CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HoECalculator.cc
Go to the documentation of this file.
2 
7 
9  theCaloGeom_(0)
10 {
11 }
13  theCaloGeom_(caloGeom)
14 {
15 }
16 
18 {
19  return getHoE(GlobalPoint(clus->x(),clus->y(),clus->z()), clus->energy(), e,c);
20 }
21 
23 {
24  return getHoE(GlobalPoint(clus->x(),clus->y(),clus->z()), clus->energy(), e,c);
25 }
26 
28  HBHERecHitMetaCollection *mhbhe, int ialgo) {
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 }
45 
46 
48  HBHERecHitMetaCollection *mhbhe) {
49  return getHoE(GlobalPoint(clus->x(),clus->y(),clus->z()), clus->energy(), mhbhe);
50 }
51 
52 double HoECalculator::getHoE(GlobalPoint pclu, float ecalEnergy, const edm::Event& e , const edm::EventSetup& c )
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 }
83 
85  HBHERecHitMetaCollection *mhbhe) {
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 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:43
int i
Definition: DBlmapReader.cc:9
const HBHERecHitCollection * hithbhe_
Definition: HoECalculator.h:48
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
virtual const_iterator find(const DetId &id) const
find by id (default version is very slow unsorted find)
double z() const
z coordinate of cluster centroid
Definition: CaloCluster.h:157
double operator()(const reco::BasicCluster *, const edm::Event &e, const edm::EventSetup &c)
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 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 f[11][100]
double energy() const
cluster energy
Definition: CaloCluster.h:120
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
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
CaloCluster_iterator clustersBegin() const
fist iterator over BasicCluster constituents
Definition: SuperCluster.h:65
tuple cout
Definition: gather_cfg.py:121
double y() const
y coordinate of cluster centroid
Definition: CaloCluster.h:154
bool isValid() const
Definition: ESHandle.h:37
CaloCluster_iterator clustersEnd() const
last iterator over BasicCluster constituents
Definition: SuperCluster.h:68