File indexing completed on 2023-03-17 10:40:25
0001
0002
0003 if [ "$#" -ne 4 ]; then
0004 echo "Script for adding all root files from a folder locally or in EOS"
0005 echo "Usage of the script:"
0006 echo "$0 [doLocal] [inputFolderName] [outputFolderName] [baseName]"
0007 echo "doLocal = True: Merge local files. False: Merge files on CERN EOS"
0008 echo "inputFolderName = Name of the folder where the root files are"
0009 echo "outputFolderName = Name of the folder to which the output is transferred"
0010 echo "baseName = Name given for the output file without .root extension"
0011 exit
0012 fi
0013
0014 LOCALRUN=$1
0015 INPUTFOLDERNAME=${2%/}
0016 OUTPUTFOLDERNAME=${3%/}
0017 BASENAME=$4
0018
0019 if [ $LOCALRUN = true ]; then
0020 hadd -ff ${BASENAME}.root `ls ${INPUTFOLDERNAME}/*.root`
0021 mv ${BASENAME}.root $OUTPUTFOLDERNAME
0022 else
0023 hadd -ff ${BASENAME}.root `xrdfs root://eoscms.cern.ch ls -u $INPUTFOLDERNAME | grep '\.root'`
0024 xrdcp ${BASENAME}.root root://eoscms.cern.ch/${OUTPUTFOLDERNAME}
0025 rm ${BASENAME}.root
0026 fi