From 207a44264c5821c52230063eefbb7a8e5c20339a Mon Sep 17 00:00:00 2001 From: "ryan@pauli" Date: Wed, 8 Jun 2022 15:24:21 -0400 Subject: [PATCH] overWrite output for converRoot.sh --- convertRoot.sh | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/convertRoot.sh b/convertRoot.sh index b16d476..d62a32a 100755 --- a/convertRoot.sh +++ b/convertRoot.sh @@ -1,5 +1,5 @@ -nCore=10; +nCore=15; if [ $# -eq 0 ]; then echo "Usage: " @@ -8,9 +8,20 @@ if [ $# -eq 0 ]; then fi runNum1=$1 - runNum2=$2 +overWrite=0 +if [[ ${runNum1} -lt 0 ]]; then + overWrite=1 + runNum1=$(( ${runNum1} * (-1) )) +fi +if [[ ${runNum2} -lt 0 ]]; then + overWrite=1 + runNum2=$(( ${runNum2} * (-1) )) +fi + +echo "is overWrite : ${overWrite} | ${runNum1} ${runNum2}" + for (( runNum=${runNum1}; runNum <=${runNum2}; runNum++)); do nFile=$(ls -1 rawdata/run${runNum}/run*evt | wc -l) @@ -49,11 +60,16 @@ for (( runNum=${runNum1}; runNum <=${runNum2}; runNum++)); do fileName=rawdata/run${runNum}/run-${runPrefix}${runNum}-${segPrefix}${SegNum}.evt outFileName=root_data/run-${runPrefix}${runNum}-${segPrefix}${SegNum}.root - if [[ -f ${outFileName} ]]; then - echo "${outFileName} exist. Skip." - else + if [[ ${overWrite} -gt 0 ]]; then echo ${fileName} armory/EventBuilder ${outFileName} 1 250 ${fileName} > /dev/null & + else + if [[ -f ${outFileName} ]]; then + echo "${outFileName} exist. Skip." + else + echo ${fileName} + armory/EventBuilder ${outFileName} 1 250 ${fileName} > /dev/null & + fi fi ((j += 1)) done @@ -61,10 +77,10 @@ for (( runNum=${runNum1}; runNum <=${runNum2}; runNum++)); do sleep 2 SegNum0=$((${nCore}*i)) - SegNum1=$((${nCore}*i + j )) + SegNum1=$((${nCore}*i + j - 1 )) while true; do - nthings=`ps aux | grep "[E]ventBuilder"| wc -l` + nthings=`ps aux | grep "armory/[E]ventBuilder"| wc -l` echo $(date)" || "$nthings" EventBuilder are running. $runNum, ${SegNum0}-${SegNum1}" if [[ $nthings > 0 ]]; then