DQMOffline
PFTau
src
CandidateBenchmark.cc
Go to the documentation of this file.
1
#include "
DQMOffline/PFTau/interface/CandidateBenchmark.h
"
2
3
#include "
DataFormats/Candidate/interface/Candidate.h
"
4
5
#include <TFile.h>
6
#include <TH1.h>
7
#include <TH2.h>
8
#include <TROOT.h>
9
10
using namespace
std
;
11
12
CandidateBenchmark::CandidateBenchmark
(
Mode
mode
) :
Benchmark
(
mode
) {
13
pt_
=
nullptr
;
14
eta_
=
nullptr
;
15
phi_
=
nullptr
;
16
charge_
=
nullptr
;
17
pdgId_
=
nullptr
;
18
19
histogramBooked_
=
false
;
20
}
21
22
CandidateBenchmark::~CandidateBenchmark
() {}
23
24
void
CandidateBenchmark::setup
(
DQMStore::IBooker
&
b
) {
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
}
46
47
void
CandidateBenchmark::setup
(
DQMStore::IBooker
&
b
,
const
edm::ParameterSet
&
parameterSet
) {
48
if
(!
histogramBooked_
) {
49
edm::ParameterSet
ptPS =
parameterSet
.
getParameter
<
edm::ParameterSet
>(
"PtHistoParameter"
);
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
}
89
90
void
CandidateBenchmark::fillOne
(
const
reco::Candidate
&
cand
) {
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
}
Benchmark
abstract base class
Definition:
Benchmark.h:19
Benchmark::isInRange
bool isInRange(float pt, float eta, float phi) const
Definition:
Benchmark.h:50
Benchmark::PhaseSpace::n
int n
Definition:
Benchmark.h:25
CandidateBenchmark::CandidateBenchmark
CandidateBenchmark(Mode mode)
Definition:
CandidateBenchmark.cc:12
ALCARECOPromptCalibProdSiPixelAli0T_cff.mode
mode
Definition:
ALCARECOPromptCalibProdSiPixelAli0T_cff.py:96
CandidateBenchmark::~CandidateBenchmark
~CandidateBenchmark() override
Definition:
CandidateBenchmark.cc:22
Benchmark::DQMOFFLINE
Definition:
Benchmark.h:32
CandidateBenchmark::setup
void setup(DQMStore::IBooker &b)
book histograms
Definition:
CandidateBenchmark.cc:24
CandidateBenchmark::phi_
TH1F * phi_
Definition:
CandidateBenchmark.h:28
Benchmark::PhaseSpace
Definition:
Benchmark.h:23
edm::parameterSet
ParameterSet const & parameterSet(StableProvenance const &provenance, ProcessHistory const &history)
Definition:
Provenance.cc:11
CandidateBenchmark.h
CandidateBenchmark::histogramBooked_
bool histogramBooked_
Definition:
CandidateBenchmark.h:33
Benchmark::mode_
Mode mode_
Definition:
Benchmark.h:118
b
double b
Definition:
hdecay.h:118
CandidateBenchmark::pt_
TH1F * pt_
Definition:
CandidateBenchmark.h:26
edm::ParameterSet
Definition:
ParameterSet.h:47
Benchmark::Mode
Mode
Definition:
Benchmark.h:32
cand
Definition:
decayParser.h:32
Benchmark::PhaseSpace::M
float M
Definition:
Benchmark.h:27
Benchmark::PhaseSpace::m
float m
Definition:
Benchmark.h:26
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
std
Definition:
JetResolutionObject.h:76
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
dqm::implementation::IBooker
Definition:
DQMStore.h:43
Candidate.h
Generated for CMSSW Reference Manual by
1.8.16