CMS 3D CMS Logo

EgammaHLTPhotonTrackIsolationProducersRegional.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: EgammaHLTProducers
4 // Class: EgammaHLTPhotonTrackIsolationProducersRegional
5 //
8 //
9 // Original Author: Monica Vazquez Acosta (CERN)
10 // Created: Tue Jun 13 14:48:33 CEST 2006
11 // $Id: EgammaHLTPhotonTrackIsolationProducersRegional.h,v 1.1 2007/03/23 17:22:54 ghezzi Exp $
12 //
13 //
14 
15 // system include files
16 #include <memory>
17 
18 // user include files
21 
24 
26 
30 
33 
35 
39 
41 public:
44 
45  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
46  void produce(edm::StreamID sid, edm::Event&, const edm::EventSetup&) const override;
47 
48 private:
49  // ----------member data ---------------------------
50 
53 
54  //edm::ParameterSet conf_;
55 
56  const bool countTracks_;
57 
58  const double egTrkIsoPtMin_;
59  const double egTrkIsoConeSize_;
60  const double egTrkIsoZSpan_;
61  const double egTrkIsoRSpan_;
62  const double egTrkIsoVetoConeSize_;
63  const double egTrkIsoStripBarrel_;
64  const double egTrkIsoStripEndcap_;
65 
67 };
68 
71  : recoEcalCandidateProducer_(
72  consumes<reco::RecoEcalCandidateCollection>(config.getParameter<edm::InputTag>("recoEcalCandidateProducer"))),
73  trackProducer_(consumes<reco::TrackCollection>(config.getParameter<edm::InputTag>("trackProducer"))),
74  countTracks_(config.getParameter<bool>("countTracks")),
75  egTrkIsoPtMin_(config.getParameter<double>("egTrkIsoPtMin")),
76  egTrkIsoConeSize_(config.getParameter<double>("egTrkIsoConeSize")),
77  egTrkIsoZSpan_(config.getParameter<double>("egTrkIsoZSpan")),
78  egTrkIsoRSpan_(config.getParameter<double>("egTrkIsoRSpan")),
79  egTrkIsoVetoConeSize_(config.getParameter<double>("egTrkIsoVetoConeSize")),
80  egTrkIsoStripBarrel_(config.getParameter<double>("egTrkIsoStripBarrel")),
81  egTrkIsoStripEndcap_(config.getParameter<double>("egTrkIsoStripEndcap")) {
89 
90  //register your products
91  produces<reco::RecoEcalCandidateIsolationMap>();
92 }
93 
95 
98  desc.add<edm::InputTag>(("recoEcalCandidateProducer"), edm::InputTag("hltL1SeededRecoEcalCandidate"));
99  desc.add<edm::InputTag>(("trackProducer"), edm::InputTag("hltL1SeededEgammaRegionalCTFFinalFitWithMaterial"));
100  desc.add<bool>(("countTracks"), false);
101  desc.add<double>(("egTrkIsoPtMin"), 1.0);
102  desc.add<double>(("egTrkIsoConeSize"), 0.29);
103  desc.add<double>(("egTrkIsoZSpan"), 999999.0);
104  desc.add<double>(("egTrkIsoRSpan"), 999999.0);
105  desc.add<double>(("egTrkIsoVetoConeSize"), 0.06);
106  desc.add<double>(("egTrkIsoStripBarrel"), 0.03);
107  desc.add<double>(("egTrkIsoStripEndcap"), 0.03);
108  descriptions.add(("hltEgammaHLTPhotonTrackIsolationProducersRegional"), desc);
109 }
110 
111 // ------------ method called to produce the data ------------
114  const edm::EventSetup&) const {
115  // Get the HLT filtered objects
117  iEvent.getByToken(recoEcalCandidateProducer_, recoecalcandHandle);
118 
119  // Get the barrel hcal hits
121  iEvent.getByToken(trackProducer_, trackHandle);
122  const reco::TrackCollection* trackCollection = trackHandle.product();
123 
124  reco::RecoEcalCandidateIsolationMap isoMap(recoecalcandHandle);
125 
126  for (unsigned int iRecoEcalCand = 0; iRecoEcalCand < recoecalcandHandle->size(); iRecoEcalCand++) {
127  reco::RecoEcalCandidateRef recoecalcandref(recoecalcandHandle, iRecoEcalCand);
128 
129  bool usePhotonVertex = false;
130 
131  float isol;
132  if (countTracks_) {
133  isol = test_->photonTrackCount(&(*recoecalcandref), trackCollection, usePhotonVertex);
134  } else {
135  isol = test_->photonPtSum(&(*recoecalcandref), trackCollection, usePhotonVertex);
136  }
137 
138  isoMap.insert(recoecalcandref, isol);
139  }
140 
141  iEvent.put(std::make_unique<reco::RecoEcalCandidateIsolationMap>(isoMap));
142 }
143 
void produce(edm::StreamID sid, edm::Event &, const edm::EventSetup &) const override
T const * product() const
Definition: Handle.h:70
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
int photonTrackCount(const reco::RecoCandidate *const recocand, const reco::TrackCollection *isoTracks, bool useVertex)
Definition: config.py:1
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
trackCollection
Definition: JetHT_cfg.py:50
const edm::EDGetTokenT< reco::RecoEcalCandidateCollection > recoEcalCandidateProducer_
void insert(const key_type &k, const data_type &v)
insert an association
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::vector< RecoEcalCandidate > RecoEcalCandidateCollection
collectin of RecoEcalCandidate objects
fixed size matrix
HLT enums.
float photonPtSum(const reco::RecoCandidate *const recocand, const reco::TrackCollection *isoTracks, bool useVertex)