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 | 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 ()
 

Protected Member Functions

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 analyzer or not. More...
 
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 analyzer or not. More...
 
TH2F * book2D (DQMStore::IBooker &b, 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 depending if DQM_ has been initialized in a child analyzer or not. More...
 
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 child analyzer or not. More...
 
TProfile * bookProfile (DQMStore::IBooker &b, 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 depending if DQM_ has been initialized in a child analyzer or not. 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 22 of file Benchmark.h.

Member Enumeration Documentation

Enumerator
DEFAULT 
DQMOFFLINE 
VALIDATION 

Definition at line 35 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:110
float ptMax_
Definition: Benchmark.h:108
float phiMin_
Definition: Benchmark.h:111
float phiMax_
Definition: Benchmark.h:112
float ptMin_
Definition: Benchmark.h:107
TDirectory * dir_
Definition: Benchmark.h:103
float etaMin_
Definition: Benchmark.h:109
Mode mode_
Definition: Benchmark.h:105
Benchmark::~Benchmark ( )
virtual

Definition at line 13 of file Benchmark.cc.

13  {
14 
15 }

Member Function Documentation

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

book a 1D histogram, either with DQM or plain root depending if DQM_ has been initialized in a child analyzer or not.

book a 1D histogram, either through IBooker or plain root

Definition at line 23 of file Benchmark.cc.

References assert(), DQMStore::IBooker::book1D(), and MonitorElement::getTH1F().

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

24  {
25  if( &b ) {
26  edm::LogInfo("Benchmark") << " Benchmark::book1D " << "booking "<<histname;
27  return b.book1D(histname,title,nbins,xmin,xmax)->getTH1F();
28  }
29  else assert(0);
30 }
assert(m_qm.get())
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
TH1F * getTH1F(void) const
TH2F * Benchmark::book2D ( DQMStore::IBooker b,
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 depending if DQM_ has been initialized in a child analyzer or not.

book a 2D histogram, either through IBooker or plain root

Definition at line 32 of file Benchmark.cc.

References assert(), DQMStore::IBooker::book2D(), and MonitorElement::getTH2F().

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

34  {
35  if( &b ) {
36  edm::LogInfo("Benchmark") << " Benchmark::book2D "<<"booked "<<histname;
37  return b.book2D(histname,title,nbinsx,xmin, xmax, nbinsy, ymin, ymax)->getTH2F();
38  }
39  else assert(0);
40 }
assert(m_qm.get())
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
TH2F * getTH2F(void) const
TH2F * Benchmark::book2D ( DQMStore::IBooker b,
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 depending if DQM_ has been initialized in a child analyzer or not.

book a 2D histogram, either through IBooker or plain root

Definition at line 42 of file Benchmark.cc.

References assert(), DQMStore::IBooker::book2D(), MonitorElement::getTH2F(), i, and SiStripMonitorClusterAlca_cfi::ymin.

44  {
45  if( &b ) {
46  edm::LogInfo("Benchmark") << " Benchmark::book2D " << " booked "<<histname;
47 
48  // need to build the y bin array manually, due to a missing function in DQMStore
49  vector<float> ybins( nbinsy+1 );
50  double binsize = (ymax - ymin) / nbinsy;
51  for(int i=0; i<=nbinsy; ++i) {
52  ybins[i] = ymin + i*binsize;
53  }
54 
55  return b.book2D(histname,title,nbinsx, xbins, nbinsy, &ybins[0])->getTH2F();
56  }
57  else assert(0);
58 }
int i
Definition: DBlmapReader.cc:9
const double xbins[]
assert(m_qm.get())
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
TH2F * getTH2F(void) const
TProfile * Benchmark::bookProfile ( DQMStore::IBooker b,
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 depending if DQM_ has been initialized in a child analyzer or not.

book a TProfile, either through IBooker or plain root

Definition at line 60 of file Benchmark.cc.

References assert(), DQMStore::IBooker::bookProfile(), and MonitorElement::getTProfile().

Referenced by PFMETMonitor::setup().

62  {
63  if( &b ) {
64  edm::LogInfo("Benchmark") << " Benchmark::bookProfile "<<"booked "<<histname;
65  return b.bookProfile(histname, title, nbinsx, xmin, xmax, 0.0, 0.0, option )->getTProfile();
66  }
67  else assert(0);
68 }
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:157
assert(m_qm.get())
TProfile * getTProfile(void) const
TProfile * Benchmark::bookProfile ( DQMStore::IBooker b,
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 depending if DQM_ has been initialized in a child analyzer or not.

book a TProfile, either through IBooker or plain root

Definition at line 70 of file Benchmark.cc.

References assert(), DQMStore::IBooker::bookProfile(), MonitorElement::getTProfile(), and i.

72  {
73 
74  // 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.
75  vector<double> xbinsd(nbinsx+1);
76  for(int i=0; i<=nbinsx; ++i) {
77  xbinsd[i] = xbins[i];
78  }
79 
80  if( &b ) {
81  edm::LogInfo("Benchmark") << " Benchmark::bookProfile "<<"booked "<<histname;
82  return b.bookProfile(histname, title, nbinsx, &xbinsd[0], ymin, ymax, option)->getTProfile();
83  }
84  else assert(0);
85 }
int i
Definition: DBlmapReader.cc:9
const double xbins[]
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:157
assert(m_qm.get())
TProfile * getTProfile(void) const
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:111
float phiMax_
Definition: Benchmark.h:112
float ptMin_
Definition: Benchmark.h:107
float etaMin_
Definition: Benchmark.h:109
void Benchmark::setDirectory ( TDirectory *  dir)
virtual

Reimplemented in PFCandidateManager, PFJetMonitor, PFCandidateMonitor, and PFMETMonitor.

Definition at line 18 of file Benchmark.cc.

References dir, and sistrip::dir_.

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

18  {
19  dir_ = dir;
20 }
TDirectory * dir_
Definition: Benchmark.h:103
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 ( )

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

Definition at line 88 of file Benchmark.cc.

References sistrip::dir_.

Referenced by pkg.AbstractPkg::generate().

88  {
89  //COLIN not sure about the root mode
90  if( dir_ )
91  dir_->Write();
92 
93  //COLIN remove old bullshit:
94  // if ( ame.size() != 0 && file_)
95  // cout<<"saving histograms in "<<fileName<<endl;
96  // file_->Write(fileName.c_str());
97 }
TDirectory * dir_
Definition: Benchmark.h:103

Member Data Documentation

TDirectory* Benchmark::dir_
protected

Definition at line 103 of file Benchmark.h.

float Benchmark::etaMax_
protected

Definition at line 110 of file Benchmark.h.

Referenced by setRange().

float Benchmark::etaMin_
protected

Definition at line 109 of file Benchmark.h.

Referenced by isInRange(), and setRange().

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

Definition at line 112 of file Benchmark.h.

Referenced by isInRange(), and setRange().

float Benchmark::phiMin_
protected

Definition at line 111 of file Benchmark.h.

Referenced by isInRange(), and setRange().

float Benchmark::ptMax_
protected

Definition at line 108 of file Benchmark.h.

Referenced by setRange().

float Benchmark::ptMin_
protected

Definition at line 107 of file Benchmark.h.

Referenced by isInRange(), and setRange().