FastJet 3.0.0
|
00001 //STARTHEADER 00002 // $Id: CDFMidPointPlugin.cc 2577 2011-09-13 15:11:38Z salam $ 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/CDFMidPointPlugin.hh" 00030 #include "fastjet/ClusterSequence.hh" 00031 #include "fastjet/Error.hh" 00032 #include <sstream> 00033 00034 // CDF stuff 00035 #include "MidPointAlgorithm.hh" 00036 #include "PhysicsTower.hh" 00037 #include "Cluster.hh" 00038 00039 FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh 00040 00041 using namespace std; 00042 using namespace cdf; 00043 00044 string CDFMidPointPlugin::description () const { 00045 ostringstream desc; 00046 00047 string sm_scale_string = "split-merge uses "; 00048 switch(_sm_scale) { 00049 case SM_pt: 00050 sm_scale_string += "pt"; 00051 break; 00052 case SM_Et: 00053 sm_scale_string += "Et"; 00054 break; 00055 case SM_mt: 00056 sm_scale_string += "mt"; 00057 break; 00058 case SM_pttilde: 00059 sm_scale_string += "pttilde (scalar sum of pts)"; 00060 break; 00061 default: 00062 ostringstream err; 00063 err << "Unrecognized split-merge scale choice = " << _sm_scale; 00064 throw Error(err.str()); 00065 } 00066 00067 00068 if (cone_area_fraction() == 1) { 00069 desc << "CDF MidPoint jet algorithm, with " ; 00070 } else { 00071 desc << "CDF MidPoint+Searchcone jet algorithm, with "; 00072 } 00073 desc << "seed_threshold = " << seed_threshold () << ", " 00074 << "cone_radius = " << cone_radius () << ", " 00075 << "cone_area_fraction = " << cone_area_fraction () << ", " 00076 << "max_pair_size = " << max_pair_size () << ", " 00077 << "max_iterations = " << max_iterations () << ", " 00078 << "overlap_threshold = " << overlap_threshold () << ", " 00079 << sm_scale_string ; 00080 00081 return desc.str(); 00082 } 00083 00084 00085 void CDFMidPointPlugin::run_clustering(ClusterSequence & clust_seq) const { 00086 00087 // create the physics towers needed by the CDF code 00088 vector<PhysicsTower> towers; 00089 towers.reserve(clust_seq.jets().size()); 00090 for (unsigned i = 0; i < clust_seq.jets().size(); i++) { 00091 LorentzVector fourvect(clust_seq.jets()[i].px(), 00092 clust_seq.jets()[i].py(), 00093 clust_seq.jets()[i].pz(), 00094 clust_seq.jets()[i].E()); 00095 PhysicsTower tower(fourvect); 00096 // misuse one of the indices for tracking, since the MidPoint 00097 // implementation doesn't seem to make use of these indices 00098 tower.calTower.iEta = i; 00099 towers.push_back(tower); 00100 } 00101 00102 // prepare the CDF algorithm 00103 MidPointAlgorithm m(_seed_threshold,_cone_radius,_cone_area_fraction, 00104 _max_pair_size,_max_iterations,_overlap_threshold, 00105 MidPointAlgorithm::SplitMergeScale(_sm_scale)); 00106 00107 // run the CDF algorithm 00108 std::vector<Cluster> jets; 00109 m.run(towers,jets); 00110 00111 00112 // now transfer the jets back into our own structure -- we will 00113 // mimic the cone code with a sequential recombination sequence in 00114 // which the jets are built up by adding one particle at a time 00115 for(vector<Cluster>::const_iterator jetIter = jets.begin(); 00116 jetIter != jets.end(); jetIter++) { 00117 const vector<PhysicsTower> & tower_list = jetIter->towerList; 00118 int jet_k = tower_list[0].calTower.iEta; 00119 00120 int ntow = int(jetIter->towerList.size()); 00121 for (int itow = 1; itow < ntow; itow++) { 00122 int jet_i = jet_k; 00123 // retrieve our misappropriated index for the jet 00124 int jet_j = tower_list[itow].calTower.iEta; 00125 // do a fake recombination step with dij=0 00126 double dij = 0.0; 00127 clust_seq.plugin_record_ij_recombination(jet_i, jet_j, dij, jet_k); 00128 } 00129 00130 // NB: put a sensible looking d_iB just to be nice... 00131 double d_iB = clust_seq.jets()[jet_k].perp2(); 00132 clust_seq.plugin_record_iB_recombination(jet_k, d_iB); 00133 } 00134 00135 00136 // following code is for testing only 00137 //cout << endl; 00138 //for(vector<Cluster>::const_iterator jetIter = jets.begin(); 00139 // jetIter != jets.end(); jetIter++) { 00140 // cout << jetIter->fourVector.pt() << " " << jetIter->fourVector.y() << endl; 00141 //} 00142 //cout << "-----------------------------------------------------\n"; 00143 //vector<PseudoJet> ourjets(clust_seq.inclusive_jets()); 00144 //for (vector<PseudoJet>::const_reverse_iterator ourjet = ourjets.rbegin(); 00145 // ourjet != ourjets.rend(); ourjet++) { 00146 // cout << ourjet->perp() << " " << ourjet->rap() << endl; 00147 //} 00148 //cout << endl; 00149 } 00150 00151 FASTJET_END_NAMESPACE // defined in fastjet/internal/base.hh