fastjet 2.4.5
|
00001 //STARTHEADER 00002 // $Id: CDFJetCluPlugin.cc 1394 2009-01-17 05:08:31Z soyez $ 00003 // 00004 // Copyright (c) 2005-2006, Matteo Cacciari and Gavin Salam 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 #include "fastjet/CDFJetCluPlugin.hh" 00032 #include "fastjet/ClusterSequence.hh" 00033 #include <sstream> 00034 #include <cassert> 00035 00036 // CDF stuff 00037 #include "JetCluAlgorithm.hh" 00038 #include "PhysicsTower.hh" 00039 #include "Cluster.hh" 00040 00041 FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh 00042 00043 using namespace std; 00044 using namespace cdf; 00045 00046 string CDFJetCluPlugin::description () const { 00047 ostringstream desc; 00048 00049 desc << "CDF JetClu jet algorithm with " 00050 << "seed_threshold = " << seed_threshold () << ", " 00051 << "cone_radius = " << cone_radius () << ", " 00052 << "adjacency_cut = " << adjacency_cut () << ", " 00053 << "max_iterations = " << max_iterations () << ", " 00054 << "iratch = " << iratch () << ", " 00055 << "overlap_threshold = " << overlap_threshold () ; 00056 00057 return desc.str(); 00058 } 00059 00060 00061 void CDFJetCluPlugin::run_clustering(ClusterSequence & clust_seq) const { 00062 00063 // create the physics towers needed by the CDF code 00064 vector<PhysicsTower> towers; 00065 towers.reserve(clust_seq.jets().size()); 00066 00067 // create a map to identify jets (actually just the input particles)... 00068 //map<double,int> jetmap; 00069 00070 for (unsigned i = 0; i < clust_seq.jets().size(); i++) { 00071 PseudoJet particle(clust_seq.jets()[i]); 00072 //_insert_unique(particle, jetmap); 00073 LorentzVector fourvect(particle.px(), particle.py(), 00074 particle.pz(), particle.E()); 00075 PhysicsTower tower(fourvect); 00076 // add tracking information for later 00077 tower.fjindex = i; 00078 towers.push_back(tower); 00079 } 00080 00081 // prepare the CDF algorithm 00082 JetCluAlgorithm j(seed_threshold(), cone_radius(), adjacency_cut(), 00083 max_iterations(), iratch(), overlap_threshold()); 00084 00085 // run the CDF algorithm 00086 std::vector<Cluster> jets; 00087 j.run(towers,jets); 00088 00089 00090 // now transfer the jets back into our own structure -- we will 00091 // mimic the cone code with a sequential recombination sequence in 00092 // which the jets are built up by adding one particle at a time 00093 00094 // NB: with g++-4.0, the reverse iterator code gave problems, so switch 00095 // to indices instead 00096 //for(vector<Cluster>::const_reverse_iterator jetIter = jets.rbegin(); 00097 // jetIter != jets.rend(); jetIter++) { 00098 // const vector<PhysicsTower> & tower_list = jetIter->towerList; 00099 // int jet_k = jetmap[tower_list[0].fourVector.E]; 00100 // 00101 // int ntow = int(jetIter->towerList.size()); 00102 00103 for(int iCDFjets = jets.size()-1; iCDFjets >= 0; iCDFjets--) { 00104 00105 const vector<PhysicsTower> & tower_list = jets[iCDFjets].towerList; 00106 int ntow = int(tower_list.size()); 00107 00108 // 2008-09-04: sort the towerList (according to fjindex) so as 00109 // to have a consistent order for particles in jet 00110 // (necessary because addition of ultra-soft particles 00111 // sometimes often modifies the order, while maintaining 00112 // the same overall set) 00113 vector<int> jc_indices(ntow); 00114 vector<double> fj_indices(ntow); // use double: benefit from existing routine 00115 for (int itow = 0; itow < ntow; itow++) { 00116 jc_indices[itow] = itow; 00117 fj_indices[itow] = tower_list[itow].fjindex; 00118 } 00119 sort_indices(jc_indices, fj_indices); 00120 00121 int jet_k = tower_list[jc_indices[0]].fjindex; 00122 00123 for (int itow = 1; itow < ntow; itow++) { 00124 if (tower_list[jc_indices[itow]].Et() > 1e-50) { 00125 } 00126 int jet_i = jet_k; 00127 // retrieve our index for the jet 00128 int jet_j; 00129 jet_j = tower_list[jc_indices[itow]].fjindex; 00130 00131 // safety check 00132 assert (jet_j >= 0 && jet_j < int(towers.size())); 00133 00134 // do a fake recombination step with dij=0 00135 double dij = 0.0; 00136 00137 // JetClu does E-scheme recombination so we can stick with the 00138 // simple option 00139 clust_seq.plugin_record_ij_recombination(jet_i, jet_j, dij, jet_k); 00140 00141 } 00142 00143 // NB: put a sensible looking d_iB just to be nice... 00144 double d_iB = clust_seq.jets()[jet_k].perp2(); 00145 clust_seq.plugin_record_iB_recombination(jet_k, d_iB); 00146 } 00147 00148 00149 // following code is for testing only 00150 //cout << endl; 00151 //for(vector<Cluster>::const_iterator jetIter = jets.begin(); 00152 // jetIter != jets.end(); jetIter++) { 00153 // cout << jetIter->fourVector.pt() << " " << jetIter->fourVector.y() << endl; 00154 //} 00155 //cout << "-----------------------------------------------------\n"; 00156 //vector<PseudoJet> ourjets(clust_seq.inclusive_jets()); 00157 //for (vector<PseudoJet>::const_iterator ourjet = ourjets.begin(); 00158 // ourjet != ourjets.end(); ourjet++) { 00159 // cout << ourjet->perp() << " " << ourjet->rap() << endl; 00160 //} 00161 //cout << endl; 00162 } 00163 00164 00165 00166 FASTJET_END_NAMESPACE // defined in fastjet/internal/base.hh