CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EgammaPhotonTkNumIsolationProducer.cc
Go to the documentation of this file.
1 //*****************************************************************************
2 // File: EgammaPhotonTkNumIsolationProducer.cc
3 // ----------------------------------------------------------------------------
4 // OrigAuth: Matthias Mozer
5 // Institute: IIHE-VUB
6 //=============================================================================
7 //*****************************************************************************
8 
9 
11 
12 // Framework
14 
19 
21 
22 
24 {
25  // use configuration file to setup input/output collection names
26  photonProducer_ = conf_.getParameter<edm::InputTag>("photonProducer");
27 
28  trackProducer_ = conf_.getParameter<edm::InputTag>("trackProducer");
29  beamspotProducer_ = conf_.getParameter<edm::InputTag>("BeamspotProducer");
30 
31  ptMin_ = conf_.getParameter<double>("ptMin");
32  intRadiusBarrel_ = conf_.getParameter<double>("intRadiusBarrel");
33  intRadiusEndcap_ = conf_.getParameter<double>("intRadiusEndcap");
34  stripBarrel_ = conf_.getParameter<double>("stripBarrel");
35  stripEndcap_ = conf_.getParameter<double>("stripEndcap");
36  extRadius_ = conf_.getParameter<double>("extRadius");
37  maxVtxDist_ = conf_.getParameter<double>("maxVtxDist");
38  drb_ = conf_.getParameter<double>("maxVtxDistXY");
39 
40  //register your products
41  produces < edm::ValueMap<int> >();
42 }
43 
44 
46 
47 
48 //
49 // member functions
50 //
51 
52 // ------------ method called to produce the data ------------
53 void
55 {
56 
57  // Get the filtered objects
59  iEvent.getByLabel(photonProducer_,photonHandle);
60 
61  //get the tracks
63  iEvent.getByLabel(trackProducer_,tracks);
64  const reco::TrackCollection* trackCollection = tracks.product();
65 
66  //get beamspot
68  iEvent.getByLabel(beamspotProducer_,beamSpotH);
69  reco::TrackBase::Point beamspot = beamSpotH->position();
70 
71  //prepare product
72  std::auto_ptr<edm::ValueMap<int> > isoMap(new edm::ValueMap<int>());
73  edm::ValueMap<int>::Filler filler(*isoMap);
74  std::vector<int> retV(photonHandle->size(),0);
75 
77 
78  for(unsigned int i = 0 ; i < photonHandle->size(); ++i ){
79  int isoValue = myTkIsolation.getIso(&(photonHandle->at(i))).first;
80  retV[i] = isoValue;
81  }
82 
83 
84 
85  //fill and insert valuemap
86  filler.insert(photonHandle,retV.begin(),retV.end());
87  filler.fill();
88  iEvent.put(isoMap);
89 
90 
91 }
92 
93 
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
void insert(const H &h, I begin, I end)
Definition: ValueMap.h:53
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:10
int iEvent
Definition: GenABIO.cc:243
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
math::XYZPoint Point
point in the space
Definition: TrackBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
virtual void produce(edm::Event &, const edm::EventSetup &)
tuple tracks
Definition: testEve_cfg.py:39
T const * product() const
Definition: Handle.h:74