CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
32  pcaHelper_.setHitMap(&iEvent.get(hitMap_));
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
53  pcaHelper_.computePCA(radius);
54  // second computation within cylinder, halo hits included
55  pcaHelper_.computePCA(radius);
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
79  pcaHelper_.computePCA(radius);
80  // second computation within cylinder, halo hits included
81  pcaHelper_.computePCA(radius);
84 }
void computeShowerWidth(float radius, bool withHalo=true)
CaloClusterPtr electronCluster() const
Definition: GsfElectron.h:220
T getUntrackedParameter(std::string const &, T const &) const
void setMinDeltaR(const float dr)
void computePCA(float radius, bool withHalo=true)
edm::EDGetTokenT< HGCRecHitCollection > recHitsBH_
void setHitMap(const std::unordered_map< DetId, const HGCRecHit * > *hitMap)
to set once per event
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
hgcal::RecHitTools recHitTools_
void setDeltaR(const float dr)
bool isEB() const
Definition: GsfElectron.h:328
edm::EDGetTokenT< HGCRecHitCollection > recHitsEE_
bool getData(T &iHolder) const
Definition: EventSetup.h:128
void storeRecHits(const reco::CaloCluster &theCluster)
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
Definition: Event.h:563
int iEvent
Definition: GenABIO.cc:224
reco::SuperClusterRef superCluster() const override
Ref to SuperCluster.
void setRecHitTools(const hgcal::RecHitTools *recHitTools)
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:346
void produceHGCalIso(const reco::CaloClusterPtr &seedCluster)
edm::InputTag bhRecHitInputTag_
void setRecHitTools(const hgcal::RecHitTools *recHitTools)
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometry_
edm::InputTag hitMapInputTag_
std::vector< double > dEdXWeights_
hgcal::EGammaPCAHelper pcaHelper_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
void computeHGCAL(const reco::Photon &thePhoton, float radius)
void setGeometry(CaloGeometry const &)
Definition: RecHitTools.cc:68
bool isEB() const
Definition: Photon.h:120
void eventInit(const edm::Event &iEvent, const edm::EventSetup &iSetup)
HGCalIsoCalculator isoHelper_
tuple cout
Definition: gather_cfg.py:144
edm::EDGetTokenT< std::unordered_map< DetId, const HGCRecHit * > > hitMap_
edm::InputTag eeRecHitInputTag_