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 unsigned int>>(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  pcaHelper_.setRecHits(recHitHandleEE, recHitHandleFH, recHitHandleBH);
34  isoHelper_.setRecHits(recHitHandleEE, recHitHandleFH, recHitHandleBH);
35 }
36 
37 void HGCalEgammaIDHelper::computeHGCAL(const reco::Photon& thePhoton, float radius) {
38  if (thePhoton.isEB()) {
39  if (debug_)
40  std::cout << "The photon is in the barrel" << std::endl;
41  pcaHelper_.clear();
42  return;
43  }
44 
45  pcaHelper_.storeRecHits(*thePhoton.superCluster()->seed());
46  if (debug_)
47  std::cout << " Stored the hits belonging to the photon superCluster seed " << std::endl;
48 
49  // initial computation, no radius cut, but halo hits not taken
50  if (debug_)
51  std::cout << " Calling PCA initial computation" << std::endl;
53  // first computation within cylinder, halo hits included
55  // second computation within cylinder, halo hits included
58 
59  // isolation
60  isoHelper_.produceHGCalIso(thePhoton.superCluster()->seed());
61 }
62 
64  if (theElectron.isEB()) {
65  if (debug_)
66  std::cout << "The electron is in the barrel" << std::endl;
67  pcaHelper_.clear();
68  return;
69  }
70 
71  pcaHelper_.storeRecHits(*theElectron.electronCluster());
72  if (debug_)
73  std::cout << " Stored the hits belonging to the electronCluster " << std::endl;
74 
75  // initial computation, no radius cut, but halo hits not taken
76  if (debug_)
77  std::cout << " Calling PCA initial computation" << std::endl;
79  // first computation within cylinder, halo hits included
81  // second computation within cylinder, halo hits included
85 }
void computeShowerWidth(float radius, bool withHalo=true)
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
void setMinDeltaR(const float dr)
void computePCA(float radius, bool withHalo=true)
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
edm::EDGetTokenT< HGCRecHitCollection > recHitsBH_
edm::InputTag fhRecHitInputTag_
void setNRings(const size_t nrings)
edm::EDGetTokenT< HGCRecHitCollection > recHitsFH_
void setdEdXWeights(const std::vector< double > &dEdX)
void setRecHits(edm::Handle< HGCRecHitCollection > hitsEE, edm::Handle< HGCRecHitCollection > hitsFH, edm::Handle< HGCRecHitCollection > hitsBH)
fill - once per event
bool isEB() const
Definition: Photon.h:126
hgcal::RecHitTools recHitTools_
void setDeltaR(const float dr)
edm::EDGetTokenT< HGCRecHitCollection > recHitsEE_
bool isEB() const
Definition: GsfElectron.h:328
T getUntrackedParameter(std::string const &, T const &) const
void storeRecHits(const reco::CaloCluster &theCluster)
int iEvent
Definition: GenABIO.cc:224
reco::SuperClusterRef superCluster() const override
Ref to SuperCluster.
void setRecHitTools(const hgcal::RecHitTools *recHitTools)
void produceHGCalIso(const reco::CaloClusterPtr &seedCluster)
edm::InputTag bhRecHitInputTag_
edm::EDGetTokenT< std::unordered_map< DetId, const unsigned int > > hitMap_
void setRecHitTools(const hgcal::RecHitTools *recHitTools)
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometry_
edm::InputTag hitMapInputTag_
std::vector< double > dEdXWeights_
hgcal::EGammaPCAHelper pcaHelper_
void setHitMap(const std::unordered_map< DetId, const unsigned int > *hitMap)
to set once per event
void computeHGCAL(const reco::Photon &thePhoton, float radius)
void setGeometry(CaloGeometry const &)
Definition: RecHitTools.cc:79
void eventInit(const edm::Event &iEvent, const edm::EventSetup &iSetup)
HLT enums.
CaloClusterPtr electronCluster() const
Definition: GsfElectron.h:220
HGCalIsoCalculator isoHelper_
void setRecHits(edm::Handle< HGCRecHitCollection > recHitHandleEE, edm::Handle< HGCRecHitCollection > recHitHandleFH, edm::Handle< HGCRecHitCollection > recHitHandleBH)
edm::InputTag eeRecHitInputTag_