]>
Commit | Line | Data |
---|---|---|
f8b7a926 | 1 | #!/bin/bash |
2 | ||
3 | # set job and simulation variables as : | |
4 | # ./Run.sh --run <x> | |
5 | ||
6 | # | |
7 | # Function to run a command and check return code | |
8 | function runcommand() | |
9 | { | |
10 | echo -e "\n" | |
11 | echo -e "\n" >&2 | |
12 | ||
13 | local type=$1 | |
14 | local scr=$2 | |
15 | local log=$3 | |
16 | ||
17 | echo "* $type : $scr" | |
18 | echo "* $type : $scr" >&2 | |
ee275c29 | 19 | date |
20 | echo "Starting ${type} ${scr}" >> $log | |
21 | date >> $log | |
22 | ||
f8b7a926 | 23 | time aliroot -b -q -x $scr 2> /dev/stdout | tee -a $log |
24 | local ext=$? | |
25 | local exp=${5-0} | |
26 | ||
27 | if test -f syswatch.log ; then | |
28 | mv syswatch.log `basename $log .log`watch.log | |
29 | fi | |
30 | ||
31 | if [ "$ext" -ne "$exp" ]; then | |
32 | echo "*! $scr failed with exitcode $ext, expecting $exp" | |
33 | echo "*! $scr failed with exitcode $ext, expecting $exp" >&2 | |
34 | echo "$scr failed with exitcode $ext, expecting $exp" \ | |
35 | > validation_error.message | |
36 | exit ${4-$ext} | |
37 | else | |
38 | echo "* $scr finished with the expected exit code ($exp), moving on" | |
39 | echo "* $scr finished with the expected exit code ($exp), moving on" >&2 | |
40 | fi | |
ee275c29 | 41 | |
42 | echo "End of ${type} ${scr}" >> $log | |
43 | date >> $log | |
44 | echo "Disk usage in kB per file:" >> $log | |
45 | du -sk * | sort -n -r >> $log | |
46 | echo "Total disk usage: " >> $log | |
47 | du -sh . >> $log | |
48 | ||
f8b7a926 | 49 | } |
50 | ||
51 | # | |
52 | # Function to clean up rec-points | |
53 | function cleanRecPoints() | |
54 | { | |
55 | local alsoITS=${1-1} | |
56 | if test $alsoITS -gt 0 ; then | |
57 | rm -f *.RecPoints.root | |
58 | return; | |
59 | fi | |
60 | for i in *.RecPoints.root ; do | |
61 | if test ! -f $i ; then continue ; fi | |
62 | case $i in | |
63 | ITS*) ;; | |
64 | *) rm -f $i ;; | |
65 | esac | |
66 | done | |
67 | } | |
68 | ||
69 | # Define the pt hard bin arrays | |
70 | pthardbin_loweredges=( 0 5 11 21 36 57 84 117 152 191 234 ) | |
71 | pthardbin_higheredges=( 5 11 21 36 57 84 117 152 191 234 -1) | |
72 | ||
73 | CONFIG_SEED="" | |
74 | CONFIG_RUN_TYPE="" | |
75 | CONFIG_BMIN="" | |
76 | CONFIG_BMAX="" | |
77 | CONFIG_QUENCHING="" | |
78 | DC_RUN="" | |
79 | DC_EVENT="1" | |
80 | number=0 | |
81 | runAODTrain=0 | |
82 | runQATrain=0 | |
ee275c29 | 83 | runCheck=0 |
f8b7a926 | 84 | |
85 | while test "x$1" != "x"; do | |
86 | option="$1" | |
87 | shift | |
88 | ||
89 | case $option in | |
90 | --run) DC_RUN="$1"; shift ;; | |
91 | --event) DC_EVENT="$1"; shift ;; | |
92 | --process) CONFIG_RUN_TYPE="$1"; shift ;; | |
93 | --field) : ; shift ;; # No-op | |
94 | --energy) : ; shift ;; # No-op | |
95 | --physicslist) : ; shift ;; # No-op | |
96 | --bmin) CONFIG_BMIN="$1"; shift ;; | |
97 | --bmax) CONFIG_BMAX="$1"; shift ;; | |
98 | --pthardbin) : ; shift ;; # No-op | |
99 | --quench) CONFIG_QUENCHING="$1"; shift ;; | |
100 | --sdd) : ;; # No-op | |
101 | --number) number="$1"; shift ;; | |
102 | --qa) runQATrain=1 ;; | |
103 | --aod) runAODTrain=1 ;; | |
ee275c29 | 104 | --check) runCheck=1 ;; |
105 | --no-aod) runAODTrain=0 ;; | |
106 | --no-qa) runQATrain=0 ;; | |
107 | --no-check) runCheck=0 ;; | |
f8b7a926 | 108 | *) echo "Unkown option: $option" >&2 |
109 | esac | |
110 | done | |
111 | ||
112 | CONFIG_SEED=$((ALIEN_PROC_ID%1000000000)) | |
113 | ||
114 | if [ "$CONFIG_SEED" -eq 0 ]; then | |
115 | CONFIG_SEED=$(((DC_RUN*100000+DC_EVENT)%1000000000)) | |
116 | echo "* MC Seed is $CONFIG_SEED (based on run / counter : $DC_RUN / $DC_EVENT)" | |
117 | else | |
118 | echo "* MC Seed is $CONFIG_SEED (based on AliEn job ID)" | |
119 | fi | |
120 | ||
121 | if [ "$CONFIG_SEED" -eq 0 ]; then | |
122 | echo "*! WARNING! Seeding variable for MC is 0 !" >&2 | |
123 | fi | |
124 | ||
125 | mkdir -p input | |
126 | test -f galice.root && mv galice.root ./input/galice.root | |
127 | test -f Kinematics && mv Kinematics.root ./input/Kinematics.root | |
128 | ls input | |
129 | ||
130 | export CONFIG_SEED \ | |
131 | CONFIG_RUN_TYPE \ | |
132 | CONFIG_BMIN \ | |
133 | CONFIG_BMAX \ | |
134 | CONFIG_QUENCHING \ | |
135 | DC_RUN \ | |
136 | DC_EVENT | |
137 | ||
138 | export ALIMDC_RAWDB1="./mdc1" | |
139 | export ALIMDC_RAWDB2="./mdc2" | |
140 | export ALIMDC_TAGDB="./mdc1/tag" | |
141 | export ALIMDC_RUNDB="./mdc1/meta" | |
142 | ||
143 | if [ -f "$G4INSTALL/bin/geant4.sh" ]; then | |
144 | echo "* Sourcing G4 environment from $G4INSTALL/bin/geant4.sh" | |
145 | source $G4INSTALL/bin/geant4.sh | |
146 | fi | |
147 | ||
148 | cat <<EOF | |
149 | ||
150 | SIMRUN: Setup | |
151 | Seed: $CONFIG_SEED | |
152 | Run: $DC_RUN | |
153 | Events: $DC_EVENT | |
154 | Event generator: $CONFIG_RUN_TYPE | |
155 | Serial #: $number | |
156 | Impact parameter: ${CONFIG_BMIN}-${CONFIG_BMAX} | |
157 | Quenching: $CONFIG_QUENCHING | |
158 | Run QA: $runQATrain | |
159 | Run AOD $runAODTrain | |
160 | ||
161 | Content of current directory: | |
162 | EOF | |
163 | ls -l | |
164 | ||
165 | echo "SIMRUN: Now read to process" | |
166 | ||
ee275c29 | 167 | # --- Run simulation (out: hits, digits, sdigits) -------------------- |
f8b7a926 | 168 | runcommand "SIMULATION" "Simulate.C($DC_EVENT,$DC_RUN)" sim.log 5 |
ee275c29 | 169 | rm -f *.Hits.root |
170 | ||
171 | # --- Run reconstruction (in: digits, sdigits, raw out: ESDs) -------- | |
f8b7a926 | 172 | runcommand "RECONSTRUCTION" "Reconstruct.C($DC_RUN)" rec.log 10 |
ee275c29 | 173 | rm -f *.Digits.root *.SDigits.root |
174 | cleanRecPoints 0 | |
175 | ||
176 | # --- Create tags (in: ESDs) ----------------------------------------- | |
f8b7a926 | 177 | runcommand "TAG" "Tag.C" tag.log 50 |
ee275c29 | 178 | |
179 | # --- Run the check -------------------------------------------------- | |
180 | if test $runCheck -gt 0 ; then | |
181 | runcommand "CHECK" "Check.C" check.log 60 | |
182 | fi | |
183 | ||
184 | # --- Possibly run QA analysis --------------------------------------- | |
f8b7a926 | 185 | if test $runQATrain -gt 0 ; then |
186 | runcommand "QA" "QA.C($DC_RUN)" qa.log 100 | |
187 | fi | |
ee275c29 | 188 | |
189 | # --- Possibly run AOD analysis -------------------------------------- | |
f8b7a926 | 190 | if test $runAODTrain -gt 0 ; then |
191 | runcommand "AOD" "AOD.C($DC_RUN)" aod.log 100 | |
192 | fi | |
193 | ||
f8b7a926 | 194 | |
195 | exit 0 | |
196 | # | |
197 | # EOF | |
198 | # | |
199 |