CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EgammaPhotonTkIsolationProducer.cc
Go to the documentation of this file.
1 //*****************************************************************************
2 // File: EgammaPhotonTkIsolationProducer.cc
3 // ----------------------------------------------------------------------------
4 // OrigAuth: Matthias Mozer
5 // Institute: IIHE-VUB
6 //=============================================================================
7 //*****************************************************************************
8 
9 
11 
12 // Framework
14 
22 
24 
25 
27 {
28  // use configuration file to setup input/output collection names
29  photonProducer_ = conf_.getParameter<edm::InputTag>("photonProducer");
30 
31  trackProducer_ = conf_.getParameter<edm::InputTag>("trackProducer");
32  beamspotProducer_ = conf_.getParameter<edm::InputTag>("BeamspotProducer");
33 
34  ptMin_ = conf_.getParameter<double>("ptMin");
35  intRadiusBarrel_ = conf_.getParameter<double>("intRadiusBarrel");
36  intRadiusEndcap_ = conf_.getParameter<double>("intRadiusEndcap");
37  stripBarrel_ = conf_.getParameter<double>("stripBarrel");
38  stripEndcap_ = conf_.getParameter<double>("stripEndcap");
39  extRadius_ = conf_.getParameter<double>("extRadius");
40  maxVtxDist_ = conf_.getParameter<double>("maxVtxDist");
41  drb_ = conf_.getParameter<double>("maxVtxDistXY");
42 
43  //register your products
44  produces < edm::ValueMap<double> >();
45 }
46 
47 
49 
50 
51 //
52 // member functions
53 //
54 
55 // ------------ method called to produce the data ------------
56 void
58 {
59 
60  // Get the filtered objects
62  iEvent.getByLabel(photonProducer_,photonHandle);
63 
64  //get the tracks
66  iEvent.getByLabel(trackProducer_,tracks);
67  const reco::TrackCollection* trackCollection = tracks.product();
68 
70  iEvent.getByLabel(beamspotProducer_,beamSpotH);
71  reco::TrackBase::Point beamspot = beamSpotH->position();
72 
73  //prepare product
74  std::auto_ptr<edm::ValueMap<double> > isoMap(new edm::ValueMap<double>());
75  edm::ValueMap<double>::Filler filler(*isoMap);
76  std::vector<double> retV(photonHandle->size(),0);
77 
79 
80  for(unsigned int i = 0 ; i < photonHandle->size(); ++i ){
81  double isoValue = myTkIsolation.getIso(&(photonHandle->at(i))).second;
82  retV[i] = isoValue;
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 
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 iEvent
Definition: GenABIO.cc:243
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
EgammaPhotonTkIsolationProducer(const edm::ParameterSet &)
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