RecoEgamma
EgammaIsolationAlgos
plugins
EgammaElectronTkIsolationProducer.cc
Go to the documentation of this file.
1
//*****************************************************************************
2
// File: EgammaElectronTkIsolationProducer.cc
3
// ----------------------------------------------------------------------------
4
// OrigAuth: Matthias Mozer
5
// Institute: IIHE-VUB
6
//=============================================================================
7
//*****************************************************************************
8
9
// Framework
10
#include "
FWCore/Framework/interface/Event.h
"
11
#include "
FWCore/Framework/interface/EventSetup.h
"
12
#include "
DataFormats/Common/interface/Handle.h
"
13
#include "
FWCore/Framework/interface/ESHandle.h
"
14
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
15
#include "
FWCore/Utilities/interface/Exception.h
"
16
#include "
DataFormats/BeamSpot/interface/BeamSpot.h
"
17
18
#include "
DataFormats/EgammaCandidates/interface/GsfElectronFwd.h
"
19
#include "
DataFormats/EgammaCandidates/interface/GsfElectron.h
"
20
#include "
DataFormats/Candidate/interface/CandAssociation.h
"
21
22
#include "
RecoEgamma/EgammaIsolationAlgos/plugins/EgammaElectronTkIsolationProducer.h
"
23
#include "
RecoEgamma/EgammaIsolationAlgos/interface/ElectronTkIsolation.h
"
24
25
EgammaElectronTkIsolationProducer::EgammaElectronTkIsolationProducer
(
const
edm::ParameterSet
&
config
) : conf_(
config
) {
26
// use configuration file to setup input/output collection names
27
electronProducer_
=
conf_
.
getParameter
<
edm::InputTag
>(
"electronProducer"
);
28
29
trackProducer_
=
conf_
.
getParameter
<
edm::InputTag
>(
"trackProducer"
);
30
beamspotProducer_
=
conf_
.
getParameter
<
edm::InputTag
>(
"BeamspotProducer"
);
31
32
ptMin_
=
conf_
.
getParameter
<
double
>(
"ptMin"
);
33
intRadiusBarrel_
=
conf_
.
getParameter
<
double
>(
"intRadiusBarrel"
);
34
intRadiusEndcap_
=
conf_
.
getParameter
<
double
>(
"intRadiusEndcap"
);
35
stripBarrel_
=
conf_
.
getParameter
<
double
>(
"stripBarrel"
);
36
stripEndcap_
=
conf_
.
getParameter
<
double
>(
"stripEndcap"
);
37
extRadius_
=
conf_
.
getParameter
<
double
>(
"extRadius"
);
38
maxVtxDist_
=
conf_
.
getParameter
<
double
>(
"maxVtxDist"
);
39
drb_
=
conf_
.
getParameter
<
double
>(
"maxVtxDistXY"
);
40
41
//register your products
42
produces<edm::ValueMap<double>>();
43
}
44
45
EgammaElectronTkIsolationProducer::~EgammaElectronTkIsolationProducer
() {}
46
47
void
EgammaElectronTkIsolationProducer::produce
(
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup) {
48
// Get the filtered objects
49
edm::Handle<reco::GsfElectronCollection>
electronHandle;
50
iEvent
.getByLabel(
electronProducer_
, electronHandle);
51
52
//get the tracks
53
edm::Handle<reco::TrackCollection>
tracks
;
54
iEvent
.getByLabel(
trackProducer_
,
tracks
);
55
const
reco::TrackCollection
*
trackCollection
=
tracks
.product();
56
57
//prepare product
58
auto
isoMap = std::make_unique<edm::ValueMap<double>>();
59
edm::ValueMap<double>::Filler
filler
(*isoMap);
60
std::vector<double> retV(electronHandle->size(), 0);
61
62
edm::Handle<reco::BeamSpot>
beamSpotH;
63
iEvent
.getByLabel(
beamspotProducer_
, beamSpotH);
64
reco::TrackBase::Point
beamspot
= beamSpotH->position();
65
66
ElectronTkIsolation
myTkIsolation(
extRadius_
,
67
intRadiusBarrel_
,
68
intRadiusEndcap_
,
69
stripBarrel_
,
70
stripEndcap_
,
71
ptMin_
,
72
maxVtxDist_
,
73
drb_
,
74
trackCollection
,
75
beamspot
);
76
77
for
(
unsigned
int
i
= 0;
i
< electronHandle->size(); ++
i
) {
78
double
isoValue = myTkIsolation.
getPtTracks
(&(electronHandle->at(
i
)));
79
retV[
i
] = isoValue;
80
}
81
82
//fill and insert valuemap
83
filler
.insert(electronHandle, retV.begin(), retV.end());
84
filler
.fill();
85
iEvent
.put(
std::move
(isoMap));
86
}
Handle.h
EgammaElectronTkIsolationProducer::beamspotProducer_
edm::InputTag beamspotProducer_
Definition:
EgammaElectronTkIsolationProducer.h:30
PDWG_EXOHSCP_cff.tracks
tracks
Definition:
PDWG_EXOHSCP_cff.py:28
mps_fire.i
i
Definition:
mps_fire.py:428
MessageLogger.h
ESHandle.h
EgammaElectronTkIsolationProducer::~EgammaElectronTkIsolationProducer
~EgammaElectronTkIsolationProducer() override
Definition:
EgammaElectronTkIsolationProducer.cc:45
EgammaElectronTkIsolationProducer::stripBarrel_
double stripBarrel_
Definition:
EgammaElectronTkIsolationProducer.h:35
EgammaElectronTkIsolationProducer::stripEndcap_
double stripEndcap_
Definition:
EgammaElectronTkIsolationProducer.h:36
edm::Handle< reco::GsfElectronCollection >
EgammaElectronTkIsolationProducer::intRadiusBarrel_
double intRadiusBarrel_
Definition:
EgammaElectronTkIsolationProducer.h:33
EgammaElectronTkIsolationProducer::extRadius_
double extRadius_
Definition:
EgammaElectronTkIsolationProducer.h:37
EgammaElectronTkIsolationProducer::conf_
edm::ParameterSet conf_
Definition:
EgammaElectronTkIsolationProducer.h:41
EgammaElectronTkIsolationProducer::EgammaElectronTkIsolationProducer
EgammaElectronTkIsolationProducer(const edm::ParameterSet &)
Definition:
EgammaElectronTkIsolationProducer.cc:25
config
Definition:
config.py:1
EgammaElectronTkIsolationProducer::maxVtxDist_
double maxVtxDist_
Definition:
EgammaElectronTkIsolationProducer.h:38
BeamSpot.h
beamspot
Definition:
BeamSpotWrite2Txt.h:8
EgammaElectronTkIsolationProducer::electronProducer_
edm::InputTag electronProducer_
Definition:
EgammaElectronTkIsolationProducer.h:28
GsfElectron.h
ElectronTkIsolation
Definition:
ElectronTkIsolation.h:19
EgammaElectronTkIsolationProducer::trackProducer_
edm::InputTag trackProducer_
Definition:
EgammaElectronTkIsolationProducer.h:29
GsfElectronFwd.h
edm::ParameterSet
Definition:
ParameterSet.h:47
CandAssociation.h
duplicaterechits_cfi.trackCollection
trackCollection
Definition:
duplicaterechits_cfi.py:4
Event.h
trigObjTnPSource_cfi.filler
filler
Definition:
trigObjTnPSource_cfi.py:21
iEvent
int iEvent
Definition:
GenABIO.cc:224
EgammaElectronTkIsolationProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition:
EgammaElectronTkIsolationProducer.cc:47
edm::EventSetup
Definition:
EventSetup.h:57
EgammaElectronTkIsolationProducer::ptMin_
double ptMin_
Definition:
EgammaElectronTkIsolationProducer.h:32
EgammaElectronTkIsolationProducer::drb_
double drb_
Definition:
EgammaElectronTkIsolationProducer.h:39
reco::TrackBase::Point
math::XYZPoint Point
point in the space
Definition:
TrackBase.h:80
eostools.move
def move(src, dest)
Definition:
eostools.py:511
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition:
ParameterSet.h:303
Exception.h
edm::helper::Filler
Definition:
ValueMap.h:22
EgammaElectronTkIsolationProducer.h
ElectronTkIsolation.h
edm::Event
Definition:
Event.h:73
EgammaElectronTkIsolationProducer::intRadiusEndcap_
double intRadiusEndcap_
Definition:
EgammaElectronTkIsolationProducer.h:34
edm::InputTag
Definition:
InputTag.h:15
reco::TrackCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition:
TrackFwd.h:14
ElectronTkIsolation::getPtTracks
double getPtTracks(const reco::GsfElectron *) const
Definition:
ElectronTkIsolation.cc:105
Generated for CMSSW Reference Manual by
1.8.16