RecoEgamma
ElectronIdentification
plugins
cuts
GsfEleValueMapIsoRhoCut.cc
Go to the documentation of this file.
1
#include "
PhysicsTools/SelectorUtils/interface/CutApplicatorWithEventContentBase.h
"
2
#include "
DataFormats/EgammaCandidates/interface/GsfElectron.h
"
3
#include "
DataFormats/Common/interface/ValueMap.h
"
4
#include "
RecoEgamma/EgammaTools/interface/EBEECutValues.h
"
5
6
class
GsfEleValueMapIsoRhoCut
:
public
CutApplicatorWithEventContentBase
{
7
public
:
8
GsfEleValueMapIsoRhoCut
(
const
edm::ParameterSet
&
c
);
9
10
result_type
operator()
(
const
reco::GsfElectronPtr
&)
const
final
;
11
12
void
setConsumes
(
edm::ConsumesCollector
&)
final
;
13
void
getEventContent
(
const
edm::EventBase
&)
final
;
14
15
double
value
(
const
reco::CandidatePtr
&
cand
)
const
final
;
16
17
CandidateType
candidateType
()
const
final {
return
ELECTRON
; }
18
19
private
:
20
float
getRhoCorr
(
const
reco::GsfElectronPtr
&
cand
)
const
;
21
22
EBEECutValues
slopeTerm_
;
23
EBEECutValues
slopeStart_
;
24
EBEECutValues
constTerm_
;
25
EBEECutValues
rhoEtStart_
;
26
EBEECutValues
rhoEA_
;
27
28
bool
useRho_
;
29
30
edm::Handle<double>
rhoHandle_
;
31
edm::Handle<edm::ValueMap<float>
>
valueHandle_
;
32
};
33
34
DEFINE_EDM_PLUGIN
(
CutApplicatorFactory
,
GsfEleValueMapIsoRhoCut
,
"GsfEleValueMapIsoRhoCut"
);
35
36
GsfEleValueMapIsoRhoCut::GsfEleValueMapIsoRhoCut
(
const
edm::ParameterSet
&
params
)
37
:
CutApplicatorWithEventContentBase
(
params
),
38
slopeTerm_(
params
,
"slopeTerm"
),
39
slopeStart_(
params
,
"slopeStart"
),
40
constTerm_(
params
,
"constTerm"
),
41
rhoEtStart_(
params
,
"rhoEtStart"
),
42
rhoEA_(
params
,
"rhoEA"
) {
43
auto
rho
=
params
.getParameter<
edm::InputTag
>(
"rho"
);
44
if
(!
rho
.label().empty()) {
45
useRho_
=
true
;
46
contentTags_
.emplace(
"rho"
,
rho
);
47
}
else
48
useRho_
=
false
;
49
50
contentTags_
.emplace(
"value"
,
params
.getParameter<
edm::InputTag
>(
"value"
));
51
}
52
53
void
GsfEleValueMapIsoRhoCut::setConsumes
(
edm::ConsumesCollector
&
cc
) {
54
if
(
useRho_
)
55
contentTokens_
.emplace(
"rho"
,
cc
.consumes<
double
>(
contentTags_
[
"rho"
]));
56
contentTokens_
.emplace(
"value"
,
cc
.consumes<
edm::ValueMap<float>
>(
contentTags_
[
"value"
]));
57
}
58
59
void
GsfEleValueMapIsoRhoCut::getEventContent
(
const
edm::EventBase
&
ev
) {
60
if
(
useRho_
)
61
ev
.getByLabel(
contentTags_
[
"rho"
],
rhoHandle_
);
62
ev
.getByLabel(
contentTags_
[
"value"
],
valueHandle_
);
63
}
64
65
CutApplicatorBase::result_type
GsfEleValueMapIsoRhoCut::operator()
(
const
reco::GsfElectronPtr
&
cand
)
const
{
66
const
float
val
= (*valueHandle_)[
cand
];
67
68
const
float
et
=
cand
->et();
69
const
float
cutValue =
70
et
>
slopeStart_
(
cand
) ?
slopeTerm_
(
cand
) * (
et
-
slopeStart_
(
cand
)) +
constTerm_
(
cand
) :
constTerm_
(
cand
);
71
const
float
rhoCutValue =
getRhoCorr
(
cand
);
72
73
return
val
< cutValue + rhoCutValue;
74
}
75
76
double
GsfEleValueMapIsoRhoCut::value
(
const
reco::CandidatePtr
&
cand
)
const
{
77
reco::GsfElectronPtr
ele(
cand
);
78
return
(*
valueHandle_
)[
cand
];
79
}
80
81
float
GsfEleValueMapIsoRhoCut::getRhoCorr
(
const
reco::GsfElectronPtr
&
cand
)
const
{
82
if
(!
useRho_
)
83
return
0.;
84
else
{
85
const
double
rho
= (*rhoHandle_);
86
return
cand
->et() >=
rhoEtStart_
(
cand
) ?
rhoEA_
(
cand
) *
rho
: 0.;
87
}
88
}
GsfEleValueMapIsoRhoCut::GsfEleValueMapIsoRhoCut
GsfEleValueMapIsoRhoCut(const edm::ParameterSet &c)
Definition:
GsfEleValueMapIsoRhoCut.cc:36
GsfEleValueMapIsoRhoCut::valueHandle_
edm::Handle< edm::ValueMap< float > > valueHandle_
Definition:
GsfEleValueMapIsoRhoCut.cc:31
CalibrationSummaryClient_cfi.params
params
Definition:
CalibrationSummaryClient_cfi.py:14
EBEECutValues.h
GsfEleValueMapIsoRhoCut
Definition:
GsfEleValueMapIsoRhoCut.cc:6
GsfEleValueMapIsoRhoCut::rhoEA_
EBEECutValues rhoEA_
Definition:
GsfEleValueMapIsoRhoCut.cc:26
watchdog.const
const
Definition:
watchdog.py:83
edm::Handle< double >
GsfEleValueMapIsoRhoCut::useRho_
bool useRho_
Definition:
GsfEleValueMapIsoRhoCut.cc:28
CutApplicatorWithEventContentBase::contentTags_
std::unordered_map< std::string, edm::InputTag > contentTags_
Definition:
CutApplicatorWithEventContentBase.h:35
candidate_functions::CandidateCut::result_type
bool result_type
Definition:
CandidateCut.h:11
GsfEleValueMapIsoRhoCut::value
double value(const reco::CandidatePtr &cand) const final
Definition:
GsfEleValueMapIsoRhoCut.cc:76
GsfEleValueMapIsoRhoCut::getRhoCorr
float getRhoCorr(const reco::GsfElectronPtr &cand) const
Definition:
GsfEleValueMapIsoRhoCut.cc:81
GsfEleValueMapIsoRhoCut::slopeStart_
EBEECutValues slopeStart_
Definition:
GsfEleValueMapIsoRhoCut.cc:23
CutApplicatorWithEventContentBase.h
GsfElectron.h
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition:
PluginFactory.h:124
DDAxes::rho
edm::ParameterSet
Definition:
ParameterSet.h:47
CutApplicatorBase::CandidateType
CandidateType
Definition:
CutApplicatorBase.h:47
edmplugin::PluginFactory
Definition:
PluginFactory.h:34
cand
Definition:
decayParser.h:32
GsfEleValueMapIsoRhoCut::getEventContent
void getEventContent(const edm::EventBase &) final
Definition:
GsfEleValueMapIsoRhoCut.cc:59
EgHLTOffHistBins_cfi.et
et
Definition:
EgHLTOffHistBins_cfi.py:8
cc
GsfEleValueMapIsoRhoCut::rhoEtStart_
EBEECutValues rhoEtStart_
Definition:
GsfEleValueMapIsoRhoCut.cc:25
edm::Ptr< reco::GsfElectron >
ValueMap.h
heppy_batch.val
val
Definition:
heppy_batch.py:351
GsfEleValueMapIsoRhoCut::rhoHandle_
edm::Handle< double > rhoHandle_
Definition:
GsfEleValueMapIsoRhoCut.cc:30
GsfEleValueMapIsoRhoCut::constTerm_
EBEECutValues constTerm_
Definition:
GsfEleValueMapIsoRhoCut.cc:24
edm::ValueMap< float >
ev
bool ev
Definition:
Hydjet2Hadronizer.cc:95
CutApplicatorWithEventContentBase::contentTokens_
std::unordered_map< std::string, edm::EDGetToken > contentTokens_
Definition:
CutApplicatorWithEventContentBase.h:40
edm::EventBase
Definition:
EventBase.h:46
GsfEleValueMapIsoRhoCut::slopeTerm_
EBEECutValues slopeTerm_
Definition:
GsfEleValueMapIsoRhoCut.cc:22
EBEECutValuesT< double >
GsfEleValueMapIsoRhoCut::candidateType
CandidateType candidateType() const final
Definition:
GsfEleValueMapIsoRhoCut.cc:17
c
auto & c
Definition:
CAHitNtupletGeneratorKernelsImpl.h:46
CutApplicatorBase::ELECTRON
Definition:
CutApplicatorBase.h:47
edm::InputTag
Definition:
InputTag.h:15
edm::ConsumesCollector
Definition:
ConsumesCollector.h:45
CutApplicatorWithEventContentBase
Definition:
CutApplicatorWithEventContentBase.h:19
GsfEleValueMapIsoRhoCut::operator()
result_type operator()(const reco::GsfElectronPtr &) const final
Definition:
GsfEleValueMapIsoRhoCut.cc:65
GsfEleValueMapIsoRhoCut::setConsumes
void setConsumes(edm::ConsumesCollector &) final
Definition:
GsfEleValueMapIsoRhoCut.cc:53
Generated for CMSSW Reference Manual by
1.8.16