CMS 3D CMS Logo

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 
10 // Framework
18 
22 
23 
26 
28 {
29  // use configuration file to setup input/output collection names
30  electronProducer_ = conf_.getParameter<edm::InputTag>("electronProducer");
31 
32  trackProducer_ = conf_.getParameter<edm::InputTag>("trackProducer");
33  beamspotProducer_ = conf_.getParameter<edm::InputTag>("BeamspotProducer");
34 
35  ptMin_ = conf_.getParameter<double>("ptMin");
36  intRadiusBarrel_ = conf_.getParameter<double>("intRadiusBarrel");
37  intRadiusEndcap_ = conf_.getParameter<double>("intRadiusEndcap");
38  stripBarrel_ = conf_.getParameter<double>("stripBarrel");
39  stripEndcap_ = conf_.getParameter<double>("stripEndcap");
40  extRadius_ = conf_.getParameter<double>("extRadius");
41  maxVtxDist_ = conf_.getParameter<double>("maxVtxDist");
42  drb_ = conf_.getParameter<double>("maxVtxDistXY");
43 
44  //register your products
45  produces < edm::ValueMap<double> >();
46 
47 }
48 
50 
51 
52 
54 {
55  // Get the filtered objects
57  iEvent.getByLabel(electronProducer_,electronHandle);
58 
59  //get the tracks
61  iEvent.getByLabel(trackProducer_,tracks);
63 
64  //prepare product
65  auto isoMap = std::make_unique<edm::ValueMap<double>>();
67  std::vector<double> retV(electronHandle->size(),0);
68 
70  iEvent.getByLabel(beamspotProducer_,beamSpotH);
71  reco::TrackBase::Point beamspot = beamSpotH->position();
72 
74 
75  for(unsigned int i = 0 ; i < electronHandle->size(); ++i ){
76  double isoValue = myTkIsolation.getPtTracks(&(electronHandle->at(i)));
77  retV[i] = isoValue;
78  }
79 
80  //fill and insert valuemap
81  filler.insert(electronHandle,retV.begin(),retV.end());
82  filler.fill();
83  iEvent.put(std::move(isoMap));
84 }
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:127
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:464
void produce(edm::Event &, const edm::EventSetup &) override
T const * product() const
Definition: Handle.h:81
double getPtTracks(const reco::GsfElectron *) const
EgammaElectronTkIsolationProducer(const edm::ParameterSet &)
def move(src, dest)
Definition: eostools.py:510