CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 
double operator() (const reco::SuperCluster *, HBHERecHitMetaCollection *mhbhe, int ialgo=1)
 
double operator() (const reco::BasicCluster *, HBHERecHitMetaCollection *mhbhe)
 

Private Member Functions

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

Private Attributes

const HBHERecHitCollectionhithbhe_
 
edm::ESHandle< CaloGeometrytheCaloGeom_
 

Detailed Description

Definition at line 16 of file HoECalculator.h.

Constructor & Destructor Documentation

HoECalculator::HoECalculator ( )

Definition at line 8 of file HoECalculator.cc.

8  :
9  theCaloGeom_(0)
10 {
11 }
edm::ESHandle< CaloGeometry > theCaloGeom_
Definition: HoECalculator.h:47
HoECalculator::HoECalculator ( const edm::ESHandle< CaloGeometry > &  caloGeom)

Definition at line 12 of file HoECalculator.cc.

12  :
13  theCaloGeom_(caloGeom)
14 {
15 }
edm::ESHandle< CaloGeometry > theCaloGeom_
Definition: HoECalculator.h:47

Member Function Documentation

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

Definition at line 52 of file HoECalculator.cc.

References CaloRecHitMetaCollection::add(), CaloRecHitMetaCollectionV::end(), CaloRecHit::energy(), f, CaloRecHitMetaCollection::find(), geometry, edm::EventSetup::get(), edm::eventsetup::EventSetupRecord::get(), edm::Event::getByLabel(), CaloSubdetectorGeometry::getClosestCell(), CaloGeometry::getSubdetectorGeometry(), DetId::Hcal, hithbhe_, edm::ESHandleBase::isValid(), edm::Handle< T >::product(), edm::ESHandle< class >::product(), and theCaloGeom_.

Referenced by operator()().

