CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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);
62  const reco::TrackCollection* trackCollection = tracks.product();
63 
64  //prepare product
65  std::auto_ptr<edm::ValueMap<int> > isoMap(new edm::ValueMap<int>());
66  edm::ValueMap<int>::Filler filler(*isoMap);
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(isoMap);
85 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
virtual void produce(edm::Event &, const edm::EventSetup &)
void insert(const H &h, I begin, I end)
Definition: ValueMap.h:52
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:10
int getNumberTracks(const reco::GsfElectron *) const
int iEvent
Definition: GenABIO.cc:230
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
math::XYZPoint Point
point in the space
Definition: TrackBase.h:74
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
tuple tracks
Definition: testEve_cfg.py:39
T const * product() const
Definition: Handle.h:81