CLHEP 2.4.6.4
C++ Class Library for High Energy Physics
Loading...
Searching...
No Matches
RandLandau.h
Go to the documentation of this file.
1// $Id: RandLandau.h,v 1.5 2010/06/16 17:24:53 garren Exp $
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/defs.h"
34#include "CLHEP/Random/Random.h"
35#include "CLHEP/Utility/memory.h"
36
37namespace CLHEP {
38
39/**
40 * @author
41 * @ingroup random
42 */
43class RandLandau : public HepRandom {
44
45public:
46
47 inline RandLandau ( HepRandomEngine& anEngine );
48 inline RandLandau ( HepRandomEngine* anEngine );
49
50 // These constructors should be used to instantiate a RandLandau
51 // distribution object defining a local engine for it.
52 // The static generator will be skipped using the non-static methods
53 // defined below.
54 // If the engine is passed by pointer the corresponding engine object
55 // will be deleted by the RandLandau destructor.
56 // If the engine is passed by reference the corresponding engine object
57 // will not be deleted by the RandLandau destructor.
58
59 virtual ~RandLandau();
60 // Destructor
61
62 // Save and restore to/from streams
63
64 std::ostream & put ( std::ostream & os ) const;
65 std::istream & get ( std::istream & is );
66
67 //
68 // Methods to generate Landau-distributed random deviates.
69 //
70 // These deviates are accurate to the actual Landau distribution to
71 // one part in 10**5 or better.
72
73 // Static methods to shoot random values using the static generator
74
75 static inline double shoot();
76
77 static void shootArray ( const int size, double* vect );
78
79 // Static methods to shoot random values using a given engine
80 // by-passing the static generator.
81
82 static inline double shoot( HepRandomEngine* anotherEngine );
83
84 static void shootArray ( HepRandomEngine* anotherEngine,
85 const int size,
86 double* vect );
87
88 // Instance methods using the localEngine to instead of the static
89 // generator, and the default mean and stdDev established at construction
90
91 inline double fire();
92
93 void fireArray ( const int size, double* vect);
94
95 inline double operator()();
96
97 std::string name() const;
99
100 static std::string distributionName() {return "RandLandau";}
101 // Provides the name of this distribution class
102
103
104protected:
105
106 static double transform (double r);
107 static double transformSmall (double r);
108
109private:
110
111 std::shared_ptr<HepRandomEngine> localEngine;
112
113};
114
115} // namespace CLHEP
116
117#ifdef ENABLE_BACKWARDS_COMPATIBILITY
118// backwards compatibility will be enabled ONLY in CLHEP 1.9
119using namespace CLHEP;
120#endif
121
122#include "CLHEP/Random/RandLandau.icc"
123
124#endif
static double shoot()
static double transformSmall(double r)
RandLandau(HepRandomEngine &anEngine)
std::string name() const
Definition: RandLandau.cc:28
static double transform(double r)
Definition: RandLandau.cc:287
static void shootArray(const int size, double *vect)
Definition: RandLandau.cc:34
virtual ~RandLandau()
Definition: RandLandau.cc:31
std::istream & get(std::istream &is)
Definition: RandLandau.cc:372
void fireArray(const int size, double *vect)
Definition: RandLandau.cc:48
static std::string distributionName()
Definition: RandLandau.h:100
static double shoot(HepRandomEngine *anotherEngine)
std::ostream & put(std::ostream &os) const
Definition: RandLandau.cc:365
RandLandau(HepRandomEngine *anEngine)
HepRandomEngine & engine()
Definition: RandLandau.cc:29