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 
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 }
edm::StreamID
Definition: StreamID.h:30
EgammaElectronTkIsolationProducer::electronProducer_
const edm::EDGetTokenT< reco::GsfElectronCollection > electronProducer_
Definition: EgammaElectronTkIsolationProducer.cc:25
Handle.h
mps_fire.i
i
Definition: mps_fire.py:428
EgammaElectronTkIsolationProducer
Definition: EgammaElectronTkIsolationProducer.cc:18
edm::EDGetTokenT< reco::GsfElectronCollection >
EgammaElectronTkIsolationProducer::trackProducer_
const edm::EDGetTokenT< reco::TrackCollection > trackProducer_
Definition: EgammaElectronTkIsolationProducer.cc:26
EgammaElectronTkIsolationProducer::EgammaElectronTkIsolationProducer
EgammaElectronTkIsolationProducer(const edm::ParameterSet &)
Definition: EgammaElectronTkIsolationProducer.cc:42
EgammaElectronTkIsolationProducer::stripEndcap_
const double stripEndcap_
Definition: EgammaElectronTkIsolationProducer.cc:33
config
Definition: config.py:1
MakerMacros.h
EgammaElectronTkIsolationProducer::extRadius_
const double extRadius_
Definition: EgammaElectronTkIsolationProducer.cc:34
EgammaElectronTkIsolationProducer::ptMin_
const double ptMin_
Definition: EgammaElectronTkIsolationProducer.cc:29
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
BeamSpot.h
EgammaElectronTkIsolationProducer::beamspotProducer_
const edm::EDGetTokenT< reco::BeamSpot > beamspotProducer_
Definition: EgammaElectronTkIsolationProducer.cc:27
GsfElectron.h
ElectronTkIsolation
Definition: ElectronTkIsolation.h:19
edm::global::EDProducer
Definition: EDProducer.h:32
EgammaElectronTkIsolationProducer::stripBarrel_
const double stripBarrel_
Definition: EgammaElectronTkIsolationProducer.cc:32
EgammaElectronTkIsolationProducer::intRadiusEndcap_
const double intRadiusEndcap_
Definition: EgammaElectronTkIsolationProducer.cc:31
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
trigObjTnPSource_cfi.filler
filler
Definition: trigObjTnPSource_cfi.py:21
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:58
EgammaElectronTkIsolationProducer::intRadiusBarrel_
const double intRadiusBarrel_
Definition: EgammaElectronTkIsolationProducer.cc:30
eostools.move
def move(src, dest)
Definition: eostools.py:511
EventSetup.h
edm::helper::Filler
Definition: ValueMap.h:22
ParameterSet.h
EgammaElectronTkIsolationProducer::drb_
const double drb_
Definition: EgammaElectronTkIsolationProducer.cc:36
edm::EDConsumerBase::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: EDConsumerBase.h:155
EDProducer.h
ElectronTkIsolation.h
EgammaElectronTkIsolationProducer::produce
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Definition: EgammaElectronTkIsolationProducer.cc:60
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
EgammaElectronTkIsolationProducer::maxVtxDist_
const double maxVtxDist_
Definition: EgammaElectronTkIsolationProducer.cc:35
ElectronTkIsolation::getPtTracks
double getPtTracks(const reco::GsfElectron *) const
Definition: ElectronTkIsolation.cc:105