CMS 3D CMS Logo

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