Text gometry reset


I’m trying to find a way to rebuild a geometry created with the text geometry interface.
As pointed out in this post (Here) all main classes are singletons with the impossibility of deleting the geometry already read.

The point is, I would like to destroy the old geometry and create a new one without rerunning the application, like with the “standard” c++ geometry.

I’m thinking to implement my own classes based on the G4 ones, but first I’d like to ask you if you know an easier way to do this, without rewriting or modifying the standard TG classes.

Another question: what are the meaning of the ‘b’ and ‘r’ in the G4tgb and G4tgr class names?

Thank you for your suggestion


I recognized I never contemplated that use case. It should not be difficult to provide the needed clear() methods, as there are only a few classes that would need it. Give me some days to do it.
rare the classes who read the geometry, b are the classes that build the Geant4 objects

Some clear() methods were just what I thought I’d implement. An official implementation should be great!

Thank you very much

Hello Pedro,

I’d like to ask you if by chance you were able to take a look at this problem.
I’m asking because I’d really like to implement this feature in my software and if there could be an official implementation it would be great, otherwise, I’ll write my own patch.

Thank you very much