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 {
29  // use configuration file to setup input/output collection names
30  electronProducer_ = conf_.getParameter<edm::InputTag>("electronProducer");
31 
32  trackProducer_ = conf_.getParameter<edm::InputTag>("trackProducer");
33  beamspotProducer_ = conf_.getParameter<edm::InputTag>("BeamspotProducer");
34 
35  ptMin_ = conf_.getParameter<double>("ptMin");
36  intRadiusBarrel_ = conf_.getParameter<double>("intRadiusBarrel");
37  intRadiusEndcap_ = conf_.getParameter<double>("intRadiusEndcap");
38  stripBarrel_ = conf_.getParameter<double>("stripBarrel");
39  stripEndcap_ = conf_.getParameter<double>("stripEndcap");
40  extRadius_ = conf_.getParameter<double>("extRadius");
41  maxVtxDist_ = conf_.getParameter<double>("maxVtxDist");
42  drb_ = conf_.getParameter<double>("maxVtxDistXY");
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 }
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:136
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:475
T const * product() const
Definition: Handle.h:81
void produce(edm::Event &, const edm::EventSetup &) override
def move(src, dest)
Definition: eostools.py:510