Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-09-27 07:03:06

0001 #!/bin/sh
0002 #
0003 # This script was automatically generated from the src/scripts/eicrecon-this.sh.in file in the
0004 # EICrecon source directory when EICrecon was built. It can be sourced to set the environment
0005 # up to use this EICrecon build.
0006 #
0007 # This finds directories relative to this script. This should allow the entire EICrecon directory
0008 # to be moved and this script should still work.
0009 #
0010 # Dependency packages (i.e. JANA2 and ROOT) are setup using absolute paths
0011 
0012 SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
0013 export EICrecon_ROOT=$( readlink -f ${SCRIPT_DIR}/.. )
0014 
0015 # A helper function to prepend paths without duplication,
0016 # allowing for empty and undefined values (but not checking existence),
0017 # but not escaping colons in your paths.
0018 pathadd() {
0019     local varname="$1"
0020     local newpath="$2"
0021 
0022     eval "oldvalue=\${${varname}:-}"
0023 
0024     # surround with colon so also first and last entry are individually surrounded
0025     local canonical=":${oldvalue}:"
0026     # check whether removing newpath changes old path
0027     if [ "${canonical#*:${newpath}:}" = "${canonical}" ];
0028     then
0029         # newpath not in old path
0030         if [ -n "${oldvalue}" ]; then
0031             eval "export $varname=${newpath}:${oldvalue}"
0032         else
0033             eval "export $varname=${newpath}"
0034         fi
0035     else
0036         # newpath not in old path
0037         # redefine as what's before newpath plus what's after newpath
0038         canonical=${canonical%%:${newpath}:*}:${canonical##*:${newpath}:}
0039         # substring without surrounding colons
0040         canonical=$(expr substr ${canonical} 2 $(expr ${#canonical} - 2))
0041         # prepend newpath
0042         eval "export $varname=${newpath}:${canonical}"
0043     fi
0044 }
0045 
0046 #----------------- JANA2
0047 if [[ -f @JANA_DIR@/../../../bin/jana-this.sh ]] ; then
0048     unset ROOTSYS  # prevent ROOT from removing /usr/local/bin from PATH
0049     export JANA_ROOT=$( readlink -f @JANA_DIR@/../../.. )
0050     source @JANA_DIR@/../../../bin/jana-this.sh
0051 fi
0052 
0053 #----------------- ROOT
0054 if [[ -f @ROOT_BINDIR@/thisroot.sh ]] ; then
0055     unset ROOTSYS  # prevent ROOT from removing /usr/local/bin from PATH
0056     # workaround for https://github.com/root-project/root/issues/14085
0057     # thisroot.sh does not recognize bash when running in qemu (like eic-shell on Silicon)
0058     pushd @ROOT_BINDIR@ >/dev/null
0059     source thisroot.sh
0060     popd >/dev/null
0061 fi
0062 
0063 #----------------- PODIO
0064 PODIO=$( readlink -f @podio_LIBRARY_DIR@/.. )
0065 if [[ -d ${PODIO} ]] ; then
0066     export podio_ROOT=${PODIO}
0067     if [[ -f ${PODIO}/../env.sh ]] ; then
0068         source ${PODIO}/../env.sh
0069     fi
0070 fi
0071 
0072 #----------------- EDM4hep
0073 EDM4HEP=$( readlink -f @EDM4HEP_DIR@/../../.. )
0074 if [[ -d ${EDM4HEP} ]] ; then
0075     export EDM4HEP_ROOT=${EDM4HEP}
0076     EDM4HEP_LIBDIR=${EDM4HEP_ROOT}/lib64
0077     pathadd LD_LIBRARY_PATH ${EDM4HEP_LIBDIR}
0078 fi
0079 
0080 #----------------- EDM4EIC
0081 EDM4EIC=$( readlink -f @EDM4EIC_DIR@/../.. )
0082 if [[ -d ${EDM4EIC} ]] ; then
0083     export EDM4EIC_ROOT=${EDM4EIC}
0084     EDM4EIC_LIBDIR=$( readlink -f @EDM4EIC_DIR@/.. )
0085     pathadd LD_LIBRARY_PATH ${EDM4EIC_LIBDIR}
0086 fi
0087 
0088 #----------------- DD4hep
0089 if [[ -f @DD4hep_DIR@/../bin/thisdd4hep.sh ]] ; then
0090     source @DD4hep_DIR@/../bin/thisdd4hep.sh
0091     export DD4HEP_ROOT=@DD4hep_DIR@/..
0092 fi
0093 
0094 #----------------- fmt
0095 if [[ -d @fmt_DIR@/../../.. ]] ; then
0096     export fmt_ROOT=@fmt_DIR@/../../..
0097     fmt_LIBDIR=$( readlink -f @fmt_DIR@/../.. )
0098     pathadd LD_LIBRARY_PATH ${fmt_LIBDIR}
0099 fi
0100 
0101 #----------------- IRT
0102 if [[ -d $( readlink -f @IRT_LIBRARY_DIR@ ) ]] ; then
0103     pathadd LD_LIBRARY_PATH @IRT_LIBRARY_DIR@
0104 fi
0105 
0106 #----------------- EICrecon
0107 # Add bin to PATH if not already there
0108 pathadd PATH ${SCRIPT_DIR}
0109 
0110 # Add lib to LD_LIBRARY_PATH if not already there
0111 LIB_DIR=$( readlink -f ${EICrecon_ROOT}/lib )
0112 pathadd LD_LIBRARY_PATH ${LIB_DIR}
0113 
0114 # Add plugins to JANA_PLUGIN_PATH if not already there
0115 PLUGINS_DIR=$( readlink -f ${EICrecon_ROOT}/@PLUGIN_OUTPUT_DIRECTORY@ )
0116 pathadd JANA_PLUGIN_PATH ${PLUGINS_DIR}
0117 
0118 # Add plugin headers to ROOT_INCLUDE_PATH if not already there
0119 HEADERS_DIR=$( readlink -f ${EICrecon_ROOT}/include )
0120 pathadd ROOT_INCLUDE_PATH ${HEADERS_DIR}