Fork me on GitHub

source: git/external/fastjet/GhostedAreaSpec.hh@ 5150e39

ImprovedOutputFile Timing dual_readout llp
Last change on this file since 5150e39 was d7d2da3, checked in by pavel <pavel@…>, 12 years ago

move branches/ModularDelphes to trunk

  • Property mode set to 100644
File size: 9.7 KB
RevLine 
[d7d2da3]1//STARTHEADER
2// $Id: GhostedAreaSpec.hh 2728 2011-11-20 14:18:59Z salam $
3//
4// Copyright (c) 2005-2011, Matteo Cacciari, Gavin P. Salam and Gregory Soyez
5//
6//----------------------------------------------------------------------
7// This file is part of FastJet.
8//
9// FastJet is free software; you can redistribute it and/or modify
10// it under the terms of the GNU General Public License as published by
11// the Free Software Foundation; either version 2 of the License, or
12// (at your option) any later version.
13//
14// The algorithms that underlie FastJet have required considerable
15// development and are described in hep-ph/0512210. If you use
16// FastJet as part of work towards a scientific publication, please
17// include a citation to the FastJet paper.
18//
19// FastJet is distributed in the hope that it will be useful,
20// but WITHOUT ANY WARRANTY; without even the implied warranty of
21// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22// GNU General Public License for more details.
23//
24// You should have received a copy of the GNU General Public License
25// along with FastJet. If not, see <http://www.gnu.org/licenses/>.
26//----------------------------------------------------------------------
27//ENDHEADER
28
29
30#ifndef __FASTJET_GHOSTEDAREASPEC_HH__
31#define __FASTJET_GHOSTEDAREASPEC_HH__
32
33#include<vector>
34#include<string>
35#include "fastjet/PseudoJet.hh"
36#include "fastjet/internal/BasicRandom.hh"
37#include "fastjet/Selector.hh"
38#include "fastjet/LimitedWarning.hh"
39
40//
41#define STATIC_GENERATOR 1
42
43FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
44
45/// namespace to hold default parameters for the active area spec
46namespace gas {
47 const double def_ghost_maxrap = 6.0;
48 const int def_repeat = 1;
49 const double def_ghost_area = 0.01;
50 const double def_grid_scatter = 1.0;
51 const double def_pt_scatter = 0.1;
52 const double def_mean_ghost_pt = 1e-100;
53}
54
55//----------------------------------------------------------------------
56/// @ingroup area_classes
57/// \class GhostedAreaSpec
58/// Parameters to configure the computation of jet areas using ghosts
59///
60/// Class that defines the parameters that go into the measurement
61/// of active jet areas.
62class GhostedAreaSpec {
63public:
64 /// default constructor
65 GhostedAreaSpec(): _ghost_maxrap (gas::def_ghost_maxrap),
66 _ghost_rap_offset(0.0),
67 _repeat (gas::def_repeat),
68 _ghost_area (gas::def_ghost_area),
69 _grid_scatter (gas::def_grid_scatter),
70 _pt_scatter (gas::def_pt_scatter),
71 _mean_ghost_pt(gas::def_mean_ghost_pt),
72 _fj2_placement(false) {_initialize();}
73
74 /// explicit constructor
75 explicit GhostedAreaSpec(double ghost_maxrap_in,
76 int repeat_in = gas::def_repeat,
77 double ghost_area_in = gas::def_ghost_area,
78 double grid_scatter_in = gas::def_grid_scatter,
79 double pt_scatter_in = gas::def_pt_scatter,
80 double mean_ghost_pt_in = gas::def_mean_ghost_pt
81 ):
82 _ghost_maxrap(ghost_maxrap_in),
83 _ghost_rap_offset(0.0),
84 _repeat(repeat_in),
85 _ghost_area(ghost_area_in),
86 _grid_scatter(grid_scatter_in),
87 _pt_scatter(pt_scatter_in),
88 _mean_ghost_pt(mean_ghost_pt_in),
89 _fj2_placement(false) {_initialize();}
90
91 /// explicit constructor
92 explicit GhostedAreaSpec(double ghost_minrap_in,
93 double ghost_maxrap_in,
94 int repeat_in = gas::def_repeat,
95 double ghost_area_in = gas::def_ghost_area,
96 double grid_scatter_in = gas::def_grid_scatter,
97 double pt_scatter_in = gas::def_pt_scatter,
98 double mean_ghost_pt_in = gas::def_mean_ghost_pt
99 ):
100 _ghost_maxrap (0.5*(ghost_maxrap_in - ghost_minrap_in)),
101 _ghost_rap_offset(0.5*(ghost_maxrap_in + ghost_minrap_in)),
102 _repeat(repeat_in),
103 _ghost_area(ghost_area_in),
104 _grid_scatter(grid_scatter_in),
105 _pt_scatter(pt_scatter_in),
106 _mean_ghost_pt(mean_ghost_pt_in),
107 _fj2_placement(false) {_initialize();}
108
109
110 /// constructor based on a Selector
111 explicit GhostedAreaSpec(const Selector & selector,
112 int repeat_in = gas::def_repeat,
113 double ghost_area_in = gas::def_ghost_area,
114 double grid_scatter_in = gas::def_grid_scatter,
115 double pt_scatter_in = gas::def_pt_scatter,
116 double mean_ghost_pt_in = gas::def_mean_ghost_pt
117 );
118
119
120 /// does the initialization of actual ghost parameters
121 void _initialize();
122
123 // for accessing values set by the user
124 inline double ghost_etamax () const {return _ghost_maxrap;}
125 inline double ghost_maxrap () const {return _ghost_maxrap;}
126 inline double ghost_area () const {return _ghost_area ;}
127 inline double grid_scatter () const {return _grid_scatter;}
128 inline double pt_scatter () const {return _pt_scatter ;}
129 inline double mean_ghost_pt() const {return _mean_ghost_pt ;}
130 inline int repeat () const {return _repeat ;}
131 inline bool fj2_placement() const {return _fj2_placement;}
132
133 inline double kt_scatter () const {return _pt_scatter ;}
134 inline double mean_ghost_kt() const {return _mean_ghost_pt ;}
135
136 // for accessing values
137 inline double actual_ghost_area() const {return _actual_ghost_area;}
138 inline int n_ghosts() const {return _n_ghosts;}
139
140 // when explicitly modifying values, sometimes call the initializer
141 inline void set_ghost_area (double val) {_ghost_area = val; _initialize();}
142 inline void set_ghost_etamax (double val) {_ghost_maxrap = val; _initialize();}
143 inline void set_ghost_maxrap (double val) {_ghost_maxrap = val; _initialize();}
144 inline void set_grid_scatter (double val) {_grid_scatter = val; }
145 inline void set_pt_scatter (double val) {_pt_scatter = val; }
146 inline void set_mean_ghost_pt(double val) {_mean_ghost_pt = val; }
147 inline void set_repeat (int val) {_repeat = val; }
148
149 inline void set_kt_scatter (double val) {_pt_scatter = val; }
150 inline void set_mean_ghost_kt(double val) {_mean_ghost_pt = val; }
151
152 /// if val is true, set ghost placement as it was in FastJet 2.X. The
153 /// main differences between FJ2 and FJ3 ghost placement are
154 ///
155 /// - in FJ2 the rapidity spacing was
156 /// ceil((maxrap-minrap)/sqrt(area)), while in FJ3 it is
157 /// int((maxrap-minrap)/sqrt(area) + 0.5) [similarly for phi].
158 /// The FJ3 option offers more stability when trying to specify a
159 /// spacing that exactly fits the extent.
160 ///
161 /// - in FJ2, the ghosts are placed at the corners of grid cells
162 /// (i.e. extending up to maxrap), while in FJ3 they are placed at
163 /// the centres of grid cells (i.e. extending roughly up to
164 /// maxrap-sqrt(area)). The FJ2 behaviour effectively skews the
165 /// total area coverage when maxrap is small, by an amount
166 /// sqrt(area)/(2*maxrap).
167 ///
168 /// FJ2 placement is now deprecated.
169 void set_fj2_placement(bool val);
170
171 /// return nphi (ghosts layed out (-nrap, 0..nphi-1), (-nrap+1,0..nphi-1),
172 /// ... (nrap,0..nphi-1)
173 inline int nphi() const {return _nphi;}
174 inline int nrap() const {return _nrap;}
175
176 /// get all relevant information about the status of the
177 /// random number generator, so that it can be reset subsequently
178 /// with set_random_status.
179 inline void get_random_status(std::vector<int> & __iseed) const {
180 _random_generator.get_status(__iseed);}
181
182 /// set the status of the random number generator, as obtained
183 /// previously with get_random_status. Note that the random
184 /// generator is a static member of the class, i.e. common to all
185 /// instances of the class --- so if you modify the random for this
186 /// instance, you modify it for all instances.
187 inline void set_random_status(const std::vector<int> & __iseed) {
188 _random_generator.set_status(__iseed);}
189
190 inline void checkpoint_random() {get_random_status(_random_checkpoint);}
191 inline void restore_checkpoint_random() {set_random_status(_random_checkpoint);}
192
193 /// for a summary
194 std::string description() const;
195
196 /// push a set of ghost 4-momenta onto the back of the vector of
197 /// PseudoJets
198 void add_ghosts(std::vector<PseudoJet> & ) const;
199
200 /// very deprecated public access to a random number
201 /// from the internal generator
202 inline double random_at_own_risk() const {return _our_rand();}
203 /// very deprecated public access to the generator itself
204 inline BasicRandom<double> & generator_at_own_risk() const {
205 return _random_generator;}
206
207private:
208
209 // quantities that determine nature and distribution of ghosts
210 double _ghost_maxrap;
211 double _ghost_rap_offset;
212 int _repeat ;
213 double _ghost_area ;
214 double _grid_scatter;
215 double _pt_scatter ;
216 double _mean_ghost_pt;
217 bool _fj2_placement;
218
219 Selector _selector;
220
221 // derived quantities
222 double _actual_ghost_area, _dphi, _drap;
223 int _n_ghosts, _nphi, _nrap;
224
225
226 std::vector<int> _random_checkpoint;
227 static BasicRandom<double> _random_generator;
228 //mutable BasicRandom<double> _random_generator;
229
230 static LimitedWarning _warn_fj2_placement_deprecated;
231
232 inline double _our_rand() const {return _random_generator();}
233
234};
235
236/// just provide a typedef for backwards compatibility with programs
237/// based on versions 2.0 and 2.1 of fastjet. Since there is no
238/// easy way of telling people this is deprecated at compile or run
239/// time, we should be careful before removing this in the future.
240typedef GhostedAreaSpec ActiveAreaSpec;
241
242
243FASTJET_END_NAMESPACE
244
245#endif // __FASTJET_GHOSTEDAREASPEC_HH__
Note: See TracBrowser for help on using the repository browser.