CMS 3D CMS Logo

EgammaPhotonTkIsolationProducer.cc
Go to the documentation of this file.
1 //*****************************************************************************
2 // File: EgammaPhotonTkIsolationProducer.cc
3 // ----------------------------------------------------------------------------
4 // OrigAuth: Matthias Mozer
5 // Institute: IIHE-VUB
6 //=============================================================================
7 //*****************************************************************************
8 
21 
23 public:
25 
26  void produce(edm::StreamID sid, edm::Event&, const edm::EventSetup&) const override;
27 
28 private:
32 
33  const double ptMin_;
34  const double intRadiusBarrel_;
35  const double intRadiusEndcap_;
36  const double stripBarrel_;
37  const double stripEndcap_;
38  const double extRadius_;
39  const double maxVtxDist_;
40  const double drb_;
41 };
42 
45 
47  :
48 
49  photonProducer_{consumes(config.getParameter<edm::InputTag>("photonProducer"))},
50 
51  trackProducer_{consumes(config.getParameter<edm::InputTag>("trackProducer"))},
52  beamspotProducer_{consumes(config.getParameter<edm::InputTag>("BeamspotProducer"))},
53 
54  ptMin_(config.getParameter<double>("ptMin")),
55  intRadiusBarrel_(config.getParameter<double>("intRadiusBarrel")),
56  intRadiusEndcap_(config.getParameter<double>("intRadiusEndcap")),
57  stripBarrel_(config.getParameter<double>("stripBarrel")),
58  stripEndcap_(config.getParameter<double>("stripEndcap")),
59  extRadius_(config.getParameter<double>("extRadius")),
60  maxVtxDist_(config.getParameter<double>("maxVtxDist")),
61  drb_(config.getParameter<double>("maxVtxDistXY")) {
62  //register your products
63  produces<edm::ValueMap<double>>();
64 }
65 
66 // ------------ method called to produce the data ------------
69  const edm::EventSetup& iSetup) const {
70  // Get the filtered objects
71  auto photonHandle = iEvent.getHandle(photonProducer_);
72 
73  //prepare product
74  auto isoMap = std::make_unique<edm::ValueMap<double>>();
76  std::vector<double> retV(photonHandle->size(), 0);
77 
78  PhotonTkIsolation myTkIsolation(extRadius_,
83  ptMin_,
85  drb_,
86  &iEvent.get(trackProducer_),
87  iEvent.get(beamspotProducer_).position());
88 
89  for (unsigned int i = 0; i < photonHandle->size(); ++i) {
90  double isoValue = myTkIsolation.getIso(&(photonHandle->at(i))).second;
91  retV[i] = isoValue;
92  }
93 
94  //fill and insert valuemap
95  filler.insert(photonHandle, retV.begin(), retV.end());
96  filler.fill();
97  iEvent.put(std::move(isoMap));
98 }
PhotonTkIsolation
Definition: PhotonTkIsolation.h:20
edm::StreamID
Definition: StreamID.h:30
Handle.h
mps_fire.i
i
Definition: mps_fire.py:428
EgammaPhotonTkIsolationProducer::maxVtxDist_
const double maxVtxDist_
Definition: EgammaPhotonTkIsolationProducer.cc:39
EgammaPhotonTkIsolationProducer::extRadius_
const double extRadius_
Definition: EgammaPhotonTkIsolationProducer.cc:38
edm::EDGetTokenT
Definition: EDGetToken.h:33
EgammaPhotonTkIsolationProducer::EgammaPhotonTkIsolationProducer
EgammaPhotonTkIsolationProducer(const edm::ParameterSet &)
Definition: EgammaPhotonTkIsolationProducer.cc:46
EgammaPhotonTkIsolationProducer::photonProducer_
const edm::EDGetTokenT< edm::View< reco::Candidate > > photonProducer_
Definition: EgammaPhotonTkIsolationProducer.cc:29
EgammaPhotonTkIsolationProducer::produce
void produce(edm::StreamID sid, edm::Event &, const edm::EventSetup &) const override
Definition: EgammaPhotonTkIsolationProducer.cc:67
RecoCandidate.h
config
Definition: config.py:1
MakerMacros.h
TrackFwd.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
BeamSpot.h
PhotonTkIsolation::getIso
std::pair< int, float > getIso(const reco::Candidate *) const
Definition: PhotonTkIsolation.cc:52
EgammaPhotonTkIsolationProducer::intRadiusBarrel_
const double intRadiusBarrel_
Definition: EgammaPhotonTkIsolationProducer.cc:34
EgammaPhotonTkIsolationProducer::drb_
const double drb_
Definition: EgammaPhotonTkIsolationProducer.cc:40
EgammaPhotonTkIsolationProducer::intRadiusEndcap_
const double intRadiusEndcap_
Definition: EgammaPhotonTkIsolationProducer.cc:35
edm::global::EDProducer
Definition: EDProducer.h:32
edm::ParameterSet
Definition: ParameterSet.h:47
CandAssociation.h
Event.h
EgammaPhotonTkIsolationProducer::beamspotProducer_
const edm::EDGetTokenT< reco::BeamSpot > beamspotProducer_
Definition: EgammaPhotonTkIsolationProducer.cc:31
trigObjTnPSource_cfi.filler
filler
Definition: trigObjTnPSource_cfi.py:21
iEvent
int iEvent
Definition: GenABIO.cc:224
EgammaPhotonTkIsolationProducer::stripBarrel_
const double stripBarrel_
Definition: EgammaPhotonTkIsolationProducer.cc:36
edm::EventSetup
Definition: EventSetup.h:58
EgammaPhotonTkIsolationProducer
Definition: EgammaPhotonTkIsolationProducer.cc:22
PhotonTkIsolation.h
eostools.move
def move(src, dest)
Definition: eostools.py:511
SuperClusterFwd.h
SuperCluster.h
EgammaPhotonTkIsolationProducer::stripEndcap_
const double stripEndcap_
Definition: EgammaPhotonTkIsolationProducer.cc:37
Candidate.h
edm::helper::Filler
Definition: ValueMap.h:22
ParameterSet.h
edm::EDConsumerBase::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: EDConsumerBase.h:159
EDProducer.h
EgammaPhotonTkIsolationProducer::trackProducer_
const edm::EDGetTokenT< reco::TrackCollection > trackProducer_
Definition: EgammaPhotonTkIsolationProducer.cc:30
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
EgammaPhotonTkIsolationProducer::ptMin_
const double ptMin_
Definition: EgammaPhotonTkIsolationProducer.cc:33