Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:54:38

0001 // $Id: RandLandau.h,v 1.5 2010/06/16 17:24:53 garren Exp $
0002 // -*- C++ -*-
0003 //
0004 // -----------------------------------------------------------------------
0005 //                             HEP Random
0006 //                          --- RandLandau ---
0007 //                          class header file
0008 // -----------------------------------------------------------------------
0009 // This file is part of Geant4 (simulation toolkit for HEP).
0010 
0011 // Class defining methods for shooting or firing Landau distributed 
0012 // random values.   
0013 // 
0014 // The Landau distribution is parameterless and describes the fluctuations
0015 // in energy loss of a particle, making certain assumptions.  For 
0016 // definitions and algorithms, the following papers could be read:
0017 //
0018 // Landau, Jour Phys VIII, No. 4, p. 201 (1944)
0019 // Borsh-Supan, Jour Res. of NBS 65B NO. 4 p. 245 (1961)
0020 // Kolbig & Schorr Comp Phys Comm 31 p. 97 (1984)
0021 //
0022 // The algorithm implemented comes form RANLAN in CERNLIB.
0023 
0024 // =======================================================================
0025 // M. Fischler    - Created: 5th January 2000
0026 // M Fischler      - put and get to/from streams 12/10/04
0027 //
0028 // =======================================================================
0029 
0030 #ifndef RandLandau_h
0031 #define RandLandau_h 1
0032 
0033 #include "CLHEP/Random/defs.h"
0034 #include "CLHEP/Random/Random.h"
0035 #include "CLHEP/Utility/memory.h"
0036 
0037 namespace CLHEP {
0038 
0039 /**
0040  * @author
0041  * @ingroup random
0042  */
0043 class RandLandau : public HepRandom {
0044 
0045 public:
0046 
0047   inline RandLandau ( HepRandomEngine& anEngine );
0048   inline RandLandau ( HepRandomEngine* anEngine ); 
0049 
0050   // These constructors should be used to instantiate a RandLandau
0051   // distribution object defining a local engine for it.
0052   // The static generator will be skipped using the non-static methods
0053   // defined below.
0054   // If the engine is passed by pointer the corresponding engine object
0055   // will be deleted by the RandLandau destructor.
0056   // If the engine is passed by reference the corresponding engine object
0057   // will not be deleted by the RandLandau destructor.
0058 
0059   virtual ~RandLandau();
0060   // Destructor
0061 
0062   // Save and restore to/from streams
0063   
0064   std::ostream & put ( std::ostream & os ) const;
0065   std::istream & get ( std::istream & is );
0066 
0067   //
0068   // Methods to generate Landau-distributed random deviates.
0069   //
0070   // These deviates are accurate to the actual Landau distribution to
0071   // one part in 10**5 or better.
0072 
0073   // Static methods to shoot random values using the static generator
0074 
0075   static  inline double shoot();
0076 
0077   static  void shootArray ( const int size, double* vect );
0078 
0079   //  Static methods to shoot random values using a given engine
0080   //  by-passing the static generator.
0081 
0082   static  inline double shoot( HepRandomEngine* anotherEngine );
0083 
0084   static  void shootArray ( HepRandomEngine* anotherEngine, 
0085                 const int size,
0086                             double* vect );
0087 
0088   //  Instance methods using the localEngine to instead of the static 
0089   //  generator, and the default mean and stdDev established at construction
0090 
0091   inline double fire();
0092 
0093   void fireArray  ( const int size, double* vect);
0094 
0095   inline double operator()();
0096 
0097   std::string name() const;
0098   HepRandomEngine & engine();
0099 
0100   static std::string distributionName() {return "RandLandau";}  
0101   // Provides the name of this distribution class
0102   
0103 
0104 protected:
0105 
0106   static double transform      (double r);
0107   static double transformSmall (double r);
0108 
0109 private:
0110 
0111   std::shared_ptr<HepRandomEngine> localEngine;
0112 
0113 };
0114 
0115 }  // namespace CLHEP
0116 
0117 #ifdef ENABLE_BACKWARDS_COMPATIBILITY
0118 //  backwards compatibility will be enabled ONLY in CLHEP 1.9
0119 using namespace CLHEP;
0120 #endif
0121 
0122 #include "CLHEP/Random/RandLandau.icc"
0123 
0124 #endif