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  dEdXWeights_(iConfig.getParameter<std::vector<double> >("dEdXWeights")) {
10  isoHelper_.setDeltaR(iConfig.getParameter<double>("isoDeltaR"));
11  isoHelper_.setNRings(iConfig.getParameter<unsigned int>("isoNRings"));
12  isoHelper_.setMinDeltaR(iConfig.getParameter<double>("isoDeltaRmin"));
13 
17  caloGeometry_ = iC.esConsumes<CaloGeometry, CaloGeometryRecord>();
19  debug_ = iConfig.getUntrackedParameter<bool>("debug", false);
20 }
21 
23  edm::Handle<HGCRecHitCollection> recHitHandleEE;
24  iEvent.getByToken(recHitsEE_, recHitHandleEE);
25  edm::Handle<HGCRecHitCollection> recHitHandleFH;
26  iEvent.getByToken(recHitsFH_, recHitHandleFH);
27  edm::Handle<HGCRecHitCollection> recHitHandleBH;
28  iEvent.getByToken(recHitsBH_, recHitHandleBH);
29 
34  pcaHelper_.fillHitMap(*recHitHandleEE, *recHitHandleFH, *recHitHandleBH);
35  isoHelper_.setRecHits(recHitHandleEE, recHitHandleFH, recHitHandleBH);
36 }
37 
38 void HGCalEgammaIDHelper::computeHGCAL(const reco::Photon& thePhoton, float radius) {
39  if (thePhoton.isEB()) {
40  if (debug_)
41  std::cout << "The photon is in the barrel" << std::endl;
42  pcaHelper_.clear();
43  return;
44  }
45 
46  pcaHelper_.storeRecHits(*thePhoton.superCluster()->seed());
47  if (debug_)
48  std::cout << " Stored the hits belonging to the photon superCluster seed " << std::endl;
49 
50  // initial computation, no radius cut, but halo hits not taken
51  if (debug_)
52  std::cout << " Calling PCA initial computation" << std::endl;
54  // first computation within cylinder, halo hits included
56  // second computation within cylinder, halo hits included
59 
60  // isolation
61  isoHelper_.produceHGCalIso(thePhoton.superCluster()->seed());
62 }
63 
65  if (theElectron.isEB()) {
66  if (debug_)
67  std::cout << "The electron is in the barrel" << std::endl;
68  pcaHelper_.clear();
69  return;
70  }
71 
72  pcaHelper_.storeRecHits(*theElectron.electronCluster());
73  if (debug_)
74  std::cout << " Stored the hits belonging to the electronCluster " << std::endl;
75 
76  // initial computation, no radius cut, but halo hits not taken
77  if (debug_)
78  std::cout << " Calling PCA initial computation" << std::endl;
80  // first computation within cylinder, halo hits included
82  // second computation within cylinder, halo hits included
86 }
HGCalEgammaIDHelper::computeHGCAL
void computeHGCAL(const reco::Photon &thePhoton, float radius)
Definition: HGCalEgammaIDHelper.cc:38
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:22
HGCalEgammaIDHelper.h
hgcal::EGammaPCAHelper::fillHitMap
void fillHitMap(const HGCRecHitCollection &HGCEERecHits, const HGCRecHitCollection &HGCFHRecHits, const HGCRecHitCollection &HGCBHRecHits)
to compute from inside - once per event
Definition: EgammaPCAHelper.cc:43
CaloGeometryRecord
Definition: CaloGeometryRecord.h:30
HGCalEgammaIDHelper::isoHelper_
HGCalIsoCalculator isoHelper_
Definition: HGCalEgammaIDHelper.h:78
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
HGCalIsoCalculator::setMinDeltaR
void setMinDeltaR(const float dr)
Definition: HGCalIsoCalculator.h:54
HGCalEgammaIDHelper::recHitTools_
hgcal::RecHitTools recHitTools_
Definition: HGCalEgammaIDHelper.h:83
hgcal::EGammaPCAHelper::setRecHitTools
void setRecHitTools(const hgcal::RecHitTools *recHitTools)
Definition: EgammaPCAHelper.cc:38
edm::SortedCollection
Definition: SortedCollection.h:49
hgcal::EGammaPCAHelper::pcaInitialComputation
void pcaInitialComputation()
Definition: EgammaPCAHelper.h:59
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::Handle
Definition: AssociativeIterator.h:50
hgcal::EGammaPCAHelper::setdEdXWeights
void setdEdXWeights(const std::vector< double > &dEdX)
Definition: EgammaPCAHelper.h:57
CaloGeometry
Definition: CaloGeometry.h:21
HGCalEgammaIDHelper::caloGeometry_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometry_
Definition: HGCalEgammaIDHelper.h:82
HGCalIsoCalculator::setDeltaR
void setDeltaR(const float dr)
Definition: HGCalIsoCalculator.h:52
edm::ESHandle< CaloGeometry >
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
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:80
HGCalEgammaIDHelper::fhRecHitInputTag_
edm::InputTag fhRecHitInputTag_
Definition: HGCalEgammaIDHelper.h:73
hgcal::EGammaPCAHelper::storeRecHits
void storeRecHits(const reco::CaloCluster &theCluster)
Definition: EgammaPCAHelper.cc:73
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::ParameterSet
Definition: ParameterSet.h:36
HGCalEgammaIDHelper::debug_
bool debug_
Definition: HGCalEgammaIDHelper.h:84
HGCalEgammaIDHelper::dEdXWeights_
std::vector< double > dEdXWeights_
Definition: HGCalEgammaIDHelper.h:76
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:258
HGCalEgammaIDHelper::eeRecHitInputTag_
edm::InputTag eeRecHitInputTag_
Definition: HGCalEgammaIDHelper.h:72
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:141
HGCalEgammaIDHelper::recHitsEE_
edm::EDGetTokenT< HGCRecHitCollection > recHitsEE_
Definition: HGCalEgammaIDHelper.h:79
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:199
reco::Photon
Definition: Photon.h:21
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
hgcal::EGammaPCAHelper::computePCA
void computePCA(float radius, bool withHalo=true)
Definition: EgammaPCAHelper.cc:132
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:77
CosmicsPD_Skims.radius
radius
Definition: CosmicsPD_Skims.py:135
HGCalIsoCalculator::setRecHitTools
void setRecHitTools(const hgcal::RecHitTools *recHitTools)
Definition: HGCalIsoCalculator.h:56
HGCalEgammaIDHelper::recHitsBH_
edm::EDGetTokenT< HGCRecHitCollection > recHitsBH_
Definition: HGCalEgammaIDHelper.h:81
edm::Event
Definition: Event.h:73
edm::ConsumesCollector
Definition: ConsumesCollector.h:39