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 ()
 
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 through IBooker or plain root 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 through IBooker or plain root 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 through IBooker or plain root 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, either through IBooker or plain root 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, either through IBooker 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 32 of file Benchmark.h.

Constructor & Destructor Documentation

Benchmark::Benchmark ( Mode  mode = DEFAULT)
inline

Definition at line 34 of file Benchmark.h.

References noexcept, and ~Benchmark().

35  : dir_(nullptr), mode_(mode), ptMin_(0), ptMax_(10e10), etaMin_(-10), etaMax_(10), phiMin_(-10), phiMax_(10) {}
float etaMax_
Definition: Benchmark.h:129
float ptMax_
Definition: Benchmark.h:127
float phiMin_
Definition: Benchmark.h:130
float phiMax_
Definition: Benchmark.h:131
float ptMin_
Definition: Benchmark.h:126
TDirectory * dir_
Definition: Benchmark.h:122
float etaMin_
Definition: Benchmark.h:128
Mode mode_
Definition: Benchmark.h:124
Benchmark::~Benchmark ( )
virtual

Definition at line 12 of file Benchmark.cc.

Referenced by Benchmark().

12 {}

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 through IBooker or plain root

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

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

17  {
18  edm::LogInfo("Benchmark") << " Benchmark::book1D "
19  << "booking " << histname;
20  return b.book1D(histname, title, nbins, xmin, xmax)->getTH1F();
21 }
TH1F * getTH1F() const
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
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 through IBooker or plain root

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

Definition at line 23 of file Benchmark.cc.

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

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

31  {
32  edm::LogInfo("Benchmark") << " Benchmark::book2D "
33  << "booked " << histname;
34  return b.book2D(histname, title, nbinsx, xmin, xmax, nbinsy, ymin, ymax)->getTH2F();
35 }
TH2F * getTH2F() const
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:109
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 through IBooker or plain root

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

Definition at line 37 of file Benchmark.cc.

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

44  {
45  edm::LogInfo("Benchmark") << " Benchmark::book2D "
46  << " booked " << histname;
47 
48  // need to build the y bin array manually, due to a missing function in
49  // DQMStore
50  vector<float> ybins(nbinsy + 1);
51  double binsize = (ymax - ymin) / nbinsy;
52  for (int i = 0; i <= nbinsy; ++i) {
53  ybins[i] = ymin + i * binsize;
54  }
55 
56  return b.book2D(histname, title, nbinsx, xbins, nbinsy, &ybins[0])->getTH2F();
57 }
const double xbins[]
TH2F * getTH2F() const
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:109
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, either through IBooker or plain root

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

Definition at line 59 of file Benchmark.cc.

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

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

67  {
68  edm::LogInfo("Benchmark") << " Benchmark::bookProfile "
69  << "booked " << histname;
70  return b.bookProfile(histname, title, nbinsx, xmin, xmax, 0.0, 0.0, option)->getTProfile();
71 }
TProfile * getTProfile() const
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:113
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, either through IBooker or plain root

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

Definition at line 73 of file Benchmark.cc.

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

80  {
81  // need to convert the float bin array into a double bin array, because the
82  // DQMStore TProfile functions take floats, while the DQMStore TH2 functions
83  // take double.
84  vector<double> xbinsd(nbinsx + 1);
85  for (int i = 0; i <= nbinsx; ++i) {
86  xbinsd[i] = xbins[i];
87  }
88 
89  edm::LogInfo("Benchmark") << " Benchmark::bookProfile "
90  << "booked " << histname;
91  return b.bookProfile(histname, title, nbinsx, &xbinsd[0], ymin, ymax, option)->getTProfile();
92 }
TProfile * getTProfile() const
const double xbins[]
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:113
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 41 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_, 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 94 of file Benchmark.cc.

References sistrip::dir_.

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

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

Member Data Documentation

TDirectory* Benchmark::dir_
protected

Definition at line 122 of file Benchmark.h.

float Benchmark::etaMax_
protected

Definition at line 129 of file Benchmark.h.

Referenced by setRange().

float Benchmark::etaMin_
protected

Definition at line 128 of file Benchmark.h.

Referenced by isInRange(), and setRange().

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

Definition at line 131 of file Benchmark.h.

Referenced by isInRange(), and setRange().

float Benchmark::phiMin_
protected

Definition at line 130 of file Benchmark.h.

Referenced by isInRange(), and setRange().

float Benchmark::ptMax_
protected

Definition at line 127 of file Benchmark.h.

Referenced by setRange().

float Benchmark::ptMin_
protected

Definition at line 126 of file Benchmark.h.

Referenced by isInRange(), and setRange().