CMS 3D CMS Logo

Benchmark.h
Go to the documentation of this file.
1 #ifndef RecoParticleFlow_Benchmark_Benchmark_h
2 #define RecoParticleFlow_Benchmark_Benchmark_h
3 
5 
7 
8 #include <string>
9 
10 class TH1;
11 class TH1F;
12 class TH2;
13 class TProfile;
14 
15 class TH2F;
16 class TDirectory;
17 
19 class Benchmark {
20 public:
22 
23  class PhaseSpace {
24  public:
25  int n;
26  float m;
27  float M;
28  PhaseSpace() : n(1), m(0), M(1) {}
29  PhaseSpace(int n, float m, float M) : n(n), m(m), M(M) {}
30  };
31 
33 
35  : dir_(nullptr), mode_(mode), ptMin_(0), ptMax_(10e10), etaMin_(-10), etaMax_(10), phiMin_(-10), phiMax_(10) {}
36 
37  virtual ~Benchmark() noexcept(false);
38 
40 
41  void setRange(float ptMin, float ptMax, float etaMin, float etaMax, float phiMin, float phiMax) {
42  ptMin_ = ptMin;
43  ptMax_ = ptMax;
44  etaMin_ = etaMin;
45  etaMax_ = etaMax;
46  phiMin_ = phiMin;
47  phiMax_ = phiMax;
48  }
49 
50  bool isInRange(float pt, float eta, float phi) const {
51  return (pt > ptMin_ && pt < ptMax_ && eta > etaMin_ && eta < etaMax_ && phi > phiMin_ && phi < phiMax_);
52  }
53 
54  virtual void setDirectory(TDirectory *dir);
55 
57  void write();
58 
59 protected:
61  //TH1F *book1D(const char *histname, const char *title,
63  TH1F *book1D(DQMStore::IBooker &b, const char *histname, const char *title, int nbins, float xmin, float xmax);
64 
66  //TH2F *book2D(const char *histname, const char *title,
68  TH2F *book2D(DQMStore::IBooker &b,
69  const char *histname,
70  const char *title,
71  int nbinsx,
72  float xmin,
73  float xmax,
74  int nbinsy,
75  float ymin,
76  float ymax);
77 
79  //TH2F *book2D(const char *histname, const char *title,
81  TH2F *book2D(DQMStore::IBooker &b,
82  const char *histname,
83  const char *title,
84  int nbinsx,
85  float *xbins,
86  int nbinsy,
87  float ymin,
88  float ymax);
89 
91  //TProfile *bookProfile(const char *histname, const char *title,
93  TProfile *bookProfile(DQMStore::IBooker &b,
94  const char *histname,
95  const char *title,
96  int nbinsx,
97  float xmin,
98  float xmax,
99  float ymin,
100  float ymax,
101  const char *option);
102 
105  // TProfile *bookProfile(const char *histname, const char *title,
107  TProfile *bookProfile(DQMStore::IBooker &b,
108  const char *histname,
109  const char *title,
110  int nbinsx,
111  float *xbins,
112  float ymin,
113  float ymax,
114  const char *option);
115 
116  TDirectory *dir_;
117 
119 
120  float ptMin_;
121  float ptMax_;
122  float etaMin_;
123  float etaMax_;
124  float phiMin_;
125  float phiMax_;
126 };
127 
128 #endif
TH1F * book1D(DQMStore::IBooker &b, const char *histname, const char *title, int nbins, float xmin, float xmax)
book a 1D histogram, either with DQM or plain root depending if DQM_ has been initialized in a child ...
Definition: Benchmark.cc:15
virtual ~Benchmark() noexcept(false)
Definition: Benchmark.cc:11
float etaMax_
Definition: Benchmark.h:123
const double xbins[]
dqm::legacy::DQMStore DQMStore
Definition: Benchmark.h:21
float ptMax_
Definition: Benchmark.h:121
PhaseSpace(int n, float m, float M)
Definition: Benchmark.h:29
abstract base class
Definition: Benchmark.h:19
constexpr float ptMin
float phiMin_
Definition: Benchmark.h:124
virtual void setDirectory(TDirectory *dir)
Definition: Benchmark.cc:13
void write()
write to the TFile, in plain ROOT mode. No need to call this function in DQM mode ...
Definition: Benchmark.cc:93
float phiMax_
Definition: Benchmark.h:125
void setParameters(Mode mode)
Definition: Benchmark.h:39
bool isInRange(float pt, float eta, float phi) const
Definition: Benchmark.h:50
TH2F * book2D(DQMStore::IBooker &b, const char *histname, const char *title, int nbinsx, float xmin, float xmax, int nbinsy, float ymin, float ymax)
book a 2D histogram, either with DQM or plain root depending if DQM_ has been initialized in a child ...
Definition: Benchmark.cc:22
Benchmark(Mode mode=DEFAULT)
Definition: Benchmark.h:34
float ptMin_
Definition: Benchmark.h:120
TDirectory * dir_
Definition: Benchmark.h:116
void setRange(float ptMin, float ptMax, float etaMin, float etaMax, float phiMin, float phiMax)
Definition: Benchmark.h:41
double b
Definition: hdecay.h:118
float etaMin_
Definition: Benchmark.h:122
Mode mode_
Definition: Benchmark.h:118
TProfile * bookProfile(DQMStore::IBooker &b, const char *histname, const char *title, int nbinsx, float xmin, float xmax, float ymin, float ymax, const char *option)
book a TProfile histogram, either with DQM or plain root depending if DQM_ has been initialized in a ...
Definition: Benchmark.cc:58