Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
CLHEP::RandLandau Class Reference

#include <RandLandau.h>

+ Inheritance diagram for CLHEP::RandLandau:

Public Member Functions

 RandLandau (HepRandomEngine &anEngine)
 
 RandLandau (HepRandomEngine *anEngine)
 
virtual ~RandLandau ()
 
std::ostream & put (std::ostream &os) const
 
std::istream & get (std::istream &is)
 
double fire ()
 
void fireArray (const int size, double *vect)
 
double operator() ()
 
std::string name () const
 
HepRandomEngineengine ()
 
- Public Member Functions inherited from CLHEP::HepRandom
 HepRandom ()
 
 HepRandom (long seed)
 
 HepRandom (HepRandomEngine &algorithm)
 
 HepRandom (HepRandomEngine *algorithm)
 
virtual ~HepRandom ()
 
double flat ()
 
void flatArray (const int size, double *vect)
 
double flat (HepRandomEngine *theNewEngine)
 
void flatArray (HepRandomEngine *theNewEngine, const int size, double *vect)
 
virtual double operator() ()
 
virtual std::string name () const
 
virtual HepRandomEngineengine ()
 
virtual std::ostream & put (std::ostream &os) const
 
virtual std::istream & get (std::istream &is)
 

Static Public Member Functions

static double shoot ()
 
static void shootArray (const int size, double *vect)
 
static double shoot (HepRandomEngine *anotherEngine)
 
static void shootArray (HepRandomEngine *anotherEngine, const int size, double *vect)
 
static std::string distributionName ()
 
- Static Public Member Functions inherited from CLHEP::HepRandom
static void setTheSeed (long seed, int lux=3)
 
static long getTheSeed ()
 
static void setTheSeeds (const long *seeds, int aux=-1)
 
static const long * getTheSeeds ()
 
static void getTheTableSeeds (long *seeds, int index)
 
static HepRandomgetTheGenerator ()
 
static void setTheEngine (HepRandomEngine *theNewEngine)
 
static HepRandomEnginegetTheEngine ()
 
static void saveEngineStatus (const char filename[]="Config.conf")
 
static void restoreEngineStatus (const char filename[]="Config.conf")
 
static std::ostream & saveFullState (std::ostream &os)
 
static std::istream & restoreFullState (std::istream &is)
 
static std::ostream & saveDistState (std::ostream &os)
 
static std::istream & restoreDistState (std::istream &is)
 
static std::ostream & saveStaticRandomStates (std::ostream &os)
 
static std::istream & restoreStaticRandomStates (std::istream &is)
 
static void showEngineStatus ()
 
static int createInstance ()
 
static std::string distributionName ()
 

Static Protected Member Functions

static double transform (double r)
 
static double transformSmall (double r)
 

Additional Inherited Members

- Static Protected Attributes inherited from CLHEP::HepRandom
static const long seedTable [215][2]
 

Detailed Description

Author

Definition at line 41 of file RandLandau.h.

Constructor & Destructor Documentation

◆ RandLandau() [1/2]

CLHEP::RandLandau::RandLandau ( HepRandomEngine anEngine)
inline

◆ RandLandau() [2/2]

CLHEP::RandLandau::RandLandau ( HepRandomEngine anEngine)
inline

◆ ~RandLandau()

CLHEP::RandLandau::~RandLandau ( )
virtual

Definition at line 29 of file RandLandau.cc.

29 {
30}

Member Function Documentation

◆ distributionName()

static std::string CLHEP::RandLandau::distributionName ( )
inlinestatic

Definition at line 98 of file RandLandau.h.

98{return "RandLandau";}

◆ engine()

HepRandomEngine & CLHEP::RandLandau::engine ( )
virtual

Reimplemented from CLHEP::HepRandom.

Definition at line 27 of file RandLandau.cc.

27{return *localEngine;}

◆ fire()

double CLHEP::RandLandau::fire ( )
inline

Referenced by fireArray().

◆ fireArray()

void CLHEP::RandLandau::fireArray ( const int  size,
double *  vect 
)

Definition at line 46 of file RandLandau.cc.

47{
48 for( double* v = vect; v != vect + size; ++v )
49 *v = fire();
50}

◆ get()

std::istream & CLHEP::RandLandau::get ( std::istream &  is)
virtual

Reimplemented from CLHEP::HepRandom.

Definition at line 370 of file RandLandau.cc.

370 {
371 std::string inName;
372 is >> inName;
373 if (inName != name()) {
374 is.clear(std::ios::badbit | is.rdstate());
375 std::cerr << "Mismatch when expecting to read state of a "
376 << name() << " distribution\n"
377 << "Name found was " << inName
378 << "\nistream is left in the badbit state\n";
379 return is;
380 }
381 return is;
382}
std::string name() const
Definition: RandLandau.cc:26

