How to run Athena with Geant4 in debug mode

This page explains how to run Athena with Geant4 in debug mode. This can be done interactively, or with a script which is provided.

The main recipe was provided by Andy Buckley, and I have validated it and packaged it into a script.

The following script can be used on lxplus nodes. It checks out a version of Athena in a /tmp directory. Things to note:

  • the version of Athena must be changed in the script.

#!/bin/bash
runId=${1:-1}; shift
echo  "To run number $runId "
if [[ $runId == -1 ]]; then
    echo "Must supply runId as argument_1"; 
    exit ; 
fi

##  From the 'current' directory several files needed for a run will be copied.
originalDir=`pwd`
## CHANGE HERE
#   Below you must list all the files you need in order to run into the run directory
#   These will be copied from the current directory into the run directory
files="jobConfig.LooperKiller.py postOptions.LooperKiller.py test_G4Atlas.py"

## CHANGE HERE  - Version of Athena to use
##  Identification of run
athVer="16.6.X-r4"                              ## Shorthand id for runs
athFull="here,16.6.X,r4,runtime,32"    ## Full description string for 'asetup'
                                                            ## <<<---- Must have "32" for use with i686 G4 libs

##
# Set up Atlas environment
##------------------------
echo "Setting new Atlas environment $athVer  --- with full= $athFull **"
#-----------

# Check the files
for file in $files
do
  if [[ ! -f $file ]]; then
     echo "Fatal Error in " $0 " : cannot find file" $file
     exit 1
  fi
done

cd   /tmp/japostzp
DirAthena="AthenaDir-$athVer-dbg"
if [[ ! -d  $DirAthena ]]; then
   mkdir  $DirAthena
   cd     $DirAthena
   # asetup $athVer,here,32
   echo   "**> calling asetup with argument " $athFull
   source /afs/cern.ch/atlas/software/dist/AtlasSetup/scripts/asetup.sh $athFull
   cmt co External/Geant4
   cd External/Geant4/cmt 
   mv requirements requirements.orig
   cp ~abuckley/public/g4-requirements.i686-slc5-gcc43-dbg .
   ##  CHANGE - here  ==> the above file must correspond to the RELEASE
   #    e.g. I created a local version for the latest release (simple changes)
   #cp $originalDir/g4-requirements.i686-slc5-gcc43-dbg  .
   ln -s           g4-requirements.i686-slc5-gcc43-dbg  requirements 
   cmt config
   make 
else
   echo "Using existing installation" in `pwd`/AthenaSetupDir-$athVer
   cd     $DirAthena
   echo   "**> calling asetup with argument " $athFull
   source /afs/cern.ch/atlas/software/dist/AtlasSetup/scripts/asetup.sh $athFull
fi
alias  athena=athena.py

# cd -
cd $originalDir

echo "Let us check that we can find Athena"
which athena.py

##  Useful variables
hostNm=`hostname | sed 's/.cern.ch//' `

RUNDIR=/tmp/japostzp/Run-ath$athVer-gdb.$runId
if [[ -d $RUNDIR ]]; then
   mv $RUNDIR/test_G4Atlas.py{,-bak-$$}
else
   mkdir -p $RUNDIR
fi

cp $files $RUNDIR

if [[ ! -f am-running-$runId ]]; then 
   ln -s $RUNDIR running-on-$hostNm-$runId 
   ## ln -s running-on-$hostNm-$runId  am-running-$runId 

   echo=1
   cd $RUNDIR
   cp test_G4Atlas.py  test_G4Atlas.py_ran_$$

# Options for running
#  1.) Running with a log file in a gzip-ed file 
#  athena.py -c "RTTRunNumber=$runId" test_G4Atlas.py 2>&1 | gzip -3 > log.ath$athVer.rtt$runId.gz

#  2.) Running with gdb
athena.py -c "RTTRunNumber=$runId" test_G4Atlas.py 2>&1 | gzip -8 > log.ath$athVer.rtt$runId.gz

# Adapted way to run debug from debug 
#   http://alxr.usatlas.bnl.gov/lxr/source/atlas/Control/AthenaCommon/share/athena.py
#
# A simple way to run gdb  -- see 
#  athena.py  -d exec  -c "RTTRunNumber=$runId" test_G4Atlas.py 2>&1 | tee log.ath$athVer.rtt$runId
#  athena.py --debug exec -c "RTTRunNumber=$runId" test_G4Atlas.py 

   exit 0
else
   echo "ERROR - the job with run Id=$runId is running or already ran."
   echo " Check the file running-$runId for the host running the job."
   echo " >> Exiting."
   exit 10
fi
###-----------------------------------------------------###

-- JohnApostolakis - 26-Oct-2011

Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r3 - 2020-08-18 - TWikiAdminUser
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Sandbox/SandboxArchive All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright &© 2008-2023 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback