Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:44:30

0001 #ifndef EffPurFromHistos_H
0002 #define EffPurFromHistos_H
0003 
0004 #include "DQMOffline/RecoB/interface/FlavourHistorgrams.h"
0005 #include "DQMOffline/RecoB/interface/HistoProviderDQM.h"
0006 #include "DQMServices/Core/interface/DQMStore.h"
0007 
0008 #include "TH1F.h"
0009 #include "TCanvas.h"
0010 
0011 #include <string>
0012 
0013 class EffPurFromHistos {
0014 public:
0015   typedef dqm::legacy::DQMStore DQMStore;
0016   typedef dqm::legacy::MonitorElement MonitorElement;
0017 
0018   EffPurFromHistos(const std::string& ext,
0019                    TH1F* h_d,
0020                    TH1F* h_u,
0021                    TH1F* h_s,
0022                    TH1F* h_c,
0023                    TH1F* h_b,
0024                    TH1F* h_g,
0025                    TH1F* h_ni,
0026                    TH1F* h_dus,
0027                    TH1F* h_dusg,
0028                    TH1F* h_pu,
0029                    const std::string& label,
0030                    unsigned int mc,
0031                    int nBin = 100,
0032                    double startO = 0.005,
0033                    double endO = 1.005);
0034 
0035   EffPurFromHistos(const FlavourHistograms<double>& dDiscriminatorFC,
0036                    const std::string& label,
0037                    unsigned int mc,
0038                    DQMStore::IBooker& ibook,
0039                    int nBin = 100,
0040                    double startO = 0.005,
0041                    double endO = 1.005);
0042 
0043   ~EffPurFromHistos();
0044 
0045   // do the computation
0046   void compute(DQMStore::IBooker& ibook);
0047 
0048   // return the newly created histos
0049   TH1F* getEffFlavVsBEff_d() { return EffFlavVsXEff_d->getTH1F(); };
0050   TH1F* getEffFlavVsBEff_u() { return EffFlavVsXEff_u->getTH1F(); };
0051   TH1F* getEffFlavVsBEff_s() { return EffFlavVsXEff_s->getTH1F(); };
0052   TH1F* getEffFlavVsBEff_c() { return EffFlavVsXEff_c->getTH1F(); };
0053   TH1F* getEffFlavVsBEff_b() { return EffFlavVsXEff_b->getTH1F(); };
0054   TH1F* getEffFlavVsBEff_g() { return EffFlavVsXEff_g->getTH1F(); };
0055   TH1F* getEffFlavVsBEff_ni() { return EffFlavVsXEff_ni->getTH1F(); };
0056   TH1F* getEffFlavVsBEff_dus() { return EffFlavVsXEff_dus->getTH1F(); };
0057   TH1F* getEffFlavVsBEff_dusg() { return EffFlavVsXEff_dusg->getTH1F(); };
0058   TH1F* getEffFlavVsBEff_pu() { return EffFlavVsXEff_pu->getTH1F(); };
0059 
0060   void epsPlot(const std::string& name);
0061   void psPlot(const std::string& name);
0062 
0063   void plot(TPad* theCanvas = nullptr);
0064   void plot(const std::string& name, const std::string& ext);
0065 
0066   FlavourHistograms<double>& discriminatorNoCutEffic() const { return *discrNoCutEffic; }
0067   FlavourHistograms<double>& discriminatorCutEfficScan() const { return *discrCutEfficScan; }
0068 
0069   bool doCTagPlots(bool Ctag) {
0070     doCTagPlots_ = Ctag;
0071     return doCTagPlots_;
0072   }
0073 
0074 private:
0075   // consistency check (same binning)
0076   void check();
0077   bool fromDiscriminatorDistr;
0078 
0079   unsigned int mcPlots_;
0080   bool doCTagPlots_;
0081   std::string label_;
0082   // the string for the histo name extension
0083   std::string histoExtension;
0084 
0085   std::unique_ptr<FlavourHistograms<double>> discrNoCutEffic, discrCutEfficScan;
0086 
0087   // the input histograms (efficiency versus discriminator cut)
0088   // IMPORTANT: IT'S ASSUMED THAT ALL HISTOS HAVE THE SAME BINNING!!
0089   // (can in principle be relaxed by checking explicitely for the discriminator value
0090   //  instead of bin index)
0091   TH1F* effVersusDiscr_d;
0092   TH1F* effVersusDiscr_u;
0093   TH1F* effVersusDiscr_s;
0094   TH1F* effVersusDiscr_c;
0095   TH1F* effVersusDiscr_b;
0096   TH1F* effVersusDiscr_g;
0097   TH1F* effVersusDiscr_ni;
0098   TH1F* effVersusDiscr_dus;
0099   TH1F* effVersusDiscr_dusg;
0100   TH1F* effVersusDiscr_pu;
0101 
0102   // the corresponding output histograms (flavour-eff vs. b-efficiency)
0103 
0104   // binning for output histograms
0105   int nBinOutput;
0106   double startOutput;
0107   double endOutput;
0108 
0109   MonitorElement* EffFlavVsXEff_d;
0110   MonitorElement* EffFlavVsXEff_u;
0111   MonitorElement* EffFlavVsXEff_s;
0112   MonitorElement* EffFlavVsXEff_c;
0113   MonitorElement* EffFlavVsXEff_b;
0114   MonitorElement* EffFlavVsXEff_g;
0115   MonitorElement* EffFlavVsXEff_ni;
0116   MonitorElement* EffFlavVsXEff_dus;
0117   MonitorElement* EffFlavVsXEff_dusg;
0118   MonitorElement* EffFlavVsXEff_pu;
0119 };
0120 
0121 #endif