Installing COBRA


Below are instructions on how to install COBRA broken up into the following sections,

Getting the Source Code

Setting up the Enviornment

Building COBRA


Getting the COBRA Source Code

The source code is located in the CLAS CVS repository (cvs.jlab.org:/group/clas/clas_cvs) under packages/utilities/cobra.


Setting Up the Enviornment

First, make sure your ROOT enviornment is set. Just add the following lines to your .cshrc file.

# ROOTSYS is where your local copy of ROOT is located
setenv ROOTSYS /usr/local/root
setenv LD_LIBRARY_PATH ${ROOTSYS}/lib
setenv PATH ${PATH}:${ROOTSYS}/bin

Next, you'll need to make sure that you have your CLAS enviornment set up. The specific values of these enviornment variables will depend on where you're running. Below is an example shell script used at cmu to set the CLAS enviornment.

#! /bin/tcsh -f
#
# Set up CLAS enviornment for Ed Wood
#
setenv TOP_DIR /home/edwood/clas/ # Ed has some packages in a personal copy
setenv CLAS_LOCATION /home/classoft/
setenv CLAS_ROOT  /home/classoft/clas/
setenv CVS_RSH	  ssh
setenv CVSROOT    edwood@cvs.jlab.org:/group/clas/clas_cvs
setenv OS_NAME LinuxRHEL3 # Ed is running Red Hat Enterprise
setenv BUILDS     $CLAS_ROOT/builds
setenv CLAS_PROD  $BUILDS/LATEST
setenv CLAS_DEVEL $BUILDS/LATEST
setenv CLAS_PACK  $TOP_DIR/packages
setenv CLAS_LIB   $CLAS_DEVEL/lib/LinuxRHEL3
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${CLAS_DEVEL}/slib/LinuxRHEL3
setenv PATH ${PATH}:${CLAS_DEVEL}/bin/LinuxRHEL3
setenv OSCLAS "`uname`RHEL3"
setenv OSNAME "`uname`RHEL3"
setenv CLAS_PARMS /home/clasg11/jlabg11/CLAS_PARMS # parms from g11 area
setenv CLAS_CMS $CLAS_DEVEL/packages/cms
#
# Alias some useful displays
#
alias show_clas        'echo ""; \
                        echo "         CVSROOT " $CVSROOT;\
			echo "         OS_NAME " $OS_NAME;\
                        echo "         TOP_DIR " $TOP_DIR;\
                        echo "         CLAS_LOCATION " $CLAS_LOCATION;\
                        echo "         CLAS_ROOT " $CLAS_ROOT;\
                        echo "         BUILDS " $BUILDS;\
                        echo "         CLAS_PROD " $CLAS_PROD;\
                        echo "         CLAS_DEVEL " $CLAS_DEVEL;\
                        echo "         CLAS_PACK " $CLAS_PACK;\
			echo "         CLAS_LIB " $CLAS_LIB;\
			echo "         CLAS_PARMS " $CLAS_PARMS;\
                        echo "";\
                        echo "";'

# Set up CERN enviornment
setenv CERN /usr/local/cern
setenv CERN_LEVEL 2004
setenv CERN_ROOT $CERN/$CERN_LEVEL
setenv CERN_LIB ${CERN_ROOT}/lib
setenv CERN_BIN ${CERN_ROOT}/bin
setenv CERNLIB ${CERN_ROOT}/lib

Once your CLAS and ROOT enviornments are set, setting up the COBRA enviornment is simple. Just add the following lines to your .cshrc file.

# COBRASYS is where your local copy of COBRA is located
setenv COBRASYS /home/edwood/clas/packages/utilities/cobra 
setenv PATH ${PATH}:${COBRASYS}/bin
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${COBRASYS}/lib
That's it, your enviornment should be ok.

Building COBRA

COBRA has several build options, which you choose will depend on what you want it to do. Configuring COBRA can be done by running the configure script in the top directory. This script produces globals.mk, in the same directory, which defines all the libs, includes, flags, etc. needed to build COBRA software.

[edwood@plan9 cobra]$ ./configure --help
Usage: configure [--options]
 
     --interface <inter> Build data interface 'inter'. This is a build option
                         to specify which CLAS data interfaces should be built
                         into ClasEvent.
                          
                         Options: Bos ==> For BOS file interface
                                  CLASdata ==> Compressed ROOT file interface
                                  all ==> Build all interfaces
 
     --build <package>   Build 'package' into COBRA. This tells COBRA which
                         CLAS packages to build in when it's compiled.
                         Note: Make sure your CLAS_PACK or CLAS_DEVEL has these
                               pacakages.
 
                         Options: Pcor ==> g11/g1c momentum corrections
                                  g11pcor ==> New g11a momentum corrections
 
     --warn <level>      Set warning level (default is all). This adds -Wlevel
                         to the compiler flags.
 
     --opt <level>       Set optimization level (default is 2). Adds -Olevel to
                         the compiler flags.
 
     --debug             Turn debugging ON (default is OFF)
 
     --f2c <lib>         FORTRAN to C conversion library (default is g2c)
 
     --help              Print this message
 
 
Example Usage:
[destro@cobracmd]$ ./configure --interface all --build g11pcor
If you have the complete set of CLAS packages, I'd recommend building with the --interface all flag. With just the CLASdata interface (compressed ROOT files), you can get away with only linking against 3 CLAS libs (eloss,map_manager and recutl). As far as packages go, make sure you have the package before you try and build it in. If you don't have it, need it, or want it, then it should be ok to leave it out.

Once you've configured COBRA, you can build it by simply typing make in the top directory (to be safe, do a make clean if you're rebuilding it).

[edwood@plan9 cobra]$ make

When the build is done, you should have the following libs in cobra/lib.

[edwood@plan9 cobra]$ ls lib/ 
libClasEvent.so  libEvent.so   libPArray.so
libClasRuns.so   libKinFit.so  libPTypes.so 

Now proceed to the Getting Started section to check to see the things built properly.




© 2005 Mike Williams, Department of Physics, Carnegie Mellon University.