CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Attributes
CandidateBenchmark Class Reference

To plot Candidate quantities. More...

#include <CandidateBenchmark.h>

Inheritance diagram for CandidateBenchmark:
Benchmark CandidateBenchmarkAnalyzer

Public Member Functions

 CandidateBenchmark (Mode mode)
 
template<class C >
void fill (const C &candidates)
 
void fillOne (const reco::Candidate &candidate)
 fill histograms with a given particle More...
 
void setup (DQMStore::IBooker &b)
 book histograms More...
 
void setup (DQMStore::IBooker &b, const edm::ParameterSet &parameterSet)
 
 ~CandidateBenchmark () override
 
- Public Member Functions inherited from Benchmark
 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 Attributes

TH1F * charge_
 
TH1F * eta_
 
bool histogramBooked_
 
TH1F * pdgId_
 COLIN add this histo. More...
 
TH1F * phi_
 
TH1F * pt_
 
- Protected Attributes inherited from Benchmark
TDirectory * dir_
 
float etaMax_
 
float etaMin_
 
Mode mode_
 
float phiMax_
 
float phiMin_
 
float ptMax_
 
float ptMin_
 

Additional Inherited Members

- Public Types inherited from Benchmark
typedef dqm::legacy::DQMStore DQMStore
 
enum  Mode { DEFAULT, DQMOFFLINE, VALIDATION }
 
- Protected Member Functions inherited from Benchmark
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...
 

Detailed Description

To plot Candidate quantities.

Definition at line 10 of file CandidateBenchmark.h.

Constructor & Destructor Documentation

◆ CandidateBenchmark()

CandidateBenchmark::CandidateBenchmark ( Mode  mode)

Definition at line 12 of file CandidateBenchmark.cc.

12  : Benchmark(mode) {
13  pt_ = nullptr;
14  eta_ = nullptr;
15  phi_ = nullptr;
16  charge_ = nullptr;
17  pdgId_ = nullptr;
18 
19  histogramBooked_ = false;
20 }

References charge_, eta_, histogramBooked_, pdgId_, phi_, and pt_.

◆ ~CandidateBenchmark()

CandidateBenchmark::~CandidateBenchmark ( )
override

Definition at line 22 of file CandidateBenchmark.cc.

22 {}

Member Function Documentation

◆ fill()

template<class C >
void CandidateBenchmark::fill ( const C &  candidates)

Definition at line 37 of file CandidateBenchmark.h.

37  {
38  for (unsigned int i = 0; i < candCollection.size(); i++) {
39  const reco::Candidate &cand = candCollection[i];
40  fillOne(cand);
41  }
42 }

References fillOne(), and mps_fire::i.

Referenced by CandidateBenchmarkAnalyzer::analyze().

◆ fillOne()

void CandidateBenchmark::fillOne ( const reco::Candidate candidate)

fill histograms with a given particle

Definition at line 90 of file CandidateBenchmark.cc.

90  {
91  if (!isInRange(cand.pt(), cand.eta(), cand.phi()))
92  return;
93 
94  if (histogramBooked_) {
95  if (pt_)
96  pt_->Fill(cand.pt());
97  if (eta_)
98  eta_->Fill(cand.eta());
99  if (phi_)
100  phi_->Fill(cand.phi());
101  if (charge_)
102  charge_->Fill(cand.charge());
103  }
104 }

References charge_, eta_, histogramBooked_, Benchmark::isInRange(), phi_, and pt_.

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

◆ setup() [1/2]

void CandidateBenchmark::setup ( DQMStore::IBooker b)

book histograms

Definition at line 24 of file CandidateBenchmark.cc.

24  {
25  if (!histogramBooked_) {
26  PhaseSpace ptPS(100, 0, 100);
27  PhaseSpace phiPS(360, -3.1416, 3.1416);
28  PhaseSpace etaPS(100, -5, 5);
29  switch (mode_) {
30  case DQMOFFLINE:
31  default:
32  ptPS = PhaseSpace(50, 0, 100);
33  phiPS.n = 50;
34  etaPS.n = 20;
35  break;
36  }
37 
38  pt_ = book1D(b, "pt_", "pt_;p_{T} (GeV)", ptPS.n, ptPS.m, ptPS.M);
39  eta_ = book1D(b, "eta_", "eta_;#eta", etaPS.n, etaPS.m, etaPS.M);
40  phi_ = book1D(b, "phi_", "phi_;#phi", phiPS.n, phiPS.m, phiPS.M);
41  charge_ = book1D(b, "charge_", "charge_;charge", 3, -1.5, 1.5);
42 
43  histogramBooked_ = true;
44  }
45 }

References b, Benchmark::book1D(), charge_, Benchmark::DQMOFFLINE, eta_, histogramBooked_, Benchmark::PhaseSpace::m, Benchmark::PhaseSpace::M, Benchmark::mode_, Benchmark::PhaseSpace::n, phi_, and pt_.

Referenced by CandidateBenchmarkAnalyzer::bookHistograms(), PFJetMonitor::setup(), PFMETMonitor::setup(), and PFCandidateMonitor::setup().

◆ setup() [2/2]

