Make EventSeeder run before primary generation#1617
Conversation
Test Results 18 files 18 suites 6h 13m 13s ⏱️ Results for commit ca9c070. |
|
@MarkusFrankATcernch What do you think of this? Can I instead put a sequence to be adopted into the GeneratePrimaries step? |
Looks quite elegant.But why still register the callback To me it looks like this callback is called also by The other possibility you mention I like more:I think Maybe this one also needs a DD4hep/DDG4/include/DDG4/Geant4EventAction.h Line 152 in 46e0a0a and then: or alternatively allow to inject a To me this possibility looks more natural than tweaking the event action sequence. |
|
I only thought of this on the walk to work today and I have to check: when the generator action reads from a file, it also reads the metadate, also the run and event number, and that should be used by the event seeder, so that in that case we actually have to call it after we read an event from the file. But for the particle gun, we have to call it before the particle gun. I think injecting this to the front of the action sequence is better, I'll give this a go. Thanks! |
|
I think I found that we don't pick up the event or run id from the input file at all. So calling the eventSeeder first would be fine, but maybe we have to fix that we pick up the event and runID from the input file |
### Briefly, what does this PR introduce? Please link to any relevant presentations or discussions. This PR adds `--random.enableEventSeed` to the npsim CI tests to ensure we end up simulating the same events even when the internal event random number consumption changes. Mostly aspirational until we pick up AIDASoft/DD4hep#1617 (at least for gun)... ### What is the urgency of this PR? - [ ] High (please describe reason below) - [x] Medium - [ ] Low ### What kind of change does this PR introduce? - [x] Bug fix (issue: ensure events are reproducible) - [ ] New feature (issue #__) - [ ] Optimization (issue #__) - [ ] Updated documentation - [ ] other: __ ### Please check if any of the following apply - [ ] This PR introduces breaking changes. Please describe changes users need to make below. - [ ] This PR changes default behavior. Please describe changes below. - [ ] AI was used in preparing this PR. Please describe usage below.
If I understand correctly, the callback order from GeneratePrimaries and beginOfEvent is controlled by Geant4?
So this first registers the eventSeeder to be called by the generate primary call, and then because it is registered as a call, and not "adopted" as a sequence by our GeneratePrimaries code, I change the order in which calls and sequences are called. I have no idea if that will have bad side effects... And one should expect calls to come after sequences?
Since "adopt" claims ownership of the sequence, I didn't want to pass the eventSeeder into it.
BEGINRELEASENOTES
callsbefore adopted sequencesENDRELEASENOTES