CMS 3D CMS Logo

HoECalculator.cc
Go to the documentation of this file.
2 
6 
7 HoECalculator::HoECalculator() : theCaloGeom_(nullptr) {}
8 HoECalculator::HoECalculator(const edm::ESHandle<CaloGeometry>& caloGeom) : theCaloGeom_(caloGeom) {}
9 
11  return getHoE(GlobalPoint(clus->x(), clus->y(), clus->z()), clus->energy(), e, c);
12 }
13 
15  return getHoE(GlobalPoint(clus->x(), clus->y(), clus->z()), clus->energy(), e, c);
16 }
17 
18 /*
19 double HoECalculator::operator() ( const reco::SuperCluster* clus,
20  HBHERecHitMetaCollection *mhbhe, int ialgo) {
21  double HoE=0.;
22  switch (ialgo) {
23  case 1:
24  for (reco::CaloCluster_iterator bc=clus->clustersBegin(); bc!=clus->clustersEnd(); bc++) {
25  double HoEi = getHoE(GlobalPoint((*bc)->x(),(*bc)->y(),(*bc)->z()),clus->energy(), mhbhe);
26  if (HoEi > HoE) HoE = HoEi;
27  }
28  break;
29  case 2:
30  HoE = getHoE(GlobalPoint(clus->x(),clus->y(),clus->z()), clus->energy(), mhbhe);
31  break;
32  default:
33  std::cout << "!!! algo for HoE should be 1 or 2 " << std::endl;
34  }
35  return HoE;
36 }
37 
38 double HoECalculator::operator() ( const reco::BasicCluster* clus,
39  HBHERecHitMetaCollection *mhbhe) {
40  return getHoE(GlobalPoint(clus->x(),clus->y(),clus->z()), clus->energy(), mhbhe);
41 }
42 
43 */
44 
45 double HoECalculator::getHoE(GlobalPoint pclu, float ecalEnergy, const edm::Event& e, const edm::EventSetup& c) {
46  if (!theCaloGeom_.isValid())
48 
49  //product the geometry
51 
52  //Create a HBHERecHitCollection
54  e.getByLabel("hbhereco", "", hbhe);
55  const HBHERecHitCollection* hithbhe_ = hbhe.product();
56 
57  double HoE = 0.;
59  const CaloSubdetectorGeometry* geometry_p;
60  geometry_p = geometry.getSubdetectorGeometry(DetId::Hcal, 4);
61  DetId hcalDetId;
62  hcalDetId = geometry_p->getClosestCell(pclu);
63  double hcalEnergy = 0;
64 
66  iterRecHit = hithbhe_->find(hcalDetId);
67  if (iterRecHit != hithbhe_->end()) {
68  hcalEnergy = iterRecHit->energy();
69  HoE = hcalEnergy / ecalEnergy;
70  }
71 
72  return HoE;
73 }
74 
75 /*
76 double HoECalculator::getHoE(GlobalPoint pos, float energy,
77  HBHERecHitMetaCollection *mhbhe) {
78 
79  double HoE=0.;
80 
81  if (mhbhe) {
82  const CaloSubdetectorGeometry *geometry_p ;
83  geometry_p = theCaloGeom_->getSubdetectorGeometry (DetId::Hcal,4) ;
84  HcalDetId dB= geometry_p->getClosestCell(pos);
85  CaloRecHitMetaCollectionV::const_iterator i=mhbhe->find(dB);
86  if (i!=mhbhe->end()) {
87  HoE = i->energy()/energy;
88  }
89  }
90  return HoE ;
91 }
92 */
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
reco::CaloCluster::y
double y() const
y coordinate of cluster centroid
Definition: CaloCluster.h:175
Handle.h
edm::SortedCollection::const_iterator
std::vector< T >::const_iterator const_iterator
Definition: SortedCollection.h:80
HoECalculator::HoECalculator
HoECalculator()
Definition: HoECalculator.cc:7
HoECalculator::getHoE
double getHoE(GlobalPoint pos, float energy, const edm::Event &e, const edm::EventSetup &c)
Definition: HoECalculator.cc:45
reco::SuperCluster
Definition: SuperCluster.h:18
CaloGeometryRecord
Definition: CaloGeometryRecord.h:30
geometry
Definition: geometry.py:1
DetId::Hcal
Definition: DetId.h:28
edm::SortedCollection
Definition: SortedCollection.h:49
reco::CaloCluster::z
double z() const
z coordinate of cluster centroid
Definition: CaloCluster.h:178
edm::Handle
Definition: AssociativeIterator.h:50
DetId
Definition: DetId.h:17
CaloGeometry
Definition: CaloGeometry.h:21
HoECalculator::theCaloGeom_
edm::ESHandle< CaloGeometry > theCaloGeom_
Definition: HoECalculator.h:39
reco::CaloCluster
Definition: CaloCluster.h:31
edm::ESHandle< CaloGeometry >
HoECalculator::operator()
double operator()(const reco::BasicCluster *, const edm::Event &e, const edm::EventSetup &c)
Definition: HoECalculator.cc:10
GlobalPoint
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Point3DBase< float, GlobalTag >
edm::eventsetup::DependentRecordImplementation::get
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
Definition: DependentRecordImplementation.h:112
CaloGeometryRecord.h
HoECalculator.h
CaloSubdetectorGeometry.h
edm::SortedCollection::end
const_iterator end() const
Definition: SortedCollection.h:267
edm::EventSetup
Definition: EventSetup.h:57
CaloSubdetectorGeometry::getClosestCell
virtual DetId getClosestCell(const GlobalPoint &r) const
Definition: CaloSubdetectorGeometry.cc:44
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
edm::ESHandleBase::isValid
bool isValid() const
Definition: ESHandle.h:44
HoECalculator::hithbhe_
const HBHERecHitCollection * hithbhe_
Definition: HoECalculator.h:40
photonIsolationHIProducer_cfi.hbhe
hbhe
Definition: photonIsolationHIProducer_cfi.py:8
edm::SortedCollection::find
iterator find(key_type k)
Definition: SortedCollection.h:240
CaloSubdetectorGeometry
Definition: CaloSubdetectorGeometry.h:22
edm::Event
Definition: Event.h:73
reco::CaloCluster::energy
double energy() const
cluster energy
Definition: CaloCluster.h:149
reco::CaloCluster::x
double x() const
x coordinate of cluster centroid
Definition: CaloCluster.h:172
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37