-
Notifications
You must be signed in to change notification settings - Fork 115
Open
Labels
Description
It is noted in the library that the ParticleHandler is not extensible currently:
DD4hep/DDG4/python/DDSim/Helper/ParticleHandler.py
Lines 117 to 120 in 3466ee7
| def setupUserParticleHandler(self, part, kernel, DDG4): | |
| """Create the UserParticleHandler and configure it. | |
| FIXME: this is not extensible at the moment |
I am trying to add a more truth-heavy handler here: Geant4FullTruthParticleHandler, which then needs to be handled by the python handler. Currently my solution is here:
if self.userParticleHandler not in ["Geant4TCUserParticleHandler", "Geant4TVUserParticleHandler", "Geant4FullTruthParticleHandler"]:
logger.error("unknown UserParticleHandler: %r" % self.userParticleHandler)
exit(1)
if self.userParticleHandler in ["Geant4TCUserParticleHandler", "Geant4FullTruthParticleHandler"]:
user = DDG4.Action(kernel, "%s/UserParticleHandler" % self.userParticleHandler)
try:
user.TrackingVolume_Zmax = DDG4.tracker_region_zmax
user.TrackingVolume_Rmax = DDG4.tracker_region_rmax
etc.
But this is clunky. I would be very happy to tweak the handler to be extensible, if someone could describe what is in mind for this?
I guess the particle handler could be defined as a config, e.g.
sim.part.userParticleHandler = {"handler": "Geant4TCUserParticleHandler", "user.TrackingVolume_Zmax": "DDG4.tracker_region_zmax", etc.}
Although this is still not completely extensible.