4 #create the event list for one run: the run number if guessed from the path
5 #the input file can either be a root file with the trees or a zipfile with
6 #file FilterEvents_Trees.root inside
7 [[ $# -eq 0 ]] && echo "Usage: $0 file" && exit
11 runNumber=$(guessRunNumber $file)
12 period=$(guessPeriod $file)
15 if [[ ${period%_*} =~ (LHC10h|LHC11h|LHC12h) ]]; then
20 [[ -z $outputFile ]] && outputFile=${runNumber}.list
22 [[ ! -f $file ]] && echo "cannot access file $file" && exit
24 [[ "${file##*\.}" == *zip ]] && file+="#FilterEvents_Trees.root"
27 [[ ${OSTYPE} =~ inux ]] && this=$(readlink -f $0)
30 echo outputFile=$outputFile
31 echo runNumber=$runNumber
34 echo scriptPath=$scriptPath
35 echo aliroot -b -q "${scriptPath}/makeEventList.C(\"${file}\",${ptMinHighPt},${ptMinV0s})"
37 aliroot -b -q "${scriptPath}/makeEventList.C(\"${file}\",${ptMinHighPt},${ptMinV0s})" 2>/dev/null\
38 | awk -v period=${period} '/^offlineTrigger/ {triggerType=$2;} $8 !~ "*" && $0 ~ "^*.*/\\w*/\\w*/" { n=split($10,a,"/"); rawfile="/"a[4]"/"a[5]"/"a[6]"/"period"/"a[8]"/raw/"a[n-1]".root"; print rawfile" "$8" "triggerType; }' \
39 | sort -V | uniq > $outputFile
45 #guess run number from the path, pick the rightmost one
47 declare -a path=( $1 )
49 for ((x=${dirDepth}-1;x>=0;x--)); do
51 [[ ${field} =~ ^000[0-9]*[0-9]$ ]] && runNumber=${field#000} && break
60 #guess the year from the path, pick the rightmost one
62 declare -a path=( $1 )
64 for ((x=${dirDepth}-1;x>=0;x--)); do
66 [[ ${field} =~ ^LHC[0-9][0-9][a-z]_*.*$ ]] && period=${field%%_*} && break