7 #ifndef JETUTIL_JETDISTANCES_H
8 #define JETUTIL_JETDISTANCES_H
17 namespace JetDistances {
20 inline static double fixedPhi(
double aPhi)
22 while ( aPhi < -
M_PI )
34 template<
class PARTICLE>
35 inline static double deltaEta(
const PARTICLE& jet1,
37 {
return jet1.eta() - jet2.eta(); }
39 inline static double deltaEta(
const double eta1,
43 template<
class PARTICLE>
44 inline static double deltaPhi(
const PARTICLE& jet1,
47 return fixedPhi(jet1.phi() - jet2.phi());
51 inline static double deltaPhi(
const double phi1,
54 return fixedPhi( phi1 - phi2 );
58 template<
class PARTICLE>
59 inline static double deltaR2(
const PARTICLE& jet1,
60 const PARTICLE& jet2){
61 return ( deltaEta(jet1,jet2) * deltaEta(jet1,jet2) +
62 deltaPhi(jet1,jet2) * deltaPhi(jet1,jet2) );
65 inline static double deltaR2(
const double eta1,
const double phi1,
66 const double eta2,
const double phi2 ) {
68 deltaPhi(phi1,phi2) * deltaPhi(phi1,phi2) );
71 template<
class PARTICLE>
72 inline static double deltaR(
const PARTICLE& jet1,
73 const PARTICLE& jet2){
74 return sqrt( deltaR2(jet1, jet2) );
77 inline static double deltaR(
const double eta1,
const double phi1,
78 const double eta2,
const double phi2 ) {
79 return sqrt( deltaR2(
eta1, phi1,
eta2, phi2) );