Running multiple macro files and ouputting to different files


I am looking to run multiple macro files one after the other and have my program output the results of each macro file to a new file.

I can create a “master” macro file that is just a large number of “/control/execute run_x.mac” commands to run all the macro files.

A macro command to rename the output file would be very helpful.

Alternatively, a macro command to input an integer variable into the geant program would be work as I could update that integer after each /control/execute run_x.mac" command then rename each file with that integer.

Each macro file contains a different number of runs so using GetRunID() isn’t an option.

Many thanks,

By the output of the results do you mean you create the file using the analysis manager?
If so, you can change the file name with:

/analysis/setFileName name           # Set name for the output file

It’s used e.g. in the basic/B5/run2.mac example.

Yes thank you, that’s exactly what I needed! I think i had my instance of analysis manager in the wrong place.

Many thanks,