CMS 3D CMS Logo

JetConvergenceDistance.cc
Go to the documentation of this file.
1 #include <cmath>
2 #include <cassert>
3 
5 
6 namespace fftjetcms {
8  : etaBw_(sqrt(etaToPhiBandwidthRatio)), phiBw_(1.0 / etaBw_), ptBw_(relativePtBandwidth) {
11  }
12 
13  double JetConvergenceDistance::operator()(const fftjet::RecombinedJet<VectorLike>& j1,
14  const fftjet::RecombinedJet<VectorLike>& j2) const {
15  const double deta = (j1.vec().Eta() - j2.vec().Eta()) / etaBw_;
16  double dphi = j1.vec().Phi() - j2.vec().Phi();
17  if (dphi > M_PI)
18  dphi -= (2.0 * M_PI);
19  else if (dphi < -M_PI)
20  dphi += (2.0 * M_PI);
21  dphi /= phiBw_;
22  const double mag1 = j1.magnitude();
23  const double mag2 = j2.magnitude();
24  double dmag = 0.0;
25  if (mag1 > 0.0 || mag2 > 0.0)
26  dmag = 2.0 * (mag1 - mag2) / (mag1 + mag2) / ptBw_;
27  return sqrt(deta * deta + dphi * dphi + dmag * dmag);
28  }
29 } // namespace fftjetcms
assert(be >=bs)
double operator()(const fftjet::RecombinedJet< VectorLike > &jet1, const fftjet::RecombinedJet< VectorLike > &jet2) const override
T sqrt(T t)
Definition: SSEVec.h:23
#define M_PI
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)