fastjet 2.4.5
|
00001 //STARTHEADER 00002 // $Id: JadePlugin.cc 1491 2009-03-11 17:04:38Z salam $ 00003 // 00004 // Copyright (c) 2007-2009, Matteo Cacciari, Gavin Salam and Gregory Soyez 00005 // 00006 //---------------------------------------------------------------------- 00007 // This file is part of FastJet. 00008 // 00009 // FastJet is free software; you can redistribute it and/or modify 00010 // it under the terms of the GNU General Public License as published by 00011 // the Free Software Foundation; either version 2 of the License, or 00012 // (at your option) any later version. 00013 // 00014 // The algorithms that underlie FastJet have required considerable 00015 // development and are described in hep-ph/0512210. If you use 00016 // FastJet as part of work towards a scientific publication, please 00017 // include a citation to the FastJet paper. 00018 // 00019 // FastJet is distributed in the hope that it will be useful, 00020 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00021 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00022 // GNU General Public License for more details. 00023 // 00024 // You should have received a copy of the GNU General Public License 00025 // along with FastJet; if not, write to the Free Software 00026 // Foundation, Inc.: 00027 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00028 //---------------------------------------------------------------------- 00029 //ENDHEADER 00030 00031 // fastjet stuff 00032 #include "fastjet/ClusterSequence.hh" 00033 #include "fastjet/JadePlugin.hh" 00034 #include <iostream> 00035 //#include "fastjet/internal/ClusterSequence_N2.icc" 00036 #include "fastjet/NNH.hh" 00037 00038 // other stuff 00039 #include <vector> 00040 #include <sstream> 00041 #include <limits> 00042 00043 00044 00045 00046 using namespace std; 00047 00048 FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh 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 // if testing against Hoeth's implementation, need to rescale the 00093 // dij by Q^2. 00094 //double Q2 = cs.Q2(); 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(); // get new diB 00105 cs.plugin_record_iB_recombination(i, diB); 00106 nnh.remove_jet(i); 00107 } 00108 njets--; 00109 } 00110 } 00111 00112 FASTJET_END_NAMESPACE // defined in fastjet/internal/base.hh