FastJet 3.0.2
|
00001 //STARTHEADER 00002 // $Id: D0RunIBaseConePlugin.cc 1779 2010-10-25 10:32:59Z soyez $ 00003 // 00004 // Copyright (c) 2009-2011, Matteo Cacciari, Gavin P. 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, see <http://www.gnu.org/licenses/>. 00026 //---------------------------------------------------------------------- 00027 //ENDHEADER 00028 00029 // D0 stuff 00030 // apparently this has to go first to avoid a problem with gcc-4.0.1 builds on Macs 00031 #include <list> 00032 #include "ConeClusterAlgo.hpp" 00033 #include "HepEntityIpre96.h" 00034 #include "HepEntityI.h" 00035 00036 #include "fastjet/D0RunIBaseConePlugin.hh" 00037 #include "fastjet/D0RunIpre96ConePlugin.hh" 00038 #include "fastjet/D0RunIConePlugin.hh" 00039 #include "fastjet/ClusterSequence.hh" 00040 #include "fastjet/Error.hh" 00041 #include <sstream> 00042 00043 FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh 00044 00045 using namespace std; 00046 using namespace d0runi; 00047 00048 ///////////////////////////////////////////// 00049 // // 00050 // D0RunIBaseConePlugin implementation // 00051 // // 00052 ///////////////////////////////////////////// 00053 00054 const double D0RunIBaseConePlugin::_DEFAULT_SPLifr = 0.5; //shared Et fraction threshold 00055 const double D0RunIBaseConePlugin::_DEFAULT_TWOrad = 0.; 00056 const bool D0RunIBaseConePlugin::_DEFAULT_D0_Angle = false; 00057 const bool D0RunIBaseConePlugin::_DEFAULT_Increase_Delta_R = true; 00058 const bool D0RunIBaseConePlugin::_DEFAULT_Kill_Far_Clusters = true; 00059 const bool D0RunIBaseConePlugin::_DEFAULT_Jet_Et_Min_On_Iter = true; 00060 const double D0RunIBaseConePlugin::_DEFAULT_Far_Ratio = 0.5; 00061 const double D0RunIBaseConePlugin::_DEFAULT_Eitem_Negdrop = -1.0; 00062 const double D0RunIBaseConePlugin::_DEFAULT_Et_Min_Ratio = 0.5; 00063 const double D0RunIBaseConePlugin::_DEFAULT_Thresh_Diff_Et = 0.01; 00064 00065 00066 // for the real work, we write a template class that decides which 00067 // HepEntity type to use 00068 template<typename HepEntityType> 00069 void D0RunIBaseConePlugin::run_clustering_worker(ClusterSequence & clust_seq) const{ 00070 // create the entities needed by the D0 code 00071 vector<HepEntityType> entities(clust_seq.jets().size()); 00072 list<const HepEntityType * > ensemble; 00073 for (unsigned i = 0; i < clust_seq.jets().size(); i++) { 00074 entities[i].Fill(clust_seq.jets()[i].E(), 00075 clust_seq.jets()[i].px(), 00076 clust_seq.jets()[i].py(), 00077 clust_seq.jets()[i].pz(), 00078 i); 00079 // use only the particles that do not have infinite rapidity 00080 if (abs(entities[i].pz() ) < entities[i].E() ) { 00081 ensemble.push_back(& (entities[i])); 00082 } 00083 } 00084 00085 // prepare the D0 algorithm 00086 ConeClusterAlgo<HepEntityType> 00087 RunIconeAlgo(CONErad(), 00088 JETmne(), 00089 TWOrad(), 00090 SPLifr(), 00091 D0_Angle(), 00092 Increase_Delta_R(), 00093 Kill_Far_Clusters(), 00094 Jet_Et_Min_On_Iter(), 00095 Far_Ratio(), 00096 Eitem_Negdrop(), 00097 Et_Min_Ratio(), 00098 Thresh_Diff_Et()); 00099 00100 00101 // run the algorithm 00102 float Zvertex = 0.; 00103 list<HepEntityType> jets; 00104 RunIconeAlgo.makeClusters(jets, ensemble, Zvertex); 00105 00106 // now transfer the information about the jets into the 00107 // FastJet structure 00108 for(int i = RunIconeAlgo.TempColl.size()-1; i >= 0; i--) { 00109 00110 std::list<const HepEntityType*> tlist = RunIconeAlgo.TempColl[i].LItems(); 00111 typename std::list<const HepEntityType*>::iterator tk; 00112 00113 // get first particle in list 00114 tk = tlist.begin(); 00115 int jet_k = (*tk)->index; 00116 00117 // GS addition: in order to use the proper recombination scheme 00118 // used by D0 we need to keep track of the sum as a 00119 // "HepEntityType" 00120 HepEntityType jet_current_momentum = *(*tk); 00121 00122 // now merge with remaining particles in list 00123 tk++; 00124 for (; tk != tlist.end(); tk++) { 00125 int jet_i = jet_k; 00126 int jet_j = (*tk)->index; 00127 // do a fake recombination step with dij=0 00128 double dij = 0.0; 00129 00130 // GS addition: find the new momentum and convert that into a 00131 // pseudo-jet 00132 jet_current_momentum.Add(**tk); 00133 PseudoJet new_mom(jet_current_momentum.px(), jet_current_momentum.py(), 00134 jet_current_momentum.pz(), jet_current_momentum.E()); 00135 00136 clust_seq.plugin_record_ij_recombination(jet_i, jet_j, dij, new_mom, jet_k); 00137 } 00138 00139 // NB: put a sensible looking d_iB just to be nice... 00140 double d_iB = clust_seq.jets()[jet_k].perp2(); 00141 clust_seq.plugin_record_iB_recombination(jet_k, d_iB); 00142 } 00143 } 00144 00145 00146 ///////////////////////////////////////////// 00147 // // 00148 // D0RunIpre96ConePlugin implementation // 00149 // // 00150 ///////////////////////////////////////////// 00151 00152 bool D0RunIpre96ConePlugin::_first_time=true; 00153 00154 string D0RunIpre96ConePlugin::description () const { 00155 ostringstream desc; 00156 00157 desc << "D0 Run I (pre 96) cone jet algorithm, with "; 00158 desc << "cone_radius = " << CONErad () << ", " 00159 << "min_jet_Et = " << JETmne () << ", " 00160 << "split_fraction = " << SPLifr (); 00161 00162 return desc.str(); 00163 } 00164 00165 void D0RunIpre96ConePlugin::run_clustering(ClusterSequence & clust_seq) const { 00166 // print a banner if we run this for the first time 00167 _print_banner(clust_seq.fastjet_banner_stream()); 00168 00169 run_clustering_worker<HepEntityIpre96>(clust_seq); 00170 } 00171 00172 // print a banner for reference to the 3rd-party code 00173 void D0RunIpre96ConePlugin::_print_banner(ostream *ostr) const{ 00174 if (! _first_time) return; 00175 _first_time=false; 00176 00177 // make sure the user has not set the banner stream to NULL 00178 if (!ostr) return; 00179 00180 (*ostr) << "#--------------------------------------------------------------------------" << endl; 00181 (*ostr) << "# You are running the D0 Run I (pre96) Cone plugin for FastJet " << endl; 00182 (*ostr) << "# Original code by the D0 collaboration, provided by Lars Sonnenschein; " << endl; 00183 (*ostr) << "# interface by FastJet authors " << endl; 00184 (*ostr) << "# If you use this plugin, please cite " << endl; 00185 (*ostr) << "# B. Abbott et al. [D0 Collaboration], FERMILAB-PUB-97-242-E. " << endl; 00186 (*ostr) << "# in addition to the usual FastJet reference. " << endl; 00187 (*ostr) << "#--------------------------------------------------------------------------" << endl; 00188 00189 // make sure we really have the output done. 00190 ostr->flush(); 00191 } 00192 00193 00194 ///////////////////////////////////////////// 00195 // // 00196 // D0RunIConePlugin implementation // 00197 // // 00198 ///////////////////////////////////////////// 00199 00200 bool D0RunIConePlugin::_first_time=true; 00201 00202 string D0RunIConePlugin::description () const { 00203 ostringstream desc; 00204 00205 desc << "D0 Run I cone jet algorithm, with "; 00206 desc << "cone_radius = " << CONErad () << ", " 00207 << "min_jet_Et = " << JETmne () << ", " 00208 << "split_fraction = " << SPLifr (); 00209 00210 return desc.str(); 00211 } 00212 00213 void D0RunIConePlugin::run_clustering(ClusterSequence & clust_seq) const { 00214 // print a banner if we run this for the first time 00215 _print_banner(clust_seq.fastjet_banner_stream()); 00216 00217 run_clustering_worker<HepEntityI>(clust_seq); 00218 } 00219 00220 // print a banner for reference to the 3rd-party code 00221 void D0RunIConePlugin::_print_banner(ostream *ostr) const{ 00222 if (! _first_time) return; 00223 _first_time=false; 00224 00225 // make sure the user has not set the banner stream to NULL 00226 if (!ostr) return; 00227 00228 (*ostr) << "#--------------------------------------------------------------------------" << endl; 00229 (*ostr) << "# You are running the D0 Run I Cone plugin for FastJet " << endl; 00230 (*ostr) << "# Original code provided by Lars Sonnenschein; interface by FastJet authors" << endl; 00231 (*ostr) << "# If you use this plugin, please cite " << endl; 00232 (*ostr) << "# B. Abbott et al. [D0 Collaboration], FERMILAB-PUB-97-242-E. " << endl; 00233 (*ostr) << "# in addition to the usual FastJet reference. " << endl; 00234 (*ostr) << "#--------------------------------------------------------------------------" << endl; 00235 00236 // make sure we really have the output done. 00237 ostr->flush(); 00238 } 00239 00240 00241 00242 FASTJET_END_NAMESPACE // defined in fastjet/internal/base.hh