Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:07:20

0001 #!/bin/bash -ex
0002 if [ $(klist | grep 'Default principal' | grep cmsbuild | wc -l) -eq 0 ] ; then
0003   echo "Only run for cmsbuild user which has the rights to copy LHE files"
0004   exit 0
0005 fi
0006 CMSEOS_BASE="/eos/cms/store/user/cmsbuild/unittest/lhe"
0007 export CMSEOS_LHE_ROOT_DIRECTORY="${CMSEOS_BASE}/ref"
0008 LHEtoEOSManager=${CMSSW_BASE}/src/GeneratorInterface/LHEInterface/scripts/cmsLHEtoEOSManager.py
0009 REF_FILE=$(${LHEtoEOSManager} -l 1 | grep 'lhe.xz$' | tail -1)
0010 if [ $REF_FILE = "" ] ; then
0011   echo "ERROR: Unable to find reference LHE file"
0012   exit 1
0013 fi
0014 ERR=0
0015 rm -rf test_cmsLHEtoEOSManager ; mkdir -p test_cmsLHEtoEOSManager
0016 pushd test_cmsLHEtoEOSManager
0017   xrdcp root://eoscms.cern.ch/${CMSEOS_LHE_ROOT_DIRECTORY}/1/${REF_FILE} ${REF_FILE}
0018   xz -d ${REF_FILE}
0019   REF_FILE=$(echo $REF_FILE | sed 's|.xz$||')
0020   UNQ_NAME=$(date +%s)-$(echo $(hostname) $$ | md5sum | sed 's| .*||').lhe
0021   mv ${REF_FILE} ${UNQ_NAME}
0022   export CMSEOS_LHE_ROOT_DIRECTORY="${CMSEOS_BASE}/ibs"
0023   if ${LHEtoEOSManager} -u 1 --compress -f ${UNQ_NAME} ; then
0024     ${LHEtoEOSManager} --force -u 1 -f ${UNQ_NAME}.xz || ERR=1
0025   else
0026     ERR=1
0027   fi
0028 popd
0029 rm -rf test_cmsLHEtoEOSManager
0030 xrdfs root://eoscms.cern.ch/ rm    ${CMSEOS_LHE_ROOT_DIRECTORY}/1/${UNQ_NAME}.xz || true
0031 exit $ERR