RecoEgamma
EgammaIsolationAlgos
plugins
EgammaTowerIsolationProducer.cc
Go to the documentation of this file.
1
//*****************************************************************************
2
// File: EgammaTowerIsolationProducer.cc
3
// ----------------------------------------------------------------------------
4
// OrigAuth: Matthias Mozer
5
// Institute: IIHE-VUB
6
//=============================================================================
7
//*****************************************************************************
8
9
#include "
DataFormats/CaloTowers/interface/CaloTowerCollection.h
"
10
#include "
DataFormats/Candidate/interface/CandAssociation.h
"
11
#include "
DataFormats/Candidate/interface/Candidate.h
"
12
#include "
DataFormats/RecoCandidate/interface/RecoCandidate.h
"
13
#include "
FWCore/Framework/interface/Event.h
"
14
#include "
FWCore/Framework/interface/stream/EDProducer.h
"
15
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
16
#include "
RecoEgamma/EgammaIsolationAlgos/interface/EgammaTowerIsolation.h
"
17
18
class
EgammaTowerIsolationProducer
:
public
edm::stream::EDProducer
<> {
19
public
:
20
explicit
EgammaTowerIsolationProducer
(
const
edm::ParameterSet
&);
21
22
void
produce
(
edm::Event
&,
const
edm::EventSetup
&)
override
;
23
24
private
:
25
// ----------member data ---------------------------
26
27
const
edm::EDGetTokenT<edm::View<reco::Candidate>
>
emObjectProducer_
;
28
const
edm::EDGetTokenT<CaloTowerCollection>
towerProducer_
;
29
30
const
edm::EDPutTokenT<edm::ValueMap<double>
>
putToken_
;
31
32
const
double
egHcalIsoPtMin_
;
33
const
double
egHcalIsoConeSizeOut_
;
34
const
double
egHcalIsoConeSizeIn_
;
35
const
signed
int
egHcalDepth_
;
36
};
37
38
#include "
FWCore/Framework/interface/MakerMacros.h
"
39
DEFINE_FWK_MODULE
(
EgammaTowerIsolationProducer
);
40
41
EgammaTowerIsolationProducer::EgammaTowerIsolationProducer
(
const
edm::ParameterSet
&
config
)
42
: emObjectProducer_{consumes(
config
.getParameter<
edm::InputTag
>(
"emObjectProducer"
))},
43
towerProducer_{consumes(
config
.getParameter<
edm::InputTag
>(
"towerProducer"
))},
44
putToken_{produces<edm::ValueMap<double>>()},
45
egHcalIsoPtMin_{
config
.getParameter<
double
>(
"etMin"
)},
46
egHcalIsoConeSizeOut_{
config
.getParameter<
double
>(
"extRadius"
)},
47
egHcalIsoConeSizeIn_{
config
.getParameter<
double
>(
"intRadius"
)},
48
egHcalDepth_{
config
.getParameter<
int
>(
"Depth"
)} {}
49
50
void
EgammaTowerIsolationProducer::produce
(
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup) {
51
// Get the filtered objects
52
auto
emObjectHandle =
iEvent
.getHandle(
emObjectProducer_
);
53
54
// Get the barrel hcal hits
55
auto
const
&
towers
=
iEvent
.get(
towerProducer_
);
56
57
edm::ValueMap<double>
isoMap;
58
edm::ValueMap<double>::Filler
filler
(isoMap);
59
std::vector<double> retV(emObjectHandle->size(), 0);
60
61
EgammaTowerIsolation
myHadIsolation(
62
egHcalIsoConeSizeOut_
,
egHcalIsoConeSizeIn_
,
egHcalIsoPtMin_
,
egHcalDepth_
, &
towers
);
63
64
for
(
size_t
i
= 0;
i
< emObjectHandle->size(); ++
i
) {
65
double
isoValue = myHadIsolation.getTowerEtSum(&(emObjectHandle->at(
i
)));
66
retV[
i
] = isoValue;
67
}
68
69
filler
.insert(emObjectHandle, retV.begin(), retV.end());
70
filler
.fill();
71
iEvent
.emplace(
putToken_
,
std::move
(isoMap));
72
}
HLT_FULL_cff.towers
towers
Definition:
HLT_FULL_cff.py:36362
mps_fire.i
i
Definition:
mps_fire.py:428
edm::EDGetTokenT
Definition:
EDGetToken.h:33
edm::EDPutTokenT
Definition:
EDPutToken.h:33
EgammaTowerIsolationProducer::egHcalIsoConeSizeOut_
const double egHcalIsoConeSizeOut_
Definition:
EgammaTowerIsolationProducer.cc:33
EDProducer.h
RecoCandidate.h
config
Definition:
config.py:1
MakerMacros.h
EgammaTowerIsolationProducer::putToken_
const edm::EDPutTokenT< edm::ValueMap< double > > putToken_
Definition:
EgammaTowerIsolationProducer.cc:30
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
EgammaTowerIsolationProducer::towerProducer_
const edm::EDGetTokenT< CaloTowerCollection > towerProducer_
Definition:
EgammaTowerIsolationProducer.cc:28
EgammaTowerIsolation.h
EgammaTowerIsolationProducer::egHcalIsoPtMin_
const double egHcalIsoPtMin_
Definition:
EgammaTowerIsolationProducer.cc:32
EgammaTowerIsolationProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition:
EgammaTowerIsolationProducer.cc:50
edm::ParameterSet
Definition:
ParameterSet.h:47
EgammaTowerIsolationProducer::EgammaTowerIsolationProducer
EgammaTowerIsolationProducer(const edm::ParameterSet &)
Definition:
EgammaTowerIsolationProducer.cc:41
CandAssociation.h
Event.h
trigObjTnPSource_cfi.filler
filler
Definition:
trigObjTnPSource_cfi.py:21
EgammaTowerIsolation
Definition:
EgammaTowerIsolation.h:197
iEvent
int iEvent
Definition:
GenABIO.cc:224
edm::stream::EDProducer
Definition:
EDProducer.h:38
edm::EventSetup
Definition:
EventSetup.h:58
CaloTowerCollection.h
eostools.move
def move(src, dest)
Definition:
eostools.py:511
edm::ValueMap
Definition:
ValueMap.h:107
Candidate.h
edm::helper::Filler
Definition:
ValueMap.h:22
EgammaTowerIsolationProducer::egHcalIsoConeSizeIn_
const double egHcalIsoConeSizeIn_
Definition:
EgammaTowerIsolationProducer.cc:34
ParameterSet.h
EgammaTowerIsolationProducer
Definition:
EgammaTowerIsolationProducer.cc:18
edm::Event
Definition:
Event.h:73
edm::InputTag
Definition:
InputTag.h:15
EgammaTowerIsolationProducer::emObjectProducer_
const edm::EDGetTokenT< edm::View< reco::Candidate > > emObjectProducer_
Definition:
EgammaTowerIsolationProducer.cc:27
EgammaTowerIsolationProducer::egHcalDepth_
const signed int egHcalDepth_
Definition:
EgammaTowerIsolationProducer.cc:35
Generated for CMSSW Reference Manual by
1.8.16