Message: Random numbers and global time Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Random numbers and global time 

Forum: Run Management
Date: 11 Jan, 2010
From: Guillaume Guérin <Guillaume Guérin>

Hello,

here is an error message I just met with my simulations :

G4ParticleChange::CheckIt    : the global time goes back  !!
  Difference:  3615.6282[ns] 
 G4ParticleChange::CheckIt 
      -----------------------------------------------
        G4ParticleChange Information  
      -----------------------------------------------
        # of 2ndaries       :                    0
      -----------------------------------------------
        Energy Deposit (MeV):                    0
        Non-ionizing Energy Deposit (MeV):                    0
        Track Status        :                Alive
        True Path Length (mm) :            -1.08e+06
        Stepping Control      :                    0
        Mass (GeV)   :                    0
        Charge (eplus)   :                    0
        MagneticMoment   :                    0
                :  =                    0*[e hbar]/[2 m]
        Position - x (mm)   :             4.64e+09
        Position - y (mm)   :             4.94e+10
        Position - z (mm)   :             4.89e+11
        Time (ns)           :            -3.62e+03
        Proper Time (ns)    :                    0
        Momentum Direct - x :               -0.905
        Momentum Direct - y :                0.235
        Momentum Direct - z :                0.355
        Kinetic Energy (MeV):                 1.46
        Polarization - x    :                    0
        Polarization - y    :                    0
        Polarization - z    :                    0
        Touchable (pointer) :           0x10603f80

*** G4Exception : 200
      issued by : G4ParticleChange::CheckIt
momentum, energy, and/or time was illegal
*** Event Must Be Aborted 

I get these messages since I changed the way I set the Seeds of my random numbers generator (I use the Ranecu Engine). In order to run 200 simulations at the same time, in a calculation farm, I set the seeds in the following way :

CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine); 
  std::fstream randomFile;
  randomFile.open("/dev/urandom", std::ios::in | std::ios::binary);
  long mySeeds [2];
  randomFile.read(reinterpret_cast<char *>(&mySeeds[0]), sizeof(unsigned int)); 
  randomFile.close();

  randomFile.open("/dev/urandom", std::ios::in | std::ios::binary);
  randomFile.read(reinterpret_cast<char *>(&mySeeds[1]), sizeof(unsigned int)); 
  randomFile.close(); 
  G4cout << "Random seed are " << mySeeds[0] << " and " << mySeeds[1] << G4endl;
  CLHEP::HepRandom::setTheSeeds(mySeeds);
  G4cout << "*******************************" << G4endl;
  G4cout << "*******************************" << G4endl;
  CLHEP::HepRandom::showEngineStatus();

It allows me to avoid getting the repeated same results (since the Ranecu engine "only" has 255 couples of uncorrelated longs, I do not initialize it with only one long). Is there anything in the way I set the seeds that could explain the error messages I get ?

Best regards,

Guillaume Guérin

PS : maybe there is simply an other random numbers generator that would be more appropriate ? What is the effect of picking two longs that are not necessarily uncorrelated ?

 Add Message Add Message
to: "Random numbers and global time"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]