Conversation
|
@nusense Please have a look when you get back to work. I've already merged this into a release-candidate branch that John is actively exercising. We made a separate PR to |
nusense
left a comment
There was a problem hiding this comment.
I'm still working through all the typical scenarios, of which I see five:
(1) utils::app_init::RandGen() called non-zero
[tune is configured]
rndm = RandomGen::Instance()->RndFlux().Rndm()
(2) utils:app_init::RandGen(0)
[tune is configured]
rndm = RandomGen::Instance()->RndFlux().Rndm()
(3) [tune is configured]
utils::app_init::RandGen() called non-zero
rndm = RandomGen::Instance()->RndFlux().Rndm()
(4) [tune is configured]
utils:app_init::RandGen(0)
rndm = RandomGen::Instance()->RndFlux().Rndm()
(5) utils::app_init::RandGen() never called; [tune is configured]
rndm = RandomGen::Instance()->RndFlux().Rndm()
I'm still working them through in my head. I'm also working out the use case for static RandomGen * Instance(long int seed). I'm not sure where Instance(seed) gets constructed rather than Instance().
Would it be possible to incorporate the changes in #516 into this PR, so it would be easier to see the totality of the changes.
I think I copied:
// sync GENIE and PYTHIA8 seeds
RandomGen * rnd = RandomGen::Instance();
long int seed = rnd->GetSeed();
fPythia->readString("Random:setSeed = on");
fPythia->settings.mode("Random:seed", seed);
from Costas' first attempt at supporting Pythia8, in src/Physics/Hadronization/Pythia8Hadro2019.cxx circa R-3_04_00.
Which is why the random seed is initialized in the algorithm. I'm not sure why it was done this way, but I blindly followed it.
But it would make sense to also have it in RandomGen::SetSeed() (around lines 22, 115) similarly to how the pythia6 seed is set .
#ifdef __GENIE_PYTHIA8_ENABLED__
#include "Framework/Utils/Pythia8Singleton.h"
#endif
...
#ifdef __GENIE_PYTHIA8_ENABLED__
Pythia8::Pythia* gPythia = Pythia8Singleton::Instance()->Pythia8();
gPythia->readString("Random:setSeed = on");
gPythia->settings.mode("Random:seed", seed);
gPythia->init();
#endif
One probably needs init() there to ensure that it was picked up in case where the tune was constructed prior to the SetSeed() scenarios 3-5. Even if we fix the order in GENIE supplied apps, that doesn't guarantee that user generated alternative applications won't have it the same as they used to be. With this addition, it might make sense to remove the Random:[set]Seed lines from the 3 algorithms. Those algorithms also set other things, so I think those must stay with their accompanying init()
|
Hmm. I may have remembered why the direct Pythia8 call wasn't in |
|
Is |
|
Yep moving RandomGen seems quite a heavy lift indeed! So, I think that regardless of coverage (seed instantiation vs tune configuration), having some synchronisation of the seed is better than having none, and that seems to be resolved without adding the calls to the |
|
I think without the call to |
Copy of #514 , targeting master.
Summoning @nusense and @sjgardiner for review, again!