CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
EgammaTowerIsolation Class Reference

#include <EgammaTowerIsolation.h>

Public Types

enum  HcalDepth { AllDepths =-1, Undefined =0, Depth1 =1, Depth2 =2 }
 

Public Member Functions

 EgammaTowerIsolation (double extRadius, double intRadius, double etLow, signed int depth, const CaloTowerCollection *)
 
int getNumberTracks (const reco::Candidate *) const
 
double getTowerESum (const reco::Candidate *) const
 
double getTowerESum (const reco::SuperCluster *) const
 
double getTowerEtSum (const reco::Candidate *) const
 
double getTowerEtSum (const reco::SuperCluster *) const
 
 ~EgammaTowerIsolation ()
 

Private Attributes

signed int depth_
 
double etLow_
 
double extRadius_
 
double intRadius_
 
const CaloTowerCollectiontowercollection_
 

Detailed Description

Definition at line 25 of file EgammaTowerIsolation.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

EgammaTowerIsolation::EgammaTowerIsolation ( double  extRadius,
double  intRadius,
double  etLow,
signed int  depth,
const CaloTowerCollection towercollection 
)

Definition at line 27 of file EgammaTowerIsolation.cc.

31  :
32  extRadius_(extRadius),
33  intRadius_(intRadius),
34  etLow_(etLow),
35  depth_(depth),
36  towercollection_(towercollection)
37 {
38 }
const CaloTowerCollection * towercollection_
EgammaTowerIsolation::~EgammaTowerIsolation ( )

Definition at line 40 of file EgammaTowerIsolation.cc.

41 {
42 }

Member Function Documentation

int EgammaTowerIsolation::getNumberTracks ( const reco::Candidate ) const
double EgammaTowerIsolation::getTowerESum ( const reco::Candidate photon) const
double EgammaTowerIsolation::getTowerESum ( const reco::SuperCluster sc) const

Definition at line 102 of file EgammaTowerIsolation.cc.

References AllDepths, edm::SortedCollection< T, SORT >::begin(), Geom::deltaPhi(), Depth1, Depth2, depth_, edm::SortedCollection< T, SORT >::end(), reco::CaloCluster::eta(), etLow_, edm::hlt::Exception, extRadius_, intRadius_, M_PI, reco::CaloCluster::phi(), reco::CaloCluster::position(), funct::sin(), towercollection_, and Geom::twoPi().

103 {
104  math::XYZPoint theCaloPosition = sc->position();
105  double candEta=sc->eta();
106  double candPhi=sc->phi();
107  double eSum =0.;
108 
109  //loop over tracks
110  for(CaloTowerCollection::const_iterator trItr = towercollection_->begin(); trItr != towercollection_->end(); ++trItr){
111 
112  double this_e=0;
113  switch(depth_){
114  case AllDepths: this_e = trItr->hadEnergy();break;
115  case Depth1: this_e = trItr->ietaAbs()<18 || trItr->ietaAbs()>29 ? trItr->hadEnergy() : trItr->hadEnergyHeInnerLayer();break;
116  case Depth2: this_e = trItr->hadEnergyHeOuterLayer();break;
117  default: throw cms::Exception("Configuration Error") << "EgammaTowerIsolation: Depth " << depth_ << " not known. "; break;
118  }
119 
120  if ( this_e*sin(trItr->p4().theta()) < etLow_ )
121  continue ;
122 
123  double towerEta=trItr->eta();
124  double towerPhi=trItr->phi();
125  double twoPi= 2*M_PI;
126  if(towerPhi<0) towerPhi+=twoPi;
127  if(candPhi<0) candPhi+=twoPi;
128  double deltaPhi=fabs(towerPhi-candPhi);
129  if(deltaPhi>twoPi) deltaPhi-=twoPi;
130  if(deltaPhi>M_PI) deltaPhi=twoPi-deltaPhi;
131  double deltaEta = towerEta - candEta;
132 
133 
134  double dr = deltaEta*deltaEta + deltaPhi*deltaPhi;
135  if( dr < extRadius_*extRadius_ &&
136  dr >= intRadius_*intRadius_ )
137  {
138  eSum += this_e;
139  }
140 
141  }//end loop over tracks
142 
143  return eSum;
144 }
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:123
double deltaPhi(float phi1, float phi2)
Definition: VectorUtil.h:30
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
std::vector< CaloTower >::const_iterator const_iterator
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:160
const_iterator end() const
#define M_PI
Definition: BFit3D.cc:3
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:13
const CaloTowerCollection * towercollection_
double twoPi()
Definition: Pi.h:32
double phi() const
azimuthal angle of cluster centroid
Definition: CaloCluster.h:163
const_iterator begin() const
double EgammaTowerIsolation::getTowerEtSum ( const reco::Candidate photon) const

