RecoEgamma
PhotonIdentification
plugins
cuts
PhoFull5x5SigmaIEtaIEtaValueMapCut.cc
Go to the documentation of this file.
1
#include "
PhysicsTools/SelectorUtils/interface/CutApplicatorWithEventContentBase.h
"
2
#include "
DataFormats/EgammaCandidates/interface/Photon.h
"
3
4
class
PhoFull5x5SigmaIEtaIEtaValueMapCut
:
public
CutApplicatorWithEventContentBase
{
5
public
:
6
PhoFull5x5SigmaIEtaIEtaValueMapCut
(
const
edm::ParameterSet
&
c
);
7
8
result_type
operator()
(
const
reco::PhotonPtr
&)
const
final
;
9
10
void
setConsumes
(
edm::ConsumesCollector
&)
final
;
11
void
getEventContent
(
const
edm::EventBase
&)
final
;
12
13
double
value
(
const
reco::CandidatePtr
&
cand
)
const
final
;
14
15
CandidateType
candidateType
()
const
final {
return
PHOTON
; }
16
17
private
:
18
const
float
_cutValueEB
;
19
const
float
_cutValueEE
;
20
const
float
_barrelCutOff
;
21
edm::Handle<edm::ValueMap<float>
>
_full5x5SigmaIEtaIEtaMap
;
22
23
constexpr
static
char
full5x5SigmaIEtaIEta_
[] =
"full5x5SigmaIEtaIEta"
;
24
};
25
26
constexpr
char
PhoFull5x5SigmaIEtaIEtaValueMapCut::full5x5SigmaIEtaIEta_
[];
27
28
DEFINE_EDM_PLUGIN
(
CutApplicatorFactory
,
PhoFull5x5SigmaIEtaIEtaValueMapCut
,
"PhoFull5x5SigmaIEtaIEtaValueMapCut"
);
29
30
PhoFull5x5SigmaIEtaIEtaValueMapCut::PhoFull5x5SigmaIEtaIEtaValueMapCut
(
const
edm::ParameterSet
&
c
)
31
:
CutApplicatorWithEventContentBase
(
c
),
32
_cutValueEB(
c
.getParameter<double>(
"cutValueEB"
)),
33
_cutValueEE(
c
.getParameter<double>(
"cutValueEE"
)),
34
_barrelCutOff(
c
.getParameter<double>(
"barrelCutOff"
)) {
35
edm::InputTag
maptag =
c
.getParameter<
edm::InputTag
>(
"full5x5SigmaIEtaIEtaMap"
);
36
contentTags_
.emplace(
full5x5SigmaIEtaIEta_
, maptag);
37
}
38
39
void
PhoFull5x5SigmaIEtaIEtaValueMapCut::setConsumes
(
edm::ConsumesCollector
&
cc
) {
40
auto
full5x5SigmaIEtaIEta =
cc
.consumes<
edm::ValueMap<float>
>(
contentTags_
[
full5x5SigmaIEtaIEta_
]);
41
contentTokens_
.emplace(
full5x5SigmaIEtaIEta_
, full5x5SigmaIEtaIEta);
42
}
43
44
void
PhoFull5x5SigmaIEtaIEtaValueMapCut::getEventContent
(
const
edm::EventBase
&
ev
) {
45
ev
.getByLabel(
contentTags_
[
full5x5SigmaIEtaIEta_
],
_full5x5SigmaIEtaIEtaMap
);
46
}
47
48
CutApplicatorBase::result_type
PhoFull5x5SigmaIEtaIEtaValueMapCut::operator()
(
const
reco::PhotonPtr
&
cand
)
const
{
49
// Figure out the cut value
50
const
float
cutValue = (
std::abs
(
cand
->superCluster()->eta()) <
_barrelCutOff
?
_cutValueEB
:
_cutValueEE
);
51
float
sihihval = -1.0;
52
if
(
_full5x5SigmaIEtaIEtaMap
.
isValid
() &&
_full5x5SigmaIEtaIEtaMap
->
contains
(
cand
.id())) {
53
sihihval = (*_full5x5SigmaIEtaIEtaMap)[
cand
];
54
}
else
if
(
_full5x5SigmaIEtaIEtaMap
.
isValid
() &&
_full5x5SigmaIEtaIEtaMap
->
idSize
() == 1 &&
55
cand
.id() ==
edm::ProductID
()) {
56
// in case we have spoofed a ptr
57
//note this must be a 1:1 valuemap (only one product input)
58
sihihval =
_full5x5SigmaIEtaIEtaMap
->
begin
()[
cand
.key()];
59
}
else
if
(
_full5x5SigmaIEtaIEtaMap
.
isValid
()) {
// throw an exception
60
sihihval = (*_full5x5SigmaIEtaIEtaMap)[
cand
];
61
}
62
63
// Retrieve the variable value for this particle
64
const
float
full5x5SigmaIEtaIEta =
_full5x5SigmaIEtaIEtaMap
.
isValid
() ? sihihval :
cand
->full5x5_sigmaIetaIeta();
65
66
// Apply the cut and return the result
67
return
full5x5SigmaIEtaIEta < cutValue;
68
}
69
70
double
PhoFull5x5SigmaIEtaIEtaValueMapCut::value
(
const
reco::CandidatePtr
&
cand
)
const
{
71
reco::PhotonPtr
pho(
cand
);
72
float
sihihval = -1.0;
73
if
(
_full5x5SigmaIEtaIEtaMap
.
isValid
() &&
_full5x5SigmaIEtaIEtaMap
->
contains
(
cand
.id())) {
74
sihihval = (*_full5x5SigmaIEtaIEtaMap)[
cand
];
75
}
else
if
(
_full5x5SigmaIEtaIEtaMap
.
isValid
() &&
_full5x5SigmaIEtaIEtaMap
->
idSize
() == 1 &&
76
cand
.id() ==
edm::ProductID
()) {
77
// in case we have spoofed a ptr
78
//note this must be a 1:1 valuemap (only one product input)
79
sihihval =
_full5x5SigmaIEtaIEtaMap
->
begin
()[
cand
.key()];
80
}
else
if
(
_full5x5SigmaIEtaIEtaMap
.
isValid
()) {
// throw an exception
81
sihihval = (*_full5x5SigmaIEtaIEtaMap)[
cand
];
82
}
83
84
return
_full5x5SigmaIEtaIEtaMap
.
isValid
() ? sihihval : pho->full5x5_sigmaIetaIeta();
85
}
makeMEIFBenchmarkPlots.ev
ev
Definition:
makeMEIFBenchmarkPlots.py:55
CutApplicatorWithEventContentBase
Definition:
CutApplicatorWithEventContentBase.h:19
PhoFull5x5SigmaIEtaIEtaValueMapCut::_cutValueEE
const float _cutValueEE
Definition:
PhoFull5x5SigmaIEtaIEtaValueMapCut.cc:19
CutApplicatorWithEventContentBase::contentTags_
std::unordered_map< std::string, edm::InputTag > contentTags_
Definition:
CutApplicatorWithEventContentBase.h:35
PhoFull5x5SigmaIEtaIEtaValueMapCut::operator()
result_type operator()(const reco::PhotonPtr &) const final
Definition:
PhoFull5x5SigmaIEtaIEtaValueMapCut.cc:48
runTheMatrix.const
const
Definition:
runTheMatrix.py:341
edm::ValueMap::idSize
size_t idSize() const
Definition:
ValueMap.h:157
gpuPixelDoublets::cc
uint32_t cc[maxCellsPerHit]
Definition:
gpuFishbone.h:49
edm::Handle
Definition:
AssociativeIterator.h:50
Photon.h
PhoFull5x5SigmaIEtaIEtaValueMapCut::_cutValueEB
const float _cutValueEB
Definition:
PhoFull5x5SigmaIEtaIEtaValueMapCut.cc:18
PhoFull5x5SigmaIEtaIEtaValueMapCut::setConsumes
void setConsumes(edm::ConsumesCollector &) final
Definition:
PhoFull5x5SigmaIEtaIEtaValueMapCut.cc:39
HltBtagPostValidation_cff.c
c
Definition:
HltBtagPostValidation_cff.py:31
PhoFull5x5SigmaIEtaIEtaValueMapCut::_barrelCutOff
const float _barrelCutOff
Definition:
PhoFull5x5SigmaIEtaIEtaValueMapCut.cc:20
PhoFull5x5SigmaIEtaIEtaValueMapCut::PhoFull5x5SigmaIEtaIEtaValueMapCut
PhoFull5x5SigmaIEtaIEtaValueMapCut(const edm::ParameterSet &c)
Definition:
PhoFull5x5SigmaIEtaIEtaValueMapCut.cc:30
PhoFull5x5SigmaIEtaIEtaValueMapCut
Definition:
PhoFull5x5SigmaIEtaIEtaValueMapCut.cc:4
edm::ProductID
Definition:
ProductID.h:27
edmplugin::PluginFactory
Definition:
PluginFactory.h:35
candidate_functions::CandidateCut::result_type
bool result_type
Definition:
CandidateCut.h:11
PhoFull5x5SigmaIEtaIEtaValueMapCut::candidateType
CandidateType candidateType() const final
Definition:
PhoFull5x5SigmaIEtaIEtaValueMapCut.cc:15
funct::abs
Abs< T >::type abs(const T &t)
Definition:
Abs.h:22
PhoFull5x5SigmaIEtaIEtaValueMapCut::getEventContent
void getEventContent(const edm::EventBase &) final
Definition:
PhoFull5x5SigmaIEtaIEtaValueMapCut.cc:44
CutApplicatorWithEventContentBase.h
edm::Ptr
Definition:
AssociationVector.h:31
PhoFull5x5SigmaIEtaIEtaValueMapCut::value
double value(const reco::CandidatePtr &cand) const final
Definition:
PhoFull5x5SigmaIEtaIEtaValueMapCut.cc:70
edm::EventBase
Definition:
EventBase.h:47
edm::ValueMap::begin
const_iterator begin() const
Definition:
ValueMap.h:229
edm::ValueMap< float >
CutApplicatorWithEventContentBase::contentTokens_
std::unordered_map< std::string, edm::EDGetToken > contentTokens_
Definition:
CutApplicatorWithEventContentBase.h:40
PhoFull5x5SigmaIEtaIEtaValueMapCut::_full5x5SigmaIEtaIEtaMap
edm::Handle< edm::ValueMap< float > > _full5x5SigmaIEtaIEtaMap
Definition:
PhoFull5x5SigmaIEtaIEtaValueMapCut.cc:21
edm::HandleBase::isValid
bool isValid() const
Definition:
HandleBase.h:70
edm::InputTag
Definition:
InputTag.h:15
CutApplicatorBase::CandidateType
CandidateType
Definition:
CutApplicatorBase.h:47
edm::ParameterSet
Definition:
ParameterSet.h:47
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition:
PluginFactory.h:123
cand
Definition:
decayParser.h:32
PhoFull5x5SigmaIEtaIEtaValueMapCut::full5x5SigmaIEtaIEta_
static constexpr char full5x5SigmaIEtaIEta_[]
Definition:
PhoFull5x5SigmaIEtaIEtaValueMapCut.cc:23
CutApplicatorBase::PHOTON
Definition:
CutApplicatorBase.h:47
edm::ValueMap::contains
bool contains(ProductID id) const
Definition:
ValueMap.h:155
edm::ConsumesCollector
Definition:
ConsumesCollector.h:45
Generated for CMSSW Reference Manual by
1.8.14