Skip to content

Commit 92a0261

Browse files
fuhlig1ChristianTackeGSI
authored andcommitted
Store correct random seed in parameter container
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. 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()), FairSoft apr21p2 does not have the problem but any later FairSoft version will save the wrong information in the parameter container FairBaseParSet irrespective of the seed value defined in Root. This commit fixes the issue and saves the correct seed value specified by gRandom->SetSeed(<your value>). (cherry picked from commit 20d0431)
1 parent 4cd6215 commit 92a0261

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

base/steer/FairRunSim.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ void FairRunSim::Init()
234234
}
235235
if (par) {
236236
par->SetContListStr(ContList);
237-
par->SetRndSeed(gRandom->GetSeed());
237+
par->SetRndSeed(gRandom->TRandom::GetSeed());
238238
par->setChanged();
239239
par->setInputVersion(fRunId, 1);
240240
}

templates/project_root_containers/MyProjGenerators/Pythia8Generator.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class FairPrimaryGenerator;
2727
class PyTr1Rng : public RndmEngine
2828
{
2929
public:
30-
PyTr1Rng() { rng = new TRandom1(gRandom->GetSeed()); };
30+
PyTr1Rng() { rng = new TRandom1(gRandom->TRandom::GetSeed()); };
3131
virtual ~PyTr1Rng(){};
3232

3333
Double_t flat() { return rng->Rndm(); };
@@ -39,7 +39,7 @@ class PyTr1Rng : public RndmEngine
3939
class PyTr3Rng : public RndmEngine
4040
{
4141
public:
42-
PyTr3Rng() { rng = new TRandom3(gRandom->GetSeed()); };
42+
PyTr3Rng() { rng = new TRandom3(gRandom->TRandom::GetSeed()); };
4343
virtual ~PyTr3Rng(){};
4444

4545
Double_t flat() { return rng->Rndm(); };

templates/project_stl_containers/MyProjGenerators/Pythia8Generator.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class FairPrimaryGenerator;
2727
class PyTr1Rng : public RndmEngine
2828
{
2929
public:
30-
PyTr1Rng() { rng = new TRandom1(gRandom->GetSeed()); };
30+
PyTr1Rng() { rng = new TRandom1(gRandom->TRandom::GetSeed()); };
3131
virtual ~PyTr1Rng(){};
3232

3333
Double_t flat() { return rng->Rndm(); };
@@ -39,7 +39,7 @@ class PyTr1Rng : public RndmEngine
3939
class PyTr3Rng : public RndmEngine
4040
{
4141
public:
42-
PyTr3Rng() { rng = new TRandom3(gRandom->GetSeed()); };
42+
PyTr3Rng() { rng = new TRandom3(gRandom->TRandom::GetSeed()); };
4343
virtual ~PyTr3Rng(){};
4444

4545
Double_t flat() { return rng->Rndm(); };

0 commit comments

Comments
 (0)