Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
RandLandau.h
이 파일의 문서화 페이지로 가기
1 // $Id:$
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/Random.h"
34 #include "CLHEP/Utility/memory.h"
35 
36 namespace CLHEP {
37 
42 class RandLandau : public HepRandom {
43 
44 public:
45 
46  inline RandLandau ( HepRandomEngine& anEngine );
47  inline RandLandau ( HepRandomEngine* anEngine );
48 
49  // These constructors should be used to instantiate a RandLandau
50  // distribution object defining a local engine for it.
51  // The static generator will be skipped using the non-static methods
52  // defined below.
53  // If the engine is passed by pointer the corresponding engine object
54  // will be deleted by the RandLandau destructor.
55  // If the engine is passed by reference the corresponding engine object
56  // will not be deleted by the RandLandau destructor.
57 
58  virtual ~RandLandau();
59  // Destructor
60 
61  // Save and restore to/from streams
62 
63  std::ostream & put ( std::ostream & os ) const;
64  std::istream & get ( std::istream & is );
65 
66  //
67  // Methods to generate Landau-distributed random deviates.
68  //
69  // These deviates are accurate to the actual Landau distribution to
70  // one part in 10**5 or better.
71 
72  // Static methods to shoot random values using the static generator
73 
74  static inline double shoot();
75 
76  static void shootArray ( const int size, double* vect );
77 
78  // Static methods to shoot random values using a given engine
79  // by-passing the static generator.
80 
81  static inline double shoot( HepRandomEngine* anotherEngine );
82 
83  static void shootArray ( HepRandomEngine* anotherEngine,
84  const int size,
85  double* vect );
86 
87  // Instance methods using the localEngine to instead of the static
88  // generator, and the default mean and stdDev established at construction
89 
90  inline double fire();
91 
92  void fireArray ( const int size, double* vect);
93 
94  inline double operator()();
95 
96  std::string name() const;
98 
99  static std::string distributionName() {return "RandLandau";}
100  // Provides the name of this distribution class
101 
102 
103 protected:
104 
105  static double transform (double r);
106  static double transformSmall (double r);
107 
108 private:
109 
110  std::shared_ptr<HepRandomEngine> localEngine;
111 
112 };
113 
114 } // namespace CLHEP
115 
116 #include "CLHEP/Random/RandLandau.icc"
117 
118 #endif
HepRandomEngine & engine()
Definition: RandLandau.cc:28
static void shootArray(const int size, double *vect)
Definition: RandLandau.cc:33
void fireArray(const int size, double *vect)
Definition: RandLandau.cc:47
std::string name() const
Definition: RandLandau.cc:27
std::shared_ptr< HepRandomEngine > localEngine
Definition: RandLandau.h:110
static std::string distributionName()
Definition: RandLandau.h:99
std::ostream & put(std::ostream &os) const
Definition: RandLandau.cc:364
static double shoot()
static double transform(double r)
Definition: RandLandau.cc:286
RandLandau(HepRandomEngine &anEngine)
virtual ~RandLandau()
Definition: RandLandau.cc:30
static double transformSmall(double r)