Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:57:12

0001 #!/bin/bash
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