CLHEP/Random/RandLandau.h

00001 // $Id: RandLandau.h,v 1.6 2002/04/12 15:02:45 evc 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 //
00027 // =======================================================================
00028 
00029 #ifndef RandLandau_h
00030 #define RandLandau_h 1
00031 
00032 #include "CLHEP/Random/Random.h"
00033 
00038 class RandLandau : public HepRandom {
00039 
00040 public:
00041 
00042   inline RandLandau ( HepRandomEngine& anEngine );
00043   inline RandLandau ( HepRandomEngine* anEngine ); 
00044 
00045   // These constructors should be used to instantiate a RandLandau
00046   // distribution object defining a local engine for it.
00047   // The static generator will be skipped using the non-static methods
00048   // defined below.
00049   // If the engine is passed by pointer the corresponding engine object
00050   // will be deleted by the RandLandau destructor.
00051   // If the engine is passed by reference the corresponding engine object
00052   // will not be deleted by the RandLandau destructor.
00053 
00054   virtual ~RandLandau();
00055   // Destructor
00056 
00057   //
00058   // Methods to generate Landau-distributed random deviates.
00059   //
00060   // These deviates are accurate to the actual Landau distribution to
00061   // one part in 10**5 or better.
00062 
00063   // Static methods to shoot random values using the static generator
00064 
00065   static  inline double shoot();
00066 
00067   static  void shootArray ( const int size, double* vect );
00068 
00069   //  Static methods to shoot random values using a given engine
00070   //  by-passing the static generator.
00071 
00072   static  inline double shoot( HepRandomEngine* anotherEngine );
00073 
00074   static  void shootArray ( HepRandomEngine* anotherEngine, 
00075                             const int size,
00076                             double* vect );
00077 
00078   //  Instance methods using the localEngine to instead of the static 
00079   //  generator, and the default mean and stdDev established at construction
00080 
00081   inline double fire();
00082 
00083   void fireArray  ( const int size, double* vect);
00084 
00085   inline double operator()();
00086 
00087 protected:
00088 
00089   static double transform      (double r);
00090   static double transformSmall (double r);
00091 
00092 private:
00093 
00094   // Private copy constructor. Defining it here disallows use.
00095   RandLandau(const RandLandau& d);
00096 
00097   HepRandomEngine* localEngine;
00098   bool deleteEngine;
00099 
00100 };
00101 
00102 #include "CLHEP/Random/RandLandau.icc"
00103 
00104 #endif

Class Library for High Energy Physics (version 1.8)