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 
10 
11 // Framework
13 
21 
23 
25  :
26 
27  // use configuration file to setup input/output collection names
28  photonProducer_(config.getParameter<edm::InputTag>("photonProducer")),
29 
30  trackProducer_(config.getParameter<edm::InputTag>("trackProducer")),
31  beamspotProducer_(config.getParameter<edm::InputTag>("BeamspotProducer")),
32 
33  ptMin_(config.getParameter<double>("ptMin")),
34  intRadiusBarrel_(config.getParameter<double>("intRadiusBarrel")),
35  intRadiusEndcap_(config.getParameter<double>("intRadiusEndcap")),
36  stripBarrel_(config.getParameter<double>("stripBarrel")),
37  stripEndcap_(config.getParameter<double>("stripEndcap")),
38  extRadius_(config.getParameter<double>("extRadius")),
39  maxVtxDist_(config.getParameter<double>("maxVtxDist")),
40  drb_(config.getParameter<double>("maxVtxDistXY")) {
41  //register your products
42  produces<edm::ValueMap<double>>();
43 }
44 
46 
47 //
48 // member functions
49 //
50 
51 // ------------ method called to produce the data ------------
54  const edm::EventSetup& iSetup) const {
55  // Get the filtered objects
57  iEvent.getByLabel(photonProducer_, photonHandle);
58 
59  //get the tracks
61  iEvent.getByLabel(trackProducer_, tracks);
63 
65  iEvent.getByLabel(beamspotProducer_, beamSpotH);
67 
68  //prepare product
69  auto isoMap = std::make_unique<edm::ValueMap<double>>();
71  std::vector<double> 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  double isoValue = myTkIsolation.getIso(&(photonHandle->at(i))).second;
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
EgammaPhotonTkIsolationProducer(const edm::ParameterSet &)
void produce(edm::StreamID sid, edm::Event &, const edm::EventSetup &) const override
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
def move(src, dest)
Definition: eostools.py:511