ClusterSequence_N2.cc

Go to the documentation of this file.
00001 //STARTHEADER
00002 // $Id: ClusterSequence_N2.cc 1540 2009-04-29 18:04:55Z salam $
00003 //
00004 // Copyright (c) 2005-2009, 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 
00032 // The plain N^2 part of the ClusterSequence class -- separated out
00033 // from the rest of the class implementation so as to speed up
00034 // compilation of this particular part while it is under test.
00035 
00036 #include "fastjet/internal/ClusterSequence_N2.icc"
00037 
00038 #include<iostream>
00039 
00040 FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
00041 
00042 
00043 using namespace std;
00044 
00045 
00046 //*************************************************************************
00047 //
00048 //                             THINGS FOR E+E-
00049 //
00050 //*************************************************************************
00051 
00052 
00053 //----------------------------------------------------------------------
00054 template<> inline void ClusterSequence::_bj_set_jetinfo(
00055                            EEBriefJet * const jetA, const int _jets_index) const {
00056 
00057   double E = _jets[_jets_index].E();
00058   double scale = E*E; // the default energy scale for the kt alg
00059   double p  = jet_def().extra_param(); // in case we're ee_genkt
00060   switch (_jet_algorithm) {
00061   case ee_kt_algorithm:
00062     assert(_Rparam > 2.0); // force this to be true! [not best place, but works]
00063     // recall that _invR2 is artificially set to 1 for this alg
00064     // so that we automatically have dij = scale * 2(1-cos theta_ij)
00065     // Normally, _Rparam should be automatically set to 4 from JetDefinition
00066     break; 
00067   case ee_genkt_algorithm:
00068     if (p <= 0 && scale < 1e-300) scale = 1e-300; // same dodgy safety as genkt
00069     scale = pow(scale,p);
00070     break;
00071   default:
00072     throw Error("Unrecognised jet algorithm");
00073   }
00074   jetA->kt2  = scale; // "kt2" might one day be renamed as "scale" or some such
00075 
00076   double norm = _jets[_jets_index].modp2();
00077   if (norm > 0) {
00078     norm = 1.0/sqrt(norm);
00079     jetA->nx = norm * _jets[_jets_index].px();
00080     jetA->ny = norm * _jets[_jets_index].py();
00081     jetA->nz = norm * _jets[_jets_index].pz();
00082   } else {
00083     jetA->nx = 0.0;
00084     jetA->ny = 0.0;
00085     jetA->nz = 1.0;
00086   }
00087   jetA->_jets_index = _jets_index;
00088   // initialise NN info as well
00089   jetA->NN_dist = _R2;
00090   jetA->NN      = NULL;
00091 }
00092 
00093 //----------------------------------------------------------------------
00094 // returns the angular distance between the two jets
00095 template<> double ClusterSequence::_bj_dist(
00096                 const EEBriefJet * const jeta, 
00097                 const EEBriefJet * const jetb) const {
00098   double dist = 1.0 
00099     - jeta->nx*jetb->nx
00100     - jeta->ny*jetb->ny
00101     - jeta->nz*jetb->nz;
00102   dist *= 2; // distance is _2_*min(Ei^2,Ej^2)*(1-cos theta)
00103   //cout << "Dist = " << dist << ": " 
00104   //     << jeta->nx << " "
00105   //     << jeta->ny << " "
00106   //     << jeta->nz << " "
00107   //     <<endl;
00108   return dist;
00109 }
00110 
00111 
00112 
00113 // get explicit copies of the two N2 cluster cases we need
00114 // plain BriefJet
00115 void ClusterSequence::_simple_N2_cluster_BriefJet() {  
00116   _simple_N2_cluster<BriefJet>();
00117 }
00118 
00119 
00120 // e+e- BriefJet
00121 void ClusterSequence::_simple_N2_cluster_EEBriefJet() {  
00122   _simple_N2_cluster<EEBriefJet>();
00123 }
00124 
00125 // //----------------------------------------------------------------------
00126 // /// Force instantiation of desired versions of _simple_N2_cluster
00127 // ///
00128 // /// This is not very elegant...
00129 // void ClusterSequence::_dummy_N2_cluster_instantiation() {
00130 //   _simple_N2_cluster<BriefJet>();
00131 //   _simple_N2_cluster<EEBriefJet>();
00132 // }
00133 
00134 FASTJET_END_NAMESPACE
00135 

Generated on 26 Feb 2010 for fastjet by  doxygen 1.6.1