Skip to content

Fix Geant4 random number initialisation

Florian Uhlig requested to merge f.uhlig/cbmroot:fix_random_seed_geant4 into master

Between Root 6.22 and 6.24 the return value of TRandom3::GetSeed() was changed. Since Root 6.24 the function GetSeed returns the current element of the state used to generate the random number which returns a fixed value of 624 for TRandom3. Note that the returned value is not the seed of the generator that was defined with the SetSeed function. To get the seed value which was set by the function SetSeed one neeeds to use the GetSeed() function from the base class (gRandom->TRandom::GetSeed()), Since the function GetSeed is used to initialize the Geant4 random number generator with the same seed value used by Root the previous implementation always set the Geant4 random seed to 624 when using ROOT 6.24 or newer. FairSoft apr21p2 does not have the problem but any later FairSoft version will initialise the Geant4 random number generator with the fixed number 624 irrespective of the seed value defined in Root. This commit fixes the issue and initialises the Geant4 random number generator again with the seed specified by gRandom->SetSeed(). The seed value passed to Geant4 is now also stored in the CbmGeant4Settings such that one can contoll the seed value from the transport file.

Merge request reports