CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules 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 
17 
19 public:
21 
22  void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
23 
24 private:
28 
29  const double ptMin_;
30  const double intRadiusBarrel_;
31  const double intRadiusEndcap_;
32  const double stripBarrel_;
33  const double stripEndcap_;
34  const double extRadius_;
35  const double maxVtxDist_;
36  const double drb_;
37 };
38 
41 
43  : electronProducer_{consumes(config.getParameter<edm::InputTag>("electronProducer"))},
44  trackProducer_{consumes(config.getParameter<edm::InputTag>("trackProducer"))},
45  beamspotProducer_{consumes(config.getParameter<edm::InputTag>("BeamspotProducer"))},
46 
47  ptMin_{config.getParameter<double>("ptMin")},
48  intRadiusBarrel_{config.getParameter<double>("intRadiusBarrel")},
49  intRadiusEndcap_{config.getParameter<double>("intRadiusEndcap")},
50  stripBarrel_{config.getParameter<double>("stripBarrel")},
51  stripEndcap_{config.getParameter<double>("stripEndcap")},
52  extRadius_{config.getParameter<double>("extRadius")},
53  maxVtxDist_{config.getParameter<double>("maxVtxDist")},
54  drb_{config.getParameter<double>("maxVtxDistXY")}
55 
56 {
57  produces<edm::ValueMap<double>>();
58 }
59 
61  // Get the filtered objects
62  auto electronHandle = iEvent.getHandle(electronProducer_);
63 
64  //prepare product
65  auto isoMap = std::make_unique<edm::ValueMap<double>>();
67  std::vector<double> retV(electronHandle->size(), 0);
68 
69  ElectronTkIsolation myTkIsolation(extRadius_,
74  ptMin_,
76  drb_,
77  &iEvent.get(trackProducer_),
78  iEvent.get(beamspotProducer_).position());
79 
80  for (unsigned int i = 0; i < electronHandle->size(); ++i) {
81  double isoValue = myTkIsolation.getPtTracks(&(electronHandle->at(i)));
82  retV[i] = isoValue;
83  }
84 
85  //fill and insert valuemap
86  filler.insert(electronHandle, retV.begin(), retV.end());
87  filler.fill();
88  iEvent.put(std::move(isoMap));
89 }
Definition: config.py:1
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const edm::EDGetTokenT< reco::TrackCollection > trackProducer_
int iEvent
Definition: GenABIO.cc:224
const edm::EDGetTokenT< reco::BeamSpot > beamspotProducer_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
const edm::EDGetTokenT< reco::GsfElectronCollection > electronProducer_
EgammaElectronTkIsolationProducer(const edm::ParameterSet &)
double getPtTracks(const reco::GsfElectron *) const
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
def move(src, dest)
Definition: eostools.py:511