FastJet 3.0.2
|
00001 //STARTHEADER 00002 // $Id: GhostedAreaSpec.hh 2728 2011-11-20 14:18:59Z salam $ 00003 // 00004 // Copyright (c) 2005-2011, Matteo Cacciari, Gavin P. 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, see <http://www.gnu.org/licenses/>. 00026 //---------------------------------------------------------------------- 00027 //ENDHEADER 00028 00029 00030 #ifndef __FASTJET_GHOSTEDAREASPEC_HH__ 00031 #define __FASTJET_GHOSTEDAREASPEC_HH__ 00032 00033 #include<vector> 00034 #include<string> 00035 #include "fastjet/PseudoJet.hh" 00036 #include "fastjet/internal/BasicRandom.hh" 00037 #include "fastjet/Selector.hh" 00038 #include "fastjet/LimitedWarning.hh" 00039 00040 // 00041 #define STATIC_GENERATOR 1 00042 00043 FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh 00044 00045 /// namespace to hold default parameters for the active area spec 00046 namespace gas { 00047 const double def_ghost_maxrap = 6.0; 00048 const int def_repeat = 1; 00049 const double def_ghost_area = 0.01; 00050 const double def_grid_scatter = 1.0; 00051 const double def_pt_scatter = 0.1; 00052 const double def_mean_ghost_pt = 1e-100; 00053 } 00054 00055 //---------------------------------------------------------------------- 00056 /// @ingroup area_classes 00057 /// \class GhostedAreaSpec 00058 /// Parameters to configure the computation of jet areas using ghosts 00059 /// 00060 /// Class that defines the parameters that go into the measurement 00061 /// of active jet areas. 00062 class GhostedAreaSpec { 00063 public: 00064 /// default constructor 00065 GhostedAreaSpec(): _ghost_maxrap (gas::def_ghost_maxrap), 00066 _ghost_rap_offset(0.0), 00067 _repeat (gas::def_repeat), 00068 _ghost_area (gas::def_ghost_area), 00069 _grid_scatter (gas::def_grid_scatter), 00070 _pt_scatter (gas::def_pt_scatter), 00071 _mean_ghost_pt(gas::def_mean_ghost_pt), 00072 _fj2_placement(false) {_initialize();} 00073 00074 /// explicit constructor 00075 explicit GhostedAreaSpec(double ghost_maxrap_in, 00076 int repeat_in = gas::def_repeat, 00077 double ghost_area_in = gas::def_ghost_area, 00078 double grid_scatter_in = gas::def_grid_scatter, 00079 double pt_scatter_in = gas::def_pt_scatter, 00080 double mean_ghost_pt_in = gas::def_mean_ghost_pt 00081 ): 00082 _ghost_maxrap(ghost_maxrap_in), 00083 _ghost_rap_offset(0.0), 00084 _repeat(repeat_in), 00085 _ghost_area(ghost_area_in), 00086 _grid_scatter(grid_scatter_in), 00087 _pt_scatter(pt_scatter_in), 00088 _mean_ghost_pt(mean_ghost_pt_in), 00089 _fj2_placement(false) {_initialize();} 00090 00091 /// explicit constructor 00092 explicit GhostedAreaSpec(double ghost_minrap_in, 00093 double ghost_maxrap_in, 00094 int repeat_in = gas::def_repeat, 00095 double ghost_area_in = gas::def_ghost_area, 00096 double grid_scatter_in = gas::def_grid_scatter, 00097 double pt_scatter_in = gas::def_pt_scatter, 00098 double mean_ghost_pt_in = gas::def_mean_ghost_pt 00099 ): 00100 _ghost_maxrap (0.5*(ghost_maxrap_in - ghost_minrap_in)), 00101 _ghost_rap_offset(0.5*(ghost_maxrap_in + ghost_minrap_in)), 00102 _repeat(repeat_in), 00103 _ghost_area(ghost_area_in), 00104 _grid_scatter(grid_scatter_in), 00105 _pt_scatter(pt_scatter_in), 00106 _mean_ghost_pt(mean_ghost_pt_in), 00107 _fj2_placement(false) {_initialize();} 00108 00109 00110 /// constructor based on a Selector 00111 explicit GhostedAreaSpec(const Selector & selector, 00112 int repeat_in = gas::def_repeat, 00113 double ghost_area_in = gas::def_ghost_area, 00114 double grid_scatter_in = gas::def_grid_scatter, 00115 double pt_scatter_in = gas::def_pt_scatter, 00116 double mean_ghost_pt_in = gas::def_mean_ghost_pt 00117 ); 00118 00119 00120 /// does the initialization of actual ghost parameters 00121 void _initialize(); 00122 00123 // for accessing values set by the user 00124 inline double ghost_etamax () const {return _ghost_maxrap;} 00125 inline double ghost_maxrap () const {return _ghost_maxrap;} 00126 inline double ghost_area () const {return _ghost_area ;} 00127 inline double grid_scatter () const {return _grid_scatter;} 00128 inline double pt_scatter () const {return _pt_scatter ;} 00129 inline double mean_ghost_pt() const {return _mean_ghost_pt ;} 00130 inline int repeat () const {return _repeat ;} 00131 inline bool fj2_placement() const {return _fj2_placement;} 00132 00133 inline double kt_scatter () const {return _pt_scatter ;} 00134 inline double mean_ghost_kt() const {return _mean_ghost_pt ;} 00135 00136 // for accessing values 00137 inline double actual_ghost_area() const {return _actual_ghost_area;} 00138 inline int n_ghosts() const {return _n_ghosts;} 00139 00140 // when explicitly modifying values, sometimes call the initializer 00141 inline void set_ghost_area (double val) {_ghost_area = val; _initialize();} 00142 inline void set_ghost_etamax (double val) {_ghost_maxrap = val; _initialize();} 00143 inline void set_ghost_maxrap (double val) {_ghost_maxrap = val; _initialize();} 00144 inline void set_grid_scatter (double val) {_grid_scatter = val; } 00145 inline void set_pt_scatter (double val) {_pt_scatter = val; } 00146 inline void set_mean_ghost_pt(double val) {_mean_ghost_pt = val; } 00147 inline void set_repeat (int val) {_repeat = val; } 00148 00149 inline void set_kt_scatter (double val) {_pt_scatter = val; } 00150 inline void set_mean_ghost_kt(double val) {_mean_ghost_pt = val; } 00151 00152 /// if val is true, set ghost placement as it was in FastJet 2.X. The 00153 /// main differences between FJ2 and FJ3 ghost placement are 00154 /// 00155 /// - in FJ2 the rapidity spacing was 00156 /// ceil((maxrap-minrap)/sqrt(area)), while in FJ3 it is 00157 /// int((maxrap-minrap)/sqrt(area) + 0.5) [similarly for phi]. 00158 /// The FJ3 option offers more stability when trying to specify a 00159 /// spacing that exactly fits the extent. 00160 /// 00161 /// - in FJ2, the ghosts are placed at the corners of grid cells 00162 /// (i.e. extending up to maxrap), while in FJ3 they are placed at 00163 /// the centres of grid cells (i.e. extending roughly up to 00164 /// maxrap-sqrt(area)). The FJ2 behaviour effectively skews the 00165 /// total area coverage when maxrap is small, by an amount 00166 /// sqrt(area)/(2*maxrap). 00167 /// 00168 /// FJ2 placement is now deprecated. 00169 void set_fj2_placement(bool val); 00170 00171 /// return nphi (ghosts layed out (-nrap, 0..nphi-1), (-nrap+1,0..nphi-1), 00172 /// ... (nrap,0..nphi-1) 00173 inline int nphi() const {return _nphi;} 00174 inline int nrap() const {return _nrap;} 00175 00176 /// get all relevant information about the status of the 00177 /// random number generator, so that it can be reset subsequently 00178 /// with set_random_status. 00179 inline void get_random_status(std::vector<int> & __iseed) const { 00180 _random_generator.get_status(__iseed);} 00181 00182 /// set the status of the random number generator, as obtained 00183 /// previously with get_random_status. Note that the random 00184 /// generator is a static member of the class, i.e. common to all 00185 /// instances of the class --- so if you modify the random for this 00186 /// instance, you modify it for all instances. 00187 inline void set_random_status(const std::vector<int> & __iseed) { 00188 _random_generator.set_status(__iseed);} 00189 00190 inline void checkpoint_random() {get_random_status(_random_checkpoint);} 00191 inline void restore_checkpoint_random() {set_random_status(_random_checkpoint);} 00192 00193 /// for a summary 00194 std::string description() const; 00195 00196 /// push a set of ghost 4-momenta onto the back of the vector of 00197 /// PseudoJets 00198 void add_ghosts(std::vector<PseudoJet> & ) const; 00199 00200 /// very deprecated public access to a random number 00201 /// from the internal generator 00202 inline double random_at_own_risk() const {return _our_rand();} 00203 /// very deprecated public access to the generator itself 00204 inline BasicRandom<double> & generator_at_own_risk() const { 00205 return _random_generator;} 00206 00207 private: 00208 00209 // quantities that determine nature and distribution of ghosts 00210 double _ghost_maxrap; 00211 double _ghost_rap_offset; 00212 int _repeat ; 00213 double _ghost_area ; 00214 double _grid_scatter; 00215 double _pt_scatter ; 00216 double _mean_ghost_pt; 00217 bool _fj2_placement; 00218 00219 Selector _selector; 00220 00221 // derived quantities 00222 double _actual_ghost_area, _dphi, _drap; 00223 int _n_ghosts, _nphi, _nrap; 00224 00225 00226 std::vector<int> _random_checkpoint; 00227 static BasicRandom<double> _random_generator; 00228 //mutable BasicRandom<double> _random_generator; 00229 00230 static LimitedWarning _warn_fj2_placement_deprecated; 00231 00232 inline double _our_rand() const {return _random_generator();} 00233 00234 }; 00235 00236 /// just provide a typedef for backwards compatibility with programs 00237 /// based on versions 2.0 and 2.1 of fastjet. Since there is no 00238 /// easy way of telling people this is deprecated at compile or run 00239 /// time, we should be careful before removing this in the future. 00240 typedef GhostedAreaSpec ActiveAreaSpec; 00241 00242 00243 FASTJET_END_NAMESPACE 00244 00245 #endif // __FASTJET_GHOSTEDAREASPEC_HH__