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 std::vector< CaloTowerDetId > *detIdToExclude=0) const
 
double getTowerESum (const reco::SuperCluster *, const std::vector< CaloTowerDetId > *detIdToExclude=0) const
 
double getTowerEtSum (const reco::Candidate *, const std::vector< CaloTowerDetId > *detIdToExclude=0) const
 
double getTowerEtSum (const reco::SuperCluster *, const std::vector< CaloTowerDetId > *detIdToExclude=0) const
 
 ~EgammaTowerIsolation ()
 

Private Attributes

signed int depth_
 
double etLow_
 
double extRadius_
 
double intRadius_
 
const CaloTowerCollectiontowercollection_
 

Detailed Description

Definition at line 26 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 std::vector< CaloTowerDetId > *  detIdToExclude = 0 
) const

Definition at line 102 of file EgammaTowerIsolation.cc.

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

Referenced by ConvertedPhotonProducer::buildCollections(), ConversionTrackCandidateProducer::buildCollections(), PhotonProducer::fillPhotonCollection(), ElectronHcalHelper::hcalESumDepth1(), and ElectronHcalHelper::hcalESumDepth2().

103 {
104  return getTowerESum( photon->get<reco::SuperClusterRef>().get(), detIdToExclude );
105 }
double getTowerESum(const reco::Candidate *, const std::vector< CaloTowerDetId > *detIdToExclude=0) const
T get() const
get a component
Definition: Candidate.h:216
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:242
double EgammaTowerIsolation::getTowerESum ( const reco::SuperCluster sc,
const std::vector< CaloTowerDetId > *  detIdToExclude = 0 
) const

Definition at line 107 of file EgammaTowerIsolation.cc.

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

108 {
109  double candEta=sc->eta();
110  double candPhi=sc->phi();
111  double eSum =0.;
112 
113  //loop over towers
114  for(CaloTowerCollection::const_iterator trItr = towercollection_->begin(); trItr != towercollection_->end(); ++trItr){
115 
116  // skip the towers to exclude
117  if( detIdToExclude ) {
118  std::vector<CaloTowerDetId>::const_iterator itcheck=find(detIdToExclude->begin(),detIdToExclude->end(),trItr->id());
119  if (itcheck != detIdToExclude->end())
120  continue;
121  }
122 
123  double this_e=0;
124  switch(depth_){
125  case AllDepths: this_e = trItr->hadEnergy();break;
126  case Depth1: this_e = trItr->ietaAbs()<18 || trItr->ietaAbs()>29 ? trItr->hadEnergy() : trItr->hadEnergyHeInnerLayer();break;
127  case Depth2: this_e = trItr->hadEnergyHeOuterLayer();break;
128  default: throw cms::Exception("Configuration Error") << "EgammaTowerIsolation: Depth " << depth_ << " not known. "; break;
129  }
130 
131  if ( this_e*sin(trItr->p4().theta()) < etLow_ )
132  continue ;
133 
134  double towerEta=trItr->eta();
135  double towerPhi=trItr->phi();
136  double twoPi= 2*M_PI;
137  if(towerPhi<0) towerPhi+=twoPi;
138  if(candPhi<0) candPhi+=twoPi;
139  double deltaPhi=fabs(towerPhi-candPhi);
140  if(deltaPhi>twoPi) deltaPhi-=twoPi;
141  if(deltaPhi>M_PI) deltaPhi=twoPi-deltaPhi;
142  double deltaEta = towerEta - candEta;
143 
144 
145  double dr = deltaEta*deltaEta + deltaPhi*deltaPhi;
146  if( dr < extRadius_*extRadius_ &&
147  dr >= intRadius_*intRadius_ )
148  {
149  eSum += this_e;
150  }
151 
152  }//end loop over tracks
153 
154  return eSum;
155 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
std::vector< CaloTower >::const_iterator const_iterator
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:160
const_iterator end() const
#define M_PI
Definition: BFit3D.cc:3
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 std::vector< CaloTowerDetId > *  detIdToExclude = 0 
) const

Definition at line 47 of file EgammaTowerIsolation.cc.

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

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

48 {
49  return getTowerEtSum( photon->get<reco::SuperClusterRef>().get(), detIdToExclude );
50 }
double getTowerEtSum(const reco::Candidate *, const std::vector< CaloTowerDetId > *detIdToExclude=0) const
T get() const
get a component
Definition: Candidate.h:216
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:242
double EgammaTowerIsolation::getTowerEtSum ( const reco::SuperCluster sc,
const std::vector< CaloTowerDetId > *  detIdToExclude = 0 
) const

Definition at line 52 of file EgammaTowerIsolation.cc.

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

53 {
54  double candEta=sc->eta();
55  double candPhi=sc->phi();
56  double ptSum =0.;
57 
58  //loop over towers
60 
61  // skip the towers to exclude
62  if ( detIdToExclude )
63  {
64  std::vector<CaloTowerDetId>::const_iterator itcheck=find(detIdToExclude->begin(),detIdToExclude->end(),trItr->id());
65  if (itcheck != detIdToExclude->end())
66  continue;
67  }
68 
69  double this_pt=0;
70  switch(depth_){
71  case AllDepths: this_pt = trItr->hadEt();break;
72  case Depth1: this_pt = trItr->ietaAbs()<18 || trItr->ietaAbs()>29 ? trItr->hadEt() : trItr->hadEnergyHeInnerLayer()*sin(trItr->p4().theta());break;
73  case Depth2: this_pt = trItr->hadEnergyHeOuterLayer()*sin(trItr->p4().theta());break;
74  default: throw cms::Exception("Configuration Error") << "EgammaTowerIsolation: Depth " << depth_ << " not known. "; break;
75  }
76 
77  if ( this_pt < etLow_ )
78  continue ;
79 
80  double towerEta=trItr->eta();
81  double towerPhi=trItr->phi();
82  double twoPi= 2*M_PI;
83  if(towerPhi<0) towerPhi+=twoPi;
84  if(candPhi<0) candPhi+=twoPi;
85  double deltaPhi=fabs(towerPhi-candPhi);
86  if(deltaPhi>twoPi) deltaPhi-=twoPi;
87  if(deltaPhi>M_PI) deltaPhi=twoPi-deltaPhi;
88  double deltaEta = towerEta - candEta;
89 
90  double dr = deltaEta*deltaEta + deltaPhi*deltaPhi;
91  if( dr < extRadius_*extRadius_ &&
92  dr >= intRadius_*intRadius_ )
93  { ptSum += this_pt ; }
94 
95  }//end loop over tracks
96 
97  return ptSum ;
98 
99  }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
std::vector< CaloTower >::const_iterator const_iterator
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:160
const_iterator end() const
#define M_PI
Definition: BFit3D.cc:3
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 53 of file EgammaTowerIsolation.h.

Referenced by getTowerESum(), and getTowerEtSum().

double EgammaTowerIsolation::etLow_
private

Definition at line 52 of file EgammaTowerIsolation.h.

Referenced by getTowerESum(), and getTowerEtSum().

double EgammaTowerIsolation::extRadius_
private

Definition at line 50 of file EgammaTowerIsolation.h.

Referenced by getTowerESum(), and getTowerEtSum().

double EgammaTowerIsolation::intRadius_
private

Definition at line 51 of file EgammaTowerIsolation.h.

Referenced by getTowerESum(), and getTowerEtSum().

const CaloTowerCollection* EgammaTowerIsolation::towercollection_
private

Definition at line 55 of file EgammaTowerIsolation.h.

Referenced by getTowerESum(), and getTowerEtSum().