ANNIE RAT-PAC simulation

===== This section is still under construction, please excuse its organization or/and lack of details. =====


Most of the information in the section has been extracted (or copied) from the RAT-PAC website:

The Reactor Analysis Tool (RAT) is intended to be a framework that combines both Monte Carlo simulation of the Braidwood detector with event-based analysis tasks, like reconstruction. The primary goals are:

  • Make it easy to analyze Monte Carlo-generated events as well as data from disk using the same software with only a few command changes. Even in the proposal/R&D phase, where there is no real data, this is still useful for dumping Monte Carlo events to disk to be analyzed by another job. When there is real data, being able to do the analysis with the same code path as was used on Monte Carlo is very reassuring.
  • Allow for a modular, user-controlled analysis of events. This includes allowing the user to selected which analysis tasks to perform (different fitters, pruning unneeded data from the event data structure, etc.). It should also be relatively straightforward for users to introduce their own code into the analysis process.
  • Separate analysis into small tasks which can be developed asynchronously by different people, yet integrated with minimal (or perhaps zero) pain.
  • Integrate into existing GEANT4 and GLG4sim efforts with a minimum of code duplication. As much as possible, RAT should be designed incorporate upgrades of these packages just by relinking. No cut and paste of code (mainly a question with GLG4sim).

RAT-PAC on the ANNIE machines

RAT-PAC can be somewhat easily installed on your personal laptop by following the instructions on the website.
Here is a list of the prerequisites you'll need to run it:
  • CMake
  • Python 2.7
  • Scons
  • ROOT 5.34 (or any 5.?? version)
  • GEANT 4.10

The website provides a good installation guide for those prerequisites.

RAT-PAC can also be installed and run on the ANNIE machines located at Fermilab. So far, the two machines where it has been tested are:
  • This is the virtual machine created for ANNIE. You need a FermiCloud (upon a ServiceDesk request) account to access this machine.
  • This is the machine used for analysis.

On the fermicloud Virtual Machine

To be able to run RAT-PAC, you'll need to load the libraries belonging to all the prerequisites. All those softwares are located in /root/softwares.
Here are the lines you need to add to your .bashrc file:

# cmake support

# python support
alias python=/root/softwares/python/bin/python2.7

# scons support

# Geant4.10.01, root5.34 support
source /root/softwares/root-5.34/bin/
source /root/softwares/geant410/geant4.10.01.p02-build/InstallTreeFiles/

There's probably a cleaner way to do it and I'm working on it but this should work.

You can then clone our git repository in your personal workspace like this:

git clone ssh://

To ensure that we can easily update the core features of RAT-PAC, we develop the ANNIE simulations on a separate branch. To gain access
to the ANNIE-specific code, enter the ratpac folder and check out the "annie" branch like this:

cd annie-ratpac
git checkout annie

You may freely make commits to your local copy of the "annie" branch. Steven Gardiner will maintain the "master" branch and keep it up-to-date with the
latest commits to the official RAT-PAC repository.

To use RAT-PAC, you will also need to add the following lines to .bashrc (change the paths if necessary):

# RATPAC support (Geant4.10.01, root5.34)
source /home/rat-pac/
alias ratpac='cd /home/rat-pac/'
echo "RAT-PAC support loaded.." 

To load the RAT-PAC support, just type RATPAC. For the first installation, just enter the ratpac folder and type:

scons -c

'scons' is the equivalent of 'make' and 'scons -c' is a 'make clean'

On the anniegpvm01

The steps are very similar. The only difference is that we don't have root access to gpvm so all the prerequisites are in my personal app folder. Please be careful !
Here are the lines you need to add to your .profile file:

# cmake support

#python support
setup python v2_7_6

#scons support

# RATPAC support (Geant4.10.01, root5.34)
source /annie/app/users/vfischer/softwares/root-5.34/bin/
source /annie/app/users/vfischer/softwares/geant410/geant4.10.01.p02-build/InstallTreeFiles/
source /annie/app/users/vfischer/rat-pac/
alias ratpac='cd /annie/app/users/vfischer/rat-pac/'
echo "RAT-PAC support loaded.." 

Modify the last three lines of the RATPAC function to match your personal repository path.
To load the RAT-PAC support, please follow the same instructions than for the Virtual Machine.

Quick RAT-PAC tutorial

Once compiled with scons, you can modify geometries without having to compile rat-pac again since geometries, materials, etc.. are handled as variables in a database (this is actually possible to do in a regular GEANT4 framework).
All the files related to ANNIE are located in data/ANNIE/:
  • ANNIE.geo : Contains the geometry of ANNIE.
  • ELEMENTS_ANNIE.ratdb : Contains some elements specific to ANNIE (Gd,..). Most of the common elements (H,O,Fe,...) are located in data/ELEMENTS.ratdb.
  • MATERIALS_ANNIE.ratdb : Contains some materials specific to ANNIE (ej335). Most of the common materials (water, steel,...) are located in data/MATERIALS.ratdb.
  • OPTICS_ANNIE.ratdb : Contains the optical information specific to ANNIE (liquid emission, absorption,...). Most of the common optics information (water refraction, acrylic absoption,..) are located in data/OPTICS.ratdb.
  • PMTINFO_bottom.ratdb : Contains the position information (x,y,z,orientation) of the PMTs

You can then create your own macro file in mac/ or use an existing one such as mac/ANNIE.mac.

To run a RAT-PAC simulation, simply type:

rat -o output.root mac/ANNIE.mac

where output.root will be created.

Et voila !