CLHEP VERSION Reference Documentation
CLHEP Home Page CLHEP Documentation CLHEP Bug Reports |
00001 // $Id: RandLandau.h,v 1.5 2010/06/16 17:24:53 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 #include "CLHEP/Utility/memory.h" 00036 00037 namespace CLHEP { 00038 00043 class RandLandau : public HepRandom { 00044 00045 public: 00046 00047 inline RandLandau ( HepRandomEngine& anEngine ); 00048 inline RandLandau ( HepRandomEngine* anEngine ); 00049 00050 // These constructors should be used to instantiate a RandLandau 00051 // distribution object defining a local engine for it. 00052 // The static generator will be skipped using the non-static methods 00053 // defined below. 00054 // If the engine is passed by pointer the corresponding engine object 00055 // will be deleted by the RandLandau destructor. 00056 // If the engine is passed by reference the corresponding engine object 00057 // will not be deleted by the RandLandau destructor. 00058 00059 virtual ~RandLandau(); 00060 // Destructor 00061 00062 // Save and restore to/from streams 00063 00064 std::ostream & put ( std::ostream & os ) const; 00065 std::istream & get ( std::istream & is ); 00066 00067 // 00068 // Methods to generate Landau-distributed random deviates. 00069 // 00070 // These deviates are accurate to the actual Landau distribution to 00071 // one part in 10**5 or better. 00072 00073 // Static methods to shoot random values using the static generator 00074 00075 static inline double shoot(); 00076 00077 static void shootArray ( const int size, double* vect ); 00078 00079 // Static methods to shoot random values using a given engine 00080 // by-passing the static generator. 00081 00082 static inline double shoot( HepRandomEngine* anotherEngine ); 00083 00084 static void shootArray ( HepRandomEngine* anotherEngine, 00085 const int size, 00086 double* vect ); 00087 00088 // Instance methods using the localEngine to instead of the static 00089 // generator, and the default mean and stdDev established at construction 00090 00091 inline double fire(); 00092 00093 void fireArray ( const int size, double* vect); 00094 00095 inline double operator()(); 00096 00097 std::string name() const; 00098 HepRandomEngine & engine(); 00099 00100 static std::string distributionName() {return "RandLandau";} 00101 // Provides the name of this distribution class 00102 00103 00104 protected: 00105 00106 static double transform (double r); 00107 static double transformSmall (double r); 00108 00109 private: 00110 00111 shared_ptr<HepRandomEngine> localEngine; 00112 00113 }; 00114 00115 } // namespace CLHEP 00116 00117 #ifdef ENABLE_BACKWARDS_COMPATIBILITY 00118 // backwards compatibility will be enabled ONLY in CLHEP 1.9 00119 using namespace CLHEP; 00120 #endif 00121 00122 #include "CLHEP/Random/RandLandau.icc" 00123 00124 #endif