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

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.

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

12  : Benchmark(mode) {
13  pt_ = nullptr;
14  eta_ = nullptr;
15  phi_ = nullptr;
16  charge_ = nullptr;
17  pdgId_ = nullptr;
18 
19  histogramBooked_ = false;
20 }
TH1F * pdgId_
COLIN add this histo.
Benchmark(Mode mode=DEFAULT)
Definition: Benchmark.h:34

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

References fillOne(), and mps_fire::i.

Referenced by CandidateBenchmarkAnalyzer::analyze().

37  {
38  for (unsigned int i = 0; i < candCollection.size(); i++) {
39  const reco::Candidate &cand = candCollection[i];
40  fillOne(cand);
41  }
42 }
void fillOne(const reco::Candidate &candidate)
fill histograms with a given particle

◆ fillOne()

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

fill histograms with a given particle

Definition at line 90 of file CandidateBenchmark.cc.

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

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

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 }
bool isInRange(float pt, float eta, float phi) const
Definition: Benchmark.h:50

◆ setup() [1/2]

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

book histograms

Definition at line 24 of file CandidateBenchmark.cc.

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

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 }
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
double b
Definition: hdecay.h:120
Mode mode_
Definition: Benchmark.h:118

◆ setup() [2/2]

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

Definition at line 47 of file CandidateBenchmark.cc.

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

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 }
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
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
ParameterSet const & parameterSet(StableProvenance const &provenance, ProcessHistory const &history)
Definition: Provenance.cc:11
double b
Definition: hdecay.h:120

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