-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
Last updated: May 24, 2019
Attempting to run nextSim with no arguments will result in an error
nextSim[ERROR] nextSim: Input macro filename not specified!
Passing the -h flag will display a list of all command line options.
These options are summarized in the table below.
| Long Option | Flag | Argument | Description |
|---|---|---|---|
| --help | -h | Display the help dialogue and exit | |
| --input | -i | filename | Specify an input geant macro file |
| --output | -o | prefix | Specify the prefix of the output file e.g. prefix-001.root |
| --gui | -g | Run interactive GUI session | |
| --tree | -t | treename | Set the output TTree name (default="data") |
| --yield | -Y | multiplier | Specify the light yield multiplier to use when producing photons (default=1) |
| --verbose | -v | Toggle verbose output mode | |
| --delay | -D | seconds | Set the time delay between successive event counter updates (default=10) |
| --version | -V | Print the version (current commit) number | |
| --mt-thread-limit | -n | threads | Set the number of threads to use (uses all threads for n <= 0) |
| --mt-max-threads | -T | Print the maximum number of threads and exit |
The simplest way to start a session is to toggle the GUI flag i.e.
nextSim -gThis will bring up the default empty NEXTSim GUI session as seen below

Commands for source and detector setup may be selected from the command window on the left. All NEXTSim commands are found under the nDet drop-down menu.
For example
/nDet/detector/addGeometry rectangle
/nDet/detector/update
will generate the simplest possible detector, using default settings. The detector should look something like

Note that, by default, the detector will be placed at the origin. This means that particles will be generated at the center of the detector. To move the detector use
/nDet/detector/setPosition 50 0 0 cm
/nDet/detector/addGeometry rectangle
/nDet/detector/update
This will place an additional detector at x=50, y=0, z=0 cm. Every time the
addGeometry command is called, a new detector is added to the scene with
whatever setup information was specified by the user prior to the call. To
get back to just one detector use the clear command
/nDet/detector/clear
/nDet/detector/setPosition 50 0 0 cm
/nDet/detector/addGeometry rectangle
/nDet/detector/update
Now the viewer should only show a single bar detector. Note that update must
be called any time the setup is changed, otherwise the changes will not take effect.
To simulate an event, click the green play button on the top menu-bar. After a short delay, while Geant is loading the high-precision neutron model, a green track may be seen on the screen.

Note that by default the particle source will generate 1 MeV neutrons along the X-axis. You may instead see an event where the neutron travels through the detector without scattering. This means that you will not see the flash of optical photons at the center of the detector, but if you see the green neutron track everything is working as it should.
Using this method, you may run as many single events as you wish. Once you close the GUI window, you will notice that a root file has been generated. By default, its filename will contain the date and time e.g.
nDetMasterOutputFile: File run_000_14:34:09_Wed_Sep_18_2019.root opened.
The GUI is good for testing new detector setups on an event-by-event basis but the constant drawing of particle tracks will slow the program considerably. Instead of running an interactive session, we may copy the above commands into an ascii file in order to simulate a batch of events all at once.
We make a macro file named ourFirstMacro.mac with the following contents
#ourFirstMacro.mac
/nDet/detector/setPosition 50 0 0 cm
/nDet/detector/addGeometry rectangle
/nDet/detector/update
/run/beamOn 100
Where I have added the beamOn command, which will generate the specified
number of events. Now insead of starting with the -g flag, we start with
-i indicating that we want the program to read from an input macro e.g.
nextSim -i ourFirstMacro.macNOTE: The interactive GUI may also be used with input macros. We simply
omit the -g flag here because we are running many events at once.
Any interactive command may be used in macro files. This makes it much easier to simulate more complicated setups. Instead of a GUI window, all output is piped through stdout. But the simulation running behind the scenes is exactly the same as with the GUI session.
Many different types of setups may be simulated. There are currently over 60 macro commands which may be used to generate various detector geometries with different PMT output characteristics. Several example macro files are included in the directory NEXTSim/mac/ which show how to use some of these commands.