File indexing completed on 2023-03-17 11:27:48
0001
0002
0003 void plotkeys(TDirectory *curdir, TFile *newfi, TString dir, string input, string objecttoplot, string sample) {
0004 curdir = gDirectory;
0005 TIter next(curdir->GetListOfKeys());
0006 TKey *key;
0007 TCanvas c1;
0008
0009 newfi->mkdir(dir);
0010 newfi->cd(dir);
0011
0012 while ((key = (TKey *)next())) {
0013 key->ls();
0014 TClass *cl = gROOT->GetClass(key->GetClassName());
0015 TH1 *h = (TH1 *)key->ReadObj();
0016 h->Draw();
0017
0018
0019 TString plotname;
0020 TString keyname = key->GetName();
0021 plotname = (keyname + ".png");
0022 if (sample == "") {
0023 c1.SaveAs(dir + '/' + plotname);
0024 } else {
0025 if (objecttoplot == "Calibrations") {
0026 c1.SaveAs(sample + '/' + plotname);
0027 }
0028 if (objecttoplot == "CaloParticles") {
0029
0030 unsigned last = dir.Last('/');
0031 c1.SaveAs(sample + '/' + dir(last + 1, dir.Length()) + '/' + plotname);
0032 }
0033 }
0034 h->Write();
0035 }
0036 }
0037
0038 void validationplots(string input, string objecttoplot, string sample = "") {
0039 gROOT->ForceStyle();
0040 gStyle->SetOptStat("ksiourmen");
0041
0042 TFile *file = TFile::Open(input.c_str());
0043 TDirectory *currentdir;
0044
0045 std::vector<TString> folders;
0046 if (objecttoplot == "SimHits") {
0047 folders.push_back("hgcalSimHitStudy");
0048 } else if (objecttoplot == "Digis") {
0049 folders.push_back("hgcalDigiStudyEE");
0050 folders.push_back("hgcalDigiStudyHEF");
0051 folders.push_back("hgcalDigiStudyHEB");
0052 } else if (objecttoplot == "RecHits") {
0053 folders.push_back("hgcalRecHitStudyEE");
0054 folders.push_back("hgcalRecHitStudyHEF");
0055 folders.push_back("hgcalRecHitStudyHEB");
0056 } else if (objecttoplot == "CaloParticles") {
0057 folders.push_back("DQMData/Run 1/HGCAL/Run summary/CaloParticles/-11");
0058 folders.push_back("DQMData/Run 1/HGCAL/Run summary/CaloParticles/-13");
0059 folders.push_back("DQMData/Run 1/HGCAL/Run summary/CaloParticles/-211");
0060 folders.push_back("DQMData/Run 1/HGCAL/Run summary/CaloParticles/-321");
0061 folders.push_back("DQMData/Run 1/HGCAL/Run summary/CaloParticles/11");
0062 folders.push_back("DQMData/Run 1/HGCAL/Run summary/CaloParticles/111");
0063 folders.push_back("DQMData/Run 1/HGCAL/Run summary/CaloParticles/13");
0064 folders.push_back("DQMData/Run 1/HGCAL/Run summary/CaloParticles/211");
0065 folders.push_back("DQMData/Run 1/HGCAL/Run summary/CaloParticles/22");
0066 folders.push_back("DQMData/Run 1/HGCAL/Run summary/CaloParticles/321");
0067 } else if (objecttoplot == "Calibrations") {
0068 folders.push_back("DQMData/Run 1/HGCalHitCalibration/Run summary");
0069 }
0070
0071 TFile *newfi = new TFile("newfi.root", "recreate");
0072
0073 for (std::vector<TString>::iterator fol = folders.begin(); fol != folders.end(); ++fol) {
0074 file->cd((*fol));
0075 plotkeys(currentdir, newfi, (*fol), input, objecttoplot, sample);
0076 }
0077
0078 newfi->Close();
0079 }