fastjet 2.4.5
EECambridgePlugin.cc
Go to the documentation of this file.
00001 //STARTHEADER
00002 // $Id: EECambridgePlugin.cc 1491 2009-03-11 17:04:38Z salam $
00003 //
00004 // Copyright (c) 2007-2008, Matteo Cacciari, Gavin 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, write to the Free Software
00026 //  Foundation, Inc.:
00027 //      59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00028 //----------------------------------------------------------------------
00029 //ENDHEADER
00030 
00031 // fastjet stuff
00032 #include "fastjet/ClusterSequence.hh"
00033 #include "fastjet/EECambridgePlugin.hh"
00034 #include "fastjet/NNH.hh"
00035 
00036 // other stuff
00037 #include <sstream>
00038 #include <limits>
00039 
00040 FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
00041 
00042 using namespace std;
00043 
00044 //----------------------------------------------------------------------
00046 class EECamBriefJet {
00047 public:
00048   void init(const PseudoJet & jet) {
00049     double norm = 1.0/sqrt(jet.modp2());
00050     nx = jet.px() * norm;
00051     ny = jet.py() * norm;
00052     nz = jet.pz() * norm;
00053   }
00054 
00055   double distance(const EECamBriefJet * jet) const {
00056     double dij = 1 - nx*jet->nx
00057                    - ny*jet->ny
00058                    - nz*jet->nz;
00059     return dij;
00060   }
00061 
00062   double beam_distance() const {
00063     return numeric_limits<double>::max();
00064   }
00065 
00066 private:
00067   double nx, ny, nz;
00068 };
00069 
00070 
00071 string EECambridgePlugin::description () const {
00072   ostringstream desc;
00073   desc << "EECambridge plugin with ycut = " << ycut() ;
00074   return desc.str();
00075 }
00076 
00077 void EECambridgePlugin::run_clustering(ClusterSequence & cs) const {
00078   int njets = cs.jets().size();
00079   NNH<EECamBriefJet> nnh(cs.jets());
00080 
00081   double Q2 = cs.Q2(); 
00082 
00083   while (njets > 0) {
00084     int i, j, k;
00085     // here we get a minimum based on the purely angular variable from the NNH class
00086     // (called dij there, but vij in the Cambridge article (which uses dij for 
00087     // a kt distance...)
00088     double vij = nnh.dij_min(i, j); // i,j are return values...
00089 
00090     // next we work out the dij (ee kt distance), and based on its
00091     // value decide whether we have soft-freezing (represented here by
00092     // a "Beam" clustering) or not
00093     double dij;
00094     if (j >= 0) {
00095       double scale = min(cs.jets()[i].E(), cs.jets()[j].E());
00096       dij = 2 * vij * scale * scale;
00097       if (dij > Q2 * ycut()) {
00098         // we'll call the softer partner a "beam" jet
00099         if (cs.jets()[i].E() > cs.jets()[j].E()) swap(i,j);
00100         j = -1;
00101       }
00102     } else {
00103       // for the last particle left, just use yij = 1
00104       dij = Q2;
00105     }
00106     
00107     if (j >= 0) {
00108       cs.plugin_record_ij_recombination(i, j, dij, k);
00109       nnh.merge_jets(i, j, cs.jets()[k], k);
00110     } else {
00111       cs.plugin_record_iB_recombination(i, dij);
00112       nnh.remove_jet(i);
00113     }
00114     njets--;
00115   }
00116     
00117 }
00118 
00119 FASTJET_END_NAMESPACE      // defined in fastjet/internal/base.hh
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines