32 #include "fastjet/ClusterSequence.hh" 
   33 #include "fastjet/JadePlugin.hh" 
   36 #include "fastjet/NNH.hh" 
   37 #include "fastjet/NNFJN2Plain.hh" 
   49 FASTJET_BEGIN_NAMESPACE      
 
   75   void init(
const PseudoJet & jet) {
 
   76     double norm = 1.0/sqrt(jet.modp2());
 
   80     rt2E = sqrt(2.0)*jet.E();
 
   83   double distance(
const JadeBriefJet * jet)
 const {
 
   84     double dij = 1 - nx*jet->nx
 
   87     dij *= rt2E*jet->rt2E;
 
   91   double geometrical_distance(
const JadeBriefJet * jet)
 const {
 
   92     double dij = 1 - nx*jet->nx
 
   95     dij *= max(rt2E,jet->rt2E);
 
   99   double momentum_factor()
 const {
 
  103   double beam_distance()
 const {
 
  104     return numeric_limits<double>::max();
 
  107   double geometrical_beam_distance()
 const {
 
  113     const double almost_max = numeric_limits<double>::max() * (1 - 1e-13);
 
  114     if (rt2E>1.0) 
return almost_max / rt2E;
 
  115     else          return almost_max; 
 
  119   double rt2E, nx, ny, nz;
 
  124 string JadePlugin::description ()
 const {
 
  126   desc << 
"e+e- JADE algorithm plugin";
 
  129     desc << 
", using NNH strategy"; 
break;
 
  130   case strategy_NNFJN2Plain:
 
  131     desc << 
", using NNFJN2Plain strategy"; 
break;
 
  133     throw Error(
"Unrecognized strategy in JadePlugin");
 
  182 template<
class N> 
void JadePlugin::_actual_run_clustering(
ClusterSequence & cs)
 const {
 
  184   int njets = cs.
jets().size();
 
  194     double dij = nn.dij_min(i, j);
 
  198       nn.merge_jets(i, j, cs.
jets()[k], k);
 
  200       double diB = cs.
jets()[i].E()*cs.
jets()[i].E(); 
 
  214     _actual_run_clustering<NNH<JadeBriefJet> >(cs);
 
  216   case strategy_NNFJN2Plain:
 
  217     _actual_run_clustering<NNFJN2Plain<JadeBriefJet> >(cs);
 
  220     throw Error(
"Unrecognized strategy in JadePlugin");
 
  225 FASTJET_END_NAMESPACE