31 #include "fastjet/GhostedAreaSpec.hh" 32 #include "fastjet/Error.hh" 38 FASTJET_BEGIN_NAMESPACE
40 BasicRandom<double> GhostedAreaSpec::_random_generator;
41 LimitedWarning GhostedAreaSpec::_warn_fj2_placement_deprecated;
44 GhostedAreaSpec::GhostedAreaSpec(
47 double ghost_area_in ,
48 double grid_scatter_in ,
49 double pt_scatter_in ,
50 double mean_ghost_pt_in
53 _ghost_area(ghost_area_in),
54 _grid_scatter(grid_scatter_in),
55 _pt_scatter(pt_scatter_in),
56 _mean_ghost_pt(mean_ghost_pt_in),
57 _fj2_placement(false),
59 _actual_ghost_area(-1.0)
64 if (!_selector.
has_finite_area())
throw Error(
"To construct a GhostedAreaSpec with a Selector, the selector must have a finite area");
65 if (!_selector.
applies_jet_by_jet())
throw Error(
"To construct a GhostedAreaSpec with a Selector, the selector must apply jet-by-jet");
67 double ghost_maxrap_local, ghost_minrap_local;
69 _ghost_maxrap = 0.5*(ghost_maxrap_local - ghost_minrap_local);
70 _ghost_rap_offset = 0.5*(ghost_maxrap_local + ghost_minrap_local);
80 if (val) _warn_fj2_placement_deprecated.
warn(
"FJ2 placement of ghosts can lead to systematic edge effects in area evaluation and is deprecated. Prefer new (default) FJ3 placement.");
89 _drap = sqrt(_ghost_area);
92 _nphi = int(ceil(twopi/_dphi)); _dphi = twopi/_nphi;
93 _nrap = int(ceil(_ghost_maxrap/_drap)); _drap = _ghost_maxrap / _nrap;
94 _actual_ghost_area = _dphi * _drap;
95 _n_ghosts = (2*_nrap+1)*_nphi;
102 _nphi = int(twopi/_dphi + 0.5); _dphi = twopi/_nphi;
103 _nrap = int(_ghost_maxrap/_drap + 0.5); _drap = _ghost_maxrap / _nrap;
104 _actual_ghost_area = _dphi * _drap;
105 _n_ghosts = (2*_nrap)*_nphi;
118 if (_fj2_placement) {
123 nrap_upper = _nrap-1;
127 for (
int irap = -_nrap; irap <= nrap_upper; irap++) {
128 for (
int iphi = 0; iphi < _nphi; iphi++) {
135 double phi_fj2 = (iphi+0.5) * _dphi + _dphi*(_our_rand()-0.5)*_grid_scatter;
137 if (_fj2_placement) phi = 0.5*pi - phi_fj2;
139 double rap = (irap+rap_offset) * _drap + _drap*(_our_rand()-0.5)*_grid_scatter
140 + _ghost_rap_offset ;
141 double pt = _mean_ghost_pt*(1+(_our_rand()-0.5)*_pt_scatter);
143 double exprap = exp(+rap);
144 double pminus = pt/exprap;
145 double pplus = pt*exprap;
146 double px = pt*cos(phi);
147 double py = pt*sin(phi);
148 PseudoJet mom(px,py,0.5*(pplus-pminus),0.5*(pplus+pminus));
157 if (_selector.
worker().get() && !_selector.
pass(mom))
continue;
158 event.push_back(mom);
166 ostr <<
"ghosts of area " << actual_ghost_area()
167 <<
" (had requested " << ghost_area() <<
")";
168 if (_selector.
worker().get())
169 ostr <<
", placed according to selector (" << _selector.
description() <<
")";
171 ostr <<
", placed up to y = " << ghost_maxrap() ;
172 ostr <<
", scattered wrt to perfect grid by (rel) " << grid_scatter()
173 <<
", mean_ghost_pt = " << mean_ghost_pt()
174 <<
", rel pt_scatter = " << pt_scatter()
175 <<
", n repetitions of ghost distributions = " << repeat();
179 FASTJET_END_NAMESPACE
void set_cached_rap_phi(double rap, double phi)
in some cases when setting a 4-momentum, the user/program knows what rapidity and azimuth are associa...
void add_ghosts(std::vector< PseudoJet > &) const
push a set of ghost 4-momenta onto the back of the vector of PseudoJets
const SharedPtr< SelectorWorker > & worker() const
returns a (reference to) the underlying worker's shared pointer
void _initialize()
does the initialization of actual ghost parameters
bool has_finite_area() const
returns true if it has a meaningful and finite area (i.e.
void get_rapidity_extent(double &rapmin, double &rapmax) const
returns the rapidity range for which it may return "true"
void warn(const char *warning)
outputs a warning to standard error (or the user's default warning stream if set) ...
bool applies_jet_by_jet() const
returns true if this can be applied jet by jet
bool pass(const PseudoJet &jet) const
return true if the jet passes the selection
base class corresponding to errors that can be thrown by FastJet
Class that encodes information about cuts and other selection criteria that can be applied to PseudoJ...
std::string description() const
returns a textual description of the selector
void set_fj2_placement(bool val)
if val is true, set ghost placement as it was in FastJet 2.X.
std::string description() const
for a summary
Class to contain pseudojets, including minimal information of use to jet-clustering routines...