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 // $Id: EgammaHLTHcalIsolationDoubleCone.cc,v 1.1 2007/05/31 19:38:50 mpieri Exp $
13 //
14 
15 // include files
16 
18 
19 
20 #define PI 3.141592654
21 #define TWOPI 6.283185308
22 
23 
24 
26 
27  float hcalIsol=0.;
28 
29  float candSCphi = recocandidate->superCluster()->phi();
30  float candSCeta = recocandidate->superCluster()->eta();
31  if(candSCphi<0) candSCphi+=TWOPI;
32  float conesizeSquared=conesize*conesize;
33  float exclusionSquared= exclusion*exclusion;
34 
35  for(HBHERecHitCollection::const_iterator hbheItr = hbhe->begin(); hbheItr != hbhe->end(); ++hbheItr){
36  double HcalHit_eta=geometry->getPosition(hbheItr->id()).eta(); //Attention getpos
37  if(fabs(HcalHit_eta-candSCeta)<conesize) {
38  float HcalHit_pth=hbheItr->energy()*sin(2*atan(exp(-HcalHit_eta)));
39  if(HcalHit_pth>ptMin) {
40  double HcalHit_phi=geometry->getPosition(hbheItr->id()).phi();
41  float deltaeta=fabs(HcalHit_eta-candSCeta);
42  if(HcalHit_phi<0) HcalHit_phi+=TWOPI;
43  float deltaphi=fabs(HcalHit_phi-candSCphi);
44  if(deltaphi>TWOPI) deltaphi-=TWOPI;
45  if(deltaphi>PI) deltaphi=TWOPI-deltaphi;
46  float newDelta= (deltaphi*deltaphi+ deltaeta*deltaeta);
47  if(newDelta<conesizeSquared && newDelta>exclusionSquared ) hcalIsol+=HcalHit_pth;
48  }
49  }
50  }
51 
52  for(HFRecHitCollection::const_iterator hfItr = hf->begin(); hfItr != hf->end(); ++hfItr){
53  double HcalHit_eta=geometry->getPosition(hfItr->id()).eta(); //Attention getpos
54  if(fabs(HcalHit_eta-candSCeta)<conesize) {
55  float HcalHit_pth=hfItr->energy()*sin(2*atan(exp(-HcalHit_eta)));
56  if(HcalHit_pth>ptMin) {
57  double HcalHit_phi=geometry->getPosition(hfItr->id()).phi();
58  float deltaeta=fabs(HcalHit_eta-candSCeta);
59  float deltaphi;
60  if(HcalHit_phi<0) HcalHit_phi+=TWOPI;
61  if(candSCphi<0) candSCphi+=TWOPI;
62  deltaphi=fabs(HcalHit_phi-candSCphi);
63  if(deltaphi>TWOPI) deltaphi-=TWOPI;
64  if(deltaphi>PI) deltaphi=TWOPI-deltaphi;
65  float newDelta= (deltaphi*deltaphi+ deltaeta*deltaeta);
66  if(newDelta<conesizeSquared && newDelta>exclusionSquared ) hcalIsol+=HcalHit_pth;
67  }
68  }
69  }
70 
71 
72  return hcalIsol;
73 
74 }
75 
float isolPtSum(const reco::RecoCandidate *recocandidate, const HBHERecHitCollection *hbhe, const HFRecHitCollection *hf, const CaloGeometry *geometry)
#define PI
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
std::vector< T >::const_iterator const_iterator
T eta() const
const GlobalPoint & getPosition(const DetId &id) const
Get the position of a given detector id.
Definition: CaloGeometry.cc:68
const_iterator end() const
ESHandle< TrackerGeometry > geometry
const_iterator begin() const
virtual reco::SuperClusterRef superCluster() const
reference to a SuperCluster
Definition: DDAxes.h:10