CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
10 // Framework
18 
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<double> >();
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<double> > isoMap(new edm::ValueMap<double>());
66  edm::ValueMap<double>::Filler filler(*isoMap);
67  std::vector<double> retV(electronHandle->size(),0);
68 
70  iEvent.getByLabel(beamspotProducer_,beamSpotH);
71  reco::TrackBase::Point beamspot = beamSpotH->position();
72 
74 
75  for(unsigned int i = 0 ; i < electronHandle->size(); ++i ){
76  double isoValue = myTkIsolation.getPtTracks(&(electronHandle->at(i)));
77  retV[i] = isoValue;
78  }
79 
80  //fill and insert valuemap
81  filler.insert(electronHandle,retV.begin(),retV.end());
82  filler.fill();
83  iEvent.put(isoMap);
84 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
void insert(const H &h, I begin, I end)
Definition: ValueMap.h:52
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:13
int iEvent
Definition: GenABIO.cc:230
virtual void produce(edm::Event &, const edm::EventSetup &)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
math::XYZPoint Point
point in the space
Definition: TrackBase.h:82
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:402
T const * product() const
Definition: Handle.h:81
tuple tracks
Definition: testEve_cfg.py:39
double getPtTracks(const reco::GsfElectron *) const
EgammaElectronTkIsolationProducer(const edm::ParameterSet &)