fastjet 2.4.5
D0RunIIConePlugin.cc
Go to the documentation of this file.
00001 //STARTHEADER
00002 // $Id: D0RunIIConePlugin.cc 1626 2009-06-12 15:30:42Z 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/D0RunIIConePlugin.hh"
00032 #include "fastjet/ClusterSequence.hh"
00033 #include "fastjet/Error.hh"
00034 #include <sstream>
00035 
00036 // D0 stuff
00037 #include <list>
00038 #include "ILConeAlgorithm.hpp"
00039 #include "HepEntity.h"
00040 
00041 FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
00042 
00043 using namespace std;
00044 using namespace d0;
00045 
00046 const double D0RunIIConePlugin::_DEFAULT_split_ratio              = 0.5  ; // overlap threshold
00047 const double D0RunIIConePlugin::_DEFAULT_far_ratio                = 0.5  ;
00048 const double D0RunIIConePlugin::_DEFAULT_Et_min_ratio             = 0.5  ;
00049 const bool   D0RunIIConePlugin::_DEFAULT_kill_duplicate           = true ;
00050 const double D0RunIIConePlugin::_DEFAULT_duplicate_dR             = 0.005; 
00051 const double D0RunIIConePlugin::_DEFAULT_duplicate_dPT            = 0.01 ; 
00052 const double D0RunIIConePlugin::_DEFAULT_search_factor            = 1.0  ; 
00053 const double D0RunIIConePlugin::_DEFAULT_pT_min_leading_protojet  = 0.   ; 
00054 const double D0RunIIConePlugin::_DEFAULT_pT_min_second_protojet   = 0.   ;
00055 const int    D0RunIIConePlugin::_DEFAULT_merge_max                = 10000; 
00056 const double D0RunIIConePlugin::_DEFAULT_pT_min_nomerge           = 0.   ;
00057 
00058 
00059 string D0RunIIConePlugin::description () const {
00060   ostringstream desc;
00061   
00062   desc << "D0 Run II Improved Legacy (midpoint) cone jet algorithm, with ";
00063   desc << "cone_radius = "        << cone_radius        () << ", "
00064        << "min_jet_Et = "         << min_jet_Et         () << ", " 
00065        << "split_ratio = "        << split_ratio        ();
00066 
00067   return desc.str();
00068 }
00069 
00070 
00071 void D0RunIIConePlugin::run_clustering(ClusterSequence & clust_seq) const {
00072  
00073   // create the entities needed by the D0 code
00074   vector<HepEntity> entities(clust_seq.jets().size());
00075   list<const HepEntity * > ensemble;
00076   for (unsigned i = 0; i < clust_seq.jets().size(); i++) {
00077     entities[i].Fill(clust_seq.jets()[i].E(),
00078                      clust_seq.jets()[i].px(),
00079                      clust_seq.jets()[i].py(),
00080                      clust_seq.jets()[i].pz(),
00081                      i);
00082     // use only the particles that do not have infinite rapidity
00083     if (abs(entities[i].pz) < entities[i].E) {
00084       ensemble.push_back(& (entities[i]));
00085     }
00086   }
00087 
00088   // prepare the D0 algorithm
00089   ILConeAlgorithm<HepEntity> 
00090     ilegac(cone_radius(), 
00091            min_jet_Et(), 
00092            split_ratio(),
00093            far_ratio(), 
00094            Et_min_ratio(), 
00095            kill_duplicate(), 
00096            duplicate_dR(), 
00097            duplicate_dPT(), 
00098            search_factor(), 
00099            pT_min_leading_protojet(), 
00100            pT_min_second_protojet(), 
00101            merge_max(), 
00102            pT_min_nomerge());
00103 
00104   // run the algorithm
00105   float Item_ET_Threshold = 0.;
00106   list<HepEntity> jets;
00107   ilegac.makeClusters(jets, ensemble, Item_ET_Threshold);
00108 
00109   // now transfer the information about the jets into the
00110   // FastJet structure
00111   for(int i = ilegac.ilcv.size()-1; i >= 0; i--) {
00112     
00113     std::list<const HepEntity*> tlist = ilegac.ilcv[i].LItems();
00114     std::list<const HepEntity*>::iterator tk;
00115     
00116     // get first particle in list
00117     tk = tlist.begin();
00118 
00119     // if there is no particle, just discard it
00120     // Note: this unexpected behaviour has been observed when the
00121     //       min_jet_Et parameter was set to 0
00122     if (tk==tlist.end())
00123       continue;
00124 
00125     int jet_k = (*tk)->index;
00126     // now merge with remaining particles in list
00127     tk++;
00128     for (; tk != tlist.end(); tk++) {
00129       int jet_i = jet_k;
00130       int jet_j = (*tk)->index;
00131       // do a fake recombination step with dij=0
00132       double dij = 0.0;
00133       clust_seq.plugin_record_ij_recombination(jet_i, jet_j, dij, jet_k);
00134     }
00135 
00136     // NB: put a sensible looking d_iB just to be nice...
00137     double d_iB = clust_seq.jets()[jet_k].perp2();
00138     clust_seq.plugin_record_iB_recombination(jet_k, d_iB);
00139 
00140   }
00141 }
00142 
00143 FASTJET_END_NAMESPACE      // defined in fastjet/internal/base.hh
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines