eic / drich-dev

Resources for EPIC dRICH Development
3 stars 5 forks source link

`simulate.py` scans return only 1 event #103

Open c-dilks opened 1 year ago

c-dilks commented 1 year ago

Environment: (where does this bug occur, have you tried other environments)

Steps to reproduce: (give a step by step account of how to trigger the bug)

  1. simulate.py -t 6 -k 5 -n 30 (eta scan, used in CI)

Likely other tests (set with -t option) fail as well. simulate.py generates a Geant4 macro file then runs it with npsim; the tests that now (likely) fail have the following pattern:

/control/verbose 2
/run/initialize
/gps/verbose 2
/gps/particle pi+
/gps/number 1
/gps/position 0 0 0 cm

# eta scan, with varied azimuth for each eta bin

# eta=1.6  theta=22.828754832963863 deg
/gps/direction 0.2679262666315343 -0.2806111036063496 0.9216685544064713
/gps/ene/mono 4.862377599175745 GeV
/run/beamOn 1
/gps/direction 0.35670337364908533 -0.15260989170314782 0.9216685544064713
/gps/ene/mono 4.862377599175745 GeV
/run/beamOn 1
/gps/direction 0.355244674481362 -0.15597530917076796 0.9216685544064713
/gps/ene/mono 4.862377599175745 GeV
/run/beamOn 1
/gps/direction -0.3269047091825161 -0.2089506806224379 0.9216685544064713
/gps/ene/mono 4.862377599175745 GeV
/run/beamOn 1
/gps/direction 0.1315721232832751 0.3649874685424366 0.9216685544064713
/gps/ene/mono 4.862377599175745 GeV
/run/beamOn 1

...

Expected Result: (what do you expect when you execute the steps above)

An output file with many events, and stdout from npsim includes (irrelevant lines omitted):

ParticleHandler  INFO  +++ Event 0 Begin event action. Access event related information.
ParticleHandler  INFO  +++ Event 1 Begin event action. Access event related information.
ParticleHandler  INFO  +++ Event 2 Begin event action. Access event related information.
ParticleHandler  INFO  +++ Event 3 Begin event action. Access event related information.
ParticleHandler  INFO  +++ Event 4 Begin event action. Access event related information.
...

Actual Result: (what do you get when you execute the steps above)

An output file with 1 event, and the corresponding stdout is repeated for event 0:

ParticleHandler  INFO  +++ Event 0 Begin event action. Access event related information.
ParticleHandler  INFO  +++ Event 0 Begin event action. Access event related information.
ParticleHandler  INFO  +++ Event 0 Begin event action. Access event related information.
ParticleHandler  INFO  +++ Event 0 Begin event action. Access event related information.
ParticleHandler  INFO  +++ Event 0 Begin event action. Access event related information.
...

See example CI log

c-dilks commented 1 year ago

@wdconinc did something change in Geant4 or DD4hep such that the pattern of multiple /run/beamOn 1 calls (with varying gun directions, for example) now results in only a single event? Previously it ran as many events as /run/beamOn 1 calls.

c-dilks commented 1 year ago

@chchatte92 because of this issue, we don't really have CI working here on drich-dev; this would need to be fixed if you still want to move simulate.py to reconstruction_benchmarks, or you'll have to make your own npsim commands etc. there, or generate HEPMC files (however you prefer to run benchmarks is up to you).

EDIT well, CI does work here, this issue just means the eta and momentum scans all only process a single event.

wdconinc commented 1 year ago

I don't know specifically what could explain this. Geant4 formally starts a new G4Run with each /run/beamOn 1 call, and it might be that dd4hep now overwrite the previous run in the edm4hep file instead of adding events to a single run. Just a thought.

c-dilks commented 1 year ago

Could it be the change to PODIO frames?

That's one difference I see after comparing recent CI output to old (working) CI output:

All of the eta_scan jobs have this problem.

Also I was a bit wrong about the lines Event # Begin event action... incrementing, but I'm confident those linked old logs were from a workflow run in a working state, since they are from the PR merge commit that added these particular jobs.

wdconinc commented 1 year ago

The change would indeed likely have come with the update to the EDM4hep output plugin to write podio frames.