EECambridgePlugin.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/EECambridgePlugin.hh"
00034 #include "fastjet/NNH.hh"
00035
00036
00037 #include <sstream>
00038 #include <limits>
00039
00040 FASTJET_BEGIN_NAMESPACE
00041
00042 using namespace std;
00043
00044
00046 class EECamBriefJet {
00047 public:
00048 void init(const PseudoJet & jet) {
00049 double norm = 1.0/sqrt(jet.modp2());
00050 nx = jet.px() * norm;
00051 ny = jet.py() * norm;
00052 nz = jet.pz() * norm;
00053 }
00054
00055 double distance(const EECamBriefJet * jet) const {
00056 double dij = 1 - nx*jet->nx
00057 - ny*jet->ny
00058 - nz*jet->nz;
00059 return dij;
00060 }
00061
00062 double beam_distance() const {
00063 return numeric_limits<double>::max();
00064 }
00065
00066 private:
00067 double nx, ny, nz;
00068 };
00069
00070
00071 string EECambridgePlugin::description () const {
00072 ostringstream desc;
00073 desc << "EECambridge plugin with ycut = " << ycut() ;
00074 return desc.str();
00075 }
00076
00077 void EECambridgePlugin::run_clustering(ClusterSequence & cs) const {
00078 int njets = cs.jets().size();
00079 NNH<EECamBriefJet> nnh(cs.jets());
00080
00081 double Q2 = cs.Q2();
00082
00083 while (njets > 0) {
00084 int i, j, k;
00085
00086
00087
00088 double vij = nnh.dij_min(i, j);
00089
00090
00091
00092
00093 double dij;
00094 if (j >= 0) {
00095 double scale = min(cs.jets()[i].E(), cs.jets()[j].E());
00096 dij = 2 * vij * scale * scale;
00097 if (dij > Q2 * ycut()) {
00098
00099 if (cs.jets()[i].E() > cs.jets()[j].E()) swap(i,j);
00100 j = -1;
00101 }
00102 } else {
00103
00104 dij = Q2;
00105 }
00106
00107 if (j >= 0) {
00108 cs.plugin_record_ij_recombination(i, j, dij, k);
00109 nnh.merge_jets(i, j, cs.jets()[k], k);
00110 } else {
00111 cs.plugin_record_iB_recombination(i, dij);
00112 nnh.remove_jet(i);
00113 }
00114 njets--;
00115 }
00116
00117 }
00118
00119 FASTJET_END_NAMESPACE