celeritas icon indicating copy to clipboard operation
celeritas copied to clipboard

Improve event ID handling

Open sethrj opened this issue 1 year ago • 1 comments

We've always treated event IDs as "OpaqueId"s, indexed from zero onward. This didn't always match with the way Geant4/HepMC recorded event numbers but we ignored it and output warnings about nonconsecutive event IDs. With #1447 we really discovered that event "IDs" are arbitrary: they're more like integer labels, and we introduced UniqueEventId to denote this for integrating with Geant4.

I think we need a more consistent mapping across libraries and input files, injecting primaries one event at a time (primaries will no longer have an event ID, you just have to group them). Then the primary generator (or whatever) can keep a map of "numerical event label" to EventId (consecutive).

sethrj avatar Oct 17 '24 06:10 sethrj

@wdconinc noticed that hepmc files don't work properly in the .mac input. This is related to this issue and #1390 and the refactoring of the hepmc3 generators. I think we should:

  1. Refactor PrimaryGenerator as a distribution and remove the EventId.
  2. Construct the primary generator in user action initialization for sharing among threads; and save number of requested events
  3. Move generator initialization code from GlobalSetup to RunAction

sethrj avatar Nov 25 '24 18:11 sethrj