CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

EgammaTowerIsolation Class Reference

#include <EgammaTowerIsolation.h>

List of all members.

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

Enumerator:
AllDepths 
Undefined 
Depth1 
Depth2 

Definition at line 29 of file EgammaTowerIsolation.h.


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.

                                                                                    :
  extRadius_(extRadius),
  intRadius_(intRadius),
  etLow_(etLow),
  depth_(depth),
  towercollection_(towercollection)
{
}
EgammaTowerIsolation::~EgammaTowerIsolation ( )

Definition at line 40 of file EgammaTowerIsolation.cc.

{
}

Member Function Documentation

int EgammaTowerIsolation::getNumberTracks ( const reco::Candidate ) const
double EgammaTowerIsolation::getTowerESum ( const reco::SuperCluster sc,
const std::vector< CaloTowerDetId > *  detIdToExclude = 0 
) const

Definition at line 108 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_, Exception, extRadius_, spr::find(), intRadius_, M_PI, reco::CaloCluster::phi(), reco::CaloCluster::position(), funct::sin(), towercollection_, and Geom::twoPi().

{
  math::XYZPoint theCaloPosition = sc->position();
  double candEta=sc->eta();
  double candPhi=sc->phi();
  double eSum =0.;

  //loop over towers
  for(CaloTowerCollection::const_iterator trItr = towercollection_->begin(); trItr != towercollection_->end(); ++trItr){

    // skip the towers to exclude
    if( detIdToExclude ) {
      std::vector<CaloTowerDetId>::const_iterator itcheck=find(detIdToExclude->begin(),detIdToExclude->end(),trItr->id());
      if (itcheck != detIdToExclude->end())
        continue;
    }

    double this_e=0;
    switch(depth_){
    case AllDepths: this_e = trItr->hadEnergy();break;
    case Depth1: this_e = trItr->ietaAbs()<18 || trItr->ietaAbs()>29 ? trItr->hadEnergy() : trItr->hadEnergyHeInnerLayer();break;
    case Depth2: this_e = trItr->hadEnergyHeOuterLayer();break;
    default: throw cms::Exception("Configuration Error") << "EgammaTowerIsolation: Depth " << depth_ << " not known. "; break;
    }

    if ( this_e*sin(trItr->p4().theta()) < etLow_ )
      continue ;

    double towerEta=trItr->eta();
    double towerPhi=trItr->phi();
    double twoPi= 2*M_PI;
    if(towerPhi<0) towerPhi+=twoPi;
    if(candPhi<0) candPhi+=twoPi;
    double deltaPhi=fabs(towerPhi-candPhi);
    if(deltaPhi>twoPi) deltaPhi-=twoPi;
    if(deltaPhi>M_PI) deltaPhi=twoPi-deltaPhi;
    double deltaEta = towerEta - candEta;


    double dr = deltaEta*deltaEta + deltaPhi*deltaPhi;
    if( dr < extRadius_*extRadius_ &&
        dr >= intRadius_*intRadius_ )
      {
        eSum += this_e;
      }

  }//end loop over tracks

  return eSum;
}
double EgammaTowerIsolation::getTowerESum ( const reco::Candidate photon,
const std::vector< CaloTowerDetId > *  detIdToExclude = 0 
) const
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(), Geom::deltaPhi(), Depth1, Depth2, depth_, edm::SortedCollection< T, SORT >::end(), reco::CaloCluster::eta(), etLow_, Exception, extRadius_, spr::find(), intRadius_, M_PI, reco::CaloCluster::phi(), reco::CaloCluster::position(), funct::sin(), towercollection_, and Geom::twoPi().

{
  math::XYZPoint theCaloPosition = sc->position();
  double candEta=sc->eta();
  double candPhi=sc->phi();
  double ptSum =0.;

  //loop over towers
  for(CaloTowerCollection::const_iterator trItr = towercollection_->begin(); trItr != towercollection_->end(); ++trItr){

    // skip the towers to exclude
    if ( detIdToExclude )
     {
      std::vector<CaloTowerDetId>::const_iterator itcheck=find(detIdToExclude->begin(),detIdToExclude->end(),trItr->id());
      if (itcheck != detIdToExclude->end())
              continue;
     }

    double this_pt=0;
    switch(depth_){
    case AllDepths: this_pt = trItr->hadEt();break;
    case Depth1: this_pt = trItr->ietaAbs()<18 || trItr->ietaAbs()>29 ? trItr->hadEt() : trItr->hadEnergyHeInnerLayer()*sin(trItr->p4().theta());break;
    case Depth2: this_pt = trItr->hadEnergyHeOuterLayer()*sin(trItr->p4().theta());break;
    default: throw cms::Exception("Configuration Error") << "EgammaTowerIsolation: Depth " << depth_ << " not known. "; break;
    }

    if ( this_pt < etLow_ )
      continue ;

    double towerEta=trItr->eta();
    double towerPhi=trItr->phi();
    double twoPi= 2*M_PI;
    if(towerPhi<0) towerPhi+=twoPi;
    if(candPhi<0) candPhi+=twoPi;
    double deltaPhi=fabs(towerPhi-candPhi);
    if(deltaPhi>twoPi) deltaPhi-=twoPi;
    if(deltaPhi>M_PI) deltaPhi=twoPi-deltaPhi;
    double deltaEta = towerEta - candEta;

    double dr = deltaEta*deltaEta + deltaPhi*deltaPhi;
    if( dr < extRadius_*extRadius_ &&
        dr >= intRadius_*intRadius_ )
     { ptSum += this_pt ; }

   }//end loop over tracks

  return ptSum ;

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

Definition at line 50 of file EgammaTowerIsolation.h.

Referenced by getTowerESum(), and getTowerEtSum().

Definition at line 51 of file EgammaTowerIsolation.h.

Referenced by getTowerESum(), and getTowerEtSum().

Definition at line 55 of file EgammaTowerIsolation.h.

Referenced by getTowerESum(), and getTowerEtSum().