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 *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...
 
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...
 
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...
 
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...
 

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) {}

◆ ~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.

16  {
17  edm::LogInfo("Benchmark") << " Benchmark::book1D "
18  << "booking " << histname;
19  return b.book1D(histname, title, nbins, xmin, xmax)->getTH1F();
20 }

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

◆ book2D() [1/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.

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 }

References b, mps_fire::i, runGCPTkAlMap::title, fw3dlego::xbins, L1TOccupancyClient_cfi::ymax, and L1TOccupancyClient_cfi::ymin.

◆ book2D() [2/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.

30  {
31  edm::LogInfo("Benchmark") << " Benchmark::book2D "
32  << "booked " << histname;
33  return b.book2D(histname, title, nbinsx, xmin, xmax, nbinsy, ymin, ymax)->getTH2F();
34 }

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

◆ bookProfile() [1/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.

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 }

References b, mps_fire::i, fileinputsource_cfi::option, runGCPTkAlMap::title, fw3dlego::xbins, L1TOccupancyClient_cfi::ymax, and L1TOccupancyClient_cfi::ymin.

◆ bookProfile() [2/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.

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 }

References b, fileinputsource_cfi::option, runGCPTkAlMap::title, TrackerOfflineValidation_Dqm_cff::xmax, and TrackerOfflineValidation_Dqm_cff::xmin.

Referenced by PFMETMonitor::setup().

◆ isInRange()

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

Definition at line 50 of file Benchmark.h.

50  {
51  return (pt > ptMin_ && pt < ptMax_ && eta > etaMin_ && eta < etaMax_ && phi > phiMin_ && phi < phiMax_);
52  }

References etaMin_, phi, phiMax_, phiMin_, DiDispStaMuonMonitor_cfi::pt, and ptMin_.

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

◆ 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

◆ 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.

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 }

References sistrip::dir_.

Referenced by pkg.AbstractPkg::generate().

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

runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
fw3dlego::xbins
const double xbins[]
Definition: fw3dlego_xbins.cc:16
ALCARECOTkAlBeamHalo_cff.etaMin
etaMin
GeV.
Definition: ALCARECOTkAlBeamHalo_cff.py:32
mps_fire.i
i
Definition: mps_fire.py:428
Benchmark::phiMin_
float phiMin_
Definition: Benchmark.h:124
Benchmark::etaMin_
float etaMin_
Definition: Benchmark.h:122
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
Benchmark::dir_
TDirectory * dir_
Definition: Benchmark.h:116
ALCARECOPromptCalibProdSiPixelAli0T_cff.mode
mode
Definition: ALCARECOPromptCalibProdSiPixelAli0T_cff.py:96
ptMin
constexpr float ptMin
Definition: PhotonIDValueMapProducer.cc:155
Benchmark::phiMax_
float phiMax_
Definition: Benchmark.h:125
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
Benchmark::DQMOFFLINE
Definition: Benchmark.h:32
fileinputsource_cfi.option
option
Definition: fileinputsource_cfi.py:94
L1TOccupancyClient_cfi.ymax
ymax
Definition: L1TOccupancyClient_cfi.py:43
AlignmentTrackSelector_cfi.ptMax
ptMax
Definition: AlignmentTrackSelector_cfi.py:12
AlignmentTrackSelector_cfi.phiMin
phiMin
Definition: AlignmentTrackSelector_cfi.py:18
AlignmentTrackSelector_cfi.phiMax
phiMax
Definition: AlignmentTrackSelector_cfi.py:17
LaserClient_cfi.nbins
nbins
Definition: LaserClient_cfi.py:51
Benchmark::mode_
Mode mode_
Definition: Benchmark.h:118
b
double b
Definition: hdecay.h:118
Benchmark::VALIDATION
Definition: Benchmark.h:32
Benchmark::etaMax_
float etaMax_
Definition: Benchmark.h:123
Benchmark::ptMax_
float ptMax_
Definition: Benchmark.h:121
DDAxes::phi
L1TOccupancyClient_cfi.ymin
ymin
Definition: L1TOccupancyClient_cfi.py:43
TrackerOfflineValidation_Dqm_cff.xmax
xmax
Definition: TrackerOfflineValidation_Dqm_cff.py:11
Benchmark::DEFAULT
Definition: Benchmark.h:32
ALCARECOTkAlBeamHalo_cff.etaMax
etaMax
Definition: ALCARECOTkAlBeamHalo_cff.py:33
Benchmark::ptMin_
float ptMin_
Definition: Benchmark.h:120
TrackerOfflineValidation_Dqm_cff.xmin
xmin
Definition: TrackerOfflineValidation_Dqm_cff.py:10
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23