CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
JetToPeakDistance.cc
Go to the documentation of this file.
1 #include <cmath>
2 #include <cassert>
3 
5 
6 namespace fftjetcms {
7  JetToPeakDistance::JetToPeakDistance(const double etaToPhiBandwidthRatio)
8  : etaBw_(sqrt(etaToPhiBandwidthRatio)), phiBw_(1.0 / etaBw_) {
9  assert(etaToPhiBandwidthRatio > 0.0);
10  }
11 
12  double JetToPeakDistance::operator()(const fftjet::RecombinedJet<VectorLike>& j1, const fftjet::Peak& peak) const {
13  if (peak.membershipFactor() <= 0.0)
14  // This peak essentially does not exist...
15  return 2.0e300;
16 
17  const double deta = (j1.vec().Eta() - peak.eta()) / etaBw_;
18  double dphi = j1.vec().Phi() - peak.phi();
19  if (dphi > M_PI)
20  dphi -= (2.0 * M_PI);
21  else if (dphi < -M_PI)
22  dphi += (2.0 * M_PI);
23  dphi /= phiBw_;
24  return sqrt(deta * deta + dphi * dphi);
25  }
26 } // namespace fftjetcms
double operator()(const fftjet::RecombinedJet< VectorLike > &jet, const fftjet::Peak &peak) const
JetToPeakDistance(double etaToPhiBandwidthRatio=1.0)
assert(be >=bs)
T sqrt(T t)
Definition: SSEVec.h:19
#define M_PI