Commit 9b4d18d1 authored by Breno Rilho Lemos's avatar Breno Rilho Lemos 💬

Improve log file layout; add starting point of events

parent d863240c
......@@ -27,7 +27,7 @@ fi
# Define a timestamp function
timestamp() {
date +"%y-%m-%d %T $1"
date +"%y-%m-%d, %T, $1"
}
##############################
......@@ -397,7 +397,7 @@ if [ "$SAMPLE" = "true" ]; then
##############################
elif [ "$SAMPLE" = "false" ]; then
if ! grep -q "DATA ANALYSIS FINISHED" $PROGRESS_LOG; then
if ! grep -q "DATA_ANALYSIS, FINISHED" $PROGRESS_LOG; then
# Verify if AliESDs.root is here
ALIESD_ROOT_FILE=$(pwd)/AliESDs.root
......@@ -410,6 +410,7 @@ elif [ "$SAMPLE" = "false" ]; then
############################
# Phase 1: aliroot extract #
############################
timestamp "STARTING DATA ANALYSIS" >> $PROGRESS_LOG
eval $(alienv -w ${ALIENV_WORK_DIR} -a ${ALIENV_OS_SPEC} load ${ALIENV_ID})
pushd ${ALIROOT_SCRIPT_DIR}
# Remove existing symbolic link
......@@ -427,7 +428,7 @@ elif [ "$SAMPLE" = "false" ]; then
fi
popd
timestamp "${UNIQUEID} - DATA ANALYSIS FINISHED" >> $PROGRESS_LOG
timestamp "${UNIQUEID}, DATA_ANALYSIS, FINISHED" >> $PROGRESS_LOG
else
if [ "$DOWNLOAD" = "false" ]; then
......@@ -440,20 +441,20 @@ elif [ "$SAMPLE" = "false" ]; then
fi
fi
if ! grep -q "${UNIQUEID} - ANIMATION DIRECTORY CREATED" $PROGRESS_LOG ; then
if ! grep -q "${UNIQUEID}, ANIMATION DIRECTORY CREATED" $PROGRESS_LOG ; then
# Create directory where animations will be saved
BLENDER_OUTPUT=$(pwd)/$UNIQUEID
mkdir --verbose -p ${BLENDER_OUTPUT}
timestamp "${UNIQUEID} - ANIMATION DIRECTORY CREATED" >> $PROGRESS_LOG
timestamp "${UNIQUEID}, ANIMATION DIRECTORY CREATED" >> $PROGRESS_LOG
else
BLENDER_OUTPUT=$(pwd)/$UNIQUEID
fi
pushd ${ALIROOT_SCRIPT_DIR} # push back to aliroot directory
if ! grep -q "${UNIQUEID} - DATA ANALYSIS FILES MOVED to animation directory" $PROGRESS_LOG; then
if ! grep -q "${UNIQUEID}, DATA ANALYSIS FILES MOVED to animation directory" $PROGRESS_LOG; then
#################################################
# Phase 1: iteration for every event identifier #
#################################################
......@@ -465,7 +466,7 @@ elif [ "$SAMPLE" = "false" ]; then
if ! [[ -s $FILE_WITH_DATA ]]; then
echo "File $FILE_WITH_DATA has zero size. Ignore and continue."
rm $FILE_WITH_DATA
rm -f $FILE_WITH_DATA
continue
fi
......@@ -474,23 +475,24 @@ elif [ "$SAMPLE" = "false" ]; then
done
timestamp "${UNIQUEID} - DATA ANALYSIS FILES MOVED to animation directory" >> $PROGRESS_LOG
timestamp "${UNIQUEID}, DATA ANALYSIS FILES MOVED to animation directory" >> $PROGRESS_LOG
fi
popd
pushd ${BLENDER_SCRIPT_DIR}
if ! grep -q "${UNIQUEID} - CREATED EVENT COUNTER FILE" $PROGRESS_LOG; then
if ! grep -q "${UNIQUEID}, CREATED EVENT COUNTER FILE" $PROGRESS_LOG; then
# Event counter for animating no more events than the informed amount
rm -f event_counter.txt
EVENT_COUNTER=0
echo "$EVENT_COUNTER" > event_counter.txt
timestamp "${UNIQUEID} - CREATED EVENT COUNTER FILE" >> $PROGRESS_LOG
timestamp "${UNIQUEID}, CREATED EVENT COUNTER FILE" >> $PROGRESS_LOG
fi
if ! grep -q "${UNIQUEID} - DATA FILES RENAMED according to UNIQUEID" $PROGRESS_LOG; then
if ! grep -q "${UNIQUEID}, DATA FILES RENAMED according to UNIQUEID" $PROGRESS_LOG; then
EXTRACTED_FILES=$(ls -1 esd_detail-event_*.dat | sort --version-sort)
......@@ -507,7 +509,7 @@ elif [ "$SAMPLE" = "false" ]; then
done
timestamp "${UNIQUEID} - DATA FILES RENAMED according to UNIQUEID" >> $PROGRESS_LOG
timestamp "${UNIQUEID}, DATA FILES RENAMED according to UNIQUEID" >> $PROGRESS_LOG
fi
......@@ -546,12 +548,13 @@ elif [ "$SAMPLE" = "false" ]; then
if [[ $NUMBER_OF_PARTICLES -le $MAX_PARTICLES && $NUMBER_OF_PARTICLES \
-ge $MIN_PARTICLES && $EVENT_COUNTER -lt $N_OF_EVENTS ]]; then
if ! grep -q "${UNIQUEID} - Event ${EVENT_ID} - SCENE READY." $PROGRESS_LOG; then
if ! grep -q "${UNIQUEID}, ${EVENT_ID}, SCENE, FINISHED" $PROGRESS_LOG; then
echo "Processing ${EVENT_UNIQUE_ID} ($NUMBER_OF_PARTICLES tracks) in Blender"
echo "Processing ${EVENT_UNIQUE_ID} in Blender"
timestamp "${UNIQUEID}, ${EVENT_ID}, SCENE, STARTING, $NUMBER_OF_PARTICLES" >> $PROGRESS_LOG
blender -noaudio --background -P animate_particles.py -- -radius=0.05 \
-duration=${DURATION} -cameras="${CAMERAS}" -datafile="${LOCAL_FILE_WITH_DATA}"\
-n_event=${EVENT_ID} -simulated_t=0.03 -fps=${FPS} -resolution=${RESOLUTION}\
......@@ -559,27 +562,30 @@ elif [ "$SAMPLE" = "false" ]; then
-tpc=${TPC} -trd=${TRD} -emcal=${EMCAL} -detailed_tpc=${DETAILED_TPC} \
-blendersave=${BLENDERSAVE} -picpct=${PICPCT} -tpc_blender_path=${BLENDER_SCRIPT_DIR}\
-output_path="${BLENDER_OUTPUT}"
timestamp "${UNIQUEID} - Event ${EVENT_ID} - SCENE READY." >> $PROGRESS_LOG
timestamp "${UNIQUEID}, ${EVENT_ID}, SCENE, FINISHED, $NUMBER_OF_PARTICLES" >> $PROGRESS_LOG
fi
for type in $CAMERAS; do
if ! grep -q "${UNIQUEID} - Event ${EVENT_ID} - ${type} FINISHED" $PROGRESS_LOG; then
if ! grep -q "${UNIQUEID}, ${EVENT_ID}, ${type}, FINISHED" $PROGRESS_LOG; then
timestamp "${UNIQUEID}, ${EVENT_ID}, ${type}, STARTING, $NUMBER_OF_PARTICLES" >> $PROGRESS_LOG
blender -noaudio --background -P render.py -- -cam ${type} -datafile\
"${LOCAL_FILE_WITH_DATA}" -n_event ${EVENT_ID} -pic_pct ${PICPCT} -output_path "${BLENDER_OUTPUT}"
timestamp "${UNIQUEID} - Event ${EVENT_ID} - ${type} FINISHED" >> $PROGRESS_LOG
timestamp "${UNIQUEID}, ${EVENT_ID}, ${type}, FINISHED, $NUMBER_OF_PARTICLES" >> $PROGRESS_LOG
fi
done
if [ "$MOSAIC" = "true" ]; then
if ! grep -q "${UNIQUEID} - Event ${EVENT_ID} - MOSAIC FINISHED" $PROGRESS_LOG; then
if ! grep -q "${UNIQUEID}, ${EVENT_ID}, MOSAIC, FINISHED" $PROGRESS_LOG; then
pushd ${BLENDER_OUTPUT}
timestamp "${UNIQUEID}, ${EVENT_ID}, MOSAIC, STARTING, $NUMBER_OF_PARTICLES" >> $PROGRESS_LOG
# Delete existing incomplete .mp4 file
if [[ -f ${EVENT_UNIQUE_ID}_Mosaic.mp4 ]]; then
rm ${EVENT_UNIQUE_ID}_Mosaic.mp4
......@@ -595,24 +601,24 @@ elif [ "$SAMPLE" = "false" ]; then
"[0:v][1:v]hstack=inputs=2[top];[2:v][3:v]hstack=inputs=2[bottom];[top][bottom]vstack=inputs=2[v]"\
-map "[v]" ${EVENT_UNIQUE_ID}_Mosaic.mp4
timestamp "${UNIQUEID} - Event ${EVENT_ID} - MOSAIC FINISHED" >> $PROGRESS_LOG
timestamp "${UNIQUEID}, ${EVENT_ID}, MOSAIC, FINISHED, $NUMBER_OF_PARTICLES" >> $PROGRESS_LOG
popd
fi
fi
if ! grep -q "${UNIQUEID} - Event ${EVENT_ID} - TEXT DATA MOVED to final location" $PROGRESS_LOG; then
if ! grep -q "${UNIQUEID}, ${EVENT_ID}, TEXT DATA MOVED to final location" $PROGRESS_LOG; then
# Move processed file to final location
mv $LOCAL_FILE_WITH_DATA ${BLENDER_OUTPUT}/$LOCAL_FILE_WITH_DATA
timestamp "${UNIQUEID} - Event ${EVENT_ID} - TEXT DATA MOVED to final location" >> $PROGRESS_LOG
timestamp "${UNIQUEID}, ${EVENT_ID}, TEXT DATA MOVED to final location" >> $PROGRESS_LOG
fi
echo "EVENT ${EVENT_UNIQUE_ID} DONE with FILE $LOCAL_FILE_WITH_DATA."
# Increment event counter
EVENT_COUNTER=$EVENT_COUNTER+1
rm event_counter.txt
rm -f event_counter.txt
echo "$EVENT_COUNTER" > event_counter.txt
else
......@@ -626,20 +632,20 @@ elif [ "$SAMPLE" = "false" ]; then
fi
# Remove non-processed files
rm $LOCAL_FILE_WITH_DATA
rm -f $LOCAL_FILE_WITH_DATA
fi
else
echo "Average Z Momentum too low (minimum accepted is $MIN_AVG_PZ). Continue."
# Remove non-processed files
rm $LOCAL_FILE_WITH_DATA
rm -f $LOCAL_FILE_WITH_DATA
fi
else
echo "Average Transversal Momentum too low (minimum accepted is $MIN_AVG_PT). Continue."
# Remove non-processed files
rm $LOCAL_FILE_WITH_DATA
rm -f $LOCAL_FILE_WITH_DATA
fi
popd
......@@ -648,8 +654,8 @@ elif [ "$SAMPLE" = "false" ]; then
# Remove event counter file
pushd ${BLENDER_SCRIPT_DIR}
rm event_counter.txt
rm -f event_counter.txt
popd
fi
timestamp "JOB FINISHED" >> $PROGRESS_LOG
timestamp "${UNIQUEID}, JOB FINISHED" >> $PROGRESS_LOG
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment