RecoEgamma
EgammaIsolationAlgos
plugins
EgammaPhotonTkNumIsolationProducer.cc
Go to the documentation of this file.
1
//*****************************************************************************
2
// File: EgammaPhotonTkNumIsolationProducer.cc
3
// ----------------------------------------------------------------------------
4
// OrigAuth: Matthias Mozer
5
// Institute: IIHE-VUB
6
//=============================================================================
7
//*****************************************************************************
8
9
#include "
DataFormats/BeamSpot/interface/BeamSpot.h
"
10
#include "
DataFormats/Candidate/interface/CandAssociation.h
"
11
#include "
DataFormats/Candidate/interface/Candidate.h
"
12
#include "
DataFormats/Common/interface/Handle.h
"
13
#include "
DataFormats/TrackReco/interface/TrackFwd.h
"
14
#include "
FWCore/Framework/interface/Event.h
"
15
#include "
FWCore/Framework/interface/global/EDProducer.h
"
16
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
17
#include "
RecoEgamma/EgammaIsolationAlgos/interface/PhotonTkIsolation.h
"
18
19
class
EgammaPhotonTkNumIsolationProducer
:
public
edm::global::EDProducer
<> {
20
public
:
21
explicit
EgammaPhotonTkNumIsolationProducer
(
const
edm::ParameterSet
&);
22
23
void
produce
(
edm::StreamID
sid,
edm::Event
&,
const
edm::EventSetup
&)
const override
;
24
25
private
:
26
const
edm::EDGetTokenT<edm::View<reco::Candidate>
>
photonProducer_
;
27
const
edm::EDGetTokenT<reco::TrackCollection>
trackProducer_
;
28
const
edm::EDGetTokenT<reco::BeamSpot>
beamspotProducer_
;
29
30
const
double
ptMin_
;
31
const
double
intRadiusBarrel_
;
32
const
double
intRadiusEndcap_
;
33
const
double
stripBarrel_
;
34
const
double
stripEndcap_
;
35
const
double
extRadius_
;
36
const
double
maxVtxDist_
;
37
const
double
drb_
;
38
};
39
40
#include "
FWCore/Framework/interface/MakerMacros.h
"
41
DEFINE_FWK_MODULE
(
EgammaPhotonTkNumIsolationProducer
);
42
43
EgammaPhotonTkNumIsolationProducer::EgammaPhotonTkNumIsolationProducer
(
const
edm::ParameterSet
&
config
)
44
:
45
46
photonProducer_{
consumes
(
config
.getParameter<
edm::InputTag
>(
"photonProducer"
))},
47
48
trackProducer_{consumes(
config
.getParameter<
edm::InputTag
>(
"trackProducer"
))},
49
beamspotProducer_{consumes(
config
.getParameter<
edm::InputTag
>(
"BeamspotProducer"
))},
50
51
ptMin_(
config
.getParameter<
double
>(
"ptMin"
)),
52
intRadiusBarrel_(
config
.getParameter<
double
>(
"intRadiusBarrel"
)),
53
intRadiusEndcap_(
config
.getParameter<
double
>(
"intRadiusEndcap"
)),
54
stripBarrel_(
config
.getParameter<
double
>(
"stripBarrel"
)),
55
stripEndcap_(
config
.getParameter<
double
>(
"stripEndcap"
)),
56
extRadius_(
config
.getParameter<
double
>(
"extRadius"
)),
57
maxVtxDist_(
config
.getParameter<
double
>(
"maxVtxDist"
)),
58
drb_(
config
.getParameter<
double
>(
"maxVtxDistXY"
))
59
60
{
61
//register your products
62
produces<edm::ValueMap<int>>();
63
}
64
65
// ------------ method called to produce the data ------------
66
void
EgammaPhotonTkNumIsolationProducer::produce
(
edm::StreamID
sid,
67
edm::Event
&
iEvent
,
68
const
edm::EventSetup
& iSetup)
const
{
69
// Get the filtered objects
70
auto
photonHandle =
iEvent
.getHandle(
photonProducer_
);
71
72
//prepare product
73
auto
isoMap = std::make_unique<edm::ValueMap<int>>();
74
edm::ValueMap<int>::Filler
filler
(*isoMap);
75
std::vector<int> retV(photonHandle->size(), 0);
76
77
PhotonTkIsolation
myTkIsolation(
extRadius_
,
78
intRadiusBarrel_
,
79
intRadiusEndcap_
,
80
stripBarrel_
,
81
stripEndcap_
,
82
ptMin_
,
83
maxVtxDist_
,
84
drb_
,
85
&
iEvent
.get(
trackProducer_
),
86
iEvent
.get(
beamspotProducer_
).position());
87
88
for
(
unsigned
int
i
= 0;
i
< photonHandle->size(); ++
i
) {
89
int
isoValue = myTkIsolation.
getIso
(&(photonHandle->at(
i
))).first;
90
retV[
i
] = isoValue;
91
}
92
93
//fill and insert valuemap
94
filler
.insert(photonHandle, retV.begin(), retV.end());
95
filler
.fill();
96
iEvent
.put(
std::move
(isoMap));
97
}
PhotonTkIsolation
Definition:
PhotonTkIsolation.h:20
EgammaPhotonTkNumIsolationProducer::ptMin_
const double ptMin_
Definition:
EgammaPhotonTkNumIsolationProducer.cc:30
edm::StreamID
Definition:
StreamID.h:30
EgammaPhotonTkNumIsolationProducer
Definition:
EgammaPhotonTkNumIsolationProducer.cc:19
Handle.h
mps_fire.i
i
Definition:
mps_fire.py:428
EgammaPhotonTkNumIsolationProducer::stripEndcap_
const double stripEndcap_
Definition:
EgammaPhotonTkNumIsolationProducer.cc:34
edm::EDGetTokenT
Definition:
EDGetToken.h:33
EgammaPhotonTkNumIsolationProducer::drb_
const double drb_
Definition:
EgammaPhotonTkNumIsolationProducer.cc:37
EgammaPhotonTkNumIsolationProducer::intRadiusBarrel_
const double intRadiusBarrel_
Definition:
EgammaPhotonTkNumIsolationProducer.cc:31
EgammaPhotonTkNumIsolationProducer::stripBarrel_
const double stripBarrel_
Definition:
EgammaPhotonTkNumIsolationProducer.cc:33
config
Definition:
config.py:1
MakerMacros.h
TrackFwd.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
BeamSpot.h
PhotonTkIsolation::getIso
std::pair< int, float > getIso(const reco::Candidate *) const
Definition:
PhotonTkIsolation.cc:52
edm::global::EDProducer
Definition:
EDProducer.h:32
EgammaPhotonTkNumIsolationProducer::maxVtxDist_
const double maxVtxDist_
Definition:
EgammaPhotonTkNumIsolationProducer.cc:36
edm::ParameterSet
Definition:
ParameterSet.h:47
EgammaPhotonTkNumIsolationProducer::EgammaPhotonTkNumIsolationProducer
EgammaPhotonTkNumIsolationProducer(const edm::ParameterSet &)
Definition:
EgammaPhotonTkNumIsolationProducer.cc:43
CandAssociation.h
Event.h
trigObjTnPSource_cfi.filler
filler
Definition:
trigObjTnPSource_cfi.py:21
iEvent
int iEvent
Definition:
GenABIO.cc:224
EgammaPhotonTkNumIsolationProducer::beamspotProducer_
const edm::EDGetTokenT< reco::BeamSpot > beamspotProducer_
Definition:
EgammaPhotonTkNumIsolationProducer.cc:28
edm::EventSetup
Definition:
EventSetup.h:58
EgammaPhotonTkNumIsolationProducer::extRadius_
const double extRadius_
Definition:
EgammaPhotonTkNumIsolationProducer.cc:35
PhotonTkIsolation.h
EgammaPhotonTkNumIsolationProducer::trackProducer_
const edm::EDGetTokenT< reco::TrackCollection > trackProducer_
Definition:
EgammaPhotonTkNumIsolationProducer.cc:27
eostools.move
def move(src, dest)
Definition:
eostools.py:511
EgammaPhotonTkNumIsolationProducer::produce
void produce(edm::StreamID sid, edm::Event &, const edm::EventSetup &) const override
Definition:
EgammaPhotonTkNumIsolationProducer.cc:66
EgammaPhotonTkNumIsolationProducer::photonProducer_
const edm::EDGetTokenT< edm::View< reco::Candidate > > photonProducer_
Definition:
EgammaPhotonTkNumIsolationProducer.cc:26
EgammaPhotonTkNumIsolationProducer::intRadiusEndcap_
const double intRadiusEndcap_
Definition:
EgammaPhotonTkNumIsolationProducer.cc:32
Candidate.h
edm::helper::Filler
Definition:
ValueMap.h:22
ParameterSet.h
edm::EDConsumerBase::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition:
EDConsumerBase.h:155
EDProducer.h
edm::Event
Definition:
Event.h:73
edm::InputTag
Definition:
InputTag.h:15
Generated for CMSSW Reference Manual by
1.8.16