Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:09:45

0001 #ifndef EffPurFromHistos2D_H
0002 #define EffPurFromHistos2D_H
0003 
0004 #include "DQMOffline/RecoB/interface/FlavourHistorgrams2D.h"
0005 #include "DQMOffline/RecoB/interface/HistoProviderDQM.h"
0006 #include "DQMServices/Core/interface/DQMStore.h"
0007 
0008 #include "TH2F.h"
0009 #include "TCanvas.h"
0010 
0011 #include <string>
0012 
0013 class EffPurFromHistos2D {
0014 public:
0015   typedef dqm::legacy::DQMStore DQMStore;
0016   typedef dqm::legacy::MonitorElement MonitorElement;
0017 
0018   EffPurFromHistos2D(const std::string& ext,
0019                      TH2F* h_d,
0020                      TH2F* h_u,
0021                      TH2F* h_s,
0022                      TH2F* h_c,
0023                      TH2F* h_b,
0024                      TH2F* h_g,
0025                      TH2F* h_ni,
0026                      TH2F* h_dus,
0027                      TH2F* h_dusg,
0028                      TH2F* h_pu,
0029                      const std::string& label,
0030                      unsigned int mc,
0031                      int nBinX = 100,
0032                      double startOX = 0.05,
0033                      double endOX = 1.05);
0034 
0035   EffPurFromHistos2D(const FlavourHistograms2D<double, double>& dDiscriminatorFC,
0036                      const std::string& label,
0037                      unsigned int mc,
0038                      DQMStore::IBooker& ibook,
0039                      int nBinX = 100,
0040                      double startOX = 0.05,
0041                      double endOX = 1.05);
0042 
0043   ~EffPurFromHistos2D();
0044 
0045   // do the computation
0046   void compute(DQMStore::IBooker& ibook, std::vector<double> fixedEff);
0047 
0048   void epsPlot(const std::string& name);
0049   void psPlot(const std::string& name);
0050 
0051   void plot(TPad* theCanvas = nullptr);
0052   void plot(const std::string& name, const std::string& ext);
0053 
0054   FlavourHistograms2D<double, double>& discriminatorNoCutEffic() const { return *discrNoCutEffic; }
0055   FlavourHistograms2D<double, double>& discriminatorCutEfficScan() const { return *discrCutEfficScan; }
0056 
0057   bool doCTagPlots(bool Ctag) {
0058     doCTagPlots_ = Ctag;
0059     return doCTagPlots_;
0060   }
0061 
0062 private:
0063   // consistency check(same binning)
0064   void check();
0065   bool fromDiscriminatorDistr;
0066 
0067   unsigned int mcPlots_;
0068   bool doCTagPlots_;
0069   std::string label_;
0070   // the string for the histo name extension
0071   std::string histoExtension;
0072 
0073   std::unique_ptr<FlavourHistograms2D<double, double> > discrNoCutEffic, discrCutEfficScan;
0074 
0075   // the input histograms(efficiency versus discriminator cut)
0076   // IMPORTANT: IT'S ASSUMED THAT ALL HISTOS HAVE THE SAME BINNING!!
0077   //(can in principle be relaxed by checking explicitely for the discriminator value
0078   //  instead of bin index)
0079   TH2F* effVersusDiscr_d;
0080   TH2F* effVersusDiscr_u;
0081   TH2F* effVersusDiscr_s;
0082   TH2F* effVersusDiscr_c;
0083   TH2F* effVersusDiscr_b;
0084   TH2F* effVersusDiscr_g;
0085   TH2F* effVersusDiscr_ni;
0086   TH2F* effVersusDiscr_dus;
0087   TH2F* effVersusDiscr_dusg;
0088   TH2F* effVersusDiscr_pu;
0089 
0090   // the corresponding output histograms(flavour-eff vs. b-efficiency)
0091 
0092   // binning for output histograms
0093   int nBinOutputX;
0094   double startOutputX;
0095   double endOutputX;
0096   int nBinOutputY;
0097   double startOutputY;
0098   double endOutputY;
0099 
0100   std::vector<MonitorElement*> X_vs_Y_eff_at_fixedZeff;
0101 };
0102 
0103 #endif