G4INCL::Ranecu Class Reference

#include <G4INCLRanecu.hh>

Inheritance diagram for G4INCL::Ranecu:

G4INCL::IRandomGenerator

Public Member Functions

 Ranecu ()
 Ranecu (const SeedVector &sv)
virtual ~Ranecu ()
SeedVector getSeeds () const
void setSeeds (const SeedVector &sv)
G4double flat ()

Detailed Description

Definition at line 51 of file G4INCLRanecu.hh.


Constructor & Destructor Documentation

G4INCL::Ranecu::Ranecu (  ) 

Definition at line 48 of file G4INCLRanecu.cc.

00048                  {
00049     iseed1 = 666;
00050     iseed2 = 777;
00051   }

G4INCL::Ranecu::Ranecu ( const SeedVector sv  ) 

Definition at line 53 of file G4INCLRanecu.cc.

References setSeeds().

00053                                      {
00054     setSeeds(sv);
00055   }

G4INCL::Ranecu::~Ranecu (  )  [virtual]

Definition at line 57 of file G4INCLRanecu.cc.

00057 {}


Member Function Documentation

G4double G4INCL::Ranecu::flat (  )  [virtual]

Implements G4INCL::IRandomGenerator.

Definition at line 59 of file G4INCLRanecu.cc.

00060   {
00061     // This is an adapted version of subroutine ranecu:
00062     // A. Padal, J. Sempau Computer Physics Cummunications 175 (2006) 440-450
00063     G4double uscale=1.0/2.147483563e9;
00064 
00065     long i1=iseed1/53668;
00066     iseed1=40014*(iseed1-i1*53668)-i1*12211;
00067 
00068     if(iseed1 < 0) iseed1 = iseed1 + 2147483563;
00069 
00070     long i2=iseed2/52774;
00071     iseed2=40692*(iseed2-i2*52774)-i2*3791;
00072     if(iseed2 < 0) iseed2=iseed2+2147483399;
00073 
00074     long iz=iseed1-iseed2;
00075     if(iz < 1) iz=iz+2147483562;
00076 
00077     return iz*uscale;
00078   }

SeedVector G4INCL::Ranecu::getSeeds (  )  const [inline, virtual]

Implements G4INCL::IRandomGenerator.

Definition at line 57 of file G4INCLRanecu.hh.

00057                                 {
00058       SeedVector sv;
00059       sv.push_back(iseed1);
00060       sv.push_back(iseed2);
00061       return sv;
00062     };

void G4INCL::Ranecu::setSeeds ( const SeedVector sv  )  [inline, virtual]

Implements G4INCL::IRandomGenerator.

Definition at line 64 of file G4INCLRanecu.hh.

Referenced by Ranecu().

00064                                         {
00065       iseed1 = sv[0];
00066       iseed2 = sv[1];
00067     };


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:54:09 2013 for Geant4 by  doxygen 1.4.7