CMS 3D CMS Logo

PtIsolationAlgo.h
Go to the documentation of this file.
1 #ifndef IsolationUtils_PtIsolationAlgo_h
2 #define IsolationUtils_PtIsolationAlgo_h
3 /* \class PtIsolationAlgo<T, C>
4  *
5  * \author Francesco Fabozzi, INFN
6  */
8 
9 template <typename T, typename C>
11 public:
12  typedef double value_type;
14  PtIsolationAlgo(double dRMin, double dRMax, double dzMax, double d0Max, double ptMin)
16  double operator()(const T &, const C &) const;
17 
18 private:
20 };
21 
22 template <typename T, typename C>
23 double PtIsolationAlgo<T, C>::operator()(const T &cand, const C &elements) const {
24  double ptSum = 0;
25  double candVz = cand.vz();
26  double candEta = cand.eta();
27  double candPhi = cand.phi();
28  for (typename C::const_iterator elem = elements.begin(); elem != elements.end(); ++elem) {
29  double elemPt = elem->pt();
30  if (elemPt < ptMin_)
31  continue;
32  double elemVx = elem->vx();
33  double elemVy = elem->vy();
34  double elemD0 = sqrt(elemVx * elemVx + elemVy * elemVy);
35  if (elemD0 > d0Max_)
36  continue;
37  double dz = fabs(elem->vz() - candVz);
38  if (dz > dzMax_)
39  continue;
40  double dR = deltaR(elem->eta(), elem->phi(), candEta, candPhi);
41  if ((dR > dRMax_) || (dR < dRMin_))
42  continue;
43  ptSum += elemPt;
44  }
45  return ptSum;
46 }
47 
48 #endif
constexpr float ptMin
PtIsolationAlgo(double dRMin, double dRMax, double dzMax, double d0Max, double ptMin)
constexpr float dzMax
T sqrt(T t)
Definition: SSEVec.h:19
double operator()(const T &, const C &) const
long double T