fastjet 2.4.5
GhostedAreaSpec.cc
Go to the documentation of this file.
00001 //STARTHEADER
00002 // $Id: GhostedAreaSpec.cc 1273 2008-08-11 18:22:55Z 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 "fastjet/GhostedAreaSpec.hh"
00032 #include<iostream>
00033 #include<sstream>
00034 
00035 using namespace std;
00036 
00037 FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
00038 
00039 BasicRandom<double> GhostedAreaSpec::_random_generator;
00040 
00041 //======================================================================
00045 void GhostedAreaSpec::_initialize() {
00046   // add on area-measuring dummy particles
00047   _drap = sqrt(_ghost_area);
00048   _dphi = _drap;
00049   _nphi = int(ceil(twopi/_dphi)); _dphi = twopi/_nphi;
00050   _nrap = int(ceil(_ghost_maxrap/_drap)); _drap = _ghost_maxrap / _nrap;
00051   _actual_ghost_area = _dphi * _drap;
00052   _n_ghosts   = (2*_nrap+1)*_nphi;
00053 
00054   // checkpoint the status of the random number generator.
00055   checkpoint_random();
00056   //_random_generator.info(cerr);
00057 }
00058 
00059 //----------------------------------------------------------------------
00061 void GhostedAreaSpec::add_ghosts(vector<PseudoJet> & event) const {
00062   // add momenta for ghosts
00063   for (int irap = -_nrap; irap <= _nrap; irap++) {
00064     for (int iphi = 0; iphi < _nphi; iphi++) {
00065      
00066       // include random offsets for all quantities
00067       double phi = (iphi+0.5) * _dphi + _dphi*(_our_rand()-0.5)*_grid_scatter;
00068       double rap = irap * _drap + _drap*(_our_rand()-0.5)*_grid_scatter
00069                                                          + _ghost_rap_offset ;
00070       double kt = _mean_ghost_kt*(1+(_our_rand()-0.5)*_kt_scatter);
00071 
00072       double pminus = kt*exp(-rap);
00073       double pplus  = kt*exp(+rap);
00074       double px = kt*sin(phi);
00075       double py = kt*cos(phi);
00076       //cout << kt<<" "<<rap<<" "<<phi<<"\n";
00077       //if (phi>=twopi || phi < 0.0) cout << "Hey: "<< phi-twopi<<"\n";
00078       PseudoJet mom(px,py,0.5*(pplus-pminus),0.5*(pplus+pminus));
00079       event.push_back(mom);
00080     }
00081   }
00082 }
00083 
00084 string GhostedAreaSpec::description() const {
00085 
00086   ostringstream ostr;
00087   ostr << "ghosts of area " << actual_ghost_area() 
00088        << " (had requested " << ghost_area() << ")"
00089        << ", placed up to y = " << ghost_maxrap() 
00090        << ", scattered wrt to perfect grid by (rel) " << grid_scatter() 
00091        << ", mean_ghost_kt = " << mean_ghost_kt()
00092        << ", rel kt_scatter =  " << kt_scatter()
00093        << ", n repetitions of ghost distributions =  " << repeat();
00094   return ostr.str();
00095 }
00096 
00097 FASTJET_END_NAMESPACE
00098 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines