workflow_sketch.sh 3.34 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash

##############################
# Configurations             #
##############################
# Put aliBuild in the PATH env var
export PATH="/mnt/SSD/schnorr/python/bin:$PATH"
# Directory where runAnalysis.C is placed
export ALIROOT_SCRIPT_DIR=$(pwd)/aliRoot/
# Directory where blender scripts are
export BLENDER_SCRIPT_DIR=$(pwd)/animate/
# Directory where output animations should be placed
export BLENDER_OUTPUT=$(pwd)/output/
# alienv working directory
export ALIENV_WORK_DIR=/mnt/SSD/schnorr/ALICE/sw/
export ALIENV_ID=AliPhysics/latest-aliroot5-user
# Put blender 2.79b in the PATH env var
export PATH="/home/schnorr/install/blender-2.79-linux-glibc219-x86_64/:$PATH"

##############################
# Usage                      #
##############################
function usage()
{
25
    echo "$0 <URL> <DOWNLOAD> [DEFAULT_ANIMATION]";
26
27
    echo "  where <URL> is a URL to uniquely identify a dataset";
    echo "  where <DOWNLOAD> is true or false, indicate whether the dataset should be downloaded";
28
29
    echo "  where <DEFAULT_ANIMATION> is true or false, indicate whether the default animation should be generated";
    echo "  leaving <DEFAULT_ANIMATION> blank will generate custom animation from data file";
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
}

##############################
# Parse Parameters           #
##############################
URL=$1
if [ -z $URL ]; then
    echo "Error. Must pass the dataset URL."
    usage
    exit
fi

DOWNLOAD=$2
if [ -z $DOWNLOAD ]; then
    echo "Error. Must explicitely inform whether to download the dataset or not."
    usage
    exit
fi

49
50
51
52
53
54
55
56
57
58
59
60
61
62
DEFAULT_ANIMATION=$3
if [ "$DEFAULT_ANIMATION" = "true" ]; then
    echo "Preparing default animation."
    ##############################
    # Phase 1: blender animate   #
    ##############################
    pushd ${BLENDER_SCRIPT_DIR}
    blender -noaudio --background -P animate_particles.py -- -radius=0.05 -duration=2 -camera="BarrelCamera" -datafile="d-esd-detail.dat" -simulated_t=0.02 -fps=5 -resolution=100 -stamp_note="Texto no canto"
    popd
    mkdir --verbose -p ${BLENDER_OUTPUT}
    mv --verbose /tmp/blender ${BLENDER_OUTPUT}
    echo "Done."
fi

63
64
65
66
67
68
69
70
##############################
# Download Dataset           #
##############################
if [ "$DOWNLOAD" = "true" ]; then
    echo "Downloading data."
    wget $URL
fi

71
72
73
74
if [ -z $DEFAULT_ANIMATION ]; then
  # Verify if AliESDs.root is here
  # #ALIESD_ROOT_FILE=$(pwd)/AliESDs.root
  mv --verbose $(pwd)/AliESDs.root ${ALIROOT_SCRIPT_DIR}
75

76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
  ##############################
  # Phase 1: aliroot extract   #
  ##############################
  eval $(alienv -w /home/tropos/alice/sw -a ubuntu1804_x86-64 load ${ALIENV_ID}) #-w ${ALIENV_WORK_DIR} -a ubuntu1604_x86-64 load ${ALIENV_ID})
  pushd ${ALIROOT_SCRIPT_DIR}
  # #rm --verbose AliESDs.root
  # #ln --verbose -s $ALIESD_ROOT_FILE AliESDs.root
  aliroot -q -b "runAnalysis.C(2)"
  ls -lh esd-detail.dat
  #done
  popd

  ##############################
  # Phase 2: blender animate   #
  ##############################
  mv --verbose ${ALIROOT_SCRIPT_DIR}/esd-detail.dat ${BLENDER_SCRIPT_DIR}
  pushd ${BLENDER_SCRIPT_DIR}
  blender -noaudio --background -P animate_particles.py -- -radius=0.05 -duration=2 -camera="BarrelCamera" -datafile="esd-detail.dat" -simulated_t=0.02 -fps=5 -resolution=100 -stamp_note="Texto no canto"
  popd
  mkdir --verbose -p ${BLENDER_OUTPUT}
  mv --verbose /tmp/blender ${BLENDER_OUTPUT}
  echo "Done."
fi