Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ALICE-open-data
ALICE Blender animation
Commits
a91c0886
Commit
a91c0886
authored
Jun 10, 2020
by
Breno Rilho Lemos
💬
Browse files
Create self-sufficient script with progress log for PCAD running (UFRGS)
parent
f248344d
Changes
3
Hide whitespace changes
Inline
Side-by-side
animate/animate_particles.py
View file @
a91c0886
...
@@ -3,8 +3,8 @@
...
@@ -3,8 +3,8 @@
#
#
# For console only rendering (example):
# For console only rendering (example):
# $ blender -noaudio --background -P animate_particles.py -- -radius=0.05 -duration=1 -cameras="BarrelCamera OverviewCamera" \
# $ blender -noaudio --background -P animate_particles.py -- -radius=0.05 -duration=1 -cameras="BarrelCamera OverviewCamera" \
# -datafile="esd-detail.dat" -n_event=0 -simulated_t=0.02 -fps=24 -resolution=100 -transparency=1.2 \
# -datafile="esd-detail.dat" -n_event=0 -simulated_t=0.02 -fps=24 -resolution=100 -transparency=1.2
-stamp_note="Texto no canto"
\
#
-stamp_note="Texto no canto"
-its=1 -tpc=0 -trd=1 -detailed_tpc=1 -emcal=0 -blendersave=0 -picpct=5 -tpc_blender_path="/home/files/blender"
# -its=1 -tpc=0 -trd=1 -detailed_tpc=1 -emcal=0 -blendersave=0 -picpct=5 -tpc_blender_path="/home/files/blender"
-output_path="/tmp/blender"
#
#
import
os
import
os
...
@@ -46,6 +46,7 @@ parser.add_argument('-blendersave','--blendersave')
...
@@ -46,6 +46,7 @@ parser.add_argument('-blendersave','--blendersave')
parser
.
add_argument
(
'-picpct'
,
'--picpct'
)
parser
.
add_argument
(
'-picpct'
,
'--picpct'
)
parser
.
add_argument
(
'-tpc_blender_path'
,
'--tpc_blender_path'
)
parser
.
add_argument
(
'-tpc_blender_path'
,
'--tpc_blender_path'
)
parser
.
add_argument
(
'-detailed_tpc'
,
'--detailed_tpc'
)
parser
.
add_argument
(
'-detailed_tpc'
,
'--detailed_tpc'
)
parser
.
add_argument
(
'-output_path'
,
'--output_path'
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
bpy
.
context
.
user_preferences
.
view
.
show_splash
=
False
bpy
.
context
.
user_preferences
.
view
.
show_splash
=
False
...
@@ -85,11 +86,11 @@ for i in range(j,len(cams_string)):
...
@@ -85,11 +86,11 @@ for i in range(j,len(cams_string)):
cam
+=
cams_string
[
i
]
cam
+=
cams_string
[
i
]
cams_list
.
append
(
cam
)
cams_list
.
append
(
cam
)
#
c
onfigure
o
utput
#
C
onfigure
O
utput
outputPath
=
"/tmp/alice_blender
/"
outputPath
=
str
(
args
.
output_path
)
+
"
/"
fileIdentifier
=
"PhysicalTrajectories_"
fileIdentifier
=
"PhysicalTrajectories_"
renderAnimation
=
Tru
e
# True
renderAnimation
=
Fals
e
# True
saveBlenderFile
=
blendersave
# False
saveBlenderFile
=
blendersave
# False
"""
"""
...
...
animate/render.py
0 → 100644
View file @
a91c0886
# -*- coding: utf-8 -*-
# animate_particles.py - Animate HEP events
#
# For console only rendering (example):
# $ blender -noaudio --background -P animate_particles.py -- -cam "OverviewCamera" -datafile "Run139038_Orbit7548473_BunchCross1534_2.dat" \
# -n_event 2 -pic_pct 30 -output_path "/home"
#
import
bpy
import
argparse
import
sys
# Pass on command line arguments to script:
class
ArgumentParserForBlender
(
argparse
.
ArgumentParser
):
def
_get_argv_after_doubledash
(
self
):
try
:
idx
=
sys
.
argv
.
index
(
"--"
)
return
sys
.
argv
[
idx
+
1
:]
# the list after '--'
except
ValueError
as
e
:
# '--' not in the list:
return
[]
# overrides superclass
def
parse_args
(
self
):
return
super
().
parse_args
(
args
=
self
.
_get_argv_after_doubledash
())
parser
=
ArgumentParserForBlender
()
parser
.
add_argument
(
'-cam'
,
'--render_cam'
)
parser
.
add_argument
(
'-datafile'
,
'--datafile'
)
parser
.
add_argument
(
'-n_event'
,
'--n_event'
)
parser
.
add_argument
(
'-pic_pct'
,
'--pic_pct'
)
parser
.
add_argument
(
'-output_path'
,
'--output_path'
)
args
=
parser
.
parse_args
()
render_cam
=
str
(
args
.
render_cam
)
datafile
=
str
(
args
.
datafile
)
n_event
=
str
(
args
.
n_event
)
pic_pct
=
int
(
args
.
pic_pct
)
outputPath
=
str
(
args
.
output_path
)
+
"/"
fileIdentifier
=
"PhysicalTrajectories_"
bpy
.
ops
.
wm
.
open_mainfile
(
filepath
=
outputPath
+
fileIdentifier
+
"AlirootFileGenerator_"
+
datafile
+
"_Event_"
+
n_event
+
".blend"
)
bcs
=
bpy
.
context
.
scene
# Set specific output info
output_prefix
=
"PhysicalTrajectories_1920px_AlirootFileGenerator_"
+
datafile
+
"_Event_"
+
n_event
+
"_"
+
render_cam
bcs
.
render
.
filepath
=
outputPath
+
output_prefix
bcs
.
camera
=
bpy
.
data
.
objects
[
render_cam
]
# Take picture of animation
bcs
.
frame_current
=
int
(
bcs
.
frame_end
*
pic_pct
/
100
)
bpy
.
ops
.
render
.
render
()
bpy
.
data
.
images
[
'Render Result'
].
save_render
(
filepath
=
bcs
.
render
.
filepath
+
".png"
)
# Render actual animation
bpy
.
ops
.
render
.
render
(
animation
=
True
)
workflow_sketch.sh
View file @
a91c0886
...
@@ -16,6 +16,9 @@ export ALIENV_ID=AliPhysics/latest-aliroot5-user
...
@@ -16,6 +16,9 @@ export ALIENV_ID=AliPhysics/latest-aliroot5-user
# Put Blender 2.79b in the PATH env var
# Put Blender 2.79b in the PATH env var
export
PATH
=
"/home/schnorr/install/blender-2.79-linux-glibc219-x86_64/:
$PATH
"
export
PATH
=
"/home/schnorr/install/blender-2.79-linux-glibc219-x86_64/:
$PATH
"
# Progress log file
export
PROGRESS_LOG
=
$(
pwd
)
/progress.log
##############################
##############################
# Command-line options #
# Command-line options #
##############################
##############################
...
@@ -74,7 +77,7 @@ TPC=1
...
@@ -74,7 +77,7 @@ TPC=1
DETAILED_TPC
=
0
DETAILED_TPC
=
0
TRD
=
1
TRD
=
1
EMCAL
=
1
EMCAL
=
1
BLENDERSAVE
=
0
BLENDERSAVE
=
1
PICPCT
=
80
PICPCT
=
80
# now enjoy the options in order and nicely split until we see --
# now enjoy the options in order and nicely split until we see --
while
true
;
do
while
true
;
do
...
@@ -312,6 +315,11 @@ else
...
@@ -312,6 +315,11 @@ else
fi
fi
# Get number of frames
FPS_DUR
=
"
$FPS
$DURATION
"
FPS_DUR
=
$(
echo
$FPS_DUR
|
awk
'{print $1*$2}'
)
# handle non-option arguments
# handle non-option arguments
if
[[
$#
-ne
0
]]
;
then
if
[[
$#
-ne
0
]]
;
then
echo
"
$0
: non-option arguments (
$#,
$*
) are ignored."
echo
"
$0
: non-option arguments (
$#,
$*
) are ignored."
...
@@ -319,6 +327,7 @@ if [[ $# -ne 0 ]]; then
...
@@ -319,6 +327,7 @@ if [[ $# -ne 0 ]]; then
exit
exit
fi
fi
##############################
##############################
# Download Dataset #
# Download Dataset #
##############################
##############################
...
@@ -328,8 +337,12 @@ if [ "$DOWNLOAD" = "true" ]; then
...
@@ -328,8 +337,12 @@ if [ "$DOWNLOAD" = "true" ]; then
usage
usage
exit
exit
fi
fi
echo
"Downloading data."
wget
$URL
if
!
grep
-q
"DOWNLOAD NOT DONE"
$PROGRESS_LOG
;
then
echo
"Downloading data."
wget
$URL
echo
"ESD DOWNLOAD DONE"
>>
$PROGRESS_LOG
fi
######################################
######################################
# Established Unique ID based on URL #
# Established Unique ID based on URL #
...
@@ -351,20 +364,21 @@ if [ "$SAMPLE" = "true" ]; then
...
@@ -351,20 +364,21 @@ if [ "$SAMPLE" = "true" ]; then
##############################
##############################
# Phase 1: Blender animate #
# Phase 1: Blender animate #
##############################
##############################
BLENDER_OUTPUT
=
$(
pwd
)
/sample
mkdir
--verbose
-p
${
BLENDER_OUTPUT
}
pushd
${
BLENDER_SCRIPT_DIR
}
pushd
${
BLENDER_SCRIPT_DIR
}
echo
"Preparing sample animation in Blender"
echo
"Preparing sample animation in Blender"
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
=
"d-esd-detail.dat"
-simulated_t
=
0.03
\
-duration
=
${
DURATION
}
-cameras
=
"
${
CAMERAS
}
"
-datafile
=
"d-esd-detail.dat"
-simulated_t
=
0.03
\
-fps
=
${
FPS
}
-resolution
=
${
RESOLUTION
}
-transparency
=
${
TRANSPARENCY
}
-stamp_note
=
\
-fps
=
${
FPS
}
-resolution
=
${
RESOLUTION
}
-transparency
=
${
TRANSPARENCY
}
\
"opendata.cern.ch_record_1102_alice_2010_LHC10h_000139038_ESD_0001_2"
-its
=
${
ITS
}
\
-stamp_note
=
"opendata.cern.ch_record_1102_alice_2010_LHC10h_000139038_ESD_0001_2"
-its
=
${
ITS
}
\
-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
}
"
popd
popd
BLENDER_OUTPUT
=
.
mkdir
--verbose
-p
${
BLENDER_OUTPUT
}
mv
--verbose
/tmp/alice_blender
${
BLENDER_OUTPUT
}
echo
"Done."
echo
"Done."
##############################
##############################
...
@@ -372,96 +386,158 @@ if [ "$SAMPLE" = "true" ]; then
...
@@ -372,96 +386,158 @@ if [ "$SAMPLE" = "true" ]; then
##############################
##############################
elif
[
"
$SAMPLE
"
=
"false"
]
;
then
elif
[
"
$SAMPLE
"
=
"false"
]
;
then
# Verify if AliESDs.root is here
if
!
grep
-q
"DATA ANALYSIS for"
$PROGRESS_LOG
;
then
ALIESD_ROOT_FILE
=
$(
pwd
)
/AliESDs.root
if
!
[[
-f
"
$ALIESD_ROOT_FILE
"
]]
# Verify if AliESDs.root is here
then
ALIESD_ROOT_FILE
=
$(
pwd
)
/AliESDs.root
echo
"AliESDs.root not found."
if
!
[[
-f
"
$ALIESD_ROOT_FILE
"
]]
exit
then
echo
"AliESDs.root not found."
exit
fi
############################
# Phase 1: aliroot extract #
############################
eval
$(
alienv
-w
${
ALIENV_WORK_DIR
}
-a
${
ALIENV_OS_SPEC
}
load
${
ALIENV_ID
}
)
pushd
${
ALIROOT_SCRIPT_DIR
}
# Remove existing symbolic link
rm
-f
--verbose
AliESDs.root
# Create a symbolic link to the actual AliESDs.root
ln
--verbose
-s
${
ALIESD_ROOT_FILE
}
AliESDs.root
# Run the extraction tool
aliroot runAnalysis.C
if
[
"
$DOWNLOAD
"
=
"false"
]
;
then
UNIQUEID
=
$(
more uniqueid.txt
)
echo
"The unique ID is
$UNIQUEID
."
fi
popd
echo
"DATA ANALYSIS for
${
UNIQUEID
}
FINISHED"
>>
$PROGRESS_LOG
else
if
[
"
$DOWNLOAD
"
=
"false"
]
;
then
pushd
${
ALIROOT_SCRIPT_DIR
}
UNIQUEID
=
$(
more uniqueid.txt
)
echo
"The unique ID is
$UNIQUEID
."
popd
fi
fi
fi
############################
if
!
grep
-q
"ANIMATION DIRECTORY"
$PROGRESS_LOG
;
then
# Phase 1: aliroot extract #
############################
# Create directory where animations will be saved
eval
$(
alienv
-w
${
ALIENV_WORK_DIR
}
-a
${
ALIENV_OS_SPEC
}
load
${
ALIENV_ID
}
)
BLENDER_OUTPUT
=
$(
pwd
)
/
$UNIQUEID
pushd
${
ALIROOT_SCRIPT_DIR
}
mkdir
--verbose
-p
${
BLENDER_OUTPUT
}
# Remove existing symbolic link
rm
-f
--verbose
AliESDs.root
# Create a symbolic link to the actual AliESDs.root
ln
--verbose
-s
${
ALIESD_ROOT_FILE
}
AliESDs.root
# Run the extraction tool
aliroot runAnalysis.C
if
[
"
$DOWNLOAD
"
=
"false"
]
;
then
UNIQUEID
=
$(
more uniqueid.txt
)
echo
"The unique ID is
$UNIQUEID
."
rm
uniqueid.txt
echo
"ANIMATION DIRECTORY
${
UNIQUEID
}
CREATED"
>>
$PROGRESS_LOG
else
BLENDER_OUTPUT
=
$(
pwd
)
/
$UNIQUEID
fi
fi
# Create directory where animations will be saved
popd
BLENDER_OUTPUT
=
$(
pwd
)
/
$UNIQUEID
mkdir
--verbose
-p
${
BLENDER_OUTPUT
}
pushd
${
ALIROOT_SCRIPT_DIR
}
# push back to aliroot directory
pushd
${
ALIROOT_SCRIPT_DIR
}
# push back to aliroot directory
#################################################
if
!
grep
-q
"MOVED to animation directory"
$PROGRESS_LOG
;
then
# Phase 1: iteration for every event identifier #
#################################################
#################################################
# Phase 1: iteration for every event identifier #
#################################################
# Event counter for animating no more events than the informed amount
EVENT_COUNTER
=
0
# Get all extracted files
EXTRACTED_FILES
=
$(
ls
-1
esd_detail-event_
*
.dat |
sort
--version-sort
)
for
FILE_WITH_DATA
in
$EXTRACTED_FILES
;
do
EVENT_ID
=
$(
echo
$FILE_WITH_DATA
|
\
sed
-e
"s#esd_detail-event_##"
\
-e
"s#
\.
dat##"
)
EVENT_UNIQUE_ID
=
${
UNIQUEID
}
_
${
EVENT_ID
}
if
!
[[
-s
$FILE_WITH_DATA
]]
;
then
echo
"File
$FILE_WITH_DATA
has zero size. Ignore and continue."
rm
$FILE_WITH_DATA
continue
fi
##############################
# Get all extracted files
# Phase 2: blender animate #
EXTRACTED_FILES
=
$(
ls
-1
esd_detail-event_
*
.dat |
sort
--version-sort
)
##############################
LOCAL_FILE_WITH_DATA
=
${
EVENT_UNIQUE_ID
}
.dat
for
FILE_WITH_DATA
in
$EXTRACTED_FILES
;
do
cp
${
ALIROOT_SCRIPT_DIR
}
/
$FILE_WITH_DATA
\
${
BLENDER_SCRIPT_DIR
}
/
${
LOCAL_FILE_WITH_DATA
}
rm
$FILE_WITH_DATA
if
!
[[
-s
$FILE_WITH_DATA
]]
;
then
echo
"File
$FILE_WITH_DATA
has zero size. Ignore and continue."
rm
$FILE_WITH_DATA
continue
fi
NUMBER_OF_PARTICLES
=
$(
wc
-l
${
BLENDER
_SCRIPT_DIR
}
/
$
LOCAL_
FILE_WITH_DATA
|
\
mv
${
ALIROOT
_SCRIPT_DIR
}
/
$FILE_WITH_DATA
\
awk
'{ print $1 }'
)
${
BLENDER_SCRIPT_DIR
}
AVERAGE_PZ
=
$(
awk
'BEGIN {pzsum=0;n=0} {pzsum+=$8;n++} END {print sqrt(pzsum*pzsum/n/n)}'
\
done
${
BLENDER_SCRIPT_DIR
}
/
${
LOCAL_FILE_WITH_DATA
}
)
AVERAGE_PT
=
$(
awk
'BEGIN {ptsum=0;n=0} {ptsum+=$9;n++} END {print ptsum/n}'
\
echo
"DATA ANALYSIS FILES of
${
UNIQUEID
}
MOVED to animation directory"
>>
$PROGRESS_LOG
${
BLENDER_SCRIPT_DIR
}
/
${
LOCAL_FILE_WITH_DATA
}
)
echo
"File
$LOCAL_FILE_WITH_DATA
has
$NUMBER_OF_PARTICLES
particles."
fi
echo
"Average Z momentum:
$AVERAGE_PZ
"
echo
"Average transversal momentum
$AVERAGE_PT
"
if
((
$(
echo
"
$AVERAGE_PT
>=
$MIN_AVG_PT
"
|bc
-l
)
))
;
then
popd
if
((
$(
echo
"
$AVERAGE_PZ
>=
$MIN_AVG_PZ
"
|bc
-l
)
))
;
then
pushd
${
BLENDER_SCRIPT_DIR
}
if
[[
$NUMBER_OF_PARTICLES
-le
$MAX_PARTICLES
&&
$NUMBER_OF_PARTICLES
\
-ge
$MIN_PARTICLES
&&
$EVENT_COUNTER
-lt
$N_OF_EVENTS
]]
;
then
# Increment event counter
if
!
grep
-q
"CREATED EVENT COUNTER FILE"
$PROGRESS_LOG
;
then
EVENT_COUNTER
=
$EVENT_COUNTER
+1
echo
"Processing
${
EVENT_UNIQUE_ID
}
(
$NUMBER_OF_PARTICLES
tracks) in Blender"
# Event counter for animating no more events than the informed amount
EVENT_COUNTER
=
0
echo
"
$EVENT_COUNTER
"
>
event_counter.txt
echo
"CREATED EVENT COUNTER FILE"
>>
$PROGRESS_LOG
fi
if
!
grep
-q
"DATA FILES RENAMED according to UNIQUEID"
$PROGRESS_LOG
;
then
EXTRACTED_FILES
=
$(
ls
-1
esd_detail-event_
*
.dat |
sort
--version-sort
)
for
FILE_WITH_DATA
in
$EXTRACTED_FILES
;
do
EVENT_ID
=
$(
echo
$FILE_WITH_DATA
|
\
sed
-e
"s#esd_detail-event_##"
\
-e
"s#
\.
dat##"
)
EVENT_UNIQUE_ID
=
${
UNIQUEID
}
_
${
EVENT_ID
}
LOCAL_FILE_WITH_DATA
=
${
EVENT_UNIQUE_ID
}
.dat
mv
$FILE_WITH_DATA
$LOCAL_FILE_WITH_DATA
done
pushd
${
BLENDER_SCRIPT_DIR
}
echo
"DATA FILES RENAMED according to UNIQUEID
${
UNIQUEID
}
"
>>
$PROGRESS_LOG
fi
EXTRACTED_FILES
=
$(
ls
-1
${
UNIQUEID
}
_
*
.dat |
sort
--version-sort
)
for
LOCAL_FILE_WITH_DATA
in
$EXTRACTED_FILES
;
do
pushd
${
BLENDER_SCRIPT_DIR
}
EVENT_ID
=
$(
echo
$LOCAL_FILE_WITH_DATA
|
\
sed
-e
"s#
${
UNIQUEID
}
_##"
\
-e
"s#
\.
dat##"
)
EVENT_UNIQUE_ID
=
${
UNIQUEID
}
_
${
EVENT_ID
}
##############################
# Phase 2: blender animate #
##############################
NUMBER_OF_PARTICLES
=
$(
wc
-l
$LOCAL_FILE_WITH_DATA
|
\
awk
'{ print $1 }'
)
AVERAGE_PZ
=
$(
awk
'BEGIN {pzsum=0;n=0} {pzsum+=$8;n++} END {print sqrt(pzsum*pzsum/n/n)}'
\
${
LOCAL_FILE_WITH_DATA
}
)
AVERAGE_PT
=
$(
awk
'BEGIN {ptsum=0;n=0} {ptsum+=$9;n++} END {print ptsum/n}'
\
${
LOCAL_FILE_WITH_DATA
}
)
echo
"File
$LOCAL_FILE_WITH_DATA
has
$NUMBER_OF_PARTICLES
particles."
echo
"Average Z momentum:
$AVERAGE_PZ
"
echo
"Average transversal momentum
$AVERAGE_PT
"
EVENT_COUNTER
=
$(
more event_counter.txt
)
if
((
$(
echo
"
$AVERAGE_PT
>=
$MIN_AVG_PT
"
|bc
-l
)
))
;
then
if
((
$(
echo
"
$AVERAGE_PZ
>=
$MIN_AVG_PZ
"
|bc
-l
)
))
;
then
if
[[
$NUMBER_OF_PARTICLES
-le
$MAX_PARTICLES
&&
$NUMBER_OF_PARTICLES
\
-ge
$MIN_PARTICLES
&&
$EVENT_COUNTER
-lt
$N_OF_EVENTS
]]
;
then
if
!
grep
-q
"Scene from
${
EVENT_UNIQUE_ID
}
READY."
$PROGRESS_LOG
;
then
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"
...
@@ -470,75 +546,89 @@ elif [ "$SAMPLE" = "false" ]; then
...
@@ -470,75 +546,89 @@ elif [ "$SAMPLE" = "false" ]; then
-n_event
=
${
EVENT_ID
}
-simulated_t
=
0.03
-fps
=
${
FPS
}
-resolution
=
${
RESOLUTION
}
\
-n_event
=
${
EVENT_ID
}
-simulated_t
=
0.03
-fps
=
${
FPS
}
-resolution
=
${
RESOLUTION
}
\
-transparency
=
${
TRANSPARENCY
}
-stamp_note
=
"
${
EVENT_UNIQUE_ID
}
"
-its
=
${
ITS
}
\
-transparency
=
${
TRANSPARENCY
}
-stamp_note
=
"
${
EVENT_UNIQUE_ID
}
"
-its
=
${
ITS
}
\
-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
}
\
echo
"Event
${
EVENT_UNIQUE_ID
}
done."
-output_path
=
"
${
BLENDER_OUTPUT
}
"
echo
"Scene from
${
EVENT_UNIQUE_ID
}
READY."
>>
$PROGRESS_LOG
fi
if
[
"
$MOSAIC
"
=
"true"
]
;
then
popd
for
type
in
$CAMERAS
;
do
pushd
/tmp/alice_blender
# Move animation images to final location
if
!
grep
-q
"
${
type
}
for
$EVENT_UNIQUE_ID
FINISHED"
$PROGRESS_LOG
;
then
mv
/tmp/alice_blender/
*
.png
${
BLENDER_OUTPUT
}
blender
-noaudio
--background
-P
render.py
--
-cam
${
type
}
-datafile
\
"
${
LOCAL_FILE_WITH_DATA
}
"
-n_event
${
EVENT_ID
}
-pic_pct
${
PICPCT
}
-output_path
"
${
BLENDER_OUTPUT
}
"
echo
"
${
type
}
for
$EVENT_UNIQUE_ID
FINISHED"
>>
$PROGRESS_LOG
fi
done
if
[
"
$MOSAIC
"
=
"true"
]
;
then
if
!
grep
-q
"MOSAIC for
$EVENT_UNIQUE_ID
FINISHED"
$PROGRESS_LOG
;
then
pushd
${
BLENDER_OUTPUT
}
# Setting input names for clips in order to make mosaic clip
# Setting input names for clips in order to make mosaic clip
INPUT_ONE
=
$(
ls
|
awk
'NR==1'
)
INPUT_ONE
=
$(
ls
*
$EVENT_UNIQUE_ID
*${
FPS_DUR
}
.mp4
|
awk
'NR==1'
)
INPUT_TWO
=
$(
ls
|
awk
'NR==2'
)
INPUT_TWO
=
$(
ls
*
$EVENT_UNIQUE_ID
*${
FPS_DUR
}
.mp4
|
awk
'NR==2'
)
INPUT_THREE
=
$(
ls
|
awk
'NR==3'
)
INPUT_THREE
=
$(
ls
*
$EVENT_UNIQUE_ID
*${
FPS_DUR
}
.mp4
|
awk
'NR==3'
)
INPUT_FOUR
=
$(
ls
|
awk
'NR==4'
)
INPUT_FOUR
=
$(
ls
*
$EVENT_UNIQUE_ID
*${
FPS_DUR
}
.mp4
|
awk
'NR==4'
)
ffmpeg
-i
${
INPUT_FOUR
}
-i
${
INPUT_TWO
}
-i
${
INPUT_THREE
}
-i
${
INPUT_ONE
}
-filter_complex
\
ffmpeg
-i
${
INPUT_FOUR
}
-i
${
INPUT_TWO
}
-i
${
INPUT_THREE
}
-i
${
INPUT_ONE
}
-filter_complex
\
"[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
popd
echo
"MOSAIC for
$EVENT_UNIQUE_ID
FINISHED"
>>
$PROGRESS_LOG
pushd
${
BLENDER_SCRIPT_DIR
}
popd
fi
fi
# Move generated clips to final location
fi
mv
/tmp/alice_blender/
*
${
BLENDER_OUTPUT
}
if
!
grep
-q
"TEXT DATA of
$EVENT_UNIQUE_ID
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
echo
"TEXT DATA of
$EVENT_UNIQUE_ID
MOVED to final location"
>>
$PROGRESS_LOG
fi
popd
echo
"EVENT
${
EVENT_UNIQUE_ID
}
DONE with FILE
$LOCAL_FILE_WITH_DATA
."
echo
"EVENT
${
EVENT_UNIQUE_ID
}
DONE with FILE
$LOCAL_FILE_WITH_DATA
."
else
if
[[
$NUMBER_OF_PARTICLES
-lt
$MIN_PARTICLES
]]
;
then
# Increment event counter
echo
"Too little particles (minimum accepted is
$MIN_PARTICLES
). Continue."
EVENT_COUNTER
=
$EVENT_COUNTER
+1
elif
[[
$NUMBER_OF_PARTICLES
-gt
$MAX_PARTICLES
]]
;
then
rm
event_counter.txt
echo
"Too many particles (maximum accepted is
$MAX_PARTICLES
). Continue."
echo
"
$EVENT_COUNTER
"
>
event_counter.txt
elif
[[
$EVENT_COUNTER
-ge
$N_OF_EVENTS
]]
;
then
echo
"Numbers of events set to be animated has already been reached. Continue."
fi
# Remove non-processed files
else
pushd
${
BLENDER_SCRIPT_DIR
}
rm
$LOCAL_FILE_WITH_DATA
popd
continue
if
[[
$NUMBER_OF_PARTICLES
-lt
$MIN_PARTICLES
]]
;
then
echo
"Too little particles (minimum accepted is
$MIN_PARTICLES
). Continue."
elif
[[
$NUMBER_OF_PARTICLES
-gt
$MAX_PARTICLES
]]
;
then
echo
"Too many particles (maximum accepted is
$MAX_PARTICLES
). Continue."
elif
[[
$EVENT_COUNTER
-ge
$N_OF_EVENTS
]]
;
then
echo
"Numbers of events set to be animated has already been reached. Continue."
fi
fi
else
echo
"Average Z Momentum too low (minimum accepted is
$MIN_AVG_PZ
). Continue."
# Remove non-processed files
# Remove non-processed files
pushd
${
BLENDER_SCRIPT_DIR
}
rm
$LOCAL_FILE_WITH_DATA
rm
$LOCAL_FILE_WITH_DATA
popd
fi
fi
else
else
echo
"Average
Transversal
Momentum too low (minimum accepted is
$MIN_AVG_P
T
). Continue."
echo
"Average
Z
Momentum too low (minimum accepted is
$MIN_AVG_P
Z
). Continue."
# Remove non-processed files
# Remove non-processed files
pushd
${
BLENDER_SCRIPT_DIR
}
rm
$LOCAL_FILE_WITH_DATA
rm
$LOCAL_FILE_WITH_DATA
popd
fi
fi
else
echo
"Average Transversal Momentum too low (minimum accepted is
$MIN_AVG_PT
). Continue."
# Remove non-processed files
rm
$LOCAL_FILE_WITH_DATA
fi
popd
done
done
popd
fi
fi
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment