overWrite output for converRoot.sh

This commit is contained in:
Ryan Tang 2022-06-08 15:24:21 -04:00
parent e8d802a268
commit 207a44264c

View File

@ -1,5 +1,5 @@
nCore=10; nCore=15;
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
echo "Usage: " echo "Usage: "
@ -8,9 +8,20 @@ if [ $# -eq 0 ]; then
fi fi
runNum1=$1 runNum1=$1
runNum2=$2 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 for (( runNum=${runNum1}; runNum <=${runNum2}; runNum++)); do
nFile=$(ls -1 rawdata/run${runNum}/run*evt | wc -l) 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 fileName=rawdata/run${runNum}/run-${runPrefix}${runNum}-${segPrefix}${SegNum}.evt
outFileName=root_data/run-${runPrefix}${runNum}-${segPrefix}${SegNum}.root outFileName=root_data/run-${runPrefix}${runNum}-${segPrefix}${SegNum}.root
if [[ -f ${outFileName} ]]; then if [[ ${overWrite} -gt 0 ]]; then
echo "${outFileName} exist. Skip."
else
echo ${fileName} echo ${fileName}
armory/EventBuilder ${outFileName} 1 250 ${fileName} > /dev/null & 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 fi
((j += 1)) ((j += 1))
done done
@ -61,10 +77,10 @@ for (( runNum=${runNum1}; runNum <=${runNum2}; runNum++)); do
sleep 2 sleep 2
SegNum0=$((${nCore}*i)) SegNum0=$((${nCore}*i))
SegNum1=$((${nCore}*i + j )) SegNum1=$((${nCore}*i + j - 1 ))
while true; do 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}" echo $(date)" || "$nthings" EventBuilder are running. $runNum, ${SegNum0}-${SegNum1}"
if [[ $nthings > 0 ]]; then if [[ $nthings > 0 ]]; then