#!/bin/sh # #################################################################### # To successfully employ this script, make sure that your bash is in # # the bin - directory or adjust accordingly. # ###################################################################### RUNFILE=$1 RUNDIR=${PWD}/`basename $1 .dat` VIRDIR=$RUNDIR/Virtual/ LIBPATH=$LD_LIBRARY_PATH MODPATH=$LD_LIBRARY_PATH SAMURAILIBPATH='PATH_TO_SAMURAI_LIB' SAMURAIMODPATH='PATH_TO_SAMURAI_MOD' GOLEM95LIBPATH='PATH_TO_GOLEM95_LIB' GOLEM95MODPATH='PATH_TO_GOLEM95_MOD' QCDLOOPLIBPATH='PATH_TO_QCDLOOP_LIB' AVH_OLOLIBPATH='PATH_TO_AVH_OLO_LIB' FFINTEGLIBPATH='PATH_TO_FFINTEG_LIB' # If input is 'HELP': if [ "$1" = "help" ] || [ "$#" = "0" ] || [ "$RUNFILE" = "$RUNDIR" ] then echo "****************************************************************" echo "-- HELP menu for the script gosamsherpa -- " echo "To generate a process feed this script with a Sherpa card: " echo "./gosamsherpa MySherpaNLOCard.dat : generates the process in " echo " the folder MySherpaNLOCard " echo " --> the extension must be .dat" echo "./gosamsherpa help : show this help screen " echo "****************************************************************" exit else if [ -d $RUNDIR ] then echo "****************************************************************" echo "The folder" $RUNDIR " already exists. Please remove or rename it" echo "to proceed. " echo "Abort process generation. " echo "****************************************************************" exit else mkdir $RUNDIR fi # dynamic library suffix: # Apple? SYSTEM=$(uname -a | grep Darwin) if [ -n "$SYSTEM" ] then echo "Detected system is Apple:" echo "$SYSTEM" LIB=dylib fi # Linux? SYSTEM=$(uname -a | grep Linux) if [ -n "$SYSTEM" ] then echo "Detected system is Linux:" echo "$SYSTEM" LIB=so fi if [ -z "$LIB" ] then echo "Operating system not recognized, compilation aborted." exit fi echo '----------------------------------------------' echo '---> Looking for the needed libraries...' while [ "$LIBPATH" != "." -o -z "$LIBPATH" ] do y=${LIBPATH##*:} # echo '---> path is: '$y'' if [ -x $y/libsamurai.$LIB ] then echo '---> samurai library is in:' echo ' '$y':' SAMURAILIBPATH='-L'$y' -lsamurai' # ls -l $y/libsamurai* fi if [ -x $y/libgolem.$LIB ] then echo '---> golem95 library is in:' echo ' '$y':' GOLEM95LIBPATH='-L'$y' -lgolem' # ls -l $y/libgolem* fi if [ -x $y/libqcdloop.$LIB ] then echo '---> qcdloop library is in:' echo ' '$y':' QCDLOOPLIBPATH='-L'$y' -lqcdloop' # ls -l $y/libqcdloop* fi if [ -x $y/libavh_olo.$LIB ] then echo '---> avh_olo library is in:' echo ' '$y':' AVH_OLOLIBPATH='-L'$y' -lavh_olo' # ls -l $y/libavh_olo* fi if [ -x $y/libff.$LIB ] then echo '---> ff library is in:' echo ' '$y':' FFINTEGLIBPATH='-L'$y' -lff' # ls -l $y/libff* fi tmp=${LIBPATH%:$y} if [ "$tmp" = "$LIBPATH" ] then break fi LIBPATH=$tmp done echo '----------------------------------------------' echo '---> Looking for the needed modules...' while [ "$MODPATH" != "." -o -z "$MODPATH" ] do y=${MODPATH##*:} if [ -d $y/../include/gosam-contrib ] then echo '---> samurai and golem95 modules are both in:' echo ' '$y':/../include/gosam-contrib:' SAMURAIMODPATH='-I'$y'/../include/gosam-contrib' GOLEM95MODPATH='-I'$y'/../include/gosam-contrib' # ls -l $y/golem95* # ls -l $y/samurai* fi if [ -d $y/../include/samurai ] then echo '---> samurai modules are in:' echo ' '$y':/../include:' SAMURAIMODPATH='-I'$y'/../include/samurai' # ls -l $y/samurai* fi if [ -d $y/../include/golem95 ] then echo '---> golem95 modules are in:' echo ' '$y':/../include:' GOLEM95MODPATH='-I'$y'/../include/golem95' # ls -l $y/golem95* fi tmp=${MODPATH%:$y} if [ "$tmp" = "$MODPATH" ] then break fi MODPATH=$tmp done if [ "$SAMURAILIBPATH" = "PATH_TO_SAMURAI_LIB" ] then echo '---> samurai library not found!' echo ' Have you exported the LD_LIBRARY_PATH properly?' echo ' Please refer to the webpage for more detailed' echo ' instructions and contacts.' exit fi if [ "$SAMURAIMODPATH" = "PATH_TO_SAMURAI_MOD" ] then echo '---> samurai modules not found!' echo ' Have you exported the LD_LIBRARY_PATH properly?' echo ' Please refer to the webpage for more detailed' echo ' instructions and contacts.' exit fi if [ "$GOLEM95LIBPATH" = "PATH_TO_GOLEM95_LIB" ] then echo '---> samurai library not found!' echo ' Have you exported the LD_LIBRARY_PATH properly?' echo ' Please refer to the webpage for more detailed' echo ' instructions and contacts.' exit fi if [ "$GOLEM95MODPATH" = "PATH_TO_GOLEM95_MOD" ] then echo '---> golem95 modules not found!' echo ' Have you exported the LD_LIBRARY_PATH properly?' echo ' Please refer to the webpage for more detailed' echo ' instructions and contacts.' exit fi if [ "$QCDLOOPLIBPATH" = "PATH_TO_QCDLOOP_LIB" ] then echo '---> qcdloop library not found!' echo ' Have you exported the LD_LIBRARY_PATH properly?' echo ' Please refer to the webpage for more detailed' echo ' instructions and contacts.' exit fi if [ "$AVHOLOLIBPATH" = "PATH_TO_AVH_OLO_LIB" ] then echo '---> avh_olo library not found!' echo ' Have you exported the LD_LIBRARY_PATH properly?' echo ' Please refer to the webpage for more detailed' echo ' instructions and contacts.' exit fi if [ "$FFINTEGLIBPATH" = "PATH_TO_FFINTEG_LIB" ] then echo '---> ff integral library not found!' echo ' Have you exported the LD_LIBRARY_PATH properly?' echo ' Please refer to the webpage for more detailed' echo ' instructions and contacts.' exit fi sed -e "s|#\{0,10\} SHERPA_LDADD| # SHERPA_LDADD|g" \ -e "s|#\{0,10\} LHOLE_CONTRACTFILE| # LHOLE_CONTRACTFILE|g" $RUNFILE > $RUNDIR/$RUNFILE cd $RUNDIR echo '----------------------------------------------' echo '>>> Generate tree-level code...' mkdir $RUNDIR/Analysis echo '--> Creating libraries for process...' Sherpa -O 0 -f $RUNFILE echo '--> Compiling libraries for process...' bash makelibs echo '----------------------------------------------' echo '>>> Generate virtual code...' echo '--> Creating gosam.rc file for process...' echo "# This file was generated automatically by 'gosamsherpa'," > gosam.rc echo "# it contains informations for the generation of the " >> gosam.rc echo "# virtual 1-loop corrections by gosam. " >> gosam.rc echo "" >> gosam.rc echo "###################" >> gosam.rc echo "# physics options #" >> gosam.rc echo "###################" >> gosam.rc echo "" >> gosam.rc echo "model=smdiag" >> gosam.rc echo "" >> gosam.rc echo "zero=me,mmu,mU,mD,mC,mS,mB,wT,wB" >> gosam.rc echo "one=gs,e" >> gosam.rc echo "" >> gosam.rc echo "symmetries=family,generation" >> gosam.rc echo "" >> gosam.rc echo "qgraf.options=onshell,notadpole,nosnail" >> gosam.rc echo "qgraf.verbatim=true=iprop[H,phim,phip,chi,0,0];" >> gosam.rc echo "" >> gosam.rc echo "diagsum=True" >> gosam.rc echo "" >> gosam.rc echo "SP_check=True" >> gosam.rc echo "SP_verbosity=2" >> gosam.rc echo "SP_chk_threshold1=0.0001" >> gosam.rc echo "SP_chk_threshold2=0.0001" >> gosam.rc echo "" >> gosam.rc echo "###################" >> gosam.rc echo "# program options #" >> gosam.rc echo "###################" >> gosam.rc echo "" >> gosam.rc echo "abbrev.level=diagram" >> gosam.rc echo "abbrev.limit=700" >> gosam.rc echo "" >> gosam.rc echo "extensions=samurai, golem95, autotools, derive" >> gosam.rc echo "" >> gosam.rc echo "form.bin=tform" >> gosam.rc echo "form.tempdir=/tmp" >> gosam.rc echo "fc.bin=gfortran -O2" >> gosam.rc echo "" >> gosam.rc echo "samurai.fcflags=$SAMURAIMODPATH " >> gosam.rc echo "samurai.ldflags=$SAMURAILIBPATH -lqcdloop -lavh_olo" >> gosam.rc echo "golem95.fcflags=$GOLEM95MODPATH" >> gosam.rc echo "golem95.ldflags=$GOLEM95LIBPATH" >> gosam.rc echo "" >> gosam.rc gosam.py --olp --mc=sherpa --config=gosam.rc --ignore-unknown --destination=$VIRDIR OLE_order.lh echo '--> Compile virtual code...' cd $VIRDIR bash autogen.sh --libdir=$VIRDIR/lib --prefix=$VIRDIR make make install cd $RUNDIR ln -s $VIRDIR/lib/libgolem_olp.$LIB mv $RUNFILE $RUNFILE.tmp sed -e "s|#\{0,10\} SHERPA_LDADD| SHERPA_LDADD|g" \ -e "s|#\{0,10\} LHOLE_CONTRACTFILE| LHOLE_CONTRACTFILE|g" $RUNFILE.tmp > $RUNFILE rm $RUNFILE.tmp fi echo "******************************************************************" echo "--> The code for the NLO process has been installed in" $RUNDIR "," echo "" echo "cd " $RUNDIR " and run:" echo "Sherpa -f " $RUNFILE echo "to start the computation." echo "******************************************************************" exit