How to cancel confine condition in one process

Hi everyone.
I’m testing a system’s response to different shape of sources.

In first run I confine the gps to a certain volume like below, and in the second run I just want the source to distribute in another part of area without confinement.


Now the problem is if I set the confine condition in the first run, the condition is saved to the second run. Is there a way that I can cancel this confine condition?

Thanks a lot!

I’m not sure exactly what your fCDEXGPS pointer points to, but I’m assuming it’s an instance of G4GeneralParticleSource. Looking at the General Particle Source class reference, calling the ClearAll() function could allow you to do what you want, though you would have to redefine all the properties of your source afterwards. If you have multiple sources and only want to remove the one which is confined to your volume you could call ListSource() to retrieve the source IDs and then DeleteaSource(G4int sourceid).