00001 //STARTHEADER 00002 // $Id: ActiveAreaSpec.cc 505 2007-03-06 18:23:05Z 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/ActiveAreaSpec.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> ActiveAreaSpec::_random_generator; 00040 00041 //====================================================================== 00045 void ActiveAreaSpec::_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 //_random_generator.info(cerr); 00055 } 00056 00057 //---------------------------------------------------------------------- 00059 void ActiveAreaSpec::add_ghosts(vector<PseudoJet> & event) const { 00060 // add momenta for ghosts 00061 for (int irap = -_nrap; irap <= _nrap; irap++) { 00062 for (int iphi = 0; iphi < _nphi; iphi++) { 00063 // // include random offsets for all quantities 00064 // double phi = (iphi+0.5) * _dphi + _dphi*rand()*_grid_scatter/RAND_MAX; 00065 // double rap = irap * _drap + _drap*rand()*_grid_scatter/RAND_MAX; 00066 // //double phi = (iphi+0.5) * _dphi* + rand()*_grid_scatter/RAND_MAX; 00067 // //double rap = irap * _drap + rand()*_grid_scatter/RAND_MAX; 00068 // double kt = _mean_ghost_kt*(1+rand()*_kt_scatter/RAND_MAX); 00069 00070 // include random offsets for all quantities 00071 double phi = (iphi+0.5) * _dphi + _dphi*_our_rand()*_grid_scatter; 00072 double rap = irap * _drap + _drap*_our_rand()*_grid_scatter; 00073 //double phi = (iphi+0.5) * _dphi* + _our_rand()*_grid_scatter; 00074 //double rap = irap * _drap + _our_rand()*_grid_scatter; 00075 double kt = _mean_ghost_kt*(1+_our_rand()*_kt_scatter); 00076 00077 00078 00079 double pminus = kt*exp(-rap); 00080 double pplus = kt*exp(+rap); 00081 double px = kt*sin(phi); 00082 double py = kt*cos(phi); 00083 //cout << kt<<" "<<rap<<" "<<phi<<"\n"; 00084 //if (phi>=twopi || phi < 0.0) cout << "Hey: "<< phi-twopi<<"\n"; 00085 PseudoJet mom(px,py,0.5*(pplus-pminus),0.5*(pplus+pminus)); 00086 //mom.set_user_index(1); // for ghost particles (user index now lost...) 00087 event.push_back(mom); 00088 //_is_pure_ghost.push_back(true); 00089 } 00090 } 00091 } 00092 00093 string ActiveAreaSpec::description() { 00094 00095 ostringstream ostr; 00096 ostr << "Active area specification with ghosts of area " << actual_ghost_area() 00097 << " (had requested " << ghost_area() << ")" 00098 << ", placed up to y = " << ghost_maxrap() 00099 << ", scattered rel. to perfect grid by " << grid_scatter() 00100 << ", mean_ghost_kt = " << mean_ghost_kt() 00101 << ", rel kt_scatter = " << kt_scatter() 00102 << ", n repetitions of ghost distributions = " << repeat(); 00103 return ostr.str(); 00104 } 00105 00106 FASTJET_END_NAMESPACE 00107