Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

CDFMidPointPlugin.cc

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

Generated on Sat Mar 3 12:36:10 2007 for fastjet by  doxygen 1.4.2