JeffersonLab / HDGeant4

Geant4 simulation for the GlueX experiment
4 stars 4 forks source link

RUNG doesn't always work with latest master #175

Closed sdobbs closed 4 years ago

sdobbs commented 4 years ago

Over the past couple of days, both Hao and I have run into an issue where we had HDDM input files generated with run 10000, and we were trying to overwrite this run number use the RUNG card in control.in to override this with a real run number (this is an MCWrapper "feature").

An additional problem is that I can't get this problem to be consistently reproducible, but I will record this for now in case someone else runs into it. You can try to reproduce this problem using the files on the JLab CUE in /work/halld/home/sdobbs/hdgeant4_run_bug

rjones30 commented 4 years ago

I have reproduced this bug, and have submitted a PR for the fix. The reason was a confusion on my part between two different things both called "run number". Here is the text from my commit. Sean, since you confirmed that this is a bug, can you please verify and execute this PR? -Richard

fetch the run number that is written in the output hddm file

from the HddmOutput object which contains a value that was loaded

with the current run number in hdgeant.cc, in contrast to the G4 run number that normally starts off with zero and increments each time a new simulation run is started. The G4 event number is a serial number that G4 assigns to each event in the order they are picked up by one of the worker threads. It is used by the internal random seeds bookkeeping so we do not want to change it to match the event number from the input hddm file and screw up that bookkeeping. Similarly, we don't want to mess with what G4 calls the "RunID" which is a unique sequence number assigned at each invocation of /run/beamOn, and does not correspond to the GlueX run number that is written in the output file. If we keep our own run/event numbers separate and distinct from the G4 run/ event numbers then this confusion should not come back to bite us again in the future.

On Wed, Sep 2, 2020 at 5:47 PM Sean Dobbs notifications@github.com wrote:

Over the past couple of days, both Hao and I have run into an issue where we had HDDM input files generated with run 10000, and we were trying to overwrite this run number use the RUNG card in control.in to override this with a real run number (this is an MCWrapper "feature").

An additional problem is that I can't get this problem to be consistently reproducible, but I will record this for now in case someone else runs into it. You can try to reproduce this problem using the files on the JLab CUE in /work/halld/home/sdobbs/hdgeant4_run_bug

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/JeffersonLab/HDGeant4/issues/175, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB3YKWBCMQ3TAG2NTJXXKTDSD24QVANCNFSM4QT2QJVA .

sdobbs commented 4 years ago

resolved by #176