CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes
Benchmark Class Reference

abstract base class More...

#include <Benchmark.h>

Inheritance diagram for Benchmark:
CandidateBenchmark MatchCandidateBenchmark MatchMETBenchmark METBenchmark PFCandidateBenchmark PFCandidateManager PFCandidateMonitor PFJetMonitor PFMETMonitor

Classes

class  PhaseSpace
 

Public Types

enum  Mode { DEFAULT, DQMOFFLINE, VALIDATION }
 

Public Member Functions

 Benchmark (Mode mode=DEFAULT)
 
bool isInRange (float pt, float eta, float phi) const
 
virtual void setDirectory (TDirectory *dir)
 
void setParameters (Mode mode)
 
void setRange (float ptMin, float ptMax, float etaMin, float etaMax, float phiMin, float phiMax)
 
void write ()
 write to the TFile, in plain ROOT mode. No need to call this function in DQM mode More...
 
virtual ~Benchmark ()
 

Static Public Attributes

static DQMStoreDQM_ = 0
 

Protected Member Functions

TH1F * book1D (const char *histname, const char *title, int nbins, float xmin, float xmax)
 book a 1D histogram, either with DQM or plain root. More...
 
TH2F * book2D (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. More...
 
TH2F * book2D (const char *histname, const char *title, int nbinsx, float *xbins, int nbinsy, float ymin, float ymax)
 book a 2D histogram, either with DQM or plain root. More...
 
TProfile * bookProfile (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. More...
 
TProfile * bookProfile (const char *histname, const char *title, int nbinsx, float *xbins, float ymin, float ymax, const char *option)
 book a TProfile histogram, either with DQM or plain root. More...
 

Protected Attributes

TDirectory * dir_
 
float etaMax_
 
float etaMin_
 
Mode mode_
 
float phiMax_
 
float phiMin_
 
float ptMax_
 
float ptMin_
 

Detailed Description

abstract base class

Definition at line 21 of file Benchmark.h.

Member Enumeration Documentation

Enumerator
DEFAULT 
DQMOFFLINE 
VALIDATION 

Definition at line 34 of file Benchmark.h.

Constructor & Destructor Documentation

Benchmark::Benchmark ( Mode  mode = DEFAULT)
inline

Definition at line 42 of file Benchmark.h.

42  :
43  dir_(0), mode_(mode),
44  ptMin_(0), ptMax_(10e10),
45  etaMin_(-10), etaMax_(10),
46  phiMin_(-10), phiMax_(10) {}
float etaMax_
Definition: Benchmark.h:101
float ptMax_
Definition: Benchmark.h:99
float phiMin_
Definition: Benchmark.h:102
float phiMax_
Definition: Benchmark.h:103
float ptMin_
Definition: Benchmark.h:98
TDirectory * dir_
Definition: Benchmark.h:94
float etaMin_
Definition: Benchmark.h:100
Mode mode_
Definition: Benchmark.h:96
Benchmark::~Benchmark ( )
virtual

Definition at line 15 of file Benchmark.cc.

15  {
16 
17 }

Member Function Documentation

TH1F * Benchmark::book1D ( const char *  histname,
const char *  title,
int  nbins,
float  xmin,
float  xmax 
)
protected

book a 1D histogram, either with DQM or plain root.

Definition at line 25 of file Benchmark.cc.

References gather_cfg::cout, sistrip::dir_, and estimatePileup::hist.

Referenced by CandidateBenchmark::setup(), MatchCandidateBenchmark::setup(), PFMETMonitor::setup(), PFCandidateMonitor::setup(), and PFJetMonitor::setup().

26  {
27  // DQM_ has to be initialized in a child analyzer.
28  if(DQM_) {
29  edm::LogInfo("Benchmark") << " Benchmark::book1D " << "booking "<<histname;
30  return DQM_->book1D(histname,title,nbins,xmin, xmax)->getTH1F();
31  }
32  else if(dir_){
33  TDirectory *oldpwd = gDirectory;
34  dir_->cd();
35  TH1F *hist = new TH1F(histname, title, nbins, xmin, xmax);
36  cout<<"booking (ROOT mode) "<<histname<<" in "<<dir_->GetName()<<endl;
37  oldpwd->cd();
38  return hist;
39  }
40  else assert(0);
41 }
static DQMStore * DQM_
Definition: Benchmark.h:40
TDirectory * dir_
Definition: Benchmark.h:94
tuple cout
Definition: gather_cfg.py:121
TH2F * Benchmark::book2D ( const char *  histname,
const char *  title,
int  nbinsx,
float  xmin,
float  xmax,
int  nbinsy,
float  ymin,
float  ymax 
)
protected

book a 2D histogram, either with DQM or plain root.

Definition at line 43 of file Benchmark.cc.

References gather_cfg::cout, sistrip::dir_, and estimatePileup::hist.

Referenced by MatchCandidateBenchmark::setup(), PFMETMonitor::setup(), and PFJetMonitor::setup().

45  {
46  // DQM_ has to be initialized in a child analyzer.
47  if(DQM_) {
48  edm::LogInfo("Benchmark") << " Benchmark::book2D "<<"booked "<<histname;
49  return DQM_->book2D(histname,title,nbinsx,xmin, xmax, nbinsy, ymin, ymax)->getTH2F();
50  }
51  else if(dir_) {
52  TDirectory *oldpwd = gDirectory;
53  dir_->cd();
54  TH2F *hist = new TH2F(histname, title, nbinsx, xmin, xmax, nbinsy, ymin, ymax);
55  cout<<"booked (ROOT mode) "<<histname<<" in "<<dir_->GetName()<<endl;
56  oldpwd->cd();
57  return hist;
58  }
59  else assert(0);
60 }
static DQMStore * DQM_
Definition: Benchmark.h:40
TDirectory * dir_
Definition: Benchmark.h:94
tuple cout
Definition: gather_cfg.py:121
TH2F * Benchmark::book2D ( const char *  histname,
const char *  title,
int  nbinsx,
float *  xbins,
int  nbinsy,
float  ymin,
float  ymax 
)
protected

book a 2D histogram, either with DQM or plain root.

Definition at line 62 of file Benchmark.cc.

References gather_cfg::cout, sistrip::dir_, estimatePileup::hist, i, and SiStripMonitorClusterAlca_cfi::ymin.

64  {
65  if(DQM_) {
66  edm::LogInfo("Benchmark") << " Benchmark::book2D " << " booked "<<histname;
67 
68  // need to build the y bin array manually, due to a missing function in DQMStore
69  vector<float> ybins( nbinsy+1 );
70  double binsize = (ymax - ymin) / nbinsy;
71  for(int i=0; i<=nbinsy; ++i) {
72  ybins[i] = ymin + i*binsize;
73  }
74 
75  return DQM_->book2D(histname,title,nbinsx, xbins, nbinsy, &ybins[0])->getTH2F();
76  }
77  else if(dir_) {
78  TDirectory *oldpwd = gDirectory;
79  dir_->cd();
80 
81  // need to convert the float bin array into a double bin array, because the DQMStore functions take floats, while the ROOT functions take double.
82  vector<double> xbinsd(nbinsx+1);
83  for(int i=0; i<=nbinsx; ++i) {
84  xbinsd[i] = xbins[i];
85  }
86 
87  TH2F *hist = new TH2F(histname, title, nbinsx, &xbinsd[0], nbinsy, ymin, ymax);
88  cout<<"booked (ROOT mode) "<<histname<<" in "<<dir_->GetName()<<endl;
89  oldpwd->cd();
90  return hist;
91  }
92  else assert(0);
93 }
int i
Definition: DBlmapReader.cc:9
const double xbins[]
static DQMStore * DQM_
Definition: Benchmark.h:40
TDirectory * dir_
Definition: Benchmark.h:94
tuple cout
Definition: gather_cfg.py:121
TProfile * Benchmark::bookProfile ( const char *  histname,
const char *  title,
int  nbinsx,
float  xmin,
float  xmax,
float  ymin,
float  ymax,
const char *  option 
)
protected

book a TProfile histogram, either with DQM or plain root.

Definition at line 95 of file Benchmark.cc.

References gather_cfg::cout, sistrip::dir_, and estimatePileup::hist.

Referenced by PFMETMonitor::setup().

97  {
98  // DQM_ has to be initialized in a child analyzer.
99  if(DQM_) {
100  edm::LogInfo("Benchmark") << " Benchmark::bookProfile "<<"booked "<<histname;
101  return DQM_->bookProfile(histname, title, nbinsx, xmin, xmax, 0.0, 0.0, option )->getTProfile();
102  }
103  else if(dir_) {
104  TDirectory *oldpwd = gDirectory;
105  dir_->cd();
106  TProfile *hist = new TProfile(histname, title, nbinsx, xmin, xmax, ymin, ymax, option);
107  cout<<"booked (ROOT mode) "<<histname<<" in "<<dir_->GetName()<<endl;
108  oldpwd->cd();
109  return hist;
110  }
111  else assert(0);
112 }
static DQMStore * DQM_
Definition: Benchmark.h:40
TDirectory * dir_
Definition: Benchmark.h:94
tuple cout
Definition: gather_cfg.py:121
TProfile * Benchmark::bookProfile ( const char *  histname,
const char *  title,
int  nbinsx,
float *  xbins,
float  ymin,
float  ymax,
const char *  option 
)
protected

book a TProfile histogram, either with DQM or plain root.

Definition at line 114 of file Benchmark.cc.

References gather_cfg::cout, sistrip::dir_, estimatePileup::hist, and i.

116  {
117 
118  // need to convert the float bin array into a double bin array, because the DQMStore TProfile functions take floats, while the DQMStore TH2 functions take double.
119  vector<double> xbinsd(nbinsx+1);
120  for(int i=0; i<=nbinsx; ++i) {
121  xbinsd[i] = xbins[i];
122  }
123 
124  // DQM_ has to be initialized in a child analyzer.
125  if(DQM_) {
126  edm::LogInfo("Benchmark") << " Benchmark::bookProfile "<<"booked "<<histname;
127  return DQM_->bookProfile(histname, title, nbinsx, &xbinsd[0], ymin, ymax, option)->getTProfile();
128  }
129  else if(dir_) {
130  TDirectory *oldpwd = gDirectory;
131  dir_->cd();
132  TProfile *hist = new TProfile(histname, title, nbinsx, &xbinsd[0], ymin, ymax, option);
133  cout<<"booked (ROOT mode) "<<histname<<" in "<<dir_->GetName()<<endl;
134  oldpwd->cd();
135  return hist;
136  }
137  else assert(0);
138 }
int i
Definition: DBlmapReader.cc:9
const double xbins[]
static DQMStore * DQM_
Definition: Benchmark.h:40
TDirectory * dir_
Definition: Benchmark.h:94
tuple cout
Definition: gather_cfg.py:121
bool Benchmark::isInRange ( float  pt,
float  eta,
float  phi 
) const
inline

Definition at line 59 of file Benchmark.h.

References etaMin_, phiMax_, phiMin_, and ptMin_.

Referenced by PFCandidateMonitor::fill(), PFJetMonitor::fill(), PFCandidateManager::fill(), CandidateBenchmark::fillOne(), MatchCandidateBenchmark::fillOne(), and PFMETMonitor::fillOne().

59  {
60  return pt>ptMin_ && pt<ptMax_ && eta>etaMin_ && eta<etaMax_ && phi>phiMin_ && phi<phiMax_ ? true : false;
61  }
float phiMin_
Definition: Benchmark.h:102
float phiMax_
Definition: Benchmark.h:103
float ptMin_
Definition: Benchmark.h:98
float etaMin_
Definition: Benchmark.h:100
Definition: DDAxes.h:10
void Benchmark::setDirectory ( TDirectory *  dir)
virtual

Reimplemented in PFCandidateManager, PFJetMonitor, PFCandidateMonitor, and PFMETMonitor.

Definition at line 19 of file Benchmark.cc.

References dir, and sistrip::dir_.

Referenced by PFMETMonitor::setDirectory(), PFCandidateMonitor::setDirectory(), PFJetMonitor::setDirectory(), and PFCandidateManager::setDirectory().

19  {
20  dir_ = dir;
21  DQM_ = 0;
22 }
static DQMStore * DQM_
Definition: Benchmark.h:40
TDirectory * dir_
Definition: Benchmark.h:94
dbl *** dir
Definition: mlp_gen.cc:35
void Benchmark::setParameters ( Mode  mode)
inline
void Benchmark::setRange ( float  ptMin,
float  ptMax,
float  etaMin,
float  etaMax,
float  phiMin,
float  phiMax 
)
inline
void Benchmark::write ( void  )

write to the TFile, in plain ROOT mode. No need to call this function in DQM mode

Definition at line 141 of file Benchmark.cc.

References sistrip::dir_.

Referenced by pkg.AbstractPkg::generate().

141  {
142  //COLIN not sure about the root mode
143  if( dir_ )
144  dir_->Write();
145 
146  //COLIN remove old bullshit:
147 // if ( ame.size() != 0 && file_)
148 // cout<<"saving histograms in "<<fileName<<endl;
149 // file_->Write(fileName.c_str());
150 }
TDirectory * dir_
Definition: Benchmark.h:94

Member Data Documentation

TDirectory* Benchmark::dir_
protected

Definition at line 94 of file Benchmark.h.

DQMStore * Benchmark::DQM_ = 0
static
float Benchmark::etaMax_
protected

Definition at line 101 of file Benchmark.h.

Referenced by setRange().

float Benchmark::etaMin_
protected

Definition at line 100 of file Benchmark.h.

Referenced by isInRange(), and setRange().

Mode Benchmark::mode_
protected
float Benchmark::phiMax_
protected

Definition at line 103 of file Benchmark.h.

Referenced by isInRange(), and setRange().

float Benchmark::phiMin_
protected

Definition at line 102 of file Benchmark.h.

Referenced by isInRange(), and setRange().

float Benchmark::ptMax_
protected

Definition at line 99 of file Benchmark.h.

Referenced by setRange().

float Benchmark::ptMin_
protected

Definition at line 98 of file Benchmark.h.

Referenced by isInRange(), and setRange().