File indexing completed on 2024-04-06 12:33:11
0001 #include <vector>
0002 #include <algorithm>
0003 #include "TMath.h"
0004 #include "macro/new_PlotHelpers.C"
0005
0006
0007 bool DEBUG = false;
0008
0009 TList* GetListOfBranches(const char* dataType, TFile* file) {
0010 if (TString(dataType) == "HLT") {
0011 file->cd("DQMData/Run 1/HLT/Run summary/Muon/MuonTrack");
0012 } else if (TString(dataType) == "RECO") {
0013 file->cd("DQMData/Run 1/Muons/Run summary/RecoMuonV/MuonTrack");
0014 } else {
0015 cout << "ERROR: Data type " << dataType << " not allowed: only RECO and HLT are considered" << endl;
0016 cerr << "ERROR: Data type " << dataType << " not allowed: only RECO and HLT are considered" << endl;
0017 return 0;
0018 }
0019
0020 TDirectory* dir = gDirectory;
0021 TList* sl = GetListOfDirectories(dir);
0022
0023 if (sl->GetSize() == 0) {
0024 cout << "ERROR: No DQM muon reco histos found in NEW file " << endl;
0025 cerr << "ERROR: No DQM muon reco histos found in NEW file " << endl;
0026 delete sl;
0027 return 0;
0028 }
0029
0030 return sl;
0031 }
0032
0033 void plotOptReset(bool logx[6],
0034 bool logy[6],
0035 bool doKolmo[6],
0036 Double_t norm[6],
0037 Double_t minx[6],
0038 Double_t maxx[6],
0039 Double_t miny[6],
0040 Double_t maxy[6],
0041 const char* drawopt[6],
0042 TString plots[6],
0043 TString titles[6]) {
0044 for (int i = 0; i < 6; ++i) {
0045 logx[i] = false;
0046 logy[i] = false;
0047 doKolmo[i] = true;
0048 norm[i] = -1;
0049 minx[i] = 0;
0050 maxx[i] = 0;
0051 miny[i] = 0;
0052 maxy[i] = 0;
0053 drawopt[i] = "";
0054 plots[i] = "";
0055 titles[i] = "";
0056 }
0057 }
0058
0059 void new_TrackValHistoPublisher(const char* newFile = "NEW_FILE", const char* refFile = "REF_FILE") {
0060 cout << ">> Starting new_TrackValHistoPublisher(" << newFile << "," << refFile << ")..." << endl;
0061
0062
0063
0064 const char* dataType = "DATATYPE";
0065 const char* refLabel("REF_LABEL, REF_RELEASE REFSELECTION");
0066 const char* newLabel("NEW_LABEL, NEW_RELEASE NEWSELECTION");
0067
0068
0069 gROOT->SetBatch();
0070 gErrorIgnoreLevel = kWarning;
0071 SetGlobalStyle();
0072
0073
0074 delete gROOT->GetListOfFiles()->FindObject(refFile);
0075 delete gROOT->GetListOfFiles()->FindObject(newFile);
0076
0077
0078 cout << ">> Opening files, moving to the right branch and getting the list of sub-branches..." << endl;
0079
0080 cout << ">> Finding new DQM file ..." << endl;
0081 TFile* sfile = new TFile(newFile);
0082 TList* sl = GetListOfBranches(dataType, sfile);
0083
0084 if (!sl) {
0085 cout << "ERROR: Could not find keys!!!" << endl;
0086 cerr << "ERROR: Could not find keys!!!" << endl;
0087 return;
0088 }
0089 TDirectory* sdir = gDirectory;
0090
0091 if (DEBUG) {
0092 for (unsigned int i = 0; i < sl->GetEntries(); i++)
0093 cout << " + " << sl->At(i)->GetName() << endl;
0094 }
0095
0096 cout << ">> Finding reference DQM file ..." << endl;
0097 TFile* rfile = new TFile(refFile);
0098 TList* rl = GetListOfBranches(dataType, rfile);
0099
0100 if (!rl) {
0101 cout << "ERROR: Could not find keys!!!" << endl;
0102 cerr << "ERROR: Could not find keys!!!" << endl;
0103 return;
0104 }
0105 TDirectory* rdir = gDirectory;
0106
0107 if (DEBUG) {
0108 for (unsigned int i = 0; i < rl->GetEntries(); i++)
0109 cout << " + " << rl->At(i)->GetName() << endl;
0110 }
0111
0112
0113 cout << ">> Iterating over histograms and collections..." << endl;
0114
0115 bool logy[6] = {false, false, false, false, false, false};
0116 bool logx[6] = {false, false, false, false, false, false};
0117 bool doKolmo[6] = {true, true, true, true, true, true};
0118 Double_t norm[6] = {-1., -1., -1., -1., -1., -1.};
0119 Double_t minx[6] = {0, 0, 0, 0, 0, 0};
0120 Double_t maxx[6] = {0, 0, 0, 0, 0, 0};
0121 Double_t miny[6] = {0, 0, 0, 0, 0, 0};
0122 Double_t maxy[6] = {0, 0, 0, 0, 0, 0};
0123 const char* drawopt[6] = {"", "", "", "", "", ""};
0124 TString plots[6] = {"", "", "", "", "", ""};
0125 TString titles[6] = {"", "", "", "", "", ""};
0126
0127 TString rcollname;
0128 TString scollname;
0129 TIter iter_r(rl);
0130 TIter iter_s(sl);
0131 TString newDirBase("NEW_RELEASE/NEWSELECTION/NEW_LABEL/");
0132 TKey* rKey = 0;
0133
0134
0135 bool NEWcollNames = false;
0136 TString Ref_CMSSW_Release("REF_RELEASE");
0137 if (Ref_CMSSW_Release.Contains("CMSSW_9") || Ref_CMSSW_Release.Contains("CMSSW_10_0"))
0138 NEWcollNames = true;
0139
0140 while ((rKey = (TKey*)iter_r())) {
0141 TString myName = rKey->GetName();
0142 rcollname = myName;
0143 if (DEBUG) {
0144 cout << " Checking collection: " << myName << endl;
0145 cerr << " Checking collection: " << myName << endl;
0146 }
0147
0148 TString myName2 = myName;
0149 if (NEWcollNames) {
0150 if (myName == "NEWprobeTrks")
0151 myName2 = "probeTrks";
0152 else if (myName == "NEWprobeTrks_TkAsso")
0153 myName2 = "probeTrks_TkAsso";
0154 else if (myName == "NEWseedsOfSTAmuons")
0155 myName2 = "seedsOfSTAmuons";
0156 else if (myName == "NEWseedsOfDisplacedSTAmuons")
0157 myName2 = "seedsOfDisplacedSTAmuons";
0158 else if (myName == "NEWcutsRecoTrkMuons")
0159 myName2 = "cutsRecoTrkMuons";
0160 else if (myName == "NEWextractGemMuons")
0161 myName2 = "extractGemMuons";
0162 else if (myName == "NEWextractMe0Muons")
0163 myName2 = "extractMe0Muons";
0164 }
0165 scollname = myName2;
0166
0167 if (DEBUG) {
0168 cout << " Comparing " << rcollname << " and " << scollname << endl;
0169 cerr << " Comparing " << rcollname << " and " << scollname << endl;
0170 }
0171
0172
0173 TString newDir = newDirBase + myName2;
0174 cout << "creating directory: " << newDir << endl;
0175 gSystem->mkdir(newDir, kTRUE);
0176
0177
0178 plotOptReset(logx, logy, doKolmo, norm, minx, maxx, miny, maxy, drawopt, plots, titles);
0179 plots[0] = "effic_vs_eta";
0180 titles[0] = "Efficiency vs #eta";
0181 plots[1] = "fakerate_vs_eta";
0182 titles[1] = "Fake rate vs #eta";
0183 plots[2] = "effic_vs_phi";
0184 titles[2] = "Efficiency vs #phi";
0185 plots[3] = "fakerate_vs_phi";
0186 titles[3] = "Fake rate vs #phi";
0187
0188 miny[0] = -0.0001;
0189 miny[1] = -0.0001;
0190 miny[2] = -0.0001;
0191 miny[3] = -0.0001;
0192
0193 maxy[0] = 1.09;
0194 maxy[1] = 1.09;
0195 maxy[2] = 1.09;
0196 maxy[3] = 1.09;
0197
0198 Plot4Histograms(newDir + "/eff_eta_phi",
0199 rdir,
0200 sdir,
0201 rcollname,
0202 scollname,
0203 "eff_eta_phi",
0204 "Efficiency vs eta and Vs phi",
0205 refLabel,
0206 newLabel,
0207 plots,
0208 titles,
0209 drawopt,
0210 logy,
0211 logx,
0212 doKolmo,
0213 norm,
0214 minx,
0215 maxx,
0216 miny,
0217 maxy);
0218
0219
0220 plotOptReset(logx, logy, doKolmo, norm, minx, maxx, miny, maxy, drawopt, plots, titles);
0221 plots[0] = "effic_vs_pt";
0222 titles[0] = "Efficiency vs pt";
0223 plots[1] = "fakerate_vs_pt";
0224 titles[1] = "Fake rate vs pt";
0225 plots[2] = "num_simul_pT";
0226 titles[2] = "N of simulated tracks vs pt";
0227 plots[3] = "num_reco_pT";
0228 titles[3] = "N of reco track vs pt";
0229
0230 logx[0] = true;
0231 logx[1] = true;
0232 logx[2] = true;
0233 logx[3] = true;
0234
0235 drawopt[0] = "";
0236 drawopt[1] = "";
0237 drawopt[2] = "hist";
0238 drawopt[3] = "hist";
0239
0240 norm[0] = -1.;
0241 norm[1] = -1.;
0242 norm[2] = 2.;
0243 norm[3] = 2.;
0244
0245 miny[0] = -0.0001;
0246 miny[1] = -0.0001;
0247 miny[2] = 0.;
0248 miny[3] = 0.;
0249
0250 maxy[0] = 1.09;
0251 maxy[1] = 1.09;
0252 maxy[2] = 0.;
0253 maxy[3] = 0.;
0254
0255 Plot4Histograms(newDir + "/eff_pt",
0256 rdir,
0257 sdir,
0258 rcollname,
0259 scollname,
0260 "eff_pt",
0261 "Efficiency vs pt and sim,reco distributions",
0262 refLabel,
0263 newLabel,
0264 plots,
0265 titles,
0266 drawopt,
0267 logy,
0268 logx,
0269 doKolmo,
0270 norm,
0271 minx,
0272 maxx,
0273 miny,
0274 maxy);
0275
0276
0277 plotOptReset(logx, logy, doKolmo, norm, minx, maxx, miny, maxy, drawopt, plots, titles);
0278 plots[0] = "effic_vs_hit";
0279 titles[0] = "Efficiency vs Number of hits";
0280 plots[1] = "fakerate_vs_hit";
0281 titles[1] = "Fake rate vs Number of hits";
0282 plots[2] = "nhits";
0283 titles[2] = "number of hits per track";
0284 plots[3] = "nhits_vs_eta_prof";
0285 titles[3] = "mean number of Hits vs eta";
0286
0287 drawopt[0] = "";
0288 drawopt[1] = "";
0289 drawopt[2] = "hist";
0290 drawopt[3] = "";
0291
0292 norm[0] = -1.;
0293 norm[1] = -1.;
0294 norm[2] = 0.;
0295 norm[3] = -1.;
0296
0297 miny[0] = -0.0001;
0298 miny[1] = -0.0001;
0299 miny[2] = 0.;
0300 miny[3] = 0.;
0301
0302 maxy[0] = 1.09;
0303 maxy[1] = 0.;
0304 maxy[2] = 0.;
0305 maxy[3] = 0.;
0306
0307 Plot4Histograms(newDir + "/eff_hits",
0308 rdir,
0309 sdir,
0310 rcollname,
0311 scollname,
0312 "eff_hits",
0313 "Efficiency vs Number of hits and hit multiplicity per track",
0314 refLabel,
0315 newLabel,
0316 plots,
0317 titles,
0318 drawopt,
0319 logy,
0320 logx,
0321 doKolmo,
0322 norm,
0323 minx,
0324 maxx,
0325 miny,
0326 maxy);
0327
0328
0329 plotOptReset(logx, logy, doKolmo, norm, minx, maxx, miny, maxy, drawopt, plots, titles);
0330 plots[0] = "effic_vs_pu";
0331 titles[0] = "Efficiency vs n.PU interactions";
0332 plots[1] = "fakerate_vs_pu";
0333 titles[1] = "Fake rate vs n.PU interactions";
0334
0335
0336
0337
0338 miny[0] = -0.0001;
0339 miny[1] = 0.;
0340
0341 maxy[0] = 1.09;
0342 maxy[1] = 0.;
0343
0344 norm[1] = -1;
0345
0346 Plot4Histograms(newDir + "/eff_pu",
0347 rdir,
0348 sdir,
0349 rcollname,
0350 scollname,
0351 "eff_pu",
0352 "Efficiency vs n.PU interactions",
0353 refLabel,
0354 newLabel,
0355 plots,
0356 titles,
0357 drawopt,
0358 logy,
0359 logx,
0360 doKolmo,
0361 norm,
0362 minx,
0363 maxx,
0364 miny,
0365 maxy);
0366
0367
0368 if (!scollname.Contains("seeds")) {
0369
0370 plotOptReset(logx, logy, doKolmo, norm, minx, maxx, miny, maxy, drawopt, plots, titles);
0371 plots[0] = "chi2";
0372 titles[0] = "Track #chi^{2}";
0373 plots[1] = "chi2prob";
0374 titles[1] = "Probability of track #chi^{2}";
0375 plots[2] = "chi2_vs_eta_prof";
0376 titles[2] = "Mean normalized #chi^{2} vs #eta";
0377
0378 drawopt[0] = "hist";
0379 drawopt[1] = "hist";
0380 drawopt[2] = "";
0381
0382 norm[0] = 0.;
0383 norm[1] = 0.;
0384 norm[2] = -1.;
0385
0386 logy[0] = true;
0387 logy[1] = false;
0388 logy[2] = false;
0389
0390 Plot4Histograms(newDir + "/chi2",
0391 rdir,
0392 sdir,
0393 rcollname,
0394 scollname,
0395 "chi2",
0396 "chi2 distributions",
0397 refLabel,
0398 newLabel,
0399 plots,
0400 titles,
0401 drawopt,
0402 logy,
0403 logx,
0404 doKolmo,
0405 norm,
0406 minx,
0407 maxx,
0408 miny,
0409 maxy);
0410
0411
0412 plotOptReset(logx, logy, doKolmo, norm, minx, maxx, miny, maxy, drawopt, plots, titles);
0413 plots[0] = "ptpull";
0414 titles[0] = "p_{T} Pull";
0415 plots[1] = "qoverppull";
0416 titles[1] = "q/p Pull";
0417 plots[2] = "phipull";
0418 titles[2] = "#phi Pull";
0419 plots[3] = "thetapull";
0420 titles[3] = "#theta Pull";
0421 plots[4] = "dxypull";
0422 titles[4] = "dxy Pull";
0423 plots[5] = "dzpull";
0424 titles[5] = "dz Pull";
0425
0426 logy[0] = true;
0427 logy[1] = true;
0428 logy[2] = true;
0429 logy[3] = true;
0430 logy[4] = true;
0431 logy[5] = true;
0432
0433 drawopt[0] = "hist";
0434 drawopt[1] = "hist";
0435 drawopt[2] = "hist";
0436 drawopt[3] = "hist";
0437 drawopt[4] = "hist";
0438 drawopt[5] = "hist";
0439
0440 norm[0] = 2.;
0441 norm[1] = 2.;
0442 norm[2] = 2.;
0443 norm[3] = 2.;
0444 norm[4] = 2.;
0445 norm[5] = 2.;
0446
0447 Plot6Histograms(newDir + "/pulls",
0448 rdir,
0449 sdir,
0450 rcollname,
0451 scollname,
0452 "pulls",
0453 "pull distributions",
0454 refLabel,
0455 newLabel,
0456 plots,
0457 titles,
0458 drawopt,
0459 logy,
0460 logx,
0461 doKolmo,
0462 norm,
0463 minx,
0464 maxx,
0465 miny,
0466 maxy);
0467
0468
0469 plotOptReset(logx, logy, doKolmo, norm, minx, maxx, miny, maxy, drawopt, plots, titles);
0470 plots[0] = "ptres_vs_eta";
0471 titles[0] = "p_{T} Relative Residual";
0472 plots[1] = "etares_vs_eta";
0473 titles[1] = "#eta Residual";
0474 plots[2] = "phires_vs_eta";
0475 titles[2] = "#phi Residual";
0476 plots[3] = "thetaCotres_vs_eta";
0477 titles[3] = "cot(#theta) Residual";
0478 plots[4] = "dxyres_vs_eta";
0479 titles[4] = "dxy Residual";
0480 plots[5] = "dzres_vs_eta";
0481 titles[5] = "dz Residual";
0482
0483 logy[0] = true;
0484 logy[1] = true;
0485 logy[2] = true;
0486 logy[3] = true;
0487 logy[4] = true;
0488 logy[5] = true;
0489
0490 drawopt[0] = "hist";
0491 drawopt[1] = "hist";
0492 drawopt[2] = "hist";
0493 drawopt[3] = "hist";
0494 drawopt[4] = "hist";
0495 drawopt[5] = "hist";
0496
0497 norm[0] = 2.;
0498 norm[1] = 2.;
0499 norm[2] = 2.;
0500 norm[3] = 2.;
0501 norm[4] = 2.;
0502 norm[5] = 2.;
0503
0504 Plot6Histograms(newDir + "/residuals",
0505 rdir,
0506 sdir,
0507 rcollname,
0508 scollname,
0509 "residuals",
0510 "residual distributions",
0511 refLabel,
0512 newLabel,
0513 plots,
0514 titles,
0515 drawopt,
0516 logy,
0517 logx,
0518 doKolmo,
0519 norm,
0520 minx,
0521 maxx,
0522 miny,
0523 maxy);
0524
0525
0526 plotOptReset(logx, logy, doKolmo, norm, minx, maxx, miny, maxy, drawopt, plots, titles);
0527 plots[0] = "phires_vs_eta_Sigma";
0528 titles[0] = "width #phi Residual vs #eta";
0529 plots[1] = "thetaCotres_vs_eta_Sigma";
0530 titles[1] = "width cot(#theta) Residual vs #eta";
0531 plots[2] = "dxyres_vs_eta_Sigma";
0532 titles[2] = "width dxy Residual vs #eta";
0533 plots[3] = "dzres_vs_eta_Sigma";
0534 titles[3] = "width dz Residual vs #eta";
0535 plots[4] = "ptres_vs_eta_Sigma";
0536 titles[4] = "width p_{T} Relative Residual vs #eta";
0537 plots[5] = "ptres_vs_eta_Mean";
0538 titles[5] = "mean p_{T} Relative Residual vs #eta";
0539
0540 logy[0] = true;
0541 logy[1] = true;
0542 logy[2] = true;
0543 logy[3] = true;
0544 logy[4] = true;
0545 logy[5] = false;
0546
0547 Plot6Histograms(newDir + "/resol_eta",
0548 rdir,
0549 sdir,
0550 rcollname,
0551 scollname,
0552 "resol_eta",
0553 "resolutions vs eta",
0554 refLabel,
0555 newLabel,
0556 plots,
0557 titles,
0558 drawopt,
0559 logy,
0560 logx,
0561 doKolmo,
0562 norm,
0563 minx,
0564 maxx,
0565 miny,
0566 maxy);
0567
0568
0569 plotOptReset(logx, logy, doKolmo, norm, minx, maxx, miny, maxy, drawopt, plots, titles);
0570 plots[0] = "phires_vs_pt_Sigma";
0571 titles[0] = "width #phi Residual vs p_{T}";
0572 plots[1] = "thetaCotres_vs_pt_Sigma";
0573 titles[1] = "width cot(#theta) Residual vs p_{T}";
0574 plots[2] = "dxyres_vs_pt_Sigma";
0575 titles[2] = "width dxy Residual vs p_{T}";
0576 plots[3] = "dzres_vs_pt_Sigma";
0577 titles[3] = "width dz Residual vs p_{T}";
0578 plots[4] = "ptres_vs_pt_Sigma";
0579 titles[4] = "width p_{T} Relative Residual vs p_{T}";
0580 plots[5] = "ptres_vs_pt_Mean";
0581 titles[5] = "mean p_{T} Relative Residual vs p_{T}";
0582
0583 logx[0] = true;
0584 logx[1] = true;
0585 logx[2] = true;
0586 logx[3] = true;
0587 logx[4] = true;
0588 logx[5] = true;
0589
0590 logy[0] = true;
0591 logy[1] = true;
0592 logy[2] = true;
0593 logy[3] = true;
0594 logy[4] = true;
0595 logy[5] = false;
0596
0597 Plot6Histograms(newDir + "/resol_pt",
0598 rdir,
0599 sdir,
0600 rcollname,
0601 scollname,
0602 "resol_pt",
0603 "resolutions vs pt",
0604 refLabel,
0605 newLabel,
0606 plots,
0607 titles,
0608 drawopt,
0609 logy,
0610 logx,
0611 doKolmo,
0612 norm,
0613 minx,
0614 maxx,
0615 miny,
0616 maxy);
0617
0618
0619 plotOptReset(logx, logy, doKolmo, norm, minx, maxx, miny, maxy, drawopt, plots, titles);
0620 plots[0] = "chargeMisId_vs_eta";
0621 titles[0] = "Charge MisId rate vs #eta";
0622 plots[1] = "chargeMisId_vs_pt";
0623 titles[1] = "Charge MisID rate vs p_{T}";
0624 plots[2] = "chargeMisId_vs_hit";
0625 titles[2] = "Charge MisID rate vs number of RecHits";
0626 plots[3] = "chargeMisId_vs_pu";
0627 titles[3] = "Charge MisID rate vs n.PU interactions";
0628
0629 logx[0] = false;
0630 logx[1] = true;
0631 logx[2] = false;
0632 logx[3] = false;
0633
0634
0635
0636
0637
0638
0639 miny[0] = -0.0001;
0640 miny[1] = 0.;
0641 miny[2] = -0.0001;
0642 miny[3] = 0.;
0643
0644 maxy[0] = 0.;
0645 maxy[1] = 0.;
0646 maxy[2] = 0.;
0647 maxy[3] = 0.;
0648
0649 Plot4Histograms(newDir + "/chargeMisId",
0650 rdir,
0651 sdir,
0652 rcollname,
0653 scollname,
0654 "chargeMisId",
0655 "charge misId rate vs eta, pt, nhits, PU",
0656 refLabel,
0657 newLabel,
0658 plots,
0659 titles,
0660 drawopt,
0661 logy,
0662 logx,
0663 doKolmo,
0664 norm,
0665 minx,
0666 maxx,
0667 miny,
0668 maxy);
0669
0670 }
0671
0672
0673 TString mergefile = "merged_plots.pdf";
0674 TString destfile = newDir + "/../" + myName + ".pdf";
0675 TString gscommand = "gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=" + mergefile + " " + newDir +
0676 "/eff_eta_phi.pdf " + newDir + "/eff_pt.pdf " + newDir + "/eff_hits.pdf " + newDir +
0677 "/eff_pu.pdf " + newDir + "/chi2.pdf " + newDir + "/pulls.pdf " + newDir + "/residuals.pdf " +
0678 newDir + "/resol_eta.pdf " + newDir + "/resol_pt.pdf " + newDir + "/chargeMisId.pdf ";
0679
0680 if (scollname.Contains("seeds"))
0681 gscommand = "gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=" + mergefile + " " + newDir +
0682 "/eff_eta_phi.pdf " + newDir + "/eff_pt.pdf " + newDir + "/eff_hits.pdf " + newDir + "/eff_pu.pdf ";
0683
0684 cout << ">> Merging partial pdfs to " << mergefile << "..." << endl;
0685 if (DEBUG)
0686 cout << " ...with command \"" << gscommand << "\"" << endl;
0687
0688 gSystem->Exec(gscommand);
0689 cout << ">> Moving " << mergefile << " to " << destfile << "..." << endl;
0690 gSystem->Rename(mergefile, destfile);
0691
0692 cout << ">> Deleting partial pdf files" << endl;
0693 gSystem->Exec("rm -rf " + newDir + "/*.pdf");
0694 cout << " ... Done" << endl;
0695
0696 }
0697
0698
0699
0700
0701 TString dir_MABH_vs_TABH = newDirBase + "probeTrks_MABH_vs_TABH";
0702 gSystem->mkdir(dir_MABH_vs_TABH, kTRUE);
0703
0704
0705 TString new_Sample_Name("NEW_LABEL");
0706
0707 if (TString(dataType) == "HLT" || new_Sample_Name.Contains("_HI")) {
0708 cout << ">> Removing the relval files from ROOT before closing..." << endl;
0709 gROOT->GetListOfFiles()->Remove(sfile);
0710 gROOT->GetListOfFiles()->Remove(rfile);
0711
0712 if (DEBUG) {
0713 cout << " Exiting!" << endl;
0714 cerr << " Exiting!" << endl;
0715 }
0716
0717 return;
0718 }
0719
0720 if (DEBUG) {
0721 cout << " Comparing MuonAssociatorByHits with quickTrackAssociatorByHits on probeTracks (for the new release)"
0722 << endl;
0723 cerr << " Comparing MuonAssociatorByHits with quickTrackAssociatorByHits on probeTracks (for the new release)"
0724 << endl;
0725 }
0726
0727 sfile->cd("DQMData/Run 1/Muons/Run summary/RecoMuonV/MuonTrack");
0728 sdir = gDirectory;
0729 rcollname = "probeTrks_TkAsso";
0730 scollname = "probeTrks";
0731
0732
0733 TString New_CMSSW_Release("NEW_RELEASE");
0734 bool NEWprobeTrksNames = false;
0735 if (New_CMSSW_Release.Contains("CMSSW_9") || New_CMSSW_Release.Contains("CMSSW_10_0"))
0736 NEWprobeTrksNames = true;
0737 if (NEWprobeTrksNames) {
0738 rcollname = "NEWprobeTrks_TkAsso";
0739 scollname = "NEWprobeTrks";
0740 }
0741
0742 const char* _refLabel("NEW_LABEL, NEW_RELEASE NEWSELECTION quickTrackAssociatorByHits");
0743 const char* _newLabel("NEW_LABEL, NEW_RELEASE NEWSELECTION MuonAssociatorByHits");
0744
0745
0746 plotOptReset(logx, logy, doKolmo, norm, minx, maxx, miny, maxy, drawopt, plots, titles);
0747 plots[0] = "effic_vs_eta";
0748 titles[0] = "Efficiency vs #eta";
0749 plots[1] = "fakerate_vs_eta";
0750 titles[1] = "Fake rate vs #eta";
0751 plots[2] = "effic_vs_pt";
0752 titles[2] = "Efficiency vs pt";
0753 plots[3] = "fakerate_vs_pt";
0754 titles[3] = "Fake rate vs pt";
0755
0756 logx[0] = false;
0757 logx[1] = false;
0758 logx[2] = true;
0759 logx[3] = true;
0760
0761 miny[0] = -0.0001;
0762 miny[1] = -0.0001;
0763 miny[2] = -0.0001;
0764 miny[3] = -0.0001;
0765
0766 maxy[0] = 1.09;
0767 maxy[1] = 0.;
0768 maxy[2] = 1.09;
0769 maxy[3] = 0.;
0770
0771 Plot4Histograms(dir_MABH_vs_TABH + "/eff_pt_eta",
0772 sdir,
0773 sdir,
0774 rcollname,
0775 scollname,
0776 "eff_pt_eta_MABHvsTABH",
0777 "Efficiency vs eta and pt - Muon vs Track Associator",
0778 _refLabel,
0779 _newLabel,
0780 plots,
0781 titles,
0782 drawopt,
0783 logy,
0784 logx,
0785 doKolmo,
0786 norm,
0787 minx,
0788 maxx,
0789 miny,
0790 maxy);
0791
0792
0793 plotOptReset(logx, logy, doKolmo, norm, minx, maxx, miny, maxy, drawopt, plots, titles);
0794 plots[0] = "effic_vs_hit";
0795 titles[0] = "Efficiency vs Number of hits";
0796 plots[1] = "fakerate_vs_hit";
0797 titles[1] = "Fake rate vs Number of hits";
0798 plots[2] = "effic_vs_phi";
0799 titles[2] = "Efficiency vs #phi";
0800 plots[3] = "fakerate_vs_phi";
0801 titles[3] = "Fake rate vs #phi";
0802
0803 miny[0] = -0.0001;
0804 miny[1] = -0.0001;
0805 miny[2] = -0.0001;
0806 miny[3] = -0.0001;
0807
0808 maxy[0] = 1.09;
0809 maxy[1] = 0.;
0810 maxy[2] = 1.09;
0811 maxy[3] = 0.;
0812
0813 Plot4Histograms(dir_MABH_vs_TABH + "/eff_phi_hits",
0814 sdir,
0815 sdir,
0816 rcollname,
0817 scollname,
0818 "eff_phi_hits_MABHvsTABH",
0819 "Efficiency vs phi and N. hits - Muon vs Track Associator",
0820 _refLabel,
0821 _newLabel,
0822 plots,
0823 titles,
0824 drawopt,
0825 logy,
0826 logx,
0827 doKolmo,
0828 norm,
0829 minx,
0830 maxx,
0831 miny,
0832 maxy);
0833
0834
0835 plotOptReset(logx, logy, doKolmo, norm, minx, maxx, miny, maxy, drawopt, plots, titles);
0836 plots[0] = "effic_vs_pu";
0837 titles[0] = "Efficiency vs n.PU interactions";
0838 plots[1] = "fakerate_vs_pu";
0839 titles[1] = "Fake rate vs n.PU interactions";
0840
0841
0842
0843
0844 miny[0] = -0.0001;
0845 miny[1] = 0.;
0846
0847 maxy[0] = 1.09;
0848 maxy[1] = 0.;
0849
0850 norm[1] = -1;
0851
0852 PlotNHistograms(dir_MABH_vs_TABH + "/eff_pu",
0853 sdir,
0854 sdir,
0855 rcollname,
0856 scollname,
0857 "eff_pu_MABHvsTABH",
0858 "Efficiency vs N.PU interactions - Muon vs Track Associator",
0859 _refLabel,
0860 _newLabel,
0861 4,
0862 plots,
0863 titles,
0864 drawopt,
0865 logy,
0866 logx,
0867 doKolmo,
0868 norm,
0869 minx,
0870 maxx,
0871 miny,
0872 maxy);
0873
0874
0875 TString _destfile = newDirBase + "probeTrks_MABH_vs_TABH" + ".pdf";
0876 TString _gscommand = "gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=" + _destfile + " " + dir_MABH_vs_TABH +
0877 "/eff_pt_eta.pdf " + dir_MABH_vs_TABH + "/eff_phi_hits.pdf " + dir_MABH_vs_TABH + "/eff_pu.pdf ";
0878
0879 cout << ">> Merging partial pdfs to " << _destfile << "..." << endl;
0880 if (DEBUG)
0881 cout << " ...with command \"" << _gscommand << "\"" << endl;
0882 gSystem->Exec(_gscommand);
0883
0884 cout << ">> Deleting partial pdf files" << endl;
0885 gSystem->Exec("rm -rf " + dir_MABH_vs_TABH + "/eff_*.pdf");
0886 cout << " ... Done" << endl;
0887
0888 cout << ">> Removing the relval files from ROOT before closing..." << endl;
0889 gROOT->GetListOfFiles()->Remove(sfile);
0890 gROOT->GetListOfFiles()->Remove(rfile);
0891
0892 if (DEBUG) {
0893 cout << " Exiting!" << endl;
0894 cerr << " Exiting!" << endl;
0895 }
0896 }