CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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

typedef dqm::legacy::DQMStore DQMStore
 
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 () noexcept(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, 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 19 of file Benchmark.h.

Member Typedef Documentation

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.

35  : dir_(nullptr), mode_(mode), ptMin_(0), ptMax_(10e10), etaMin_(-10), etaMax_(10), phiMin_(-10), phiMax_(10) {}
float etaMax_
Definition: Benchmark.h:123
float ptMax_
Definition: Benchmark.h:121
float phiMin_
Definition: Benchmark.h:124
float phiMax_
Definition: Benchmark.h:125
float ptMin_
Definition: Benchmark.h:120
TDirectory * dir_
Definition: Benchmark.h:116
float etaMin_
Definition: Benchmark.h:122
Mode mode_
Definition: Benchmark.h:118
Benchmark::~Benchmark ( )
virtualnoexcept

Definition at line 11 of file Benchmark.cc.

11 {}

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

References dqm::implementation::IBooker::book1D(), and dqm::legacy::MonitorElement::getTH1F().

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

16  {
17  edm::LogInfo("Benchmark") << " Benchmark::book1D "
18  << "booking " << histname;
19  return b.book1D(histname, title, nbins, xmin, xmax)->getTH1F();
20 }
virtual TH1F * getTH1F() const
Log< level::Info, false > LogInfo
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
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 22 of file Benchmark.cc.

References dqm::implementation::IBooker::book2D(), and dqm::legacy::MonitorElement::getTH2F().

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

30  {
31  edm::LogInfo("Benchmark") << " Benchmark::book2D "
32  << "booked " << histname;
33  return b.book2D(histname, title, nbinsx, xmin, xmax, nbinsy, ymin, ymax)->getTH2F();
34 }
virtual TH2F * getTH2F() const
Log< level::Info, false > LogInfo
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:177
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 dqm::implementation::IBooker::book2D(), dqm::legacy::MonitorElement::getTH2F(), mps_fire::i, and SiStrip_OfflineMonitoring_cff::ymin.

43  {
44  edm::LogInfo("Benchmark") << " Benchmark::book2D "
45  << " booked " << histname;
46 
47  // need to build the y bin array manually, due to a missing function in
48  // 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 }
virtual TH2F * getTH2F() const
const double xbins[]
Log< level::Info, false > LogInfo
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:177
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 58 of file Benchmark.cc.

References dqm::implementation::IBooker::bookProfile(), and dqm::legacy::MonitorElement::getTProfile().

Referenced by PFMETMonitor::setup().

66  {
67  edm::LogInfo("Benchmark") << " Benchmark::bookProfile "
68  << "booked " << histname;
69  return b.bookProfile(histname, title, nbinsx, xmin, xmax, 0.0, 0.0, option)->getTProfile();
70 }
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:322
Log< level::Info, false > LogInfo
virtual TProfile * getTProfile() 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, 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 72 of file Benchmark.cc.

References dqm::implementation::IBooker::bookProfile(), dqm::legacy::MonitorElement::getTProfile(), and mps_fire::i.

79  {
80  // need to convert the float bin array into a double bin array, because the
81  // DQMStore TProfile functions take floats, while the DQMStore TH2 functions
82  // take double.
83  vector<double> xbinsd(nbinsx + 1);
84  for (int i = 0; i <= nbinsx; ++i) {
85  xbinsd[i] = xbins[i];
86  }
87 
88  edm::LogInfo("Benchmark") << " Benchmark::bookProfile "
89  << "booked " << histname;
90  return b.bookProfile(histname, title, nbinsx, &xbinsd[0], ymin, ymax, option)->getTProfile();
91 }
const double xbins[]
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:322
Log< level::Info, false > LogInfo
virtual TProfile * getTProfile() const
bool Benchmark::isInRange ( float  pt,
float  eta,
float  phi 
) const
inline

Definition at line 50 of file Benchmark.h.

References etaMin_, phiMax_, phiMin_, and ptMin_.

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

50  {
51  return (pt > ptMin_ && pt < ptMax_ && eta > etaMin_ && eta < etaMax_ && phi > phiMin_ && phi < phiMax_);
52  }
float phiMin_
Definition: Benchmark.h:124
float phiMax_
Definition: Benchmark.h:125
float ptMin_
Definition: Benchmark.h:120
float etaMin_
Definition: Benchmark.h:122
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 Puppi_cff::etaMax, etaMax_, Puppi_cff::etaMin, etaMin_, L1TMuonDQMOffline_cfi::phiMax, phiMax_, L1TMuonDQMOffline_cfi::phiMin, phiMin_, HLT_FULL_cff::ptMax, ptMax_, ptMin, and ptMin_.

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

41  {
42  ptMin_ = ptMin;
43  ptMax_ = ptMax;
44  etaMin_ = etaMin;
45  etaMax_ = etaMax;
46  phiMin_ = phiMin;
47  phiMax_ = phiMax;
48  }
float etaMax_
Definition: Benchmark.h:123
float ptMax_
Definition: Benchmark.h:121
constexpr float ptMin
float phiMin_
Definition: Benchmark.h:124
tuple etaMin
Definition: Puppi_cff.py:45
float phiMax_
Definition: Benchmark.h:125
float ptMin_
Definition: Benchmark.h:120
float etaMin_
Definition: Benchmark.h:122
tuple etaMax
Definition: Puppi_cff.py:46
void Benchmark::write ( )

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

Definition at line 93 of file Benchmark.cc.

References sistrip::dir_.

Referenced by pkg.AbstractPkg::generate().

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

Member Data Documentation

TDirectory* Benchmark::dir_
protected

Definition at line 116 of file Benchmark.h.

float Benchmark::etaMax_
protected

Definition at line 123 of file Benchmark.h.

Referenced by setRange().

float Benchmark::etaMin_
protected

Definition at line 122 of file Benchmark.h.

Referenced by isInRange(), and setRange().

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

Definition at line 125 of file Benchmark.h.

Referenced by isInRange(), and setRange().

float Benchmark::phiMin_
protected

Definition at line 124 of file Benchmark.h.

Referenced by isInRange(), and setRange().

float Benchmark::ptMax_
protected

Definition at line 121 of file Benchmark.h.

Referenced by setRange().

float Benchmark::ptMin_
protected

Definition at line 120 of file Benchmark.h.

Referenced by isInRange(), and setRange().