32 #ifndef __FASTJET_GHOSTEDAREASPEC_HH__
33 #define __FASTJET_GHOSTEDAREASPEC_HH__
37 #include "fastjet/PseudoJet.hh"
38 #include "fastjet/internal/BasicRandom.hh"
39 #include "fastjet/Selector.hh"
40 #include "fastjet/LimitedWarning.hh"
41 #include "fastjet/internal/deprecated.hh"
42 #include "fastjet/SharedPtr.hh"
45 #define STATIC_GENERATOR 1
47 FASTJET_BEGIN_NAMESPACE
51 const double def_ghost_maxrap = 6.0;
52 const int def_repeat = 1;
53 const double def_ghost_area = 0.01;
54 const double def_grid_scatter = 1.0;
55 const double def_pt_scatter = 0.1;
56 const double def_mean_ghost_pt = 1e-100;
107 _ghost_maxrap (gas::def_ghost_maxrap),
108 _ghost_rap_offset(0.0),
109 _repeat (gas::def_repeat),
110 _ghost_area (gas::def_ghost_area),
111 _grid_scatter (gas::def_grid_scatter),
112 _pt_scatter (gas::def_pt_scatter),
113 _mean_ghost_pt(gas::def_mean_ghost_pt),
114 _fj2_placement(false),
115 _user_random_generator(){_initialize();}
125 BasicRandom<double> *user_random_generator):
126 _ghost_maxrap(ghost_maxrap_in),
127 _ghost_rap_offset(0.0),
128 _repeat (gas::def_repeat),
129 _ghost_area (gas::def_ghost_area),
130 _grid_scatter (gas::def_grid_scatter),
131 _pt_scatter (gas::def_pt_scatter),
132 _mean_ghost_pt(gas::def_mean_ghost_pt),
133 _fj2_placement(false),
134 _user_random_generator(user_random_generator) {_initialize();}
138 int repeat_in = gas::def_repeat,
139 double ghost_area_in = gas::def_ghost_area,
140 double grid_scatter_in = gas::def_grid_scatter,
141 double pt_scatter_in = gas::def_pt_scatter,
142 double mean_ghost_pt_in = gas::def_mean_ghost_pt,
143 BasicRandom<double> *user_random_generator=NULL):
144 _ghost_maxrap(ghost_maxrap_in),
145 _ghost_rap_offset(0.0),
147 _ghost_area(ghost_area_in),
148 _grid_scatter(grid_scatter_in),
149 _pt_scatter(pt_scatter_in),
150 _mean_ghost_pt(mean_ghost_pt_in),
151 _fj2_placement(false),
152 _user_random_generator(user_random_generator) {_initialize();}
156 double ghost_maxrap_in,
157 int repeat_in = gas::def_repeat,
158 double ghost_area_in = gas::def_ghost_area,
159 double grid_scatter_in = gas::def_grid_scatter,
160 double pt_scatter_in = gas::def_pt_scatter,
161 double mean_ghost_pt_in = gas::def_mean_ghost_pt,
162 BasicRandom<double> *user_random_generator=NULL):
163 _ghost_maxrap (0.5*(ghost_maxrap_in - ghost_minrap_in)),
164 _ghost_rap_offset(0.5*(ghost_maxrap_in + ghost_minrap_in)),
166 _ghost_area(ghost_area_in),
167 _grid_scatter(grid_scatter_in),
168 _pt_scatter(pt_scatter_in),
169 _mean_ghost_pt(mean_ghost_pt_in),
170 _fj2_placement(false),
171 _user_random_generator(user_random_generator) {_initialize();}
176 int repeat_in = gas::def_repeat,
177 double ghost_area_in = gas::def_ghost_area,
178 double grid_scatter_in = gas::def_grid_scatter,
179 double pt_scatter_in = gas::def_pt_scatter,
180 double mean_ghost_pt_in = gas::def_mean_ghost_pt,
181 BasicRandom<double> *user_random_generator=NULL);
188 inline double ghost_rapmax ()
const {
return _ghost_maxrap;}
189 inline double ghost_maxrap ()
const {
return _ghost_maxrap;}
190 inline double ghost_etamax ()
const {
return _ghost_maxrap;}
191 inline double ghost_maxeta ()
const {
return _ghost_maxrap;}
192 inline double ghost_area ()
const {
return _ghost_area ;}
193 inline double grid_scatter ()
const {
return _grid_scatter;}
194 inline double pt_scatter ()
const {
return _pt_scatter ;}
195 inline double mean_ghost_pt()
const {
return _mean_ghost_pt ;}
196 inline int repeat ()
const {
return _repeat ;}
197 inline bool fj2_placement()
const {
return _fj2_placement;}
199 inline double kt_scatter ()
const {
return _pt_scatter ;}
200 inline double mean_ghost_kt()
const {
return _mean_ghost_pt ;}
203 inline double actual_ghost_area()
const {
return _actual_ghost_area;}
204 inline int n_ghosts()
const {
return _n_ghosts;}
207 inline void set_ghost_area (
double val) {_ghost_area = val; _initialize();}
208 inline void set_ghost_rapmax (
double val) {_ghost_maxrap = val; _initialize();}
209 inline void set_ghost_maxrap (
double val) {_ghost_maxrap = val; _initialize();}
210 inline void set_ghost_etamax (
double val) {_ghost_maxrap = val; _initialize();}
211 inline void set_ghost_maxeta (
double val) {_ghost_maxrap = val; _initialize();}
212 inline void set_grid_scatter (
double val) {_grid_scatter = val; }
213 inline void set_pt_scatter (
double val) {_pt_scatter = val; }
214 inline void set_mean_ghost_pt(
double val) {_mean_ghost_pt = val; }
215 inline void set_repeat (
int val) {_repeat = val; }
217 inline void set_kt_scatter (
double val) {_pt_scatter = val; }
218 inline void set_mean_ghost_kt(
double val) {_mean_ghost_pt = val; }
237 FASTJET_DEPRECATED_MSG(
"This is deprecated since we strongly recommend use of the new ghost placement instead",
238 void set_fj2_placement(
bool val));
242 inline int nphi()
const {
return _nphi;}
243 inline int nrap()
const {
return _nrap;}
251 if (_user_random_generator){
252 _user_random_generator->get_status(__iseed);
254 _random_generator.get_status(__iseed);
264 if (_user_random_generator){
265 _user_random_generator->set_status(__iseed);
267 _random_generator.set_status(__iseed);
275 new_spec._fixed_seed = __iseed;
281 __iseed = _fixed_seed;
291 if (_repeat > 1) _warn_fixed_last_seeds_nrepeat_gt_1
292 .warn(
"Using fixed seeds (or accessing last used seeds) not sensible with repeat>1");
293 __iseed = _last_used_seed;
296 inline void checkpoint_random() {get_random_status(_random_checkpoint);}
297 inline void restore_checkpoint_random() {set_random_status(_random_checkpoint);}
300 std::string description()
const;
304 void add_ghosts(std::vector<PseudoJet> & )
const;
311 return _user_random_generator ? *_user_random_generator : _random_generator;}
314 return _user_random_generator;}
319 double _ghost_maxrap;
320 double _ghost_rap_offset;
323 double _grid_scatter;
325 double _mean_ghost_pt;
331 double _actual_ghost_area, _dphi, _drap;
332 int _n_ghosts, _nphi, _nrap;
335 std::vector<int> _random_checkpoint;
338 std::vector<int> _fixed_seed;
341 mutable std::vector<int> _last_used_seed;
352 static BasicRandom<double> _random_generator;
357 std::vector<int> _user_defined_seeds;
365 inline double _our_rand()
const {
366 return _user_random_generator ? (*_user_random_generator)() : _random_generator();}
368 inline void _our_rand(
unsigned int npoints,
double *pointer,
369 std::vector<int> & used_init_seed)
const {
370 return _user_random_generator
371 ? (*_user_random_generator)(npoints, pointer, used_init_seed)
372 : _random_generator(npoints, pointer, used_init_seed);
384 FASTJET_END_NAMESPACE
Parameters to configure the computation of jet areas using ghosts.
void get_last_seed(std::vector< int > &__iseed) const
allows the user to get the seed that was used at the start of the last generation of ghosts.
void set_random_status(const std::vector< int > &__iseed)
set the status of the random number generator, as obtained previously with get_random_status.
GhostedAreaSpec with_fixed_seed(const std::vector< int > &__iseed) const
allows to return a copy of this GhostedAreaSpec with a local set of seeds
GhostedAreaSpec(double ghost_maxrap_in, int repeat_in=gas::def_repeat, double ghost_area_in=gas::def_ghost_area, double grid_scatter_in=gas::def_grid_scatter, double pt_scatter_in=gas::def_pt_scatter, double mean_ghost_pt_in=gas::def_mean_ghost_pt, BasicRandom< double > *user_random_generator=NULL)
explicit constructor
GhostedAreaSpec(double ghost_minrap_in, double ghost_maxrap_in, int repeat_in=gas::def_repeat, double ghost_area_in=gas::def_ghost_area, double grid_scatter_in=gas::def_grid_scatter, double pt_scatter_in=gas::def_pt_scatter, double mean_ghost_pt_in=gas::def_mean_ghost_pt, BasicRandom< double > *user_random_generator=NULL)
explicit constructor
GhostedAreaSpec(double ghost_maxrap_in, BasicRandom< double > *user_random_generator)
explicit constructor
int nphi() const
return nphi (ghosts layed out (-nrap, 0..nphi-1), (-nrap+1,0..nphi-1), ...
BasicRandom< double > & generator_at_own_risk() const
very deprecated public access to the generator itself
GhostedAreaSpec()
default constructor
SharedPtr< BasicRandom< double > > & user_random_generator_at_own_risk()
access to the user-defined random-number generator. Will be empty if not set.
void get_random_status(std::vector< int > &__iseed) const
get all relevant information about the status of the random number generator, so that it can be reset...
void get_fixed_seed(std::vector< int > &__iseed) const
returns the current fixed seed
double random_at_own_risk() const
very deprecated public access to a random number from the internal generator
class to provide facilities for giving warnings up to some maximum number of times and to provide glo...
Class that encodes information about cuts and other selection criteria that can be applied to PseudoJ...
An implementation of shared pointers that is broadly similar to C++11 shared_ptr (https://en....