53 {
54  if ( !theCaloGeom_.isValid() )
56 
57  //product the geometry
59 
60  //Create a CaloRecHitMetaCollection
62  e.getByLabel("hbhereco","",hbhe);
63  const HBHERecHitCollection* hithbhe_ = hbhe.product();
64 
65  double HoE=0.;
67  const CaloSubdetectorGeometry *geometry_p ;
68  geometry_p = geometry.getSubdetectorGeometry (DetId::Hcal,4) ;
69  DetId hcalDetId ;
70  hcalDetId = geometry_p->getClosestCell(pclu) ;
71  double hcalEnergy = 0 ;
73  f.add(hithbhe_);
75  iterRecHit = f.find(hcalDetId) ;
76  if (iterRecHit!=f.end()) {
77  hcalEnergy = iterRecHit->energy() ;
78  HoE = hcalEnergy/ecalEnergy ;
79  }
80 
81  return HoE ;
82 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:43
const HBHERecHitCollection * hithbhe_
Definition: HoECalculator.h:48
virtual const_iterator find(const DetId &id) const
find by id (default version is very slow unsorted find)
const_iterator end() const
get the ending iterator
edm::ESHandle< CaloGeometry > theCaloGeom_
Definition: HoECalculator.h:47
float energy() const
Definition: CaloRecHit.h:19
void get(HolderT &iHolder) const
void add(const HBHERecHitCollection *hbhe)
double f[11][100]
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
virtual DetId getClosestCell(const GlobalPoint &r) const
Definition: DetId.h:20
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
T const * product() const
Definition: Handle.h:74
ESHandle< TrackerGeometry > geometry
bool isValid() const
Definition: ESHandle.h:37
double HoECalculator::getHoE ( GlobalPoint  pos,
float  energy,
HBHERecHitMetaCollection mhbhe 
)
private

Definition at line 84 of file HoECalculator.cc.

References CaloRecHitMetaCollectionV::end(), CaloRecHit::energy(), relval_parameters_module::energy, SimpleCaloRecHitMetaCollection< C >::find(), CaloSubdetectorGeometry::getClosestCell(), DetId::Hcal, i, and theCaloGeom_.

85  {
86 
87  double HoE=0.;
88 
89  if (mhbhe) {
90  const CaloSubdetectorGeometry *geometry_p ;
91  geometry_p = theCaloGeom_->getSubdetectorGeometry (DetId::Hcal,4) ;
92  HcalDetId dB= geometry_p->getClosestCell(pos);
94  if (i!=mhbhe->end()) {
95  HoE = i->energy()/energy;
96  }
97  }
98  return HoE ;
99 
100 }
int i
Definition: DBlmapReader.cc:9
virtual const_iterator find(const DetId &id) const
find by id (default version is very slow unsorted find)
const_iterator end() const
get the ending iterator
edm::ESHandle< CaloGeometry > theCaloGeom_
Definition: HoECalculator.h:47
float energy() const
Definition: CaloRecHit.h:19
virtual DetId getClosestCell(const GlobalPoint &r) const
double HoECalculator::operator() ( const reco::BasicCluster clus,
const edm::Event e,
const edm::EventSetup c 
)

Definition at line 17 of file HoECalculator.cc.

References trackerHits::c, alignCSCRings::e, and getHoE().

18 {
19  return getHoE(GlobalPoint(clus->x(),clus->y(),clus->z()), clus->energy(), e,c);
20 }
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
double getHoE(GlobalPoint pos, float energy, const edm::Event &e, const edm::EventSetup &c)
double HoECalculator::operator() ( const reco::SuperCluster clus,
const edm::Event e,
const edm::EventSetup c 
)

Definition at line 22 of file HoECalculator.cc.

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

23 {
24  return getHoE(GlobalPoint(clus->x(),clus->y(),clus->z()), clus->energy(), e,c);
25 }
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
double z() const
z coordinate of cluster centroid
Definition: CaloCluster.h:157
double getHoE(GlobalPoint pos, float energy, const edm::Event &e, const edm::EventSetup &c)
double x() const
x coordinate of cluster centroid
Definition: CaloCluster.h:151
double energy() const
cluster energy
Definition: CaloCluster.h:120
double y() const
y coordinate of cluster centroid
Definition: CaloCluster.h:154
double HoECalculator::operator() ( const reco::SuperCluster clus,
HBHERecHitMetaCollection mhbhe,
int  ialgo = 1 
)

Definition at line 27 of file HoECalculator.cc.

References reco::SuperCluster::clustersBegin(), reco::SuperCluster::clustersEnd(), gather_cfg::cout, reco::CaloCluster::energy(), getHoE(), reco::CaloCluster::x(), reco::CaloCluster::y(), and reco::CaloCluster::z().

28  {
29  double HoE=0.;
30  switch (ialgo) {
31  case 1:
32  for (reco::CaloCluster_iterator bc=clus->clustersBegin(); bc!=clus->clustersEnd(); bc++) {
33  double HoEi = getHoE(GlobalPoint((*bc)->x(),(*bc)->y(),(*bc)->z()),clus->energy(), mhbhe);
34  if (HoEi > HoE) HoE = HoEi;
35  }
36  break;
37  case 2:
38  HoE = getHoE(GlobalPoint(clus->x(),clus->y(),clus->z()), clus->energy(), mhbhe);
39  break;
40  default:
41  std::cout << "!!! algo for HoE should be 1 or 2 " << std::endl;
42  }
43  return HoE;
44 }
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
double z() const
z coordinate of cluster centroid
Definition: CaloCluster.h:157
double getHoE(GlobalPoint pos, float energy, const edm::Event &e, const edm::EventSetup &c)
double x() const
x coordinate of cluster centroid
Definition: CaloCluster.h:151
double energy() const
cluster energy
Definition: CaloCluster.h:120
CaloCluster_iterator clustersBegin() const
fist iterator over BasicCluster constituents
Definition: SuperCluster.h:71
tuple cout
Definition: gather_cfg.py:121
double y() const
y coordinate of cluster centroid
Definition: CaloCluster.h:154
CaloCluster_iterator clustersEnd() const
last iterator over BasicCluster constituents
Definition: SuperCluster.h:74
double HoECalculator::operator() ( const reco::BasicCluster clus,
HBHERecHitMetaCollection mhbhe 
)

Definition at line 47 of file HoECalculator.cc.

References getHoE().

48  {
49  return getHoE(GlobalPoint(clus->x(),clus->y(),clus->z()), clus->energy(), mhbhe);
50 }
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
double getHoE(GlobalPoint pos, float energy, const edm::Event &e, const edm::EventSetup &c)

Member Data Documentation

const HBHERecHitCollection* HoECalculator::hithbhe_
private

Definition at line 48 of file HoECalculator.h.

Referenced by getHoE().

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

Definition at line 47 of file HoECalculator.h.

Referenced by getHoE().