My user application includes some fairly modular classes, which may be called from generators or from later processes. In one of these modules, I want to collect some internal parameters and put them into a container for later writing to output. So I’ve defined a G4Hit
subclass and associated collection class, to shove the data into the event. The module is deep in the calling tree, so it doesn’t get passed G4Event*
directly. Instead, I expected to use G4RunManager::GetCurrentEvent()
, and handle the collection registration that way.
Unfortunately, when an instance of this module is used via the PrimaryEventAction (six layers down the calling tree) the call to GetCurrentEvent()
returns a null pointer. From the traceback, it’s obvious why: my code is still in G4RunManager::GenerateEvent()
, and the currentEvent
hasn’t yet been assigned!
Is there any way for code deep inside the generator to get access to the new G4Event* pointer? …And if it does, will it contain infrastructure like the G4HCofThisEvent
container?