CMS 3D CMS Logo

EgammaElectronTkNumIsolationProducer.cc
Go to the documentation of this file.
1 //*****************************************************************************
2 // File: EgammaElectronTkNumIsolationProducer.cc
3 // ----------------------------------------------------------------------------
4 // OrigAuth: Matthias Mozer
5 // Institute: IIHE-VUB
6 //=============================================================================
7 //*****************************************************************************
8 
9 // Framework
16 
21 
24 
26  : // use configuration file to setup input/output collection names
27  electronProducer_(config.getParameter<edm::InputTag>("electronProducer")),
28 
29  trackProducer_(config.getParameter<edm::InputTag>("trackProducer")),
30  beamspotProducer_(config.getParameter<edm::InputTag>("BeamspotProducer")),
31 
32  ptMin_(config.getParameter<double>("ptMin")),
33  intRadiusBarrel_(config.getParameter<double>("intRadiusBarrel")),
34  intRadiusEndcap_(config.getParameter<double>("intRadiusEndcap")),
35  stripBarrel_(config.getParameter<double>("stripBarrel")),
36  stripEndcap_(config.getParameter<double>("stripEndcap")),
37  extRadius_(config.getParameter<double>("extRadius")),
38  maxVtxDist_(config.getParameter<double>("maxVtxDist")),
39  drb_(config.getParameter<double>("maxVtxDistXY")) {
40  //register your products
41  produces<edm::ValueMap<int>>();
42 }
43 
45 
48  const edm::EventSetup& iSetup) const {
49  // Get the filtered objects
51  iEvent.getByLabel(electronProducer_, electronHandle);
52 
53  //get the tracks
55  iEvent.getByLabel(trackProducer_, tracks);
56  const reco::TrackCollection* trackCollection = tracks.product();
57 
58  //prepare product
59  auto isoMap = std::make_unique<edm::ValueMap<int>>();
61  std::vector<int> retV(electronHandle->size(), 0);
62 
63  //get beamspot
65  iEvent.getByLabel(beamspotProducer_, beamSpotH);
66  reco::TrackBase::Point beamspot = beamSpotH->position();
67 
68  ElectronTkIsolation myTkIsolation(extRadius_,
73  ptMin_,
75  drb_,
77  beamspot);
78 
79  for (unsigned int i = 0; i < electronHandle->size(); ++i) {
80  int isoValue = myTkIsolation.getNumberTracks(&(electronHandle->at(i)));
81  retV[i] = isoValue;
82  }
83 
84  //fill and insert valuemap
85  filler.insert(electronHandle, retV.begin(), retV.end());
86  filler.fill();
87  iEvent.put(std::move(isoMap));
88 }
edm::StreamID
Definition: StreamID.h:30
Handle.h
PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
mps_fire.i
i
Definition: mps_fire.py:355
MessageLogger.h
EgammaElectronTkNumIsolationProducer::stripBarrel_
const double stripBarrel_
Definition: EgammaElectronTkNumIsolationProducer.h:35
ESHandle.h
edm
HLT enums.
Definition: AlignableModifier.h:19
EgammaElectronTkNumIsolationProducer::drb_
const double drb_
Definition: EgammaElectronTkNumIsolationProducer.h:39
EgammaElectronTkNumIsolationProducer.h
edm::Handle< reco::GsfElectronCollection >
EgammaElectronTkNumIsolationProducer::electronProducer_
const edm::InputTag electronProducer_
Definition: EgammaElectronTkNumIsolationProducer.h:28
EgammaElectronTkNumIsolationProducer::EgammaElectronTkNumIsolationProducer
EgammaElectronTkNumIsolationProducer(const edm::ParameterSet &)
Definition: EgammaElectronTkNumIsolationProducer.cc:25
config
Definition: config.py:1
BeamSpot.h
EgammaElectronTkNumIsolationProducer::produce
void produce(edm::StreamID sid, edm::Event &, const edm::EventSetup &) const override
Definition: EgammaElectronTkNumIsolationProducer.cc:46
beamspot
Definition: BeamSpotWrite2Txt.h:8
GsfElectron.h
ElectronTkIsolation
Definition: ElectronTkIsolation.h:26
GsfElectronFwd.h
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::ParameterSet
Definition: ParameterSet.h:36
CandAssociation.h
duplicaterechits_cfi.trackCollection
trackCollection
Definition: duplicaterechits_cfi.py:4
Event.h
trigObjTnPSource_cfi.filler
filler
Definition: trigObjTnPSource_cfi.py:21
EgammaElectronTkNumIsolationProducer::extRadius_
const double extRadius_
Definition: EgammaElectronTkNumIsolationProducer.h:37
iEvent
int iEvent
Definition: GenABIO.cc:224
EgammaElectronTkNumIsolationProducer::ptMin_
const double ptMin_
Definition: EgammaElectronTkNumIsolationProducer.h:32
edm::EventSetup
Definition: EventSetup.h:57
EgammaElectronTkNumIsolationProducer::beamspotProducer_
const edm::InputTag beamspotProducer_
Definition: EgammaElectronTkNumIsolationProducer.h:30
EgammaElectronTkNumIsolationProducer::maxVtxDist_
const double maxVtxDist_
Definition: EgammaElectronTkNumIsolationProducer.h:38
EgammaElectronTkNumIsolationProducer::~EgammaElectronTkNumIsolationProducer
~EgammaElectronTkNumIsolationProducer() override
Definition: EgammaElectronTkNumIsolationProducer.cc:44
reco::TrackBase::Point
math::XYZPoint Point
point in the space
Definition: TrackBase.h:80
EgammaElectronTkNumIsolationProducer::stripEndcap_
const double stripEndcap_
Definition: EgammaElectronTkNumIsolationProducer.h:36
eostools.move
def move(src, dest)
Definition: eostools.py:511
EgammaElectronTkNumIsolationProducer::intRadiusEndcap_
const double intRadiusEndcap_
Definition: EgammaElectronTkNumIsolationProducer.h:34
EventSetup.h
Exception.h
EgammaElectronTkNumIsolationProducer::trackProducer_
const edm::InputTag trackProducer_
Definition: EgammaElectronTkNumIsolationProducer.h:29
edm::helper::Filler
Definition: ValueMap.h:22
ElectronTkIsolation.h
ElectronTkIsolation::getNumberTracks
int getNumberTracks(const reco::GsfElectron *) const
Definition: ElectronTkIsolation.cc:112
edm::Event
Definition: Event.h:73
EgammaElectronTkNumIsolationProducer::intRadiusBarrel_
const double intRadiusBarrel_
Definition: EgammaElectronTkNumIsolationProducer.h:33
reco::TrackCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14