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 
10 
11 // Framework
13 
18 
20 
22  :
23 
24  // use configuration file to setup input/output collection names
25  photonProducer_(config.getParameter<edm::InputTag>("photonProducer")),
26 
27  trackProducer_(config.getParameter<edm::InputTag>("trackProducer")),
28  beamspotProducer_(config.getParameter<edm::InputTag>("BeamspotProducer")),
29 
30  ptMin_(config.getParameter<double>("ptMin")),
31  intRadiusBarrel_(config.getParameter<double>("intRadiusBarrel")),
32  intRadiusEndcap_(config.getParameter<double>("intRadiusEndcap")),
33  stripBarrel_(config.getParameter<double>("stripBarrel")),
34  stripEndcap_(config.getParameter<double>("stripEndcap")),
35  extRadius_(config.getParameter<double>("extRadius")),
36  maxVtxDist_(config.getParameter<double>("maxVtxDist")),
37  drb_(config.getParameter<double>("maxVtxDistXY"))
38 
39 {
40  //register your products
41  produces<edm::ValueMap<int>>();
42 }
43 
45 
46 //
47 // member functions
48 //
49 
50 // ------------ method called to produce the data ------------
53  const edm::EventSetup& iSetup) const {
54  // Get the filtered objects
56  iEvent.getByLabel(photonProducer_, photonHandle);
57 
58  //get the tracks
60  iEvent.getByLabel(trackProducer_, tracks);
62 
63  //get beamspot
65  iEvent.getByLabel(beamspotProducer_, beamSpotH);
67 
68  //prepare product
69  auto isoMap = std::make_unique<edm::ValueMap<int>>();
71  std::vector<int> retV(photonHandle->size(), 0);
72 
73  PhotonTkIsolation myTkIsolation(extRadius_,
78  ptMin_,
80  drb_,
81  trackCollection,
82  beamspot);
83 
84  for (unsigned int i = 0; i < photonHandle->size(); ++i) {
85  int isoValue = myTkIsolation.getIso(&(photonHandle->at(i))).first;
86  retV[i] = isoValue;
87  }
88 
89  //fill and insert valuemap
90  filler.insert(photonHandle, retV.begin(), retV.end());
91  filler.fill();
92  iEvent.put(std::move(isoMap));
93 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
Definition: config.py:1
int iEvent
Definition: GenABIO.cc:224
math::XYZPoint Point
point in the space
Definition: TrackBase.h:80
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:488
T const * product() const
Definition: Handle.h:69
HLT enums.
const Point & position() const
position
Definition: BeamSpot.h:59
void produce(edm::StreamID sid, edm::Event &, const edm::EventSetup &) const override
def move(src, dest)
Definition: eostools.py:511