CMS 3D CMS Logo

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
17 
21 
24 
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 
46 
48  // Get the filtered objects
50  iEvent.getByLabel(electronProducer_, electronHandle);
51 
52  //get the 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>>();
60  std::vector<double> retV(electronHandle->size(), 0);
61 
63  iEvent.getByLabel(beamspotProducer_, beamSpotH);
64  reco::TrackBase::Point beamspot = beamSpotH->position();
65 
66  ElectronTkIsolation myTkIsolation(extRadius_,
71  ptMin_,
73  drb_,
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