CMS 3D CMS Logo

JetToPeakDistance.cc
Go to the documentation of this file.
1 #include <cmath>
2 #include <cassert>
3 
5 
6 namespace fftjetcms {
8  : etaBw_(sqrt(etaToPhiBandwidthRatio)),
9  phiBw_(1.0/etaBw_)
10  {
11  assert(etaToPhiBandwidthRatio > 0.0);
12  }
13 
15  const fftjet::RecombinedJet<VectorLike>& j1,
16  const fftjet::Peak& peak) const
17  {
18  if (peak.membershipFactor() <= 0.0)
19  // This peak essentially does not exist...
20  return 2.0e300;
21 
22  const double deta = (j1.vec().Eta() - peak.eta())/etaBw_;
23  double dphi = j1.vec().Phi() - peak.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  return sqrt(deta*deta + dphi*dphi);
30  }
31 }
double operator()(const fftjet::RecombinedJet< VectorLike > &jet, const fftjet::Peak &peak) const
JetToPeakDistance(double etaToPhiBandwidthRatio=1.0)
T sqrt(T t)
Definition: SSEVec.h:18
#define M_PI