void CandidateBenchmark::setup ( DQMStore::IBooker b,
const edm::ParameterSet parameterSet 
)

Definition at line 47 of file CandidateBenchmark.cc.

47  {
48  if (!histogramBooked_) {
50  edm::ParameterSet etaPS = parameterSet.getParameter<edm::ParameterSet>("EtaHistoParameter");
51  edm::ParameterSet phiPS = parameterSet.getParameter<edm::ParameterSet>("PhiHistoParameter");
52  edm::ParameterSet chPS = parameterSet.getParameter<edm::ParameterSet>("ChargeHistoParameter");
53 
54  if (ptPS.getParameter<bool>("switchOn")) {
55  pt_ = book1D(b,
56  "pt_",
57  "p_{T};p_{T} (GeV)",
58  ptPS.getParameter<int32_t>("nBin"),
59  ptPS.getParameter<double>("xMin"),
60  ptPS.getParameter<double>("xMax"));
61  }
62  if (etaPS.getParameter<bool>("switchOn")) {
63  eta_ = book1D(b,
64  "eta_",
65  "#eta;#eta",
66  etaPS.getParameter<int32_t>("nBin"),
67  etaPS.getParameter<double>("xMin"),
68  etaPS.getParameter<double>("xMax"));
69  }
70  if (phiPS.getParameter<bool>("switchOn")) {
71  phi_ = book1D(b,
72  "phi_",
73  "#phi;#phi",
74  phiPS.getParameter<int32_t>("nBin"),
75  phiPS.getParameter<double>("xMin"),
76  phiPS.getParameter<double>("xMax"));
77  }
78  if (chPS.getParameter<bool>("switchOn")) {
79  charge_ = book1D(b,
80  "charge_",
81  "charge;charge",
82  chPS.getParameter<int32_t>("nBin"),
83  chPS.getParameter<double>("xMin"),
84  chPS.getParameter<double>("xMax"));
85  }
86  histogramBooked_ = true;
87  }
88 }

References b, Benchmark::book1D(), charge_, eta_, edm::ParameterSet::getParameter(), histogramBooked_, edm::parameterSet(), phi_, and pt_.

Member Data Documentation

◆ charge_

TH1F* CandidateBenchmark::charge_
protected

Definition at line 29 of file CandidateBenchmark.h.

Referenced by CandidateBenchmark(), fillOne(), and setup().

◆ eta_

TH1F* CandidateBenchmark::eta_
protected

Definition at line 27 of file CandidateBenchmark.h.

Referenced by CandidateBenchmark(), fillOne(), and setup().

◆ histogramBooked_

bool CandidateBenchmark::histogramBooked_
protected

Definition at line 33 of file CandidateBenchmark.h.

Referenced by CandidateBenchmark(), fillOne(), and setup().

◆ pdgId_

TH1F* CandidateBenchmark::pdgId_
protected

COLIN add this histo.

Definition at line 31 of file CandidateBenchmark.h.

Referenced by CandidateBenchmark().

◆ phi_

TH1F* CandidateBenchmark::phi_
protected

Definition at line 28 of file CandidateBenchmark.h.

Referenced by CandidateBenchmark(), fillOne(), and setup().

◆ pt_

TH1F* CandidateBenchmark::pt_
protected

Definition at line 26 of file CandidateBenchmark.h.

Referenced by CandidateBenchmark(), fillOne(), and setup().

mps_fire.i
i
Definition: mps_fire.py:428
Benchmark::isInRange
bool isInRange(float pt, float eta, float phi) const
Definition: Benchmark.h:50
ALCARECOPromptCalibProdSiPixelAli0T_cff.mode
mode
Definition: ALCARECOPromptCalibProdSiPixelAli0T_cff.py:96
Benchmark::DQMOFFLINE
Definition: Benchmark.h:32
CandidateBenchmark::phi_
TH1F * phi_
Definition: CandidateBenchmark.h:28
CandidateBenchmark::histogramBooked_
bool histogramBooked_
Definition: CandidateBenchmark.h:33
Benchmark::mode_
Mode mode_
Definition: Benchmark.h:118
b
double b
Definition: hdecay.h:118
Benchmark::Benchmark
Benchmark(Mode mode=DEFAULT)
Definition: Benchmark.h:34
CandidateBenchmark::pt_
TH1F * pt_
Definition: CandidateBenchmark.h:26
edm::ParameterSet
Definition: ParameterSet.h:47
cand
Definition: decayParser.h:32
CandidateBenchmark::fillOne
void fillOne(const reco::Candidate &candidate)
fill histograms with a given particle
Definition: CandidateBenchmark.cc:90
reco::Candidate
Definition: Candidate.h:27
Benchmark::book1D
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 ...
Definition: Benchmark.cc:15
CandidateBenchmark::eta_
TH1F * eta_
Definition: CandidateBenchmark.h:27
edm::parameterSet
ParameterSet const & parameterSet(Provenance const &provenance, ProcessHistory const &history)
Definition: Provenance.cc:11
CandidateBenchmark::charge_
TH1F * charge_
Definition: CandidateBenchmark.h:29
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
CandidateBenchmark::pdgId_
TH1F * pdgId_
COLIN add this histo.
Definition: CandidateBenchmark.h:31