CMS 3D CMS Logo

HGCalEgammaIDHelper.cc
Go to the documentation of this file.
2 
3 #include <iostream>
4 
6  : eeRecHitInputTag_(iConfig.getParameter<edm::InputTag>("EERecHits")),
7  fhRecHitInputTag_(iConfig.getParameter<edm::InputTag>("FHRecHits")),
8  bhRecHitInputTag_(iConfig.getParameter<edm::InputTag>("BHRecHits")),
9  hitMapInputTag_(iConfig.getParameter<edm::InputTag>("hitMapTag")),
10  dEdXWeights_(iConfig.getParameter<std::vector<double>>("dEdXWeights")) {
11  isoHelper_.setDeltaR(iConfig.getParameter<double>("isoDeltaR"));
12  isoHelper_.setNRings(iConfig.getParameter<unsigned int>("isoNRings"));
13  isoHelper_.setMinDeltaR(iConfig.getParameter<double>("isoDeltaRmin"));
14 
18  hitMap_ = iC.consumes<std::unordered_map<DetId, const HGCRecHit*>>(hitMapInputTag_);
19  caloGeometry_ = iC.esConsumes();
21  debug_ = iConfig.getUntrackedParameter<bool>("debug", false);
22 }
23 
25  auto recHitHandleEE = iEvent.getHandle(recHitsEE_);
26  auto recHitHandleFH = iEvent.getHandle(recHitsFH_);
27  auto recHitHandleBH = iEvent.getHandle(recHitsBH_);
28 
33  isoHelper_.setRecHits(recHitHandleEE, recHitHandleFH, recHitHandleBH);
34 }
35 
36 void HGCalEgammaIDHelper::computeHGCAL(const reco::Photon& thePhoton, float radius) {
37  if (thePhoton.isEB()) {
38  if (debug_)
39  std::cout << "The photon is in the barrel" << std::endl;
40  pcaHelper_.clear();
41  return;
42  }
43 
44  pcaHelper_.storeRecHits(*thePhoton.superCluster()->seed());
45  if (debug_)
46  std::cout << " Stored the hits belonging to the photon superCluster seed " << std::endl;
47 
48  // initial computation, no radius cut, but halo hits not taken
49  if (debug_)
50  std::cout << " Calling PCA initial computation" << std::endl;
52  // first computation within cylinder, halo hits included
54  // second computation within cylinder, halo hits included
57 
58  // isolation
59  isoHelper_.produceHGCalIso(thePhoton.superCluster()->seed());
60 }
61 
63  if (theElectron.isEB()) {
64  if (debug_)
65  std::cout << "The electron is in the barrel" << std::endl;
66  pcaHelper_.clear();
67  return;
68  }
69 
70  pcaHelper_.storeRecHits(*theElectron.electronCluster());
71  if (debug_)
72  std::cout << " Stored the hits belonging to the electronCluster " << std::endl;
73 
74  // initial computation, no radius cut, but halo hits not taken
75  if (debug_)
76  std::cout << " Calling PCA initial computation" << std::endl;
78  // first computation within cylinder, halo hits included
80  // second computation within cylinder, halo hits included
84 }
HGCalEgammaIDHelper::computeHGCAL
void computeHGCAL(const reco::Photon &thePhoton, float radius)
Definition: HGCalEgammaIDHelper.cc:36
reco::GsfElectron::isEB
bool isEB() const
Definition: GsfElectron.h:336
reco::Photon::superCluster
reco::SuperClusterRef superCluster() const override
Ref to SuperCluster.
HGCalEgammaIDHelper::eventInit
void eventInit(const edm::Event &iEvent, const edm::EventSetup &iSetup)
Definition: HGCalEgammaIDHelper.cc:24
HGCalEgammaIDHelper.h
HGCalEgammaIDHelper::isoHelper_
HGCalIsoCalculator isoHelper_
Definition: HGCalEgammaIDHelper.h:79
edm
HLT enums.
Definition: AlignableModifier.h:19
HGCalIsoCalculator::setRecHits
void setRecHits(edm::Handle< HGCRecHitCollection > hitsEE, edm::Handle< HGCRecHitCollection > hitsFH, edm::Handle< HGCRecHitCollection > hitsBH)
fill - once per event
Definition: HGCalIsoCalculator.cc:18
gather_cfg.cout
cout
Definition: gather_cfg.py:144
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89287
HGCalIsoCalculator::setMinDeltaR
void setMinDeltaR(const float dr)
Definition: HGCalIsoCalculator.h:54
HGCalEgammaIDHelper::recHitTools_
hgcal::RecHitTools recHitTools_
Definition: HGCalEgammaIDHelper.h:85
hgcal::EGammaPCAHelper::setRecHitTools
void setRecHitTools(const hgcal::RecHitTools *recHitTools)
Definition: EgammaPCAHelper.cc:32
edm::SortedCollection
Definition: SortedCollection.h:49
hgcal::EGammaPCAHelper::pcaInitialComputation
void pcaInitialComputation()
Definition: EgammaPCAHelper.h:53
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
hgcal::EGammaPCAHelper::setdEdXWeights
void setdEdXWeights(const std::vector< double > &dEdX)
Definition: EgammaPCAHelper.h:51
HGCalEgammaIDHelper::caloGeometry_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometry_
Definition: HGCalEgammaIDHelper.h:84
HGCalEgammaIDHelper::hitMapInputTag_
edm::InputTag hitMapInputTag_
Definition: HGCalEgammaIDHelper.h:75
HGCalEgammaIDHelper::hitMap_
edm::EDGetTokenT< std::unordered_map< DetId, const HGCRecHit * > > hitMap_
Definition: HGCalEgammaIDHelper.h:83
HGCalIsoCalculator::setDeltaR
void setDeltaR(const float dr)
Definition: HGCalIsoCalculator.h:52
hgcal::EGammaPCAHelper::setHitMap
void setHitMap(const std::unordered_map< DetId, const HGCRecHit * > *hitMap)
to set once per event
Definition: EgammaPCAHelper.cc:27
reco::GsfElectron
Definition: GsfElectron.h:35
HGCalIsoCalculator::setNRings
void setNRings(const size_t nrings)
Definition: HGCalIsoCalculator.cc:96
HGCalEgammaIDHelper::HGCalEgammaIDHelper
HGCalEgammaIDHelper()
Definition: HGCalEgammaIDHelper.h:33
HGCalEgammaIDHelper::recHitsFH_
edm::EDGetTokenT< HGCRecHitCollection > recHitsFH_
Definition: HGCalEgammaIDHelper.h:81
HGCalEgammaIDHelper::fhRecHitInputTag_
edm::InputTag fhRecHitInputTag_
Definition: HGCalEgammaIDHelper.h:73
hgcal::EGammaPCAHelper::storeRecHits
void storeRecHits(const reco::CaloCluster &theCluster)
Definition: EgammaPCAHelper.cc:47
edm::ParameterSet
Definition: ParameterSet.h:47
HGCalEgammaIDHelper::debug_
bool debug_
Definition: HGCalEgammaIDHelper.h:86
HGCalEgammaIDHelper::dEdXWeights_
std::vector< double > dEdXWeights_
Definition: HGCalEgammaIDHelper.h:77
reco::Photon::isEB
bool isEB() const
Definition: Photon.h:119
iEvent
int iEvent
Definition: GenABIO.cc:224
hgcal::EGammaPCAHelper::clear
void clear()
Definition: EgammaPCAHelper.cc:232
HGCalEgammaIDHelper::eeRecHitInputTag_
edm::InputTag eeRecHitInputTag_
Definition: HGCalEgammaIDHelper.h:72
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
HGCalEgammaIDHelper::recHitsEE_
edm::EDGetTokenT< HGCRecHitCollection > recHitsEE_
Definition: HGCalEgammaIDHelper.h:80
edm::EventSetup
Definition: EventSetup.h:57
HGCalEgammaIDHelper::bhRecHitInputTag_
edm::InputTag bhRecHitInputTag_
Definition: HGCalEgammaIDHelper.h:74
hgcal::EGammaPCAHelper::computeShowerWidth
void computeShowerWidth(float radius, bool withHalo=true)
Definition: EgammaPCAHelper.cc:173
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:120
reco::Photon
Definition: Photon.h:21
hgcal::EGammaPCAHelper::computePCA
void computePCA(float radius, bool withHalo=true)
Definition: EgammaPCAHelper.cc:106
reco::GsfElectron::electronCluster
CaloClusterPtr electronCluster() const
Definition: GsfElectron.h:228
std
Definition: JetResolutionObject.h:76
HGCalIsoCalculator::produceHGCalIso
void produceHGCalIso(const reco::CaloClusterPtr &seedCluster)
Definition: HGCalIsoCalculator.cc:48
hgcal::RecHitTools::setGeometry
void setGeometry(CaloGeometry const &)
Definition: RecHitTools.cc:68
HGCalEgammaIDHelper::pcaHelper_
hgcal::EGammaPCAHelper pcaHelper_
Definition: HGCalEgammaIDHelper.h:78
CosmicsPD_Skims.radius
radius
Definition: CosmicsPD_Skims.py:135
HGCalIsoCalculator::setRecHitTools
void setRecHitTools(const hgcal::RecHitTools *recHitTools)
Definition: HGCalIsoCalculator.h:56
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
HGCalEgammaIDHelper::recHitsBH_
edm::EDGetTokenT< HGCRecHitCollection > recHitsBH_
Definition: HGCalEgammaIDHelper.h:82
edm::Event
Definition: Event.h:73
edm::ConsumesCollector
Definition: ConsumesCollector.h:45