1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
|
//----------------------------------------------------------------------
// This file distributed with FastJet has been obtained from SpartyJet
// v2.20.0 by Pierre-Antoine Delsart, Kurtis L. Geerlings, Joey
// Huston, Brian T. Martin and Chris Vermilion
// For details, see http://www.pa.msu.edu/~huston/SpartyJet/
// http://projects.hepforge.org/spartyjet/
//
// Changes from the original file are listed below.
//----------------------------------------------------------------------
// History of changes from the original JetDistance.hh file in
// SpartyJet v2.20
//
// 2009-01-15 Gregory Soyez <soyez@fastjet.fr>
//
// * put the code in the fastjet::atlas namespace
#ifndef JETUTIL_JETDISTANCES_H
#define JETUTIL_JETDISTANCES_H
#include "Jet.hh"
#include <cmath>
#include "fastjet/internal/base.hh"
FASTJET_BEGIN_NAMESPACE
namespace atlas {
struct JetDistances {
// distance in eta
inline static double deltaEta(const Jet& jet1, const Jet& jet2)
{ return jet1.eta() - jet2.eta(); }
inline static double deltaEta(const Jet* jet1,
const Jet* jet2)
{ return jet1->eta() - jet2->eta(); }
inline static double deltaEta(const double eta1,
const double eta2)
{ return (eta1 - eta2); }
inline static double deltaPhi(const Jet& jet1,
const Jet& jet2)
{
return fixedPhi(jet1.phi() - jet2.phi());
}
inline static double deltaPhi(const Jet* jet1,
const Jet* jet2)
{
return fixedPhi(jet1->phi()-jet2->phi());
}
inline static double deltaPhi(const double phi1,
const double phi2)
{
return fixedPhi( phi1 - phi2 );
}
// distance in (eta,phi)
inline static double deltaR(const Jet& jet1,
const Jet& jet2)
{ return sqrt( deltaEta(jet1,jet2) * deltaEta(jet1,jet2) +
deltaPhi(jet1,jet2) * deltaPhi(jet1,jet2) ); }
inline static double deltaR(const Jet* jet1,
const Jet* jet2)
{ return sqrt( deltaEta(jet1,jet2) * deltaEta(jet1,jet2) +
deltaPhi(jet1,jet2) * deltaPhi(jet1,jet2) ); }
inline static double deltaR(const double eta1, const double phi1,
const double eta2, const double phi2 )
{ return sqrt( deltaEta(eta1,eta2) * deltaEta(eta1,eta2) +
deltaPhi(phi1,phi2) * deltaPhi(phi1,phi2) ); }
// phi convention enforcement
inline static double fixedPhi(double aPhi)
{
while ( aPhi < -M_PI )
{
aPhi += 2.*M_PI;
}
while ( aPhi > M_PI )
{
aPhi -= 2.*M_PI;
}
return aPhi;
}
};
} // namespace atlas
FASTJET_END_NAMESPACE
#endif
|