CMS 3D CMS Logo

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_ (config.getParameter<edm::InputTag>("photonProducer")),
27 
28  trackProducer_ (config.getParameter<edm::InputTag>("trackProducer")),
29  beamspotProducer_ (config.getParameter<edm::InputTag>("BeamspotProducer")),
30 
31  ptMin_ (config.getParameter<double>("ptMin")),
32  intRadiusBarrel_ (config.getParameter<double>("intRadiusBarrel")),
33  intRadiusEndcap_ (config.getParameter<double>("intRadiusEndcap")),
34  stripBarrel_ (config.getParameter<double>("stripBarrel")),
35  stripEndcap_ (config.getParameter<double>("stripEndcap")),
36  extRadius_ (config.getParameter<double>("extRadius")),
37  maxVtxDist_ (config.getParameter<double>("maxVtxDist")),
38  drb_ (config.getParameter<double>("maxVtxDistXY"))
39 
40 {
41  //register your products
42  produces < edm::ValueMap<int> >();
43 }
44 
45 
47 
48 
49 //
50 // member functions
51 //
52 
53 // ------------ method called to produce the data ------------
54 void
56 {
57 
58  // Get the filtered objects
60  iEvent.getByLabel(photonProducer_,photonHandle);
61 
62  //get the tracks
64  iEvent.getByLabel(trackProducer_,tracks);
66 
67  //get beamspot
69  iEvent.getByLabel(beamspotProducer_,beamSpotH);
71 
72  //prepare product
73  auto isoMap = std::make_unique<edm::ValueMap<int>>();
75  std::vector<int> retV(photonHandle->size(),0);
76 
78 
79  for(unsigned int i = 0 ; i < photonHandle->size(); ++i ){
80  int isoValue = myTkIsolation.getIso(&(photonHandle->at(i))).first;
81  retV[i] = isoValue;
82  }
83 
84 
85 
86  //fill and insert valuemap
87  filler.insert(photonHandle,retV.begin(),retV.end());
88  filler.fill();
89  iEvent.put(std::move(isoMap));
90 
91 
92 }
93 
94 
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
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:535
T const * product() const
Definition: Handle.h:81
HLT enums.
const Point & position() const
position
Definition: BeamSpot.h:62
void produce(edm::StreamID sid, edm::Event &, const edm::EventSetup &) const override
def move(src, dest)
Definition: eostools.py:511