CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EgammaElectronTkIsolationProducer.cc
Go to the documentation of this file.
1 //*****************************************************************************
2 // File: EgammaElectronTkIsolationProducer.cc
3 // ----------------------------------------------------------------------------
4 // OrigAuth: Matthias Mozer
5 // Institute: IIHE-VUB
6 //=============================================================================
7 //*****************************************************************************
8 
9 // Framework
17 
21 
24 
26  // use configuration file to setup input/output collection names
27  electronProducer_ = conf_.getParameter<edm::InputTag>("electronProducer");
28 
29  trackProducer_ = conf_.getParameter<edm::InputTag>("trackProducer");
30  beamspotProducer_ = conf_.getParameter<edm::InputTag>("BeamspotProducer");
31 
32  ptMin_ = conf_.getParameter<double>("ptMin");
33  intRadiusBarrel_ = conf_.getParameter<double>("intRadiusBarrel");
34  intRadiusEndcap_ = conf_.getParameter<double>("intRadiusEndcap");
35  stripBarrel_ = conf_.getParameter<double>("stripBarrel");
36  stripEndcap_ = conf_.getParameter<double>("stripEndcap");
37  extRadius_ = conf_.getParameter<double>("extRadius");
38  maxVtxDist_ = conf_.getParameter<double>("maxVtxDist");
39  drb_ = conf_.getParameter<double>("maxVtxDistXY");
40 
41  //register your products
42  produces<edm::ValueMap<double>>();
43 }
44 
46 
48  // Get the filtered objects
50  iEvent.getByLabel(electronProducer_, electronHandle);
51 
52  //get the tracks
54  iEvent.getByLabel(trackProducer_, tracks);
56 
57  //prepare product
58  auto isoMap = std::make_unique<edm::ValueMap<double>>();
60  std::vector<double> retV(electronHandle->size(), 0);
61 
63  iEvent.getByLabel(beamspotProducer_, beamSpotH);
64  reco::TrackBase::Point beamspot = beamSpotH->position();
65 
66  ElectronTkIsolation myTkIsolation(extRadius_,
71  ptMin_,
73  drb_,
74  trackCollection,
75  beamspot);
76 
77  for (unsigned int i = 0; i < electronHandle->size(); ++i) {
78  double isoValue = myTkIsolation.getPtTracks(&(electronHandle->at(i)));
79  retV[i] = isoValue;
80  }
81 
82  //fill and insert valuemap
83  filler.insert(electronHandle, retV.begin(), retV.end());
84  filler.fill();
85  iEvent.put(std::move(isoMap));
86 }
T getParameter(std::string const &) const
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
void produce(edm::Event &, const edm::EventSetup &) override
T const * product() const
Definition: Handle.h:69
double getPtTracks(const reco::GsfElectron *) const
EgammaElectronTkIsolationProducer(const edm::ParameterSet &)
def move(src, dest)
Definition: eostools.py:511