FastJet 3.0.2
|
00001 //STARTHEADER 00002 // $Id: D0RunIIConePlugin.cc 2815 2011-12-13 21:54:40Z soyez $ 00003 // 00004 // Copyright (c) 2005-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 #include "fastjet/D0RunIIConePlugin.hh" 00030 #include "fastjet/ClusterSequence.hh" 00031 #include "fastjet/Error.hh" 00032 #include <sstream> 00033 00034 // D0 stuff 00035 #include <list> 00036 #include "ILConeAlgorithm.hpp" 00037 #include "HepEntity.h" 00038 00039 FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh 00040 00041 using namespace std; 00042 using namespace d0; 00043 00044 const double D0RunIIConePlugin::_DEFAULT_split_ratio = 0.5 ; // overlap threshold 00045 const double D0RunIIConePlugin::_DEFAULT_far_ratio = 0.5 ; 00046 const double D0RunIIConePlugin::_DEFAULT_Et_min_ratio = 0.5 ; 00047 const bool D0RunIIConePlugin::_DEFAULT_kill_duplicate = true ; 00048 const double D0RunIIConePlugin::_DEFAULT_duplicate_dR = 0.005; 00049 const double D0RunIIConePlugin::_DEFAULT_duplicate_dPT = 0.01 ; 00050 const double D0RunIIConePlugin::_DEFAULT_search_factor = 1.0 ; 00051 const double D0RunIIConePlugin::_DEFAULT_pT_min_leading_protojet = 0. ; 00052 const double D0RunIIConePlugin::_DEFAULT_pT_min_second_protojet = 0. ; 00053 const int D0RunIIConePlugin::_DEFAULT_merge_max = 10000; 00054 const double D0RunIIConePlugin::_DEFAULT_pT_min_nomerge = 0. ; 00055 00056 bool D0RunIIConePlugin::_first_time = true; 00057 00058 string D0RunIIConePlugin::description () const { 00059 ostringstream desc; 00060 00061 desc << "D0 Run II Improved Legacy (midpoint) cone jet algorithm, with "; 00062 desc << "cone_radius = " << cone_radius () << ", " 00063 << "min_jet_Et = " << min_jet_Et () << ", " 00064 << "split_ratio = " << split_ratio (); 00065 00066 return desc.str(); 00067 } 00068 00069 00070 void D0RunIIConePlugin::run_clustering(ClusterSequence & clust_seq) const { 00071 // print a banner if we run this for the first time 00072 _print_banner(clust_seq.fastjet_banner_stream()); 00073 00074 // create the entities needed by the D0 code 00075 vector<HepEntity> entities(clust_seq.jets().size()); 00076 list<const HepEntity * > ensemble; 00077 for (unsigned i = 0; i < clust_seq.jets().size(); i++) { 00078 entities[i].Fill(clust_seq.jets()[i].E(), 00079 clust_seq.jets()[i].px(), 00080 clust_seq.jets()[i].py(), 00081 clust_seq.jets()[i].pz(), 00082 i); 00083 // use only the particles that do not have infinite rapidity 00084 if (abs(entities[i].pz) < entities[i].E) { 00085 ensemble.push_back(& (entities[i])); 00086 } 00087 } 00088 00089 // prepare the D0 algorithm 00090 ILConeAlgorithm<HepEntity> 00091 ilegac(cone_radius(), 00092 min_jet_Et(), 00093 split_ratio(), 00094 far_ratio(), 00095 Et_min_ratio(), 00096 kill_duplicate(), 00097 duplicate_dR(), 00098 duplicate_dPT(), 00099 search_factor(), 00100 pT_min_leading_protojet(), 00101 pT_min_second_protojet(), 00102 merge_max(), 00103 pT_min_nomerge()); 00104 00105 // run the algorithm 00106 float Item_ET_Threshold = 0.; 00107 list<HepEntity> jets; 00108 ilegac.makeClusters(jets, ensemble, Item_ET_Threshold); 00109 00110 // now transfer the information about the jets into the 00111 // FastJet structure 00112 for(int i = ilegac.ilcv.size()-1; i >= 0; i--) { 00113 00114 std::list<const HepEntity*> tlist = ilegac.ilcv[i].LItems(); 00115 std::list<const HepEntity*>::iterator tk; 00116 00117 // get first particle in list 00118 tk = tlist.begin(); 00119 00120 // if there is no particle, just discard it 00121 // Note: this unexpected behaviour has been observed when the 00122 // min_jet_Et parameter was set to 0 00123 if (tk==tlist.end()) 00124 continue; 00125 00126 int jet_k = (*tk)->index; 00127 // now merge with remaining particles in list 00128 tk++; 00129 for (; tk != tlist.end(); tk++) { 00130 int jet_i = jet_k; 00131 int jet_j = (*tk)->index; 00132 // do a fake recombination step with dij=0 00133 double dij = 0.0; 00134 clust_seq.plugin_record_ij_recombination(jet_i, jet_j, dij, jet_k); 00135 } 00136 00137 // NB: put a sensible looking d_iB just to be nice... 00138 double d_iB = clust_seq.jets()[jet_k].perp2(); 00139 clust_seq.plugin_record_iB_recombination(jet_k, d_iB); 00140 00141 } 00142 } 00143 00144 // print a banner for reference to the 3rd-party code 00145 void D0RunIIConePlugin::_print_banner(ostream *ostr) const{ 00146 if (! _first_time) return; 00147 _first_time=false; 00148 00149 // make sure the user has not set the banner stream to NULL 00150 if (!ostr) return; 00151 00152 (*ostr) << "#--------------------------------------------------------------------------" << endl; 00153 (*ostr) << "# You are running the D0 Run II Cone plugin for FastJet " << endl; 00154 (*ostr) << "# Original code by the D0 collaboration, provided by Lars Sonnenschein; " << endl; 00155 (*ostr) << "# interface by FastJet authors " << endl; 00156 (*ostr) << "# If you use this plugin, please cite " << endl; 00157 (*ostr) << "# G. C. Blazey et al., hep-ex/0005012 " << endl; 00158 (*ostr) << "# V. M. Abazov et al. [D0 Collaboration], arXiv:1110.3771 [hep-ex] " << endl; 00159 (*ostr) << "# in addition to the usual FastJet reference. " << endl; 00160 (*ostr) << "#--------------------------------------------------------------------------" << endl; 00161 00162 // make sure we really have the output done. 00163 ostr->flush(); 00164 } 00165 00166 FASTJET_END_NAMESPACE // defined in fastjet/internal/base.hh