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