JadePlugin.cc
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #include "fastjet/ClusterSequence.hh"
00033 #include "fastjet/JadePlugin.hh"
00034 #include <iostream>
00035
00036 #include "fastjet/NNH.hh"
00037
00038
00039 #include <vector>
00040 #include <sstream>
00041 #include <limits>
00042
00043
00044
00045
00046 using namespace std;
00047
00048 FASTJET_BEGIN_NAMESPACE
00049
00050
00051
00053 class JadeBriefJet {
00054 public:
00055 void init(const PseudoJet & jet) {
00056 double norm = 1.0/sqrt(jet.modp2());
00057 nx = jet.px() * norm;
00058 ny = jet.py() * norm;
00059 nz = jet.pz() * norm;
00060 rt2E = sqrt(2.0)*jet.E();
00061 }
00062
00063 double distance(const JadeBriefJet * jet) const {
00064 double dij = 1 - nx*jet->nx
00065 - ny*jet->ny
00066 - nz*jet->nz;
00067 dij *= rt2E*jet->rt2E;
00068 return dij;
00069 }
00070
00071 double beam_distance() const {
00072 return numeric_limits<double>::max();
00073 }
00074
00075 private:
00076 double rt2E, nx, ny, nz;
00077 };
00078
00079
00080
00081 string JadePlugin::description () const {
00082 ostringstream desc;
00083 desc << "e+e- JADE algorithm plugin";
00084 return desc.str();
00085 }
00086
00087
00088 void JadePlugin::run_clustering(ClusterSequence & cs) const {
00089 int njets = cs.jets().size();
00090 NNH<JadeBriefJet> nnh(cs.jets());
00091
00092
00093
00094
00095
00096 while (njets > 0) {
00097 int i, j, k;
00098 double dij = nnh.dij_min(i, j);
00099
00100 if (j >= 0) {
00101 cs.plugin_record_ij_recombination(i, j, dij, k);
00102 nnh.merge_jets(i, j, cs.jets()[k], k);
00103 } else {
00104 double diB = cs.jets()[i].E()*cs.jets()[i].E();
00105 cs.plugin_record_iB_recombination(i, diB);
00106 nnh.remove_jet(i);
00107 }
00108 njets--;
00109 }
00110 }
00111
00112 FASTJET_END_NAMESPACE