File indexing completed on 2024-04-06 12:23:32
0001 #ifndef IsolationUtils_TrkCalIsolationAlgo_h
0002 #define IsolationUtils_TrkCalIsolationAlgo_h
0003
0004
0005
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
0023
0024
0025
0026
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