Why GPS sources keep accumulating in this case?

I am using a macro which contains two GPS sources. On visualization window executing /control/execute/ run.mac shows details of two sources (with /gps/source/list sitting in macro). However, not closing the session, when I execute the run.mac again, the number of sources accumulates to 4.

How can I avoid that, basically reset everything in my visualization to where I started? In other words an alternative of closing the visualization window and executing ./exampleB1?

Because you didn’t exit from the G4 executable. The same program is still running, which means all of the stuff you created in memory is still there. If you issue new commands to create new objects, then of course they get added to what is already there. That’s how you got two GPS sources in the first place, right? You created one, then you created another.

If you want to get rid of everything you did in your session, then you need to quit from the session.

If you just want to reset the visualization, and do a second /run/beamOn, then just do that. Check the vis documentation to see how to clear the display, and just use the /run/beamOn command, not the whole run.mac macro, to start a second run in the same session.

@mkelsey: Interesting, the memory discussion make sense.

I just tried using /gps/source/clear in my session and then /control/execute run.mac. This now lists two sources (instead of four), only thing I had to do was use /gps/source/add instead of /gps/source/intensity in my first source in run.mac.

This seems to be working at my first glance, or will you expect something deep I am missing here?

Thanks!

Cool! I didn’t know if GPS had a “clear”-like command, so I didn’t want to recommend it. You can do that and it will work as desired.

You should look over your run.mac and see whether there are other commands that might be triggering “make something” rather than “set a value.”

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.