CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
JetConvergenceDistance.cc
Go to the documentation of this file.
1 #include <cmath>
2 #include <cassert>
3 
5 
6 namespace fftjetcms {
8  const double etaToPhiBandwidthRatio,
9  const double relativePtBandwidth)
10  : etaBw_(sqrt(etaToPhiBandwidthRatio)),
11  phiBw_(1.0/etaBw_),
12  ptBw_(relativePtBandwidth)
13  {
14  assert(etaToPhiBandwidthRatio > 0.0);
15  assert(relativePtBandwidth > 0.0);
16  }
17 
19  const fftjet::RecombinedJet<VectorLike>& j1,
20  const fftjet::RecombinedJet<VectorLike>& j2) const
21  {
22  const double deta = (j1.vec().Eta() - j2.vec().Eta())/etaBw_;
23  double dphi = j1.vec().Phi() - j2.vec().Phi();
24  if (dphi > M_PI)
25  dphi -= (2.0*M_PI);
26  else if (dphi < -M_PI)
27  dphi += (2.0*M_PI);
28  dphi /= phiBw_;
29  const double mag1 = j1.magnitude();
30  const double mag2 = j2.magnitude();
31  double dmag = 0.0;
32  if (mag1 > 0.0 || mag2 > 0.0)
33  dmag = 2.0*(mag1 - mag2)/(mag1 + mag2)/ptBw_;
34  return sqrt(deta*deta + dphi*dphi + dmag*dmag);
35  }
36 }
T sqrt(T t)
Definition: SSEVec.h:46
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
#define M_PI
Definition: BFit3D.cc:3
double operator()(const fftjet::RecombinedJet< VectorLike > &jet1, const fftjet::RecombinedJet< VectorLike > &jet2) const