CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ElectronHcalHelper.cc
Go to the documentation of this file.
1 
8 
9 using namespace reco ;
10 
12  : cfg_(cfg), caloGeomCacheId_(0), hbhe_(0), mhbhe_(0), hcalIso_(0), towersH_(0), towerIso1_(0), towerIso2_(0)
13  {}
14 
16  {
17  if (cfg_.hOverEConeSize==0)
18  { return ; }
19 
20  if (!cfg_.useTowers)
21  {
22  unsigned long long newCaloGeomCacheId_
23  = es.get<CaloGeometryRecord>().cacheIdentifier() ;
24  if (caloGeomCacheId_!=newCaloGeomCacheId_)
25  {
26  caloGeomCacheId_ = newCaloGeomCacheId_ ;
27  es.get<CaloGeometryRecord>().get(caloGeom_) ;
28  }
29  }
30  }
31 
33  {
34  if (cfg_.hOverEConeSize==0)
35  { return ; }
36 
37  if (cfg_.useTowers)
38  {
39  delete towerIso1_ ; towerIso1_ = 0 ;
40  delete towerIso2_ ; towerIso2_ = 0 ;
41  delete towersH_ ; towersH_ = 0 ;
42 
45  { edm::LogError("ElectronHcalHelper::readEvent")<<"failed to get the hcal towers of label "<<cfg_.hcalTowers ; }
48  }
49  else
50  {
51  delete hcalIso_ ; hcalIso_ = 0 ;
52  delete mhbhe_ ; mhbhe_ = 0 ;
53  delete hbhe_ ; hbhe_ = 0 ;
54 
56  if (!evt.getByLabel(cfg_.hcalRecHits,*hbhe_))
57  { edm::LogError("ElectronHcalHelper::readEvent")<<"failed to get the rechits of label "<<cfg_.hcalRecHits ; }
60  }
61  }
62 
64  {
65  if (cfg_.hOverEConeSize==0)
66  { return 0 ; }
67  if (cfg_.useTowers)
68  { return(hcalESumDepth1(sc)+hcalESumDepth2(sc)) ; }
69  else
70  { return hcalIso_->getHcalESum(&sc) ; }
71  }
72 
74  {
75  if (cfg_.hOverEConeSize==0)
76  { return 0 ; }
77  if (cfg_.useTowers)
78  { return towerIso1_->getTowerESum(&sc) ; }
79  else
80  { return hcalIso_->getHcalESumDepth1(&sc) ; }
81  }
82 
84  {
85  if (cfg_.hOverEConeSize==0)
86  { return 0 ; }
87  if (cfg_.useTowers)
88  { return towerIso2_->getTowerESum(&sc) ; }
89  else
90  { return hcalIso_->getHcalESumDepth2(&sc) ; }
91  }
92 
94  {
95  if (cfg_.hOverEConeSize==0)
96  { return ; }
97  if (cfg_.useTowers)
98  {
99  delete towerIso1_ ;
100  delete towerIso2_ ;
101  delete towersH_ ;
102  }
103  else
104  {
105  delete hcalIso_ ;
106  delete mhbhe_ ;
107  delete hbhe_ ;
108  }
109  }
110 
111 
double hcalESumDepth2(const reco::SuperCluster &)
EgammaTowerIsolation * towerIso1_
double getTowerESum(const reco::Candidate *) const
edm::Handle< HBHERecHitCollection > * hbhe_
edm::Handle< CaloTowerCollection > * towersH_
void checkSetup(const edm::EventSetup &)
const Configuration cfg_
return((rh^lh)&mask)
ElectronHcalHelper(const Configuration &)
void readEvent(edm::Event &)
edm::ESHandle< CaloGeometry > caloGeom_
double hcalESum(const reco::SuperCluster &)
double getHcalESumDepth2(const reco::Candidate *c) const
SimpleCaloRecHitMetaCollection< HBHERecHitCollection > HBHERecHitMetaCollection
unsigned long long caloGeomCacheId_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
const T & get() const
Definition: EventSetup.h:55
EgammaHcalIsolation * hcalIso_
double getHcalESum(const reco::Candidate *c) const
HBHERecHitMetaCollection * mhbhe_
double getHcalESumDepth1(const reco::Candidate *c) const
EgammaTowerIsolation * towerIso2_
double hcalESumDepth1(const reco::SuperCluster &)