◆ name()

std::string CLHEP::RandLandau::name ( ) const
virtual

Reimplemented from CLHEP::HepRandom.

Definition at line 26 of file RandLandau.cc.

26{return "RandLandau";}

Referenced by get(), and put().

◆ operator()()

double CLHEP::RandLandau::operator() ( )
inlinevirtual

Reimplemented from CLHEP::HepRandom.

◆ put()

std::ostream & CLHEP::RandLandau::put ( std::ostream &  os) const
virtual

Reimplemented from CLHEP::HepRandom.

Definition at line 363 of file RandLandau.cc.

363 {
364 int pr=os.precision(20);
365 os << " " << name() << "\n";
366 os.precision(pr);
367 return os;
368}

◆ shoot() [1/2]

static double CLHEP::RandLandau::shoot ( )
inlinestatic

Referenced by shootArray().

◆ shoot() [2/2]

static double CLHEP::RandLandau::shoot ( HepRandomEngine anotherEngine)
inlinestatic

◆ shootArray() [1/2]

void CLHEP::RandLandau::shootArray ( const int  size,
double *  vect 
)
static

Definition at line 32 of file RandLandau.cc.

34{
35 for( double* v = vect; v != vect + size; ++v )
36 *v = shoot();
37}
static double shoot()

◆ shootArray() [2/2]

void CLHEP::RandLandau::shootArray ( HepRandomEngine anotherEngine,
const int  size,
double *  vect 
)
static

Definition at line 39 of file RandLandau.cc.

41{
42 for( double* v = vect; v != vect + size; ++v )
43 *v = shoot(anEngine);
44}

◆ transform()

double CLHEP::RandLandau::transform ( double  r)
staticprotected

Definition at line 285 of file RandLandau.cc.

285 {
286
287 double u = r * TABLE_MULTIPLIER;
288 int index = int(u);
289 double du = u - index;
290
291 // du is scaled such that the we dont have to multiply by TABLE_INTERVAL
292 // when interpolating.
293
294 // Five cases:
295 // A) Between .070 and .800 the function is so smooth, straight
296 // linear interpolation is adequate.
297 // B) Between .007 and .070, and between .800 and .980, quadratic
298 // interpolation is used. This requires the same 4 points as
299 // a cubic spline (thus we need .006 and .981 and .982) but
300 // the quadratic interpolation is accurate enough and quicker.
301 // C) Below .007 an asymptotic expansion for low negative lambda
302 // (involving two logs) is used; there is a pade-style correction
303 // factor.
304 // D) Above .980, a simple pade approximation is made (asymptotic to
305 // 1/(1-r)), but...
306 // E) the coefficients in that pade are different above r=.999.
307
308 if ( index >= 70 && index <= 800 ) { // (A)
309
310 double f0 = inverseLandau [index];
311 double f1 = inverseLandau [index+1];
312 return f0 + du * (f1 - f0);
313
314 } else if ( index >= 7 && index <= 980 ) { // (B)
315
316 double f_1 = inverseLandau [index-1];
317 double f0 = inverseLandau [index];
318 double f1 = inverseLandau [index+1];
319 double f2 = inverseLandau [index+2];
320
321 return f0 + du * (f1 - f0 - .25*(1-du)* (f2 -f1 - f0 + f_1) );
322
323 } else if ( index < 7 ) { // (C)
324
325 const double n0 = 0.99858950;
326 const double n1 = 34.5213058; const double d1 = 34.1760202;
327 const double n2 = 17.0854528; const double d2 = 4.01244582;
328
329 double logr = std::log(r);
330 double x = 1/logr;
331 double x2 = x*x;
332
333 double pade = (n0 + n1*x + n2*x2) / (1.0 + d1*x + d2*x2);
334
335 return ( - std::log ( -.91893853 - logr ) -1 ) * pade;
336
337 } else if ( index <= 999 ) { // (D)
338
339 const double n0 = 1.00060006;
340 const double n1 = 263.991156; const double d1 = 257.368075;
341 const double n2 = 4373.20068; const double d2 = 3414.48018;
342
343 double x = 1-r;
344 double x2 = x*x;
345
346 return (n0 + n1*x + n2*x2) / (x * (1.0 + d1*x + d2*x2));
347
348 } else { // (E)
349
350 const double n0 = 1.00001538;
351 const double n1 = 6075.14119; const double d1 = 6065.11919;
352 const double n2 = 734266.409; const double d2 = 694021.044;
353
354 double x = 1-r;
355 double x2 = x*x;
356
357 return (n0 + n1*x + n2*x2) / (x * (1.0 + d1*x + d2*x2));
358
359 }
360
361} // transform()

◆ transformSmall()

static double CLHEP::RandLandau::transformSmall ( double  r)
staticprotected

The documentation for this class was generated from the following files: