CMS 3D CMS Logo

EgammaTowerIsolation.cc

Go to the documentation of this file.
00001 //*****************************************************************************
00002 // File:      EgammaTowerIsolation.cc
00003 // ----------------------------------------------------------------------------
00004 // OrigAuth:  Matthias Mozer
00005 // Institute: IIHE-VUB
00006 //=============================================================================
00007 //*****************************************************************************
00008 //C++ includes
00009 #include <vector>
00010 #include <functional>
00011 #include <math.h>
00012 
00013 //ROOT includes
00014 #include <Math/VectorUtil.h>
00015 
00016 
00017 //CMSSW includes
00018 #include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaTowerIsolation.h"
00019 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
00020 #include "DataFormats/GeometryVector/interface/GlobalVector.h"
00021 #include "DataFormats/RecoCandidate/interface/RecoCandidate.h"
00022 #include "DataFormats/EgammaReco/interface/SuperCluster.h"
00023 #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"
00024 #include "DataFormats/CaloTowers/interface/CaloTower.h"
00025 
00026 using namespace ROOT::Math::VectorUtil ;
00027 
00028 EgammaTowerIsolation::EgammaTowerIsolation (double extRadius,
00029                                       double intRadius,
00030                                       double etLow,
00031                                       const CaloTowerCollection* towercollection)   :
00032   extRadius_(extRadius),
00033   intRadius_(intRadius),
00034   etLow_(etLow),
00035   towercollection_(towercollection)  
00036 {
00037 }
00038 
00039 EgammaTowerIsolation::~EgammaTowerIsolation ()
00040 {
00041 }
00042 
00043 
00044 
00045 // unified acces to isolations
00046 double EgammaTowerIsolation::getTowerEtSum(const reco::Candidate* photon) const  
00047 {
00048   double ptSum =0.;
00049 
00050 
00051   //Take the SC position
00052   reco::SuperClusterRef sc = photon->get<reco::SuperClusterRef>();
00053   math::XYZPoint theCaloPosition = sc.get()->position();
00054   double candEta=sc.get()->eta();
00055   double candPhi=sc.get()->phi();
00056 
00057   //loop over tracks
00058   for(CaloTowerCollection::const_iterator trItr = towercollection_->begin(); trItr != towercollection_->end(); ++trItr){
00059     
00060     double this_pt  = trItr->hadEt();
00061     if ( this_pt < etLow_ ) 
00062       continue ;  
00063     
00064     double towerEta=trItr->eta();
00065     double towerPhi=trItr->phi();
00066     double twoPi= 2*M_PI;
00067     if(towerPhi<0) towerPhi+=twoPi;
00068     if(candPhi<0) candPhi+=twoPi;
00069     double deltaPhi=fabs(towerPhi-candPhi);
00070     if(deltaPhi>twoPi) deltaPhi-=twoPi;
00071     if(deltaPhi>M_PI) deltaPhi=twoPi-deltaPhi;
00072     double deltaEta = towerEta - candEta;
00073 
00074       
00075     double dr = deltaEta*deltaEta + deltaPhi*deltaPhi;
00076     if( dr < extRadius_*extRadius_ &&
00077         dr >= intRadius_*intRadius_ )
00078       {
00079         ptSum += this_pt;
00080       }
00081     
00082   }//end loop over tracks
00083 
00084   return ptSum;
00085 }
00086 

Generated on Tue Jun 9 17:43:25 2009 for CMSSW by  doxygen 1.5.4