Project

General

Profile

ANNIE RAT-PAC simulation

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

About RAT-PAC

Most of the information in the section has been extracted (or copied) from the RAT-PAC website: http://rat.readthedocs.io/en/latest/index.html

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:
  • fermicloud056.fnal.gov: This is the virtual machine created for ANNIE. You need a FermiCloud (upon a ServiceDesk request) account to access this machine.
  • anniegpvm01.fnal.gov: 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
PATH=/root/softwares/cmake-361/bin:$PATH
LD_LIBRARY_PATH=/root/softwares/cmake-361/lib:$LD_LIBRARY_PATH

# python support
alias python=/root/softwares/python/bin/python2.7
PATH=/root/softwares/python/bin:$PATH
LD_LIBRARY_PATH=/root/softwares/python/lib:$LD_LIBRARY_PATH

# scons support
PATH=/root/softwares/scons-2.5.0-install/bin:$PATH
LD_LIBRARY_PATH=/aroot/softwares/scons-2.5.0-install/lib:$LD_LIBRARY_PATH

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

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://p-annie-ratpac@cdcvs.fnal.gov/cvs/projects/annie-ratpac

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)
RATPAC() {
source /home/rat-pac/env.sh
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:

./configure
scons -c
scons

'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
PATH=/annie/app/users/vfischer/softwares/cmake-361/bin:$PATH
LD_LIBRARY_PATH=/annie/app/users/vfischer/softwares/cmake-361/lib:$LD_LIBRARY_PATH

#python support
setup python v2_7_6

#scons support
PATH=/annie/app/users/vfischer/softwares/scons-2.5.0-install/bin:$PATH
LD_LIBRARY_PATH=/annie/app/users/vfischer/softwares/scons-2.5.0-install/lib:$LD_LIBRARY_PATH

# RATPAC support (Geant4.10.01, root5.34)
RATPAC() {
source /annie/app/users/vfischer/softwares/root-5.34/bin/thisroot.sh
source /annie/app/users/vfischer/softwares/geant410/geant4.10.01.p02-build/InstallTreeFiles/geant4.sh
source /annie/app/users/vfischer/rat-pac/env.sh
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 !