Local RAT Development

Log into GitHub, and create a fork of SNO+ RAT, by clicking the fork button in the top-right.

This will be your own copy of the RAT code that you can freely work on without your commits causing interruption to anyone else. Feel free to use all the power of Git management; however, do not change the commit history past what is part of the upstream repository. If you are unfamiliar with Git, refer to this brief overview. Please read and abide by the coding standards (SNO+-doc-1081) when writing for RAT.

Installing

Lancaster snoing

Lancaster snoing needs to know where to look for your local RAT version; to do this point the RATDEV environment variable to the path you will want your fork to live locally. It is highly suggested you put this in your shell’s configuration file for environment variables (~/.bash_profile, ~/.zshenv, etc.). This gives you the both the benefits of local development, and Lancaster snoing automatically setting up your environment.

To clone your fork directly into RATDEV, set to be within a development subdirectory of your home directory:

$ export RATDEV=$HOME/development/rat
$ echo "export RATDEV=$RATDEV" > ~/.bash_profile
$ mkdir -p $RATDEV
$ git clone git@github.com:USERNAME/rat.git $RATDEV
$ cd $RATDEV
$ git remote add upstream git@github.com:snoplus/rat.git

Local snoing

If you are using a local version of snoing, you will find it easier for snoing to help maintain your development version. Assuming the environment variable SNOING is where your local version of snoing is installed:

$ cd $SNOING
$ source env.sh
$ ./snoing.py rat-dev

In a new session (i.e., close this terminal and open a new terminal), and go to the rat-dev directory. As RAT is maintained through Git, set the default origin remote as an upstream remote, and the origin remote to your fork.

$ source $SNOING/install/env_rat-dev.sh
$ cd $RATROOT
$ git remote rename origin upstream
$ git remote add origin git@github.com:USERNAME/rat.git

Manually

Set the default origin remote as an upstream remote, and the origin remote to your fork.

$ source rat_env.sh
$ cd $RATROOT
$ git remote rename origin upstream
$ git remote add origin git@github.com:USERNAME/rat.git

Building and Updating

It is assumed that you have all the dependencies correctly installed and setup; if you are using snoing, this is handled for you. Initial building is done as part of the installation for local snoing and manual installations, for Lancaster snoing it is done automatically if env.sh doesn’t exist in RATDEV, i.e., on first source.

If you have installed RAT differently, following the update instructions below will also work for an initial build; noting that you should point the RAT_SCONS environment variable to the location of SCons, rather that sourcing $RATDEV/env.sh, which doesn’t exist yet.

Assuming there are changes to the source, either you have made direct changes, or you have pulled updated source code. You should setup the environment such that RAT can find ROOT, GEANT4, and SCons. This is dependent on the method of installation.

  • Lancaster snoing:

    $ source snoplus-env
    
  • Local snoing:

    $ source $SNOING/install/env_rat-dev.sh
    
  • Manual:

    $ source rat_env.sh
    

The process is to remove the current build, reconfigure and rebuild,

$ cd $RATROOT
$ scons -c
$ ./configure
$ source env.sh
$ scons

If you are using a local snoing, and you do not mind a git pull being called on the current branch, you can simply update using

$ cd $SNOING
$ source env.sh
$ ./snoing.py -p rat-dev