CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/PhysicsTools/IsolationUtils/interface/TrkCalIsolationAlgo.h

Go to the documentation of this file.
00001 #ifndef IsolationUtils_TrkCalIsolationAlgo_h
00002 #define IsolationUtils_TrkCalIsolationAlgo_h
00003 /* \class TrkCalIsolationAlgo<T1, C2>
00004  *
00005  * \author Christian Autermann, U Hamburg
00006  */
00007 #include "DataFormats/Math/interface/deltaR.h"
00008 
00009 template <typename T1, typename C2>
00010 class TrkCalIsolationAlgo {
00011 public:
00012   typedef double value_type;
00013   TrkCalIsolationAlgo( );
00014   TrkCalIsolationAlgo( double dRMin, double dRMax) : dRMin_( dRMin ), dRMax_( dRMax ) { }
00015   ~TrkCalIsolationAlgo() { } 
00016   double operator()(const T1 &, const C2 &) const;
00017 
00018 private:
00019   double dRMin_, dRMax_;
00020 };
00021 
00022 //This source (track) already has defined outer eta and phi. 
00023 //This is the track's end point in the tracker, this should be close
00024 //the tracks entry into the calorimeter.
00025 //A specialized template operator () for tracks in the CalIsolationAlgo class is not
00026 //feasable, since the () operator cannot be overloaded.
00027 template <typename T1, typename C2> double TrkCalIsolationAlgo<T1,C2>::
00028 operator()(const T1 & cand, const C2 & elements) const {
00029   double etSum = 0;
00030   for( typename C2::const_iterator elem = elements.begin(); 
00031        elem != elements.end(); ++elem ) {
00032     double dR = deltaR( elem->eta(), elem->phi(), 
00033                         cand.outerEta(), cand.outerPhi() );
00034     if ( dR < dRMax_ && dR > dRMin_ ) {
00035       etSum += elem->et();
00036     }
00037   }
00038   return etSum;
00039 }
00040 
00041 #endif