Go to the documentation of this file.00001 #ifndef IsolationUtils_TrkCalIsolationAlgo_h
00002 #define IsolationUtils_TrkCalIsolationAlgo_h
00003
00004
00005
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
00023
00024
00025
00026
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