Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-02-21 23:14:24

0001 #ifndef _StackValidation_
0002 #define _StackValidation_
0003 
0004 #include "Common.hh"
0005 
0006 #include "TEfficiency.h"
0007 #include "TGraphAsymmErrors.h"
0008 
0009 struct RateOpts {
0010   RateOpts() {}
0011   RateOpts(const TString& dir, const TString& sORr, const TString& rate) : dir(dir), sORr(sORr), rate(rate) {}
0012 
0013   TString dir;
0014   TString sORr;  // sim or reco
0015   TString rate;
0016 };
0017 typedef std::vector<RateOpts> ROVec;
0018 
0019 namespace {
0020   TString ref;
0021   TString refdir;
0022   void setupRef(const Bool_t cmsswComp) {
0023     ref = (cmsswComp ? "cmssw" : "sim");
0024     refdir = (cmsswComp ? "_cmssw" : "");
0025   }
0026 
0027   ROVec rates;
0028   UInt_t nrates;
0029   void setupRates(const Bool_t cmsswComp) {
0030     rates.emplace_back("efficiency", ref, "eff");
0031     rates.emplace_back("inefficiency", ref, "ineff_brl");
0032     rates.emplace_back("inefficiency", ref, "ineff_trans");
0033     rates.emplace_back("inefficiency", ref, "ineff_ec");
0034     rates.emplace_back("fakerate", "reco", "fr");
0035     rates.emplace_back("duplicaterate", ref, "dr");
0036 
0037     // set nrates after rates is set
0038     nrates = rates.size();
0039   }
0040 
0041   std::vector<TString> ptcuts;
0042   UInt_t nptcuts;
0043   void setupPtCuts() {
0044     std::vector<Float_t> tmp_ptcuts = {0.f, 0.9f, 2.f};
0045 
0046     for (const auto tmp_ptcut : tmp_ptcuts) {
0047       TString ptcut = Form("%3.1f", tmp_ptcut);
0048       ptcut.ReplaceAll(".", "p");
0049       ptcuts.emplace_back(ptcut);
0050     }
0051 
0052     // set nptcuts once ptcuts is set
0053     nptcuts = ptcuts.size();
0054   }
0055 };  // namespace
0056 
0057 class StackValidation {
0058 public:
0059   StackValidation(const TString& label, const TString& extra, const Bool_t cmsswComp, const TString& suite);
0060   ~StackValidation();
0061   void MakeValidationStacks();
0062   void MakeRatioStacks(const TString& trk);
0063   void MakeKinematicDiffStacks(const TString& trk);
0064   void MakeQualityStacks(const TString& trk);
0065 
0066 private:
0067   const TString label;
0068   const TString extra;
0069   const Bool_t cmsswComp;
0070   const TString suite;
0071 
0072   // legend height
0073   Double_t y1;
0074   Double_t y2;
0075 
0076   std::vector<TFile*> files;
0077 };
0078 
0079 #endif