====== How to add a new version of a Gaudi software ======
===== Prerequisites =====
If you work locally, you first have to execute the lines described [[ http://lhcb.physik.uzh.ch/internal/software.php | here]] (up to ''install CMT environment'').
===== Install new Version =====
(The following examples will all be for DaVinci)
Type
setenvDaVinci vXrYpZ
which will install a directory ~/cmtuser/DaVinci_vXrYpZ in your home directory
(where: **v** stands for version, **r** for release and **p** for patch).
If you only want to execute your own algorithms, thats all you have to install. Otherwise:
===== Install new packages =====
Packages are ordered in /, for instance ''Phys/DaVinci'' or ''Hlt/HltSelections''. If you want to install one of these packages, type:
getpack /
You then have to type your password several times (locally) until the package is downloaded.
===== Add your own cpp-scripts to a package =====
In the package of your choice (for instance ''Phys/DaVinci''), create a folder ''src'', where you put your .cpp and your .h files in. Then go to the folder /cmt, open the requirements file and add:
branches cmt doc job options python src
(only the ''src'' should be missing) and
# ============================================================================
# Component library building rule
# ============================================================================
library Analysis ../src/*.cpp -import=AIDA
# ============================================================================
# define component library link options
# ============================================================================
apply_pattern component_library library=Analysis
This will ensure that the code in the folder ''src'' is compiled and added to the Analysis-library. Then type:
cmt config
cmt make
which will finally compile your cpp-files.
===== Before you start your job =====
Type:
SetupProject DaVinci vXrYpZ
===== Cleaning up =====
Sometimes you need to clean up the directories, as compilation won't work anymore. When you compile your classes (algorithms, tools,...), only the ones which have changed since the last compilation will be recompiled. This may lead to ambiguities, f.ex. if you have renamed a tool, the old object file will still exist and the linker will return an error.
To delete all the object files and rerun the whole compilation on all the classes, do:
cmt make clean all
===== Running in debug mode =====
To investigate errors in your algorithm, tool, ... it may (in some cases) be useful, to run gaudirun.py in debug-mode. To do this, execute the following commands (for a c-shell on lxplus):
setenv CMTCONFIG slc4_amd64_gcc34_dbg
source setup.csh -tag=$CMTDEB
make tag=$CMTDEB
in the cmt-directory of the package in question.
Then do:
setenv GAUDIRUN `gaudirun.py`
gdb python
run $GAUDIRUN yourOptions.py
In order to make this work on grid-ui (SLC 5 and bash environment) you need to following:
source /afs/cern.ch/lhcb/software/releases/LBSCRIPTS/prod/InstallArea/scripts/LbLogin.sh #get LHCb environment from AFS (with debug stuff)
export CMTCONFIG=x86_64-slc5-gcc43-dbg
source Phys/DecayTreeTuple/cmt/setup.sh # adapt according to what you have compiled
**Note:**
* On lxplus, you may run out of memory when starting a job in debug-mode.
* In Zurich, the debug-libraries may not be installed.
===== Information about CMT =====
Information about the use of CMT can be found at [[ https://twiki.cern.ch/twiki/bin/view/LHCb/LHCbSoftwareTrainingBasics | this page]].