Definition at line 47 of file EgammaTowerIsolation.cc.

References reco::Candidate::get(), and edm::Ref< C, T, F >::get().

Referenced by PhotonIsolationCalculator::calculateHcalTowerIso(), and GsfElectronAlgo::createElectron().

48 {
49  return getTowerEtSum( photon->get<reco::SuperClusterRef>().get() );
50 }
T get() const
get a component
Definition: Candidate.h:217
double getTowerEtSum(const reco::Candidate *) const
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:241
double EgammaTowerIsolation::getTowerEtSum ( const reco::SuperCluster sc) const

Definition at line 52 of file EgammaTowerIsolation.cc.

References AllDepths, edm::SortedCollection< T, SORT >::begin(), Geom::deltaPhi(), Depth1, Depth2, depth_, edm::SortedCollection< T, SORT >::end(), reco::CaloCluster::eta(), etLow_, edm::hlt::Exception, extRadius_, intRadius_, M_PI, reco::CaloCluster::phi(), reco::CaloCluster::position(), funct::sin(), towercollection_, and Geom::twoPi().

53 {
54  math::XYZPoint theCaloPosition = sc->position();
55  double candEta=sc->eta();
56  double candPhi=sc->phi();
57  double ptSum =0.;
58 
59  //loop over tracks
61 
62  double this_pt=0;
63  switch(depth_){
64  case AllDepths: this_pt = trItr->hadEt();break;
65  case Depth1: this_pt = trItr->ietaAbs()<18 || trItr->ietaAbs()>29 ? trItr->hadEt() : trItr->hadEnergyHeInnerLayer()*sin(trItr->p4().theta());break;
66  case Depth2: this_pt = trItr->hadEnergyHeOuterLayer()*sin(trItr->p4().theta());break;
67  default: throw cms::Exception("Configuration Error") << "EgammaTowerIsolation: Depth " << depth_ << " not known. "; break;
68  }
69 
70  if ( this_pt < etLow_ )
71  continue ;
72 
73  double towerEta=trItr->eta();
74  double towerPhi=trItr->phi();
75  double twoPi= 2*M_PI;
76  if(towerPhi<0) towerPhi+=twoPi;
77  if(candPhi<0) candPhi+=twoPi;
78  double deltaPhi=fabs(towerPhi-candPhi);
79  if(deltaPhi>twoPi) deltaPhi-=twoPi;
80  if(deltaPhi>M_PI) deltaPhi=twoPi-deltaPhi;
81  double deltaEta = towerEta - candEta;
82 
83 
84  double dr = deltaEta*deltaEta + deltaPhi*deltaPhi;
85  if( dr < extRadius_*extRadius_ &&
86  dr >= intRadius_*intRadius_ )
87  {
88  ptSum += this_pt;
89  }
90 
91  }//end loop over tracks
92 
93  return ptSum;
94 }
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:123
double deltaPhi(float phi1, float phi2)
Definition: VectorUtil.h:30
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
std::vector< CaloTower >::const_iterator const_iterator
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:160
const_iterator end() const
#define M_PI
Definition: BFit3D.cc:3
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:13
const CaloTowerCollection * towercollection_
double twoPi()
Definition: Pi.h:32
double phi() const
azimuthal angle of cluster centroid
Definition: CaloCluster.h:163
const_iterator begin() const

Member Data Documentation

signed int EgammaTowerIsolation::depth_
private

Definition at line 52 of file EgammaTowerIsolation.h.

Referenced by getTowerESum(), and getTowerEtSum().

double EgammaTowerIsolation::etLow_
private

Definition at line 51 of file EgammaTowerIsolation.h.

Referenced by getTowerESum(), and getTowerEtSum().

double EgammaTowerIsolation::extRadius_
private

Definition at line 49 of file EgammaTowerIsolation.h.

Referenced by getTowerESum(), and getTowerEtSum().

double EgammaTowerIsolation::intRadius_
private

Definition at line 50 of file EgammaTowerIsolation.h.

Referenced by getTowerESum(), and getTowerEtSum().

const CaloTowerCollection* EgammaTowerIsolation::towercollection_
private

Definition at line 54 of file EgammaTowerIsolation.h.

Referenced by getTowerESum(), and getTowerEtSum().