Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:13:09

0001 #ifndef RecoParticleFlow_Benchmark_Benchmark_h
0002 #define RecoParticleFlow_Benchmark_Benchmark_h
0003 
0004 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h"
0005 
0006 #include "DQMServices/Core/interface/DQMStore.h"
0007 
0008 #include <string>
0009 
0010 class TH1;
0011 class TH1F;
0012 class TH2;
0013 class TProfile;
0014 
0015 class TH2F;
0016 class TDirectory;
0017 
0018 /// abstract base class
0019 class Benchmark {
0020 public:
0021   typedef dqm::legacy::DQMStore DQMStore;
0022 
0023   class PhaseSpace {
0024   public:
0025     int n;
0026     float m;
0027     float M;
0028     PhaseSpace() : n(1), m(0), M(1) {}
0029     PhaseSpace(int n, float m, float M) : n(n), m(m), M(M) {}
0030   };
0031 
0032   enum Mode { DEFAULT, DQMOFFLINE, VALIDATION };
0033 
0034   Benchmark(Mode mode = DEFAULT)
0035       : dir_(nullptr), mode_(mode), ptMin_(0), ptMax_(10e10), etaMin_(-10), etaMax_(10), phiMin_(-10), phiMax_(10) {}
0036 
0037   virtual ~Benchmark() noexcept(false);
0038 
0039   void setParameters(Mode mode) { mode_ = mode; }
0040 
0041   void setRange(float ptMin, float ptMax, float etaMin, float etaMax, float phiMin, float phiMax) {
0042     ptMin_ = ptMin;
0043     ptMax_ = ptMax;
0044     etaMin_ = etaMin;
0045     etaMax_ = etaMax;
0046     phiMin_ = phiMin;
0047     phiMax_ = phiMax;
0048   }
0049 
0050   bool isInRange(float pt, float eta, float phi) const {
0051     return (pt > ptMin_ && pt < ptMax_ && eta > etaMin_ && eta < etaMax_ && phi > phiMin_ && phi < phiMax_);
0052   }
0053 
0054   virtual void setDirectory(TDirectory *dir);
0055 
0056   /// write to the TFile, in plain ROOT mode. No need to call this function in DQM mode
0057   void write();
0058 
0059 protected:
0060   /// book a 1D histogram, either with DQM or plain root depending if DQM_ has been initialized in a child analyzer or not.
0061   //TH1F *book1D(const char *histname, const char *title,
0062   /// book a 1D histogram, either through IBooker or plain root
0063   TH1F *book1D(DQMStore::IBooker &b, const char *histname, const char *title, int nbins, float xmin, float xmax);
0064 
0065   /// book a 2D histogram, either with DQM or plain root depending if DQM_ has been initialized in a child analyzer or not.
0066   //TH2F *book2D(const char *histname, const char *title,
0067   /// book a 2D histogram, either through IBooker or plain root
0068   TH2F *book2D(DQMStore::IBooker &b,
0069                const char *histname,
0070                const char *title,
0071                int nbinsx,
0072                float xmin,
0073                float xmax,
0074                int nbinsy,
0075                float ymin,
0076                float ymax);
0077 
0078   /// book a 2D histogram, either with DQM or plain root depending if DQM_ has been initialized in a child analyzer or not.
0079   //TH2F *book2D(const char *histname, const char *title,
0080   /// book a 2D histogram, either through IBooker or plain root
0081   TH2F *book2D(DQMStore::IBooker &b,
0082                const char *histname,
0083                const char *title,
0084                int nbinsx,
0085                float *xbins,
0086                int nbinsy,
0087                float ymin,
0088                float ymax);
0089 
0090   /// book a TProfile histogram, either with DQM or plain root depending if DQM_ has been initialized in a child analyzer or not.
0091   //TProfile *bookProfile(const char *histname, const char *title,
0092   /// book a TProfile, either through IBooker or plain root
0093   TProfile *bookProfile(DQMStore::IBooker &b,
0094                         const char *histname,
0095                         const char *title,
0096                         int nbinsx,
0097                         float xmin,
0098                         float xmax,
0099                         float ymin,
0100                         float ymax,
0101                         const char *option);
0102 
0103   /// book a TProfile histogram, either with DQM or plain root depending if DQM_
0104   /// has been initialized in a child analyzer or not.
0105   // TProfile *bookProfile(const char *histname, const char *title,
0106   /// book a TProfile, either through IBooker or plain root
0107   TProfile *bookProfile(DQMStore::IBooker &b,
0108                         const char *histname,
0109                         const char *title,
0110                         int nbinsx,
0111                         float *xbins,
0112                         float ymin,
0113                         float ymax,
0114                         const char *option);
0115 
0116   TDirectory *dir_;
0117 
0118   Mode mode_;
0119 
0120   float ptMin_;
0121   float ptMax_;
0122   float etaMin_;
0123   float etaMax_;
0124   float phiMin_;
0125   float phiMax_;
0126 };
0127 
0128 #endif