FastJet 3.0alpha3
GhostedAreaSpec.hh
00001 //STARTHEADER
00002 // $Id: GhostedAreaSpec.hh 2020 2011-03-23 10:00:37Z salam $
00003 //
00004 // Copyright (c) 2005-2006, Matteo Cacciari and Gavin Salam
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, write to the Free Software
00026 //  Foundation, Inc.:
00027 //      59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00028 //----------------------------------------------------------------------
00029 //ENDHEADER
00030 
00031 
00032 #ifndef __FASTJET_GHOSTEDAREASPEC_HH__
00033 #define __FASTJET_GHOSTEDAREASPEC_HH__
00034 
00035 #include<vector>
00036 #include<string>
00037 #include "fastjet/PseudoJet.hh"
00038 #include "fastjet/internal/BasicRandom.hh"
00039 #include "fastjet/Selector.hh"
00040 
00041 // 
00042 #define STATIC_GENERATOR 1
00043 
00044 FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
00045 
00046 /// namespace to hold default parameters for the active area spec
00047 namespace gas {
00048   const double def_ghost_maxrap  = 6.0;
00049   const int    def_repeat        = 1;
00050   const double def_ghost_area    = 0.01;
00051   const double def_grid_scatter  = 1.0;
00052   const double def_kt_scatter    = 0.1;
00053   const double def_mean_ghost_kt = 1e-100;
00054 }
00055 
00056 //----------------------------------------------------------------------
00057 /// @ingroup area_classes
00058 /// \class GhostedAreaSpec
00059 /// Parameters to configure the computation of jet areas using ghosts
00060 ///
00061 /// Class that defines the parameters that go into the measurement
00062 /// of active jet areas.
00063 class GhostedAreaSpec {
00064 public:
00065   /// default constructor
00066   GhostedAreaSpec(): _ghost_maxrap (gas::def_ghost_maxrap), 
00067                      _ghost_rap_offset(0.0),
00068                     _repeat       (gas::def_repeat), 
00069                     _ghost_area   (gas::def_ghost_area), 
00070                     _grid_scatter (gas::def_grid_scatter), 
00071                     _kt_scatter   (gas::def_kt_scatter), 
00072                     _mean_ghost_kt(gas::def_mean_ghost_kt),
00073                     _actual_ghost_area(-1.0) {_initialize();};
00074   
00075   /// explicit constructor
00076   explicit GhostedAreaSpec(double ghost_maxrap, 
00077                           int    repeat        = gas::def_repeat,
00078                           double ghost_area    = gas::def_ghost_area,   
00079                           double grid_scatter  = gas::def_grid_scatter, 
00080                           double kt_scatter    = gas::def_kt_scatter,   
00081                           double mean_ghost_kt = gas::def_mean_ghost_kt
00082                           ): 
00083     _ghost_maxrap(ghost_maxrap), 
00084     _ghost_rap_offset(0.0),
00085     _repeat(repeat), 
00086     _ghost_area(ghost_area), 
00087     _grid_scatter(grid_scatter),  
00088     _kt_scatter(kt_scatter), 
00089     _mean_ghost_kt(mean_ghost_kt),
00090     _actual_ghost_area(-1.0) {_initialize();};
00091 
00092   /// explicit constructor
00093   explicit GhostedAreaSpec(double ghost_minrap, 
00094                            double ghost_maxrap, 
00095                            int    repeat        = gas::def_repeat,
00096                            double ghost_area    = gas::def_ghost_area,   
00097                            double grid_scatter  = gas::def_grid_scatter, 
00098                            double kt_scatter    = gas::def_kt_scatter,   
00099                            double mean_ghost_kt = gas::def_mean_ghost_kt
00100                           ): 
00101     _ghost_maxrap    (0.5*(ghost_maxrap - ghost_minrap)), 
00102     _ghost_rap_offset(0.5*(ghost_maxrap + ghost_minrap)),
00103     _repeat(repeat), 
00104     _ghost_area(ghost_area), 
00105     _grid_scatter(grid_scatter),  
00106     _kt_scatter(kt_scatter), 
00107     _mean_ghost_kt(mean_ghost_kt),
00108     _actual_ghost_area(-1.0) {_initialize();};
00109 
00110 
00111   /// constructor based on a Selector
00112   explicit GhostedAreaSpec(const Selector & selector,
00113                            int    repeat        = gas::def_repeat,
00114                            double ghost_area    = gas::def_ghost_area,   
00115                            double grid_scatter  = gas::def_grid_scatter, 
00116                            double kt_scatter    = gas::def_kt_scatter,   
00117                            double mean_ghost_kt = gas::def_mean_ghost_kt
00118                            );
00119 
00120 
00121   /// does the initialization of actual ghost parameters
00122   void _initialize();
00123 
00124   // for accessing values set by the user
00125   inline double ghost_etamax() const {return _ghost_maxrap;};
00126   inline double ghost_maxrap() const {return _ghost_maxrap;};
00127   inline double ghost_area   () const {return _ghost_area   ;};
00128   inline double grid_scatter() const {return _grid_scatter;};
00129   inline double kt_scatter  () const {return _kt_scatter  ;};
00130   inline double mean_ghost_kt() const {return _mean_ghost_kt  ;};
00131   inline int    repeat      () const {return _repeat      ;};
00132 
00133   // for accessing values 
00134   inline double actual_ghost_area() const {return _actual_ghost_area;};
00135   inline int    n_ghosts()          const {return _n_ghosts;};
00136 
00137   // when explicitly modifying values, sometimes call the initializer
00138   inline void set_ghost_area   (double val) {_ghost_area    = val; _initialize();};
00139   inline void set_ghost_etamax(double val) {_ghost_maxrap = val; _initialize();};
00140   inline void set_ghost_maxrap(double val) {_ghost_maxrap = val; _initialize();};
00141   inline void set_grid_scatter(double val) {_grid_scatter   = val; };
00142   inline void set_kt_scatter  (double val) {_kt_scatter     = val; };
00143   inline void set_mean_ghost_kt(double val){_mean_ghost_kt  = val; };
00144   inline void set_repeat      (int    val) {_repeat         = val; };
00145 
00146   /// return nphi (ghosts layed out (-nrap, 0..nphi-1), (-nrap+1,0..nphi-1),
00147   /// ... (nrap,0..nphi-1)
00148   inline int nphi() const {return _nphi;}
00149   inline int nrap() const {return _nrap;}
00150 
00151   /// get all relevant information about the status of the 
00152   /// random number generator, so that it can be reset subsequently
00153   /// with set_random_status.
00154   inline void get_random_status(std::vector<int> & __iseed) const {
00155     _random_generator.get_status(__iseed);}
00156 
00157   /// set the status of the random number generator, as obtained
00158   /// previously with get_random_status. Note that the random
00159   /// generator is a static member of the class, i.e. common to all
00160   /// instances of the class --- so if you modify the random for this
00161   /// instance, you modify it for all instances.
00162   inline void set_random_status(const std::vector<int> & __iseed) {
00163     _random_generator.set_status(__iseed);}
00164   
00165   inline void checkpoint_random() {get_random_status(_random_checkpoint);}
00166   inline void restore_checkpoint_random() {set_random_status(_random_checkpoint);}
00167 
00168   /// for a summary
00169   std::string description() const;
00170 
00171   /// push a set of ghost 4-momenta onto the back of the vector of
00172   /// PseudoJets
00173   void add_ghosts(std::vector<PseudoJet> & ) const;
00174 
00175   /// very deprecated public access to a random number 
00176   /// from the internal generator
00177   inline double random_at_own_risk() const {return _our_rand();};
00178   /// very deprecated public access to the generator itself
00179   inline BasicRandom<double> & generator_at_own_risk() const {
00180     return _random_generator;}
00181 
00182 private:
00183   
00184   // quantities that determine nature and distribution of ghosts
00185   double _ghost_maxrap;
00186   double _ghost_rap_offset;
00187   int    _repeat      ;
00188   double _ghost_area   ;  
00189   double _grid_scatter;
00190   double _kt_scatter  ;
00191   double _mean_ghost_kt;
00192 
00193   Selector _selector;
00194 
00195   // derived quantities
00196   double _actual_ghost_area, _dphi, _drap;
00197   int    _n_ghosts, _nphi, _nrap;
00198 
00199 
00200   std::vector<int> _random_checkpoint;
00201   static BasicRandom<double> _random_generator;
00202   //mutable BasicRandom<double> _random_generator;
00203 
00204   inline double _our_rand() const {return _random_generator();};
00205   
00206 };
00207 
00208 ////----------------------------------------------------------------------
00209 //class 1GhostPassiveAreaSpec : public GhostedAreaSpec {
00210 //public:
00211 //}
00212 
00213 FASTJET_END_NAMESPACE
00214 
00215 #endif // __FASTJET_GHOSTEDAREASPEC_HH__
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends