Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:23:32

0001 #ifndef IsolationUtils_TrkCalIsolationAlgo_h
0002 #define IsolationUtils_TrkCalIsolationAlgo_h
0003 /* \class TrkCalIsolationAlgo<T1, C2>
0004  *
0005  * \author Christian Autermann, U Hamburg
0006  */
0007 #include "DataFormats/Math/interface/deltaR.h"
0008 
0009 template <typename T1, typename C2>
0010 class TrkCalIsolationAlgo {
0011 public:
0012   typedef double value_type;
0013   TrkCalIsolationAlgo();
0014   TrkCalIsolationAlgo(double dRMin, double dRMax) : dRMin_(dRMin), dRMax_(dRMax) {}
0015   ~TrkCalIsolationAlgo() {}
0016   double operator()(const T1 &, const C2 &) const;
0017 
0018 private:
0019   double dRMin_, dRMax_;
0020 };
0021 
0022 //This source (track) already has defined outer eta and phi.
0023 //This is the track's end point in the tracker, this should be close
0024 //the tracks entry into the calorimeter.
0025 //A specialized template operator () for tracks in the CalIsolationAlgo class is not
0026 //feasable, since the () operator cannot be overloaded.
0027 template <typename T1, typename C2>
0028 double TrkCalIsolationAlgo<T1, C2>::operator()(const T1 &cand, const C2 &elements) const {
0029   double etSum = 0;
0030   for (typename C2::const_iterator elem = elements.begin(); elem != elements.end(); ++elem) {
0031     double dR = deltaR(elem->eta(), elem->phi(), cand.outerEta(), cand.outerPhi());
0032     if (dR < dRMax_ && dR > dRMin_) {
0033       etSum += elem->et();
0034     }
0035   }
0036   return etSum;
0037 }
0038 
0039 #endif