Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:33:13

0001 #include <iostream>
0002 #include <sstream>
0003 
0004 #include "include/HistoData.h"
0005 #include "include/PlotCompareUtility.h"
0006 #include "include/PlotTypes.h"
0007 using namespace std;
0008 
0009 int main(int argc, char *argv[]) {
0010   std::string branchRef("DQMData/PFTask/Benchmarks");
0011   std::string branchNew("DQMData/PFTask/Benchmarks");
0012 
0013   std::string branchRefPrefix("ParticleFlow/Gen");
0014   std::string branchNewPrefix("ParticleFlow/Gen");
0015 
0016   // make sure command line arguments were supplied
0017   cout << argc << endl;
0018 
0019   if (argc == 5) {
0020     // initialize plot comparison tool with 2 arguments
0021     branchRefPrefix = argv[3];
0022     branchNewPrefix = argv[4];
0023   }
0024   if (argc == 3) {
0025   };
0026   if ((argc != 3) && (argc != 5))
0027   // initialize plot comparison tool with 4 arguments
0028   {
0029     cerr << "Usage: " << argv[0]
0030          << " [reference.root] [new-comparison.root} "
0031             "[RefSubDirectory(default=ParticleFlow/Gen)] "
0032             "[NewSubDirectory(default=ParticleFlow/Gen)]\n";
0033     return 1;
0034   }
0035 
0036   PlotCompareUtility *pc =
0037       new PlotCompareUtility(argv[1], argv[2], branchNew, branchNewPrefix, branchRef, branchRefPrefix);
0038 
0039   // set thresholds for tests (set to zero or negative to ignore results)
0040   // pc->setKSThreshold(1e-6);
0041   // pc->setChi2Threshold(0);
0042   pc->setKSThreshold(1e-6);
0043   pc->setChi2Threshold(0);
0044 
0045   // add histogram information for comparison here --reverse order
0046   // PFJetBenchmark
0047   pc->addHistoData("ERneutvsPt", Plot2D)->setDoAllow2DRebinningY(true);
0048   pc->addHistoData("ERNEEvsPt", Plot2D)->setDoAllow2DRebinningY(true);
0049   pc->addHistoData("ERNHEvsPt", Plot2D)->setDoAllow2DRebinningY(true);
0050   pc->addHistoData("ERCHEvsPt", Plot2D)->setDoAllow2DRebinningY(true);
0051   pc->addHistoData("ERPtvsPt", Plot2D)->setDoAllow2DRebinningY(true);
0052 
0053   pc->addHistoData("ERneut", Plot1D);
0054   pc->addHistoData("ERNEE", Plot1D);
0055   pc->addHistoData("ERNHE", Plot1D);
0056   pc->addHistoData("ERCHE", Plot1D);
0057   pc->addHistoData("ERPt", Plot1D);
0058 
0059   pc->addHistoData("BRneutvsPt", Plot2D)->setDoAllow2DRebinningY(true);
0060   pc->addHistoData("BRNEEvsPt", Plot2D)->setDoAllow2DRebinningY(true);
0061   pc->addHistoData("BRNHEvsPt", Plot2D)->setDoAllow2DRebinningY(true);
0062   pc->addHistoData("BRCHEvsPt", Plot2D)->setDoAllow2DRebinningY(true);
0063   pc->addHistoData("BRPtvsPt", Plot2D)->setDoAllow2DRebinningY(true);
0064 
0065   pc->addHistoData("BRneut", Plot1D);
0066   pc->addHistoData("BRNEE", Plot1D);
0067   pc->addHistoData("BRNHE", Plot1D);
0068   pc->addHistoData("BRCHE", Plot1D);
0069   pc->addHistoData("BRPt", Plot1D);
0070 
0071   pc->addHistoData("jetsPt", Plot1D);
0072   pc->addHistoData("jetsEta", Plot1D);
0073   pc->addHistoData("Njets", Plot1D);
0074 
0075   // PFBenchmark Analyzer
0076   pc->addHistoData("DeltaRvsEta", Plot2D)->setDoAllow2DRebinningY(true);
0077   pc->addHistoData("DeltaPhivsEta", Plot2D);
0078   pc->addHistoData("DeltaEtavsEta", Plot2D);
0079   pc->addHistoData("DeltaEtvsEta", Plot2D)->setDoAllow2DRebinningY(true);
0080   pc->addHistoData("DeltaRvsEt", Plot2D)->setDoAllow2DRebinningY(true);
0081   pc->addHistoData("DeltaEtvsEt", Plot2D)->setDoAllow2DRebinningY(true);
0082 
0083   pc->addHistoData("DeltaR", Plot1D);
0084   pc->addHistoData("DeltaPhi", Plot1D);
0085   pc->addHistoData("DeltaEta", Plot1D);
0086   pc->addHistoData("DeltaEt", Plot1D);
0087 
0088   // ...
0089   // ...
0090 
0091   // check if everything was set up properly
0092   if (!pc->isValid()) {
0093     cout << "PlotCompareUtility failed to initialize!!!" << endl << "Final Result: no_data" << endl;
0094     cerr << "Invalid TFile(s), directory, task, or no histograms specified.\n";
0095     pc->dump();
0096     return 1;
0097   }
0098 
0099   // retrieve the list of added HistoData
0100   vector<HistoData> *histos = pc->getHistos();
0101 
0102   // loop over HistoData, compare and produce plots
0103   vector<HistoData>::iterator hd;
0104   for (hd = histos->begin(); hd != histos->end(); hd++) {
0105     //    cout << " ## #"<< hd->getName() << endl;
0106     pc->compare(&(*hd));
0107     pc->makePlots(&(*hd));
0108     pc->makeHTML(&(*hd));
0109   }
0110 
0111   // produce summary plots
0112   pc->makeDefaultPlots();
0113   pc->makeSummary("SummaryResults");
0114 
0115   // report integrated result from all studied HistoData
0116   cout << "Final Result: " << (pc->getFinalResult() ? "pass" : "fail") << endl;
0117   return 0;
0118 }