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

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

◆ DQMStore

Definition at line 21 of file Benchmark.h.

Member Enumeration Documentation

◆ Mode

Enumerator
DEFAULT 
DQMOFFLINE 
VALIDATION 

Definition at line 32 of file Benchmark.h.

Constructor & Destructor Documentation

◆ Benchmark()

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::~Benchmark ( )
virtualnoexcept

Definition at line 11 of file Benchmark.cc.

11 {}

Member Function Documentation

◆ book1D()

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 b, LaserClient_cfi::nbins, runGCPTkAlMap::title, TrackerOfflineValidation_Dqm_cff::xmax, and TrackerOfflineValidation_Dqm_cff::xmin.

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 }
Log< level::Info, false > LogInfo
double b
Definition: hdecay.h:118

◆ book2D() [1/2]

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 b, runGCPTkAlMap::title, TrackerOfflineValidation_Dqm_cff::xmax, TrackerOfflineValidation_Dqm_cff::xmin, L1TOccupancyClient_cfi::ymax, and L1TOccupancyClient_cfi::ymin.

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 }
Log< level::Info, false > LogInfo
double b
Definition: hdecay.h:118

◆ book2D() [2/2]

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 b, mps_fire::i, runGCPTkAlMap::title, fw3dlego::xbins, L1TOccupancyClient_cfi::ymax, and L1TOccupancyClient_cfi::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 }
const double xbins[]
Log< level::Info, false > LogInfo
double b
Definition: hdecay.h:118

◆ bookProfile() [1/2]

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 b, fileinputsource_cfi::option, runGCPTkAlMap::title, TrackerOfflineValidation_Dqm_cff::xmax, and TrackerOfflineValidation_Dqm_cff::xmin.

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 }
Log< level::Info, false > LogInfo
double b
Definition: hdecay.h:118

◆ bookProfile() [2/2]

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 b, mps_fire::i, fileinputsource_cfi::option, runGCPTkAlMap::title, fw3dlego::xbins, L1TOccupancyClient_cfi::ymax, and L1TOccupancyClient_cfi::ymin.

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[]
Log< level::Info, false > LogInfo
double b
Definition: hdecay.h:118

◆ isInRange()

bool Benchmark::isInRange ( float  pt,
float  eta,
float  phi 
) const
inline

◆ setDirectory()

void Benchmark::setDirectory ( TDirectory *  dir)
virtual

◆ setParameters()

void Benchmark::setParameters ( Mode  mode)
inline

◆ setRange()

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(), PFJetMonitor::setParameters(), PFMETMonitor::setParameters(), and PFCandidateMonitor::setParameters().

◆ write()

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

◆ dir_

TDirectory* Benchmark::dir_
protected

Definition at line 116 of file Benchmark.h.

◆ etaMax_

float Benchmark::etaMax_
protected

Definition at line 123 of file Benchmark.h.

Referenced by setRange().

◆ etaMin_

float Benchmark::etaMin_
protected

Definition at line 122 of file Benchmark.h.

Referenced by isInRange(), and setRange().

◆ mode_

Mode Benchmark::mode_
protected

◆ phiMax_

float Benchmark::phiMax_
protected

Definition at line 125 of file Benchmark.h.

Referenced by isInRange(), and setRange().

◆ phiMin_

float Benchmark::phiMin_
protected

Definition at line 124 of file Benchmark.h.

Referenced by isInRange(), and setRange().

◆ ptMax_

float Benchmark::ptMax_
protected

Definition at line 121 of file Benchmark.h.

Referenced by setRange().

◆ ptMin_

float Benchmark::ptMin_
protected

Definition at line 120 of file Benchmark.h.

Referenced by isInRange(), and setRange().