-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgeneratetraintest
executable file
·116 lines (106 loc) · 3.02 KB
/
generatetraintest
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#! /bin/bash
readlinkresult=
function FindFiles
{
fls=(MLTrainDefinition.cfg env.sh generator_customization.C globalvariables.C handlers.C)
hasfound=0
for f in ${fls[@]}; do
if [ -f `pwd`/$f ]; then
let "hasfound++"
fi
done
if [ $hasfound -eq ${#fls[@]} ]; then
return 1
else
return 0
fi
}
function CheckAliRoot
{
# ERRORCODES:
# 100 - no ROOT defined
# 101 - ROOT executable not Found
# 200 - ALICE_ROOT not defined
# 201 - no ARVersion.h in ALICE_ROOT/include
# 300 - ALICE_PHYSICS not defined
# 301 - no APVersion.h in ALICE_PHYSICS/include
lenROOT=$(echo $ROOTSYS | awk '{print length($1);}')
lenALIROOT=$(echo $ALICE_ROOT | awk '{print length($1);}')
lenALIPHYSICS=$(echo $ALICE_PHYSICS | awk '{print length($1);}')
if [ $lenROOT -eq 0 ]; then return 100; fi
if [ ! -f $ROOTSYS/bin/root ]; then return 101; fi
if [ $lenALIROOT -eq 0 ]; then return 200; fi
if [ ! -f $ALICE_ROOT/include/ARVersion.h ]; then return 201; fi
if [ $lenALIPHYSICS -eq 0 ]; then return 300; fi
if [ ! -f $ALICE_PHYSICS/include/APVersion.h ]; then return 301; fi
return 0
}
function HandleAlirootError
{
case $1 in
100) echo "ROOTSYS undefined"
;;
101) echo "ROOTSYS not pointing to a valid ROOT installation"
;;
200) echo "ALICE_ROOT not defined"
;;
201) echo "ALICE_ROOT not pointing to a valid AliRoot installation"
;;
301) echo "ALICE_PHYSICS not defined"
;;
302) echo "ALICE_PHYSICS not pointing to a valid AliPhysics installation"
;;
esac
}
function SafeReadlink
{
local decodepath=$1
local result=
if [ "x$(uname -a | grep Darwin)" != "x" ]; then
# MacOS, needs greadlink from homebrew
result=$(greadlink -f $decodepath)
else
result=$(readlink -f $decodepath)
fi
readlinkresult=$result
}
SafeReadlink $0
SOURCEBASE=$readlinkresult
MACRODIR=`dirname $SOURCEBASE`/legotrain_helper_macros
CheckAliRoot
result=$?
if [ $result -ne 0 ]; then
HandleAlirootError $result
exit 1
fi
FindFiles
result=$?
if [ $result -ne 1 ]; then
echo "Not all files needed for the test found. Please download them first"
exit 2
fi
source env.sh
generatescript=
if [ "x$CHILD_DATASETS" != "x" ]; then
if [ $CHILD_DATASETS -gt 1 ]; then
generatescript=$MACRODIR/legotrain_generate_meta.C
echo "Generating for meta dataset"
elif [ "x$GEN_MACRO_PATH" != "x" ]; then
generatescript=$MACRODIR/legotrain_generate_meta.C
echo "Generating for MCgen dataset (meta macro)"
else
generatescript=$MACRODIR/legotrain_generate_single.C
echo "Generating for single dataset"
fi
else
# check for MC gen train
if [ "x$GEN_MACRO_PATH" != "x" ]; then
generatescript=$MACRODIR/legotrain_generate_meta.C
echo "Generating for MCgen dataset (meta macro)"
else
generatescript=$MACRODIR/legotrain_generate_single.C
echo "Generating for single dataset"
fi
fi
echo "Using generate script $generatescript"
root -b -q $generatescript