RecoEgamma
ElectronIdentification
plugins
cuts
GsfEleEffAreaPFIsoCut.cc
Go to the documentation of this file.
1
#include "
PhysicsTools/SelectorUtils/interface/CutApplicatorWithEventContentBase.h
"
2
#include "
DataFormats/EgammaCandidates/interface/GsfElectron.h
"
3
#include "
CommonTools/Egamma/interface/EffectiveAreas.h
"
4
5
class
GsfEleEffAreaPFIsoCut
:
public
CutApplicatorWithEventContentBase
{
6
public
:
7
GsfEleEffAreaPFIsoCut
(
const
edm::ParameterSet
&
c
);
8
9
result_type
operator()
(
const
reco::GsfElectronPtr
&)
const
final
;
10
11
void
setConsumes
(
edm::ConsumesCollector
&)
final
;
12
void
getEventContent
(
const
edm::EventBase
&)
final
;
13
14
double
value
(
const
reco::CandidatePtr
&
cand
)
const
final
;
15
16
CandidateType
candidateType
()
const
final {
return
ELECTRON
; }
17
18
private
:
19
// Cut values
20
const
float
_isoCutEBLowPt
,
_isoCutEBHighPt
,
_isoCutEELowPt
,
_isoCutEEHighPt
;
21
// Configuration
22
const
float
_ptCutOff
;
23
const
float
_barrelCutOff
;
24
bool
_isRelativeIso
;
25
// Effective area constants
26
EffectiveAreas
_effectiveAreas
;
27
// The rho
28
edm::Handle<double>
_rhoHandle
;
29
30
constexpr
static
char
rhoString_
[] =
"rho"
;
31
};
32
33
constexpr
char
GsfEleEffAreaPFIsoCut::rhoString_
[];
34
35
DEFINE_EDM_PLUGIN
(
CutApplicatorFactory
,
GsfEleEffAreaPFIsoCut
,
"GsfEleEffAreaPFIsoCut"
);
36
37
GsfEleEffAreaPFIsoCut::GsfEleEffAreaPFIsoCut
(
const
edm::ParameterSet
&
c
)
38
:
CutApplicatorWithEventContentBase
(
c
),
39
_isoCutEBLowPt(
c
.getParameter<double>(
"isoCutEBLowPt"
)),
40
_isoCutEBHighPt(
c
.getParameter<double>(
"isoCutEBHighPt"
)),
41
_isoCutEELowPt(
c
.getParameter<double>(
"isoCutEELowPt"
)),
42
_isoCutEEHighPt(
c
.getParameter<double>(
"isoCutEEHighPt"
)),
43
_ptCutOff(
c
.getParameter<double>(
"ptCutOff"
)),
44
_barrelCutOff(
c
.getParameter<double>(
"barrelCutOff"
)),
45
_isRelativeIso(
c
.getParameter<
bool
>(
"isRelativeIso"
)),
46
_effectiveAreas((
c
.getParameter<
edm
::FileInPath>(
"effAreasConfigFile"
)).
fullPath
()) {
47
edm::InputTag
rhoTag
=
c
.getParameter<
edm::InputTag
>(
"rho"
);
48
contentTags_
.emplace(
rhoString_
,
rhoTag
);
49
}
50
51
void
GsfEleEffAreaPFIsoCut::setConsumes
(
edm::ConsumesCollector
&
cc
) {
52
auto
rho
=
cc
.consumes<
double
>(
contentTags_
[
rhoString_
]);
53
contentTokens_
.emplace(
rhoString_
,
rho
);
54
}
55
56
void
GsfEleEffAreaPFIsoCut::getEventContent
(
const
edm::EventBase
&
ev
) {
57
ev
.getByLabel(
contentTags_
[
rhoString_
],
_rhoHandle
);
58
}
59
60
CutApplicatorBase::result_type
GsfEleEffAreaPFIsoCut::operator()
(
const
reco::GsfElectronPtr
&
cand
)
const
{
61
// Establish the cut value
62
double
absEta =
std::abs
(
cand
->superCluster()->eta());
63
const
float
isoCut = (
cand
->pt() <
_ptCutOff
? (absEta <
_barrelCutOff
?
_isoCutEBLowPt
:
_isoCutEELowPt
)
64
: (absEta <
_barrelCutOff
?
_isoCutEBHighPt
:
_isoCutEEHighPt
));
65
66
// Compute the combined isolation with effective area correction
67
const
reco::GsfElectron::PflowIsolationVariables
& pfIso =
cand
->pfIsolationVariables();
68
const
float
chad = pfIso.
sumChargedHadronPt
;
69
const
float
nhad = pfIso.
sumNeutralHadronEt
;
70
const
float
pho = pfIso.
sumPhotonEt
;
71
const
float
eA =
_effectiveAreas
.
getEffectiveArea
(absEta);
72
const
float
rho
=
_rhoHandle
.
isValid
() ? (
float
)(*
_rhoHandle
) : 0;
// std::max likes float arguments
73
const
float
iso = chad +
std::max
(0.0
f
, nhad + pho -
rho
* eA);
74
75
// Apply the cut and return the result
76
// Scale by pT if the relative isolation is requested but avoid division by 0
77
return
iso < isoCut * (
_isRelativeIso
?
cand
->pt() : 1.);
78
}
79
80
double
GsfEleEffAreaPFIsoCut::value
(
const
reco::CandidatePtr
&
cand
)
const
{
81
reco::GsfElectronPtr
ele(
cand
);
82
// Establish the cut value
83
double
absEta =
std::abs
(ele->
superCluster
()->eta());
84
85
// Compute the combined isolation with effective area correction
86
const
reco::GsfElectron::PflowIsolationVariables
& pfIso = ele->
pfIsolationVariables
();
87
const
float
chad = pfIso.
sumChargedHadronPt
;
88
const
float
nhad = pfIso.sumNeutralHadronEt;
89
const
float
pho = pfIso.sumPhotonEt;
90
float
eA =
_effectiveAreas
.
getEffectiveArea
(absEta);
91
float
rho
= (
float
)(*
_rhoHandle
);
// std::max likes float arguments
92
float
iso = chad +
std::max
(0.0
f
, nhad + pho -
rho
* eA);
93
94
// Divide by pT if the relative isolation is requested
95
if
(
_isRelativeIso
)
96
iso /= ele->
pt
();
97
98
// Apply the cut and return the result
99
return
iso;
100
}
GsfEleEffAreaPFIsoCut::candidateType
CandidateType candidateType() const final
Definition:
GsfEleEffAreaPFIsoCut.cc:16
GsfEleEffAreaPFIsoCut::setConsumes
void setConsumes(edm::ConsumesCollector &) final
Definition:
GsfEleEffAreaPFIsoCut.cc:51
electrons_cff.bool
bool
Definition:
electrons_cff.py:366
dqmMemoryStats.float
float
Definition:
dqmMemoryStats.py:127
GsfEleEffAreaPFIsoCut::_isoCutEBLowPt
const float _isoCutEBLowPt
Definition:
GsfEleEffAreaPFIsoCut.cc:20
f
double f[11][100]
Definition:
MuScleFitUtils.cc:78
GsfEleEffAreaPFIsoCut::GsfEleEffAreaPFIsoCut
GsfEleEffAreaPFIsoCut(const edm::ParameterSet &c)
Definition:
GsfEleEffAreaPFIsoCut.cc:37
contentValuesFiles.fullPath
fullPath
Definition:
contentValuesFiles.py:64
edm
HLT enums.
Definition:
AlignableModifier.h:19
GsfEleEffAreaPFIsoCut::_isoCutEELowPt
const float _isoCutEELowPt
Definition:
GsfEleEffAreaPFIsoCut.cc:20
reco::GsfElectron::PflowIsolationVariables
Definition:
GsfElectron.h:605
GsfEleEffAreaPFIsoCut::value
double value(const reco::CandidatePtr &cand) const final
Definition:
GsfEleEffAreaPFIsoCut.cc:80
reco::LeafCandidate::pt
double pt() const final
transverse momentum
Definition:
LeafCandidate.h:146
EffectiveAreas.h
watchdog.const
const
Definition:
watchdog.py:83
edm::Handle< double >
CutApplicatorWithEventContentBase::contentTags_
std::unordered_map< std::string, edm::InputTag > contentTags_
Definition:
CutApplicatorWithEventContentBase.h:35
HLT_FULL_cff.rhoTag
rhoTag
Definition:
HLT_FULL_cff.py:14988
candidate_functions::CandidateCut::result_type
bool result_type
Definition:
CandidateCut.h:11
reco::GsfElectron::PflowIsolationVariables::sumPhotonEt
float sumPhotonEt
sum pt of PF photons // old float photonIso ;
Definition:
GsfElectron.h:609
EffectiveAreas
Definition:
EffectiveAreas.h:7
CutApplicatorWithEventContentBase.h
GsfEleEffAreaPFIsoCut::getEventContent
void getEventContent(const edm::EventBase &) final
Definition:
GsfEleEffAreaPFIsoCut.cc:56
GsfElectron.h
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition:
PluginFactory.h:124
GsfEleEffAreaPFIsoCut::_isoCutEEHighPt
const float _isoCutEEHighPt
Definition:
GsfEleEffAreaPFIsoCut.cc:20
DDAxes::rho
edm::ParameterSet
Definition:
ParameterSet.h:47
GsfEleEffAreaPFIsoCut::_barrelCutOff
const float _barrelCutOff
Definition:
GsfEleEffAreaPFIsoCut.cc:23
GsfEleEffAreaPFIsoCut::operator()
result_type operator()(const reco::GsfElectronPtr &) const final
Definition:
GsfEleEffAreaPFIsoCut.cc:60
CutApplicatorBase::CandidateType
CandidateType
Definition:
CutApplicatorBase.h:47
SiStripPI::max
Definition:
SiStripPayloadInspectorHelper.h:169
edmplugin::PluginFactory
Definition:
PluginFactory.h:34
GsfEleEffAreaPFIsoCut::rhoString_
constexpr static char rhoString_[]
Definition:
GsfEleEffAreaPFIsoCut.cc:30
cand
Definition:
decayParser.h:32
cc
reco::GsfElectron::PflowIsolationVariables::sumNeutralHadronEt
float sumNeutralHadronEt
sum pt of neutral hadrons // old float neutralHadronIso ;
Definition:
GsfElectron.h:608
edm::Ptr< reco::GsfElectron >
GsfEleEffAreaPFIsoCut::_effectiveAreas
EffectiveAreas _effectiveAreas
Definition:
GsfEleEffAreaPFIsoCut.cc:26
GsfEleEffAreaPFIsoCut::_rhoHandle
edm::Handle< double > _rhoHandle
Definition:
GsfEleEffAreaPFIsoCut.cc:28
GsfEleEffAreaPFIsoCut::_ptCutOff
const float _ptCutOff
Definition:
GsfEleEffAreaPFIsoCut.cc:22
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
EffectiveAreas::getEffectiveArea
const float getEffectiveArea(float eta) const
Definition:
EffectiveAreas.cc:44
reco::GsfElectron::superCluster
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition:
GsfElectron.h:162
GsfEleEffAreaPFIsoCut::_isoCutEBHighPt
const float _isoCutEBHighPt
Definition:
GsfEleEffAreaPFIsoCut.cc:20
funct::abs
Abs< T >::type abs(const T &t)
Definition:
Abs.h:22
reco::GsfElectron::pfIsolationVariables
const PflowIsolationVariables & pfIsolationVariables() const
Definition:
GsfElectron.h:657
c
auto & c
Definition:
CAHitNtupletGeneratorKernelsImpl.h:46
GsfEleEffAreaPFIsoCut
Definition:
GsfEleEffAreaPFIsoCut.cc:5
edm::HandleBase::isValid
bool isValid() const
Definition:
HandleBase.h:70
CutApplicatorBase::ELECTRON
Definition:
CutApplicatorBase.h:47
GsfEleEffAreaPFIsoCut::_isRelativeIso
bool _isRelativeIso
Definition:
GsfEleEffAreaPFIsoCut.cc:24
edm::InputTag
Definition:
InputTag.h:15
edm::ConsumesCollector
Definition:
ConsumesCollector.h:45
CutApplicatorWithEventContentBase
Definition:
CutApplicatorWithEventContentBase.h:19
reco::GsfElectron::PflowIsolationVariables::sumChargedHadronPt
float sumChargedHadronPt
sum-pt of charged Hadron // old float chargedHadronIso ;
Definition:
GsfElectron.h:607
Generated for CMSSW Reference Manual by
1.8.16