How to checkout

The source code lives at FNAL, We use git revision control system in (g-2).

The first step is to checkout the code from the repository. This can accomplished with git's clone command:

git clone ssh:///cvs/projects/gm2midas

Note that you have to have an active Kerberos ticket to being able to checkout the code (use kinit).

If developing code, go to the gm2midas directory and checkout the branch develop. We must do all our development in development branch. If you are only installing and using MIDAS, you may stay on the master branch.

cd gm2midas
git checkout develop (if developing code)

Make sure ROOT is installed and the following environment variables are set:

ROOTSYS=<path to your ROOT>
export PATH=$ROOTSYS/bin:$PATH   #MIDAS makefile uses root-config from PATH, so your ROOTSYS must be first ROOT in path

Set the environment variable MIDASSYS to the path to your gm2midas/midas directory.

make install

On some systems you may also manually need to make a "linux64" link to the "linux" directory, e.g.

cd $MIDASSYS ; ln -s linux/ linux64

If you get errors like

src/history_schema.cxx:677:23: error: my_global.h: No such file or directory
src/history_schema.cxx:678:19: error: mysql.h: No such file or directory

it means your system does not have mysql-devel installed, so either install or set the following flag before building MIDAS (do make clean before re-building):

export NO_MYSQL=1

How to create an experiment

Before you run MIDAS, you must set up an exptab file (preferably in /etc/exptab). An example of an exptab file setting up a single experiment called GM2 for the user daq would be:

GM2 /home/daq/experiment daq

You would also need to create the /home/daq/experiment directory.

How to start developing a code

Adam encourages us to use git flow mechanism to setup branches, doing releases, etc. A nice tutorial written by Adam on how to organize the workflow in g2mitrace development can be foud here. Let's stick to the same pattern.

1. Initialize git flow mechanism

git flow init

Use default settings when prompted.

2. Start new development branch

git flow feature start feature_name

Where feature_name is the name of your new branch (your new feature).

Various useful git commands you will need to use in your workflow:

The new feature will exist in your local copy only. To share your development with others, you might want to add your new feature to the central repository. The command is

git flow feature publish feature_name

However, it is Ok to keep your new feature locally until you are done with your development and ready to release it.

When the feature is complete and you want to close it up and push it to repository use

git flow feature finish

Build ROME

gm2midas also contains ROME, the g-2 DQM framework.

To build it, checkout the repository as described above then follow these steps:

export ROOTSYS=<path to your ROOT installation>
cd gm2midas
cd midas
export MIDASSYS=`pwd`
cd ../rome
export ROMESYS=`pwd`
make clean

ROME trouble-shooting

If you get errors like this when you try to run romebuilder.exe

romebuilder.exe: /usr/lib64/ version `CXXABI_1.3.8' not found (required by romebuilder.exe)
romebuilder.exe: /usr/lib64/ version `GLIBCXX_3.4.14' not found (required by romebuilder.exe)

It means that you build ROME when in the offline g-2 environment, e.g. after doing:

source /cvmfs/

This gets a version of g++ from CVMFS that ROME doesn't like, so only build ROME in the online environment (e.g. using your systems g++ on SLF6).