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)), phiBw_(1.0 / etaBw_) {
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
fftjetcms
Definition: AbsPileupCalculator.h:15
cms::cuda::assert
assert(be >=bs)
fftjetcms::JetToPeakDistance::JetToPeakDistance
JetToPeakDistance(double etaToPhiBandwidthRatio=1.0)
Definition: JetToPeakDistance.cc:7
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
JetToPeakDistance.h
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:49
fftjetcms::JetToPeakDistance::operator()
double operator()(const fftjet::RecombinedJet< VectorLike > &jet, const fftjet::Peak &peak) const
Definition: JetToPeakDistance.cc:12
fftjetcms::JetToPeakDistance::etaBw_
double etaBw_
Definition: JetToPeakDistance.h:16
fftjetcommon_cfi.etaToPhiBandwidthRatio
etaToPhiBandwidthRatio
Definition: fftjetcommon_cfi.py:177
fftjetcms::JetToPeakDistance::phiBw_
double phiBw_
Definition: JetToPeakDistance.h:17