Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:18:28

0001 set -Eu # no pipefail to allow head to cut pipe
0002 trap 's=$?; echo "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR
0003 IFS=$'\n\t'
0004 
0005 out=${1?Specify output}
0006 dirfile=${2?Specify filename}
0007 ext=${3?Specify extension}
0008 nevents=${4:-} # allow empty
0009 n_lines_per_event=${5:-} # allow empty
0010 
0011 xrdurl="root://dtn-eic.jlab.org"
0012 xrdbase="/work/eic2/EPIC/EVGEN"
0013 
0014 # loop over glob expression
0015 dir=$(dirname ${dirfile})
0016 file=$(basename ${dirfile})
0017 echo ${xrdurl}/${xrdbase}/${dir}/${file}.${ext}
0018 file=${file/'e+'/'e\+'}
0019 file=${file/'pi+'/'pi\+'}
0020 file=${file/'kaon+'/'kaon\+'}
0021 file=${file/'K+'/'K\+'}
0022 list=$(xrdfs ${xrdurl} ls ${xrdbase}/${dir} | grep .${ext} | sed "s/.${ext}//g" | grep -E ${file})
0023 
0024 
0025 for xrdfile in ${list} ; do
0026   
0027   # output
0028   echo "${xrdfile/${xrdbase}\//},$ext,$nevents,$n_lines_per_event" | tee -a "${out}"
0029 
0030 done