CMS 3D CMS Logo

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

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.

References noexcept, and ~Benchmark().

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.

Referenced by Benchmark().

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 DQMStore::IBooker::book1D(), and MonitorElement::getTH1F().

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

24  {
25  edm::LogInfo("Benchmark") << " Benchmark::book1D " << "booking "<<histname;
26  return b.book1D(histname,title,nbins,xmin,xmax)->getTH1F();
27 }
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 29 of file Benchmark.cc.

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

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

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 36 of file Benchmark.cc.

References DQMStore::IBooker::book2D(), MonitorElement::getTH2F(), mps_fire::i, and Phase2TrackerMonitorDigi_cff::ymin.

38  {
39  edm::LogInfo("Benchmark") << " Benchmark::book2D " << " booked "<<histname;
40 
41  // need to build the y bin array manually, due to a missing function in DQMStore
42  vector<float> ybins( nbinsy+1 );
43  double binsize = (ymax - ymin) / nbinsy;
44  for(int i=0; i<=nbinsy; ++i) {
45  ybins[i] = ymin + i*binsize;
46  }
47 
48  return b.book2D(histname,title,nbinsx, xbins, nbinsy, &ybins[0])->getTH2F();
49 }
const double xbins[]
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 51 of file Benchmark.cc.

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

Referenced by isInRange(), and PFMETMonitor::setup().

53  {
54  edm::LogInfo("Benchmark") << " Benchmark::bookProfile "<<"booked "<<histname;
55  return b.bookProfile(histname, title, nbinsx, xmin, xmax, 0.0, 0.0, option )->getTProfile();
56 }
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:157
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 58 of file Benchmark.cc.

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

60  {
61 
62  // 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.
63  vector<double> xbinsd(nbinsx+1);
64  for(int i=0; i<=nbinsx; ++i) {
65  xbinsd[i] = xbins[i];
66  }
67 
68  edm::LogInfo("Benchmark") << " Benchmark::bookProfile "<<"booked "<<histname;
69  return b.bookProfile(histname, title, nbinsx, &xbinsd[0], ymin, ymax, option)->getTProfile();
70 }
const double xbins[]
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:157
TProfile * getTProfile(void) const
bool Benchmark::isInRange ( float  pt,
float  eta,
float  phi 
) const
inline
void Benchmark::setDirectory ( TDirectory *  dir)
virtual
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 ALCARECOTkAlBeamHalo_cff::etaMax, etaMax_, ALCARECOTkAlBeamHalo_cff::etaMin, etaMin_, AlignmentTrackSelector_cfi::phiMax, phiMax_, AlignmentTrackSelector_cfi::phiMin, phiMin_, AlignmentTrackSelector_cfi::ptMax, ptMax_, ALCARECOTkAlBeamHalo_cff::ptMin, and ptMin_.

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

void Benchmark::write ( )

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

Definition at line 73 of file Benchmark.cc.

References sistrip::dir_.

Referenced by pkg.AbstractPkg::generate(), and isInRange().

73  {
74  //COLIN not sure about the root mode
75  if( dir_ )
76  dir_->Write();
77 
78  //COLIN remove old bullshit:
79  // if ( ame.size() != 0 && file_)
80  // cout<<"saving histograms in "<<fileName<<endl;
81  // file_->Write(fileName.c_str());
82 }
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().