fastjet 2.4.5
|
00001 // file taken from SpartyJet v2.20.0 00002 00003 #ifndef JETUTIL_JETDISTANCES_H 00004 #define JETUTIL_JETDISTANCES_H 00005 00006 00007 #include "Jet.hh" 00008 00009 #include <cmath> 00010 00011 #include <fastjet/internal/base.hh> 00012 00013 FASTJET_BEGIN_NAMESPACE 00014 00015 namespace atlas { 00016 00017 struct JetDistances { 00018 00019 00020 // distance in eta 00021 inline static double deltaEta(const Jet& jet1, const Jet& jet2) 00022 { return jet1.eta() - jet2.eta(); } 00023 inline static double deltaEta(const Jet* jet1, 00024 const Jet* jet2) 00025 { return jet1->eta() - jet2->eta(); } 00026 inline static double deltaEta(const double eta1, 00027 const double eta2) 00028 { return (eta1 - eta2); } 00029 00030 00031 00032 inline static double deltaPhi(const Jet& jet1, 00033 const Jet& jet2) 00034 { 00035 return fixedPhi(jet1.phi() - jet2.phi()); 00036 } 00037 inline static double deltaPhi(const Jet* jet1, 00038 const Jet* jet2) 00039 { 00040 return fixedPhi(jet1->phi()-jet2->phi()); 00041 } 00042 inline static double deltaPhi(const double phi1, 00043 const double phi2) 00044 { 00045 return fixedPhi( phi1 - phi2 ); 00046 } 00047 00048 00049 // distance in (eta,phi) 00050 inline static double deltaR(const Jet& jet1, 00051 const Jet& jet2) 00052 { return sqrt( deltaEta(jet1,jet2) * deltaEta(jet1,jet2) + 00053 deltaPhi(jet1,jet2) * deltaPhi(jet1,jet2) ); } 00054 inline static double deltaR(const Jet* jet1, 00055 const Jet* jet2) 00056 { return sqrt( deltaEta(jet1,jet2) * deltaEta(jet1,jet2) + 00057 deltaPhi(jet1,jet2) * deltaPhi(jet1,jet2) ); } 00058 00059 inline static double deltaR(const double eta1, const double phi1, 00060 const double eta2, const double phi2 ) 00061 { return sqrt( deltaEta(eta1,eta2) * deltaEta(eta1,eta2) + 00062 deltaPhi(phi1,phi2) * deltaPhi(phi1,phi2) ); } 00063 00064 00065 00066 // phi convention enforcement 00067 inline static double fixedPhi(double aPhi) 00068 { 00069 while ( aPhi < -M_PI ) 00070 { 00071 aPhi += 2.*M_PI; 00072 } 00073 while ( aPhi > M_PI ) 00074 { 00075 aPhi -= 2.*M_PI; 00076 } 00077 return aPhi; 00078 } 00079 00080 }; 00081 00082 } // namespace atlas 00083 00084 FASTJET_END_NAMESPACE 00085 #endif