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...
 

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 20 of file Benchmark.h.

Member Enumeration Documentation

Enumerator
DEFAULT 
DQMOFFLINE 
VALIDATION 

Definition at line 33 of file Benchmark.h.

Constructor & Destructor Documentation

Benchmark::Benchmark ( Mode  mode = DEFAULT)
inline

Definition at line 41 of file Benchmark.h.

41  :
42  dir_(0), mode_(mode),
43  ptMin_(0), ptMax_(10e10),
44  etaMin_(-10), etaMax_(10),
45  phiMin_(-10), phiMax_(10) {}
float etaMax_
Definition: Benchmark.h:91
float ptMax_
Definition: Benchmark.h:89
float phiMin_
Definition: Benchmark.h:92
float phiMax_
Definition: Benchmark.h:93
float ptMin_
Definition: Benchmark.h:88
TDirectory * dir_
Definition: Benchmark.h:84
float etaMin_
Definition: Benchmark.h:90
Mode mode_
Definition: Benchmark.h:86
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(), PFMETMonitor::setup(), and PFCandidateMonitor::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 }
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:717
static DQMStore * DQM_
Definition: Benchmark.h:39
TDirectory * dir_
Definition: Benchmark.h:84
TH1F * getTH1F(void) const
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:39
TDirectory * dir_
Definition: Benchmark.h:84
tuple cout
Definition: gather_cfg.py:121
TH2F * getTH2F(void) const
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:845
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, and i.

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
69  // function in DQMStore
70  vector<float> ybins( nbinsy+1 );
71  double binsize = (ymax - ymin) / nbinsy;
72  for(int i=0; i<=nbinsy; ++i) {
73  ybins[i] = ymin + i*binsize;
74  }
75 
76  return DQM_->book2D(histname,title,nbinsx, xbins, nbinsy, &ybins[0])->getTH2F();
77  }
78  else if(dir_) {
79  TDirectory *oldpwd = gDirectory;
80  dir_->cd();
81 
82  // need to convert the float bin array into a double bin array,
83  // because the DQMStore functions take floats, while the ROOT functions
84  // take double.
85  vector<double> xbinsd(nbinsx+1);
86  for(int i=0; i<=nbinsx; ++i) {
87  xbinsd[i] = xbins[i];
88  }
89 
90  TH2F *hist = new TH2F(histname, title, nbinsx, &xbinsd[0], nbinsy, ymin, ymax);
91  cout<<"booked (ROOT mode) "<<histname<<" in "<<dir_->GetName()<<endl;
92  oldpwd->cd();
93  return hist;
94  }
95  else assert(0);
96 }
int i
Definition: DBlmapReader.cc:9
const double xbins[]
static DQMStore * DQM_
Definition: Benchmark.h:39
TDirectory * dir_
Definition: Benchmark.h:84
tuple cout
Definition: gather_cfg.py:121
TH2F * getTH2F(void) const
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:845
bool Benchmark::isInRange ( float  pt,
float  eta,
float  phi 
) const
inline

Definition at line 58 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().

58  {
59  return pt>ptMin_ && pt<ptMax_ && eta>etaMin_ && eta<etaMax_ && phi>phiMin_ && phi<phiMax_ ? true : false;
60  }
float phiMin_
Definition: Benchmark.h:92
float phiMax_
Definition: Benchmark.h:93
float ptMin_
Definition: Benchmark.h:88
float etaMin_
Definition: Benchmark.h:90
Definition: DDAxes.h:10
void Benchmark::setDirectory ( TDirectory *  dir)
virtual

Reimplemented in PFCandidateManager, PFCandidateMonitor, PFJetMonitor, 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:39
TDirectory * dir_
Definition: Benchmark.h:84
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

Definition at line 51 of file Benchmark.h.

References jptDQMConfig_cff::etaMax, etaMax_, jptDQMConfig_cff::etaMin, etaMin_, jptDQMConfig_cff::phiMax, phiMax_, jptDQMConfig_cff::phiMin, phiMin_, jptDQMConfig_cff::ptMax, ptMax_, PtMinSelector_cfg::ptMin, and ptMin_.

Referenced by CandidateBenchmarkAnalyzer::CandidateBenchmarkAnalyzer(), METBenchmarkAnalyzer::METBenchmarkAnalyzer(), PFCandidateBenchmarkAnalyzer::PFCandidateBenchmarkAnalyzer(), PFCandidateManagerAnalyzer::PFCandidateManagerAnalyzer(), PFCandidateMonitor::PFCandidateMonitor(), PFJetMonitor::PFJetMonitor(), PFMETMonitor::PFMETMonitor(), PFRootEventManager::readOptions(), PFMETMonitor::setParameters(), PFJetMonitor::setParameters(), and PFCandidateMonitor::setParameters().

void Benchmark::write ( void  )

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

Definition at line 99 of file Benchmark.cc.

References sistrip::dir_.

Referenced by PFRootEventManager::write().

99  {
100  //COLIN not sure about the root mode
101  if( dir_ )
102  dir_->Write();
103 
104  //COLIN remove old bullshit:
105 // if ( ame.size() != 0 && file_)
106 // cout<<"saving histograms in "<<fileName<<endl;
107 // file_->Write(fileName.c_str());
108 }
TDirectory * dir_
Definition: Benchmark.h:84

Member Data Documentation

TDirectory* Benchmark::dir_
protected

Definition at line 84 of file Benchmark.h.

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

Definition at line 91 of file Benchmark.h.

Referenced by setRange().

float Benchmark::etaMin_
protected

Definition at line 90 of file Benchmark.h.

Referenced by isInRange(), and setRange().

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

Definition at line 93 of file Benchmark.h.

Referenced by isInRange(), and setRange().

float Benchmark::phiMin_
protected

Definition at line 92 of file Benchmark.h.

Referenced by isInRange(), and setRange().

float Benchmark::ptMax_
protected

Definition at line 89 of file Benchmark.h.

Referenced by setRange().

float Benchmark::ptMin_
protected

Definition at line 88 of file Benchmark.h.

Referenced by isInRange(), and setRange().