test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EgammaHLTHcalIsolationDoubleCone.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: EgammaHLTAlgos
4 // Class : EgammaHLTHcalIsolationDoubleCone
5 //
6 // Implementation:
7 // use double cone to exclude shower leakage
8 // mostly identical to EgammaHLTHcalIsolation, but
9 // with an inner exclusion cone
10 // Original Author:
11 // Created: Tue Jun 13 12:16:41 CEST 2006
12 //
13 
14 // include files
15 
17 
18 
19 #define PI 3.141592654
20 #define TWOPI 6.283185308
21 
22 
23 
25 
26  float hcalIsol=0.;
27 
28  float candSCphi = recocandidate->superCluster()->phi();
29  float candSCeta = recocandidate->superCluster()->eta();
30  if(candSCphi<0) candSCphi+=TWOPI;
31  float conesizeSquared=conesize*conesize;
32  float exclusionSquared= exclusion*exclusion;
33 
34  for(HBHERecHitCollection::const_iterator hbheItr = hbhe->begin(); hbheItr != hbhe->end(); ++hbheItr){
35  double HcalHit_eta=geometry->getPosition(hbheItr->id()).eta(); //Attention getpos
36  if(fabs(HcalHit_eta-candSCeta)<conesize) {
37  float HcalHit_pth=hbheItr->energy()*sin(2*atan(exp(-HcalHit_eta)));
38  if(HcalHit_pth>ptMin) {
39  double HcalHit_phi=geometry->getPosition(hbheItr->id()).phi();
40  float deltaeta=fabs(HcalHit_eta-candSCeta);
41  if(HcalHit_phi<0) HcalHit_phi+=TWOPI;
42  float deltaphi=fabs(HcalHit_phi-candSCphi);
43  if(deltaphi>TWOPI) deltaphi-=TWOPI;
44  if(deltaphi>PI) deltaphi=TWOPI-deltaphi;
45  float newDelta= (deltaphi*deltaphi+ deltaeta*deltaeta);
46  if(newDelta<conesizeSquared && newDelta>exclusionSquared ) hcalIsol+=HcalHit_pth;
47  }
48  }
49  }
50 
51  for(HFRecHitCollection::const_iterator hfItr = hf->begin(); hfItr != hf->end(); ++hfItr){
52  double HcalHit_eta=geometry->getPosition(hfItr->id()).eta(); //Attention getpos
53  if(fabs(HcalHit_eta-candSCeta)<conesize) {
54  float HcalHit_pth=hfItr->energy()*sin(2*atan(exp(-HcalHit_eta)));
55  if(HcalHit_pth>ptMin) {
56  double HcalHit_phi=geometry->getPosition(hfItr->id()).phi();
57  float deltaeta=fabs(HcalHit_eta-candSCeta);
58  float deltaphi;
59  if(HcalHit_phi<0) HcalHit_phi+=TWOPI;
60  if(candSCphi<0) candSCphi+=TWOPI;
61  deltaphi=fabs(HcalHit_phi-candSCphi);
62  if(deltaphi>TWOPI) deltaphi-=TWOPI;
63  if(deltaphi>PI) deltaphi=TWOPI-deltaphi;
64  float newDelta= (deltaphi*deltaphi+ deltaeta*deltaeta);
65  if(newDelta<conesizeSquared && newDelta>exclusionSquared ) hcalIsol+=HcalHit_pth;
66  }
67  }
68  }
69 
70 
71  return hcalIsol;
72 
73 }
74 
float isolPtSum(const reco::RecoCandidate *recocandidate, const HBHERecHitCollection *hbhe, const HFRecHitCollection *hf, const CaloGeometry *geometry)
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
std::vector< HBHERecHit >::const_iterator const_iterator
const GlobalPoint & getPosition(const DetId &id) const
Get the position of a given detector id.
Definition: CaloGeometry.cc:70
#define PI
Definition: QcdUeDQM.h:36
const_iterator end() const
ESHandle< TrackerGeometry > geometry
const_iterator begin() const
virtual reco::SuperClusterRef superCluster() const
reference to a SuperCluster