Is it safe to change event ID outside of RunManager?

I have an application where I read back previously written (and possibly filtered) events from a file, and reconstitute them for further processing.

It would be convenient for user analysis if we could preserve the event numbers through this process (otherwise you end up with filtered events 4, 12, 20, 98, etc. getting reassigned as events 0, 1, 2, 3, …).

We are using a PrimaryGeneratorAction to do the readback. Would it confuse the RunManager or other core code if we changed the event ID here?

I am not sure about whether anything would get broken but I fully expect that this is something that hasn’t ever really been considered from a design perspective. I think the most likely place for issues would be in the EventManager and after briefly glancing at it, you might want to see if implementing a derived G4VUserEventInformation would satisfy these requirements. Or just create a map of the old ID to “real” ID: auto id = (old_evts.find(evt->GetEventId()) != old_evts.end()) ? ... : evt->GetEventId()