CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
HoECalculator Class Reference

#include <HoECalculator.h>

Public Member Functions

 HoECalculator ()
 
 HoECalculator (const edm::ESHandle< CaloGeometry > &)
 
double operator() (const reco::BasicCluster *, const edm::Event &e, const edm::EventSetup &c)
 
double operator() (const reco::SuperCluster *, const edm::Event &e, const edm::EventSetup &c)
 

Private Member Functions

double getHoE (GlobalPoint pos, float energy, const edm::Event &e, const edm::EventSetup &c)
 

Private Attributes

const HBHERecHitCollectionhithbhe_
 
edm::ESHandle< CaloGeometrytheCaloGeom_
 

Detailed Description

Definition at line 14 of file HoECalculator.h.

Constructor & Destructor Documentation

◆ HoECalculator() [1/2]

HoECalculator::HoECalculator ( )

Definition at line 7 of file HoECalculator.cc.

7 : theCaloGeom_(nullptr) {}

◆ HoECalculator() [2/2]

HoECalculator::HoECalculator ( const edm::ESHandle< CaloGeometry > &  caloGeom)

Definition at line 8 of file HoECalculator.cc.

8 : theCaloGeom_(caloGeom) {}

Member Function Documentation

◆ getHoE()

double HoECalculator::getHoE ( GlobalPoint  pos,
float  energy,
const edm::Event e,
const edm::EventSetup c 
)
private

Definition at line 45 of file HoECalculator.cc.

45  {
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 }

References c, MillePedeFileConverter_cfg::e, edm::SortedCollection< T, SORT >::end(), edm::SortedCollection< T, SORT >::find(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::get(), CaloSubdetectorGeometry::getClosestCell(), photonIsolationHIProducer_cfi::hbhe, DetId::Hcal, hithbhe_, edm::ESHandleBase::isValid(), edm::ESHandle< T >::product(), and theCaloGeom_.

Referenced by operator()().

◆ operator()() [1/2]

double HoECalculator::operator() ( const reco::BasicCluster clus,
const edm::Event e,
const edm::EventSetup c 
)

Definition at line 10 of file HoECalculator.cc.

10  {
11  return getHoE(GlobalPoint(clus->x(), clus->y(), clus->z()), clus->energy(), e, c);
12 }

References c, MillePedeFileConverter_cfg::e, reco::CaloCluster::energy(), getHoE(), reco::CaloCluster::x(), reco::CaloCluster::y(), and reco::CaloCluster::z().

◆ operator()() [2/2]

double HoECalculator::operator() ( const reco::SuperCluster clus,
const edm::Event e,
const edm::EventSetup c 
)

Definition at line 14 of file HoECalculator.cc.

14  {
15  return getHoE(GlobalPoint(clus->x(), clus->y(), clus->z()), clus->energy(), e, c);
16 }

References c, MillePedeFileConverter_cfg::e, reco::CaloCluster::energy(), getHoE(), reco::CaloCluster::x(), reco::CaloCluster::y(), and reco::CaloCluster::z().

Member Data Documentation

◆ hithbhe_

const HBHERecHitCollection* HoECalculator::hithbhe_
private

Definition at line 40 of file HoECalculator.h.

Referenced by getHoE().

◆ theCaloGeom_

edm::ESHandle<CaloGeometry> HoECalculator::theCaloGeom_
private

Definition at line 39 of file HoECalculator.h.

Referenced by getHoE().

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
edm::SortedCollection::const_iterator
std::vector< T >::const_iterator const_iterator
Definition: SortedCollection.h:80
HoECalculator::getHoE
double getHoE(GlobalPoint pos, float energy, const edm::Event &e, const edm::EventSetup &c)
Definition: HoECalculator.cc:45
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
GlobalPoint
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
edm::eventsetup::DependentRecordImplementation::get
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
Definition: DependentRecordImplementation.h:109
edm::SortedCollection::end
const_iterator end() const
Definition: SortedCollection.h:267
CaloSubdetectorGeometry::getClosestCell
virtual DetId getClosestCell(const GlobalPoint &r) const
Definition: CaloSubdetectorGeometry.cc:44
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
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:46
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