|Message: Re: Automatically run example N06 for multiple energies||Not Logged In (login)|
Click on the Forum title, e.g. on the "Forums by Category" page, to read a sequence of postings to the Forum and its threads all in one page. If you are only interested in one thread or the thread following a specific posting, click the thread or the posting, which takes you to a smaller page, which contains only the part you are interested in and may be easier to navigate.
Messages are "chained" if there are only replies at the first level, i.e. 1/1.html, 1/1/1.html etc. In case of "chained" messages the message number is replaced by the icon and there is no indentation.
Inline: Display the subject line only or also the text of the posting(s); for the choice "All" the "Outline" choices are switched off.
|1||0||1||no text / full text of posting|
|2||1||All||text for level 1 only / text for All postings|
Outline: Choose the depth of the posting thread, successive toggle controls provide increasing detail.
|1||2||1||2 levels / 1 level (original posting)|
|2||3||2||3 levels / 2 levels|
|3||3||All||3 levels / all levels (all postings)|
On Thu, 17 Oct 2013 17:49:49 GMT, Brian wrote:
> Hello, I was wondering if anyone could offer some assistance. I am > creating a simulation similar to example N06 but I need to run it for > about 10**9 particles at each energy starting from 900 KeV to 14 MeV in > intervals of 50 KeV or so. I modified the example to simulate a > Cherenkov detector and I am trying to get the response spectrum. Can > anyone suggest a better way to do it? I am great with FORTRAN but I am > still learning C++. I don't fully understand how to work with GEANT4 and > ROOT. As of now I have it outputting everything I am interested in to a > file and post processing it. I just need a way to automatically switch > energies and rerun. Thanks in advance.
There are two ways you could do this, depending on what kind of computing system you have.
The simplest way is to do the file and directory management in your shell, and submit jobs to a batch system. Write a shell script with a loop over the energy values (i.e., as shell variable strings). In that script, create a destination directory named for the energy, |cd| into it, then run your G4 application with a macro where the energy is set. The shell can write a unique macro file into the directory, or you could set an envvar and use the macro command |/control/getEnv| to access it. With a batch system, you'd submit each job to your batch queue; on a single computer, you can run them in parallel in the background (if you have ~30 cores), or sequentially.
With more complexity, you can do it with one gigantic GEANT4 run. We provide macro commands where you can set up a loop, and launch a macro for each iteration of the loop. The only examples of this we have are related to visualization (e.g., examples/extended/runAndEvent/RE03), but the functionality is generic. You can put /run/beamOn inside the loop macro, and have your G4UserRunAction take care of opening and closing the output files.
I'd recommend the shell-based method (partly because that's what I like to use :-), because the shell is already designed to do directory and file management, in a way that the G4 macros aren't as capable.
-- Michael Kelsey