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 
10 // Framework
17 
22 
23 
26 
28  // use configuration file to setup input/output collection names
29  electronProducer_ (config.getParameter<edm::InputTag>("electronProducer")),
30 
31  trackProducer_ (config.getParameter<edm::InputTag>("trackProducer")),
32  beamspotProducer_ (config.getParameter<edm::InputTag>("BeamspotProducer")),
33 
34  ptMin_ (config.getParameter<double>("ptMin")),
35  intRadiusBarrel_ (config.getParameter<double>("intRadiusBarrel")),
36  intRadiusEndcap_ (config.getParameter<double>("intRadiusEndcap")),
37  stripBarrel_ (config.getParameter<double>("stripBarrel")),
38  stripEndcap_ (config.getParameter<double>("stripEndcap")),
39  extRadius_ (config.getParameter<double>("extRadius")),
40  maxVtxDist_ (config.getParameter<double>("maxVtxDist")),
41  drb_ (config.getParameter<double>("maxVtxDistXY"))
42 {
43 
44  //register your products
45  produces < edm::ValueMap<int> >();
46 
47 }
48 
50 
51 
52 
54 {
55  // Get the filtered objects
57  iEvent.getByLabel(electronProducer_,electronHandle);
58 
59  //get the tracks
61  iEvent.getByLabel(trackProducer_,tracks);
63 
64  //prepare product
65  auto isoMap = std::make_unique<edm::ValueMap<int>>();
67  std::vector<int> retV(electronHandle->size(),0);
68 
69  //get beamspot
71  iEvent.getByLabel(beamspotProducer_,beamSpotH);
72  reco::TrackBase::Point beamspot = beamSpotH->position();
73 
75 
76  for(unsigned int i = 0 ; i < electronHandle->size(); ++i ){
77  int isoValue = myTkIsolation.getNumberTracks(&(electronHandle->at(i)));
78  retV[i] = isoValue;
79  }
80 
81  //fill and insert valuemap
82  filler.insert(electronHandle,retV.begin(),retV.end());
83  filler.fill();
84  iEvent.put(std::move(isoMap));
85 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
int getNumberTracks(const reco::GsfElectron *) const
Definition: config.py:1
int iEvent
Definition: GenABIO.cc:230
math::XYZPoint Point
point in the space
Definition: TrackBase.h:83
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:535
T const * product() const
Definition: Handle.h:81
HLT enums.
def move(src, dest)
Definition: eostools.py:511
void produce(edm::StreamID sid, edm::Event &, const edm::EventSetup &) const override