CLHEP 2.4.6.4
C++ Class Library for High Energy Physics
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 lxr=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 43 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 31 of file RandLandau.cc.

31 {
32}

Member Function Documentation

◆ distributionName()

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

Definition at line 100 of file RandLandau.h.

100{return "RandLandau";}

◆ engine()

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

Reimplemented from CLHEP::HepRandom.

Definition at line 29 of file RandLandau.cc.

29{return *localEngine;}

◆ fire()

double CLHEP::RandLandau::fire ( )
inline

Referenced by fireArray().

◆ fireArray()

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

Definition at line 48 of file RandLandau.cc.

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

◆ get()

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

Reimplemented from CLHEP::HepRandom.

Definition at line 372 of file RandLandau.cc.

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

◆ name()

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

Reimplemented from CLHEP::HepRandom.

Definition at line 28 of file RandLandau.cc.

28{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 365 of file RandLandau.cc.

365 {
366 long pr=os.precision(20);
367 os << " " << name() << "\n";
368 os.precision(pr);
369 return os;
370}

◆ shoot() [1/2]

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

◆ 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 34 of file RandLandau.cc.

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

◆ shootArray() [2/2]

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

Definition at line 41 of file RandLandau.cc.

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

◆ transform()

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

Definition at line 287 of file RandLandau.cc.

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

◆ transformSmall()

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

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