Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CLHEP::RandLandau Class Reference

#include <RandLandau.h>

Inheritance diagram for CLHEP::RandLandau:
Collaboration 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)
 

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 42 of file RandLandau.h.

Constructor & Destructor Documentation

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

Definition at line 30 of file RandLandau.cc.

30  {
31 }

Member Function Documentation

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

Definition at line 99 of file RandLandau.h.

99 {return "RandLandau";}
HepRandomEngine & CLHEP::RandLandau::engine ( )
virtual

Reimplemented from CLHEP::HepRandom.

Definition at line 28 of file RandLandau.cc.

28 {return *localEngine;}
double CLHEP::RandLandau::fire ( )
inline

Here is the caller graph for this function:

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

Definition at line 47 of file RandLandau.cc.

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

Here is the call graph for this function:

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

Reimplemented from CLHEP::HepRandom.

Definition at line 371 of file RandLandau.cc.

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

Here is the call graph for this function:

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

Reimplemented from CLHEP::HepRandom.

Definition at line 27 of file RandLandau.cc.

27 {return "RandLandau";}

Here is the caller graph for this function:

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

Reimplemented from CLHEP::HepRandom.

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

Reimplemented from CLHEP::HepRandom.

Definition at line 364 of file RandLandau.cc.

364  {
365  int pr=os.precision(20);
366  os << " " << name() << "\n";
367  os.precision(pr);
368  return os;
369 }
std::string name() const
Definition: RandLandau.cc:27

Here is the call graph for this function:

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

Here is the caller graph for this function:

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

Definition at line 33 of file RandLandau.cc.

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

Here is the call graph for this function:

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

Definition at line 40 of file RandLandau.cc.

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

Here is the call graph for this function:

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

Definition at line 286 of file RandLandau.cc.

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

Here is the call graph for this function:

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

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