]> git.uio.no Git - u/mrichter/AliRoot.git/blob - JETAN/fastjet/fastjet/GhostedAreaSpec.hh
added pdet-ppart over ppart histogram for detector response
[u/mrichter/AliRoot.git] / JETAN / fastjet / fastjet / GhostedAreaSpec.hh
1 //STARTHEADER
2 // $Id: GhostedAreaSpec.hh 1273 2008-08-11 18:22:55Z salam $
3 //
4 // Copyright (c) 2005-2006, Matteo Cacciari and Gavin Salam
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, write to the Free Software
26 //  Foundation, Inc.:
27 //      59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
28 //----------------------------------------------------------------------
29 //ENDHEADER
30
31
32 #ifndef __FASTJET_GHOSTEDAREASPEC_HH__
33 #define __FASTJET_GHOSTEDAREASPEC_HH__
34
35 #include<vector>
36 #include<string>
37 #include "fastjet/PseudoJet.hh"
38 #include "fastjet/internal/BasicRandom.hh"
39
40 // 
41 #define STATIC_GENERATOR 1
42
43 namespace fastjet {      // defined in fastjet/internal/base.hh
44
45 /// namespace to hold default parameters for the active area spec
46 namespace 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_kt_scatter    = 0.1;
52   const double def_mean_ghost_kt = 1e-100;
53 }
54
55 //----------------------------------------------------------------------
56 /// Class that defines the parameters that go into the measurement
57 /// of active jet areas.
58 class GhostedAreaSpec {
59 public:
60   /// default constructor
61   GhostedAreaSpec(): _ghost_maxrap (gas::def_ghost_maxrap), 
62                      _ghost_rap_offset(0.0),
63                     _repeat       (gas::def_repeat), 
64                     _ghost_area   (gas::def_ghost_area), 
65                     _grid_scatter (gas::def_grid_scatter), 
66                     _kt_scatter   (gas::def_kt_scatter), 
67                     _mean_ghost_kt(gas::def_mean_ghost_kt),
68                     _actual_ghost_area(-1.0) {_initialize();};
69   
70   /// explicit constructor
71   explicit GhostedAreaSpec(double ghost_maxrap, 
72                           int    repeat        = gas::def_repeat,
73                           double ghost_area    = gas::def_ghost_area,   
74                           double grid_scatter  = gas::def_grid_scatter, 
75                           double kt_scatter    = gas::def_kt_scatter,   
76                           double mean_ghost_kt = gas::def_mean_ghost_kt
77                           ): 
78     _ghost_maxrap(ghost_maxrap), 
79     _ghost_rap_offset(0.0),
80     _repeat(repeat), 
81     _ghost_area(ghost_area), 
82     _grid_scatter(grid_scatter),  
83     _kt_scatter(kt_scatter), 
84     _mean_ghost_kt(mean_ghost_kt),
85     _actual_ghost_area(-1.0) {_initialize();};
86
87   /// explicit constructor
88   explicit GhostedAreaSpec(double ghost_minrap, 
89                            double ghost_maxrap, 
90                            int    repeat        = gas::def_repeat,
91                            double ghost_area    = gas::def_ghost_area,   
92                            double grid_scatter  = gas::def_grid_scatter, 
93                            double kt_scatter    = gas::def_kt_scatter,   
94                            double mean_ghost_kt = gas::def_mean_ghost_kt
95                           ): 
96     _ghost_maxrap    (0.5*(ghost_maxrap - ghost_minrap)), 
97     _ghost_rap_offset(0.5*(ghost_maxrap + ghost_minrap)),
98     _repeat(repeat), 
99     _ghost_area(ghost_area), 
100     _grid_scatter(grid_scatter),  
101     _kt_scatter(kt_scatter), 
102     _mean_ghost_kt(mean_ghost_kt),
103     _actual_ghost_area(-1.0) {_initialize();};
104
105
106   /// does the initialization of actual ghost parameters
107   void _initialize();
108
109   // for accessing values set by the user
110   inline double ghost_etamax() const {return _ghost_maxrap;};
111   inline double ghost_maxrap() const {return _ghost_maxrap;};
112   inline double ghost_area   () const {return _ghost_area   ;};
113   inline double grid_scatter() const {return _grid_scatter;};
114   inline double kt_scatter  () const {return _kt_scatter  ;};
115   inline double mean_ghost_kt() const {return _mean_ghost_kt  ;};
116   inline int    repeat      () const {return _repeat      ;};
117
118   // for accessing values 
119   inline double actual_ghost_area() const {return _actual_ghost_area;};
120   inline int    n_ghosts()          const {return _n_ghosts;};
121
122   // when explicitly modifying values, sometimes call the initializer
123   inline void set_ghost_area   (double val) {_ghost_area    = val; _initialize();};
124   inline void set_ghost_etamax(double val) {_ghost_maxrap = val; _initialize();};
125   inline void set_ghost_maxrap(double val) {_ghost_maxrap = val; _initialize();};
126   inline void set_grid_scatter(double val) {_grid_scatter   = val; };
127   inline void set_kt_scatter  (double val) {_kt_scatter     = val; };
128   inline void set_mean_ghost_kt(double val){_mean_ghost_kt  = val; };
129   inline void set_repeat      (int    val) {_repeat         = val; };
130
131   /// return nphi (ghosts layed out (-nrap, 0..nphi-1), (-nrap+1,0..nphi-1),
132   /// ... (nrap,0..nphi-1)
133   inline int nphi() const {return _nphi;}
134   inline int nrap() const {return _nrap;}
135
136   /// get all relevant information about the status of the 
137   /// random number generator, so that it can be reset subsequently
138   /// with set_random_status.
139   inline void get_random_status(std::vector<int> & __iseed) const {
140     _random_generator.get_status(__iseed);}
141
142   /// set the status of the random number generator, as obtained
143   /// previously with get_random_status. Note that the random
144   /// generator is a static member of the class, i.e. common to all
145   /// instances of the class --- so if you modify the random for this
146   /// instance, you modify it for all instances.
147   inline void set_random_status(const std::vector<int> & __iseed) {
148     _random_generator.set_status(__iseed);}
149   
150   inline void checkpoint_random() {get_random_status(_random_checkpoint);}
151   inline void restore_checkpoint_random() {set_random_status(_random_checkpoint);}
152
153   /// for a summary
154   std::string description() const;
155
156   /// push the ghost 4-momenta onto the back of the vector of PseudoJets
157   void add_ghosts(std::vector<PseudoJet> & ) const;
158
159   /// very deprecated public access to a random number 
160   /// from the internal generator
161   inline double random_at_own_risk() const {return _our_rand();};
162   /// very deprecated public access to the generator itself
163   inline BasicRandom<double> & generator_at_own_risk() const {
164     return _random_generator;}
165
166 private:
167   
168   // quantities that determine nature and distribution of ghosts
169   double _ghost_maxrap;
170   double _ghost_rap_offset;
171   int    _repeat      ;
172   double _ghost_area   ;  
173   double _grid_scatter;
174   double _kt_scatter  ;
175   double _mean_ghost_kt;
176
177   // derived quantities
178   double _actual_ghost_area, _dphi, _drap;
179   int    _n_ghosts, _nphi, _nrap;
180
181
182   std::vector<int> _random_checkpoint;
183   static BasicRandom<double> _random_generator;
184   //mutable BasicRandom<double> _random_generator;
185
186   inline double _our_rand() const {return _random_generator();};
187   
188 };
189
190 ////----------------------------------------------------------------------
191 //class 1GhostPassiveAreaSpec : public GhostedAreaSpec {
192 //public:
193 //}
194
195 } // fastjet namespace 
196
197 #endif // __FASTJET_GHOSTEDAREASPEC_HH__