CLHEP 2.0.4.7 Reference Documentation
CLHEP Home Page CLHEP Documentation CLHEP Bug Reports |
00001 // $Id: RandLandau.h,v 1.3.4.1 2005/03/18 22:26:48 garren Exp $ 00002 // -*- C++ -*- 00003 // 00004 // ----------------------------------------------------------------------- 00005 // HEP Random 00006 // --- RandLandau --- 00007 // class header file 00008 // ----------------------------------------------------------------------- 00009 // This file is part of Geant4 (simulation toolkit for HEP). 00010 00011 // Class defining methods for shooting or firing Landau distributed 00012 // random values. 00013 // 00014 // The Landau distribution is parameterless and describes the fluctuations 00015 // in energy loss of a particle, making certain assumptions. For 00016 // definitions and algorithms, the following papers could be read: 00017 // 00018 // Landau, Jour Phys VIII, No. 4, p. 201 (1944) 00019 // Borsh-Supan, Jour Res. of NBS 65B NO. 4 p. 245 (1961) 00020 // Kolbig & Schorr Comp Phys Comm 31 p. 97 (1984) 00021 // 00022 // The algorithm implemented comes form RANLAN in CERNLIB. 00023 00024 // ======================================================================= 00025 // M. Fischler - Created: 5th January 2000 00026 // M Fischler - put and get to/from streams 12/10/04 00027 // 00028 // ======================================================================= 00029 00030 #ifndef RandLandau_h 00031 #define RandLandau_h 1 00032 00033 #include "CLHEP/Random/defs.h" 00034 #include "CLHEP/Random/Random.h" 00035 00036 namespace CLHEP { 00037 00042 class RandLandau : public HepRandom { 00043 00044 public: 00045 00046 inline RandLandau ( HepRandomEngine& anEngine ); 00047 inline RandLandau ( HepRandomEngine* anEngine ); 00048 00049 // These constructors should be used to instantiate a RandLandau 00050 // distribution object defining a local engine for it. 00051 // The static generator will be skipped using the non-static methods 00052 // defined below. 00053 // If the engine is passed by pointer the corresponding engine object 00054 // will be deleted by the RandLandau destructor. 00055 // If the engine is passed by reference the corresponding engine object 00056 // will not be deleted by the RandLandau destructor. 00057 00058 virtual ~RandLandau(); 00059 // Destructor 00060 00061 // Save and restore to/from streams 00062 00063 std::ostream & put ( std::ostream & os ) const; 00064 std::istream & get ( std::istream & is ); 00065 00066 // 00067 // Methods to generate Landau-distributed random deviates. 00068 // 00069 // These deviates are accurate to the actual Landau distribution to 00070 // one part in 10**5 or better. 00071 00072 // Static methods to shoot random values using the static generator 00073 00074 static inline double shoot(); 00075 00076 static void shootArray ( const int size, double* vect ); 00077 00078 // Static methods to shoot random values using a given engine 00079 // by-passing the static generator. 00080 00081 static inline double shoot( HepRandomEngine* anotherEngine ); 00082 00083 static void shootArray ( HepRandomEngine* anotherEngine, 00084 const int size, 00085 double* vect ); 00086 00087 // Instance methods using the localEngine to instead of the static 00088 // generator, and the default mean and stdDev established at construction 00089 00090 inline double fire(); 00091 00092 void fireArray ( const int size, double* vect); 00093 00094 inline double operator()(); 00095 00096 std::string name() const; 00097 HepRandomEngine & engine(); 00098 00099 static std::string distributionName() {return "RandLandau";} 00100 // Provides the name of this distribution class 00101 00102 00103 protected: 00104 00105 static double transform (double r); 00106 static double transformSmall (double r); 00107 00108 private: 00109 00110 // Private copy constructor. Defining it here disallows use. 00111 RandLandau(const RandLandau& d); 00112 00113 HepRandomEngine* localEngine; 00114 bool deleteEngine; 00115 00116 }; 00117 00118 } // namespace CLHEP 00119 00120 #ifdef ENABLE_BACKWARDS_COMPATIBILITY 00121 // backwards compatibility will be enabled ONLY in CLHEP 1.9 00122 using namespace CLHEP; 00123 #endif 00124 00125 #include "CLHEP/Random/RandLandau.icc" 00126 00127 #endif