I am using the
G4GeneralParticleSourceData for my application, but I need some specific functionality that it is not implemented (generating primaries from the surface of a physical volume).
My approach to solve this is to construct a new
ExtendedGPS class that inherits from the GPS, along with a new messenger class that inherits from the GPS messenger.
However I don’t think it is straightforward to do this (perhaps my knowledge of C++ is not enough).
In the constructor of the extended GPS, I would need to associate the new messenger, via setting the
theMessenger, however, since this variable is private, I cannot modify it (it would need to be set to
As a less elegant solution, I could also add the new messenger to this class (along with the default one) and process my specific commands, however this would trigger the “erroneous command” logic of the default GPS from
G4GeneralParticleSourceMessenger::SetNewValue, which in this case only outputs some error message, so it would work, but it also doesn’t look right.
What would be the best solution for my problem?