00001 //STARTHEADER 00002 // $Id: GhostedAreaSpec.cc 957 2007-11-22 18:58:45Z 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 double kt = _mean_ghost_kt*(1+(_our_rand()-0.5)*_kt_scatter); 00070 00071 double pminus = kt*exp(-rap); 00072 double pplus = kt*exp(+rap); 00073 double px = kt*sin(phi); 00074 double py = kt*cos(phi); 00075 //cout << kt<<" "<<rap<<" "<<phi<<"\n"; 00076 //if (phi>=twopi || phi < 0.0) cout << "Hey: "<< phi-twopi<<"\n"; 00077 PseudoJet mom(px,py,0.5*(pplus-pminus),0.5*(pplus+pminus)); 00078 event.push_back(mom); 00079 } 00080 } 00081 } 00082 00083 string GhostedAreaSpec::description() const { 00084 00085 ostringstream ostr; 00086 ostr << "ghosts of area " << actual_ghost_area() 00087 << " (had requested " << ghost_area() << ")" 00088 << ", placed up to y = " << ghost_maxrap() 00089 << ", scattered wrt to perfect grid by (rel) " << grid_scatter() 00090 << ", mean_ghost_kt = " << mean_ghost_kt() 00091 << ", rel kt_scatter = " << kt_scatter() 00092 << ", n repetitions of ghost distributions = " << repeat(); 00093 return ostr.str(); 00094 } 00095 00096 FASTJET_END_NAMESPACE 00097