CLHEP VERSION Reference Documentation
   
CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

Random/Random/RandLandau.h
Go to the documentation of this file.
1 // $Id: RandLandau.h,v 1.5 2010/06/16 17:24:53 garren Exp $
2 // -*- C++ -*-
3 //
4 // -----------------------------------------------------------------------
5 // HEP Random
6 // --- RandLandau ---
7 // class header file
8 // -----------------------------------------------------------------------
9 // This file is part of Geant4 (simulation toolkit for HEP).
10 
11 // Class defining methods for shooting or firing Landau distributed
12 // random values.
13 //
14 // The Landau distribution is parameterless and describes the fluctuations
15 // in energy loss of a particle, making certain assumptions. For
16 // definitions and algorithms, the following papers could be read:
17 //
18 // Landau, Jour Phys VIII, No. 4, p. 201 (1944)
19 // Borsh-Supan, Jour Res. of NBS 65B NO. 4 p. 245 (1961)
20 // Kolbig & Schorr Comp Phys Comm 31 p. 97 (1984)
21 //
22 // The algorithm implemented comes form RANLAN in CERNLIB.
23 
24 // =======================================================================
25 // M. Fischler - Created: 5th January 2000
26 // M Fischler - put and get to/from streams 12/10/04
27 //
28 // =======================================================================
29 
30 #ifndef RandLandau_h
31 #define RandLandau_h 1
32 
33 #include "CLHEP/Random/defs.h"
34 #include "CLHEP/Random/Random.h"
35 #include "CLHEP/Utility/memory.h"
36 
37 namespace CLHEP {
38 
43 class RandLandau : public HepRandom {
44 
45 public:
46 
47  inline RandLandau ( HepRandomEngine& anEngine );
48  inline RandLandau ( HepRandomEngine* anEngine );
49 
50  // These constructors should be used to instantiate a RandLandau
51  // distribution object defining a local engine for it.
52  // The static generator will be skipped using the non-static methods
53  // defined below.
54  // If the engine is passed by pointer the corresponding engine object
55  // will be deleted by the RandLandau destructor.
56  // If the engine is passed by reference the corresponding engine object
57  // will not be deleted by the RandLandau destructor.
58 
59  virtual ~RandLandau();
60  // Destructor
61 
62  // Save and restore to/from streams
63 
64  std::ostream & put ( std::ostream & os ) const;
65  std::istream & get ( std::istream & is );
66 
67  //
68  // Methods to generate Landau-distributed random deviates.
69  //
70  // These deviates are accurate to the actual Landau distribution to
71  // one part in 10**5 or better.
72 
73  // Static methods to shoot random values using the static generator
74 
75  static inline double shoot();
76 
77  static void shootArray ( const int size, double* vect );
78 
79  // Static methods to shoot random values using a given engine
80  // by-passing the static generator.
81 
82  static inline double shoot( HepRandomEngine* anotherEngine );
83 
84  static void shootArray ( HepRandomEngine* anotherEngine,
85  const int size,
86  double* vect );
87 
88  // Instance methods using the localEngine to instead of the static
89  // generator, and the default mean and stdDev established at construction
90 
91  inline double fire();
92 
93  void fireArray ( const int size, double* vect);
94 
95  inline double operator()();
96 
97  std::string name() const;
99 
100  static std::string distributionName() {return "RandLandau";}
101  // Provides the name of this distribution class
102 
103 
104 protected:
105 
106  static double transform (double r);
107  static double transformSmall (double r);
108 
109 private:
110 
111  shared_ptr<HepRandomEngine> localEngine;
112 
113 };
114 
115 } // namespace CLHEP
116 
117 #ifdef ENABLE_BACKWARDS_COMPATIBILITY
118 // backwards compatibility will be enabled ONLY in CLHEP 1.9
119 using namespace CLHEP;
120 #endif
121 
122 #include "CLHEP/Random/RandLandau.icc"
123 
124 #endif
static double shoot()
static void shootArray(HepRandomEngine *anotherEngine, const int size, double *vect)
static double transformSmall(double r)
RandLandau(HepRandomEngine &anEngine)
std::string name() const
static double transform(double r)
virtual ~RandLandau()
std::istream & get(std::istream &is)
void fireArray(const int size, double *vect)
std::ostream & put(std::ostream &os) const
static std::string distributionName()
static double shoot(HepRandomEngine *anotherEngine)
static void shootArray(const int size, double *vect)
RandLandau(HepRandomEngine *anEngine)
HepRandomEngine & engine()