]>
Commit | Line | Data |
---|---|---|
a45764d9 | 1 | #!/bin/bash |
2 | ||
3 | # Script to run: | |
4 | # 1. reconstruction | |
1169eaef | 5 | # 2. calibration |
a45764d9 | 6 | # |
7 | # Files assumed to be in working directory: | |
054d9070 | 8 | # recCPass1.C - reconstruction macro |
a45764d9 | 9 | # runCalibTrain.C - calibration/filtering macro |
10 | # Arguments (run locally): | |
11 | # 1 - raw data file name | |
12 | # 2 - number of events to be processed | |
13 | # 3 - run number | |
e6844064 | 14 | |
a45764d9 | 15 | # example: |
e6844064 | 16 | # runCPass1.sh raw.root 50 104892 |
a45764d9 | 17 | |
18 | #ALIEN setting | |
19 | # $1 = raw input filename | |
25e2b4b3 | 20 | runNum=`echo $1 | cut -d "/" -f 6 | sed 's/^0*//'` |
e6844064 | 21 | |
22 | if [ $# -eq 1 ]; then | |
23 | # alien Setup | |
24 | nEvents=99999999 | |
25 | ocdbPath="raw://" | |
1169eaef | 26 | # use the value passed by LPM, or by default use the kCalibBarrel alias |
27 | triggerOptions=${ALIEN_JDL_TRIGGERALIAS-?Trigger=kCalibBarrel} | |
28 | #triggerOptions="?Trigger=kPhysicsAll" | |
e6844064 | 29 | fi |
30 | ||
31 | if [ $# -ge 4 ]; then | |
32 | # local setup | |
33 | nEvents=$2 | |
34 | runNum=$3 | |
35 | ocdbPath=$4 | |
36 | triggerOptions="?Trigger=kCalibBarrel" | |
a6168b42 | 37 | fi |
e6844064 | 38 | |
39 | if [ $# -eq 5 ]; then | |
40 | # local setup in case we specify the trigger mask | |
41 | triggerOptions=$5 | |
5cebce24 | 42 | fi |
43 | ||
44 | CHUNKNAME="$1" | |
45 | ||
46 | if [ "${CHUNKNAME:0:1}" = "/" ]; then | |
47 | FILENAME=${CHUNKNAME##*/} | |
48 | ||
49 | if [ -f "$FILENAME" ]; then | |
50 | # locally downloaded chunk | |
51 | CHUNKNAME="`pwd`/$FILENAME" | |
52 | else | |
53 | # one chunk from alien (nodownload option to the collection) | |
54 | CHUNKNAME="alien://$CHUNKNAME" | |
55 | fi | |
56 | fi | |
a6168b42 | 57 | |
5cebce24 | 58 | if [ -f "wn.xml" ]; then |
59 | # several chunks accessed remotely | |
60 | CHUNKNAME="collection://wn.xml" | |
a45764d9 | 61 | fi |
62 | ||
5cebce24 | 63 | echo "* ************************" |
64 | echo "* runCPass1.sh $*" | |
65 | echo "* Chunk name: $CHUNKNAME" | |
66 | echo "* Run number: $runNum" | |
e6844064 | 67 | echo "* nEvents: $nEvents" |
68 | echo "* runNum: $runNum" | |
69 | echo "* ocdbPath: $ocdbPath" | |
70 | echo "* triggerOptions: $triggerOptions" | |
5cebce24 | 71 | echo "* ************************" |
a45764d9 | 72 | |
e6844064 | 73 | mkdir Barrel OuterDet |
74 | ||
a45764d9 | 75 | if [ -f Run0_999999999_v3_s0.root ]; then |
5cebce24 | 76 | echo "* TPC correction file found" |
77 | ||
a45764d9 | 78 | mkdir -p TPC/Calib/Correction |
79 | mv Run0_999999999_v3_s0.root TPC/Calib/Correction/ | |
5cebce24 | 80 | |
e6844064 | 81 | for DIR in Barrel OuterDet; do |
82 | mkdir -p $DIR/TPC/Calib/Correction | |
83 | ln -s ../../../../TPC/Calib/Correction/Run0_999999999_v3_s0.root $DIR/TPC/Calib/Correction/Run0_999999999_v3_s0.root | |
84 | done | |
a45764d9 | 85 | fi |
86 | ||
5cebce24 | 87 | echo "* PATH: $PATH" |
88 | echo "* LD_LIBRARY_PATH: $LD_LIBRARY_PATH" | |
89 | echo | |
a45764d9 | 90 | |
5cebce24 | 91 | if [ "$2" == "OCDB" ]; then |
92 | export OCDB_SNAPSHOT_CREATE="kTRUE" | |
93 | export OCDB_SNAPSHOT_FILENAME="OCDB.root" | |
1169eaef | 94 | touch OCDB.generating.job |
a45764d9 | 95 | |
5cebce24 | 96 | echo "* Running AliRoot to generate the OCDB based on $CHUNKNAME" |
a45764d9 | 97 | |
5cebce24 | 98 | echo "OCDB/recCPass1.C" >&2 |
1169eaef | 99 | time aliroot -l -b -q -x recCPass1.C\(\"$CHUNKNAME\"\) &> rec.log |
5cebce24 | 100 | exitcode=$? |
101 | echo "Exit code: $exitcode" | |
1169eaef | 102 | |
103 | if [ $exitcode -ne 0 ]; then | |
104 | echo "recCPass1.C for OCDB snapshot exited with code $exitcode" > validation_error.message | |
105 | exit 10 | |
106 | fi | |
5cebce24 | 107 | |
108 | echo "* Reconstruction ran in fake mode to create OCDB.root, exiting quickly now" | |
a45764d9 | 109 | |
5cebce24 | 110 | if [ -f OCDB.root ]; then |
111 | echo "* OCDB.root was indeed produced" | |
112 | else | |
113 | echo "* Error: OCDB.root was NOT generated !!!" | |
1169eaef | 114 | echo "OCDB.root was not generated" > validation_error.message |
5cebce24 | 115 | exit 1 |
116 | fi | |
a45764d9 | 117 | |
1169eaef | 118 | exit 0 |
5cebce24 | 119 | fi |
120 | ||
1169eaef | 121 | for COMMON_FILE in wn.xml localOCDBaccessConfig.C AddTaskTPCCalib.C AddTaskTRDCalib.C OCDB.root QAtrain_duo.C; do |
e6844064 | 122 | if [ -f $COMMON_FILE ]; then |
123 | ln -s ../$COMMON_FILE Barrel/$COMMON_FILE | |
124 | ln -s ../$COMMON_FILE OuterDet/$COMMON_FILE | |
125 | fi | |
126 | done | |
5cebce24 | 127 | |
e6844064 | 128 | for BARREL_FILE in recCPass1.C runCalibTrain.C; do |
129 | ln -s ../$BARREL_FILE Barrel/$BARREL_FILE | |
130 | done | |
5cebce24 | 131 | |
e6844064 | 132 | for OUTER_FILE in recCPass1_OuterDet.C; do |
133 | ln -s ../$OUTER_FILE OuterDet/$OUTER_FILE | |
134 | done | |
5cebce24 | 135 | |
136 | #################################### Barrel ####################################### | |
137 | ||
383fa54e | 138 | cd Barrel |
a45764d9 | 139 | |
5cebce24 | 140 | echo "* Running AliRoot to reconstruct barrel of $CHUNKNAME" |
d74ff87e | 141 | |
1169eaef | 142 | echo executing aliroot -l -b -q -x "recCPass1.C(\"$CHUNKNAME\", $nEvents, \"$ocdbPath\", \"$triggerOptions\")" |
143 | time aliroot -l -b -q -x "recCPass1.C(\"$CHUNKNAME\", $nEvents, \"$ocdbPath\", \"$triggerOptions\")" &> ../rec.log | |
5cebce24 | 144 | exitcode=$? |
145 | echo "Exit code: $exitcode" | |
383fa54e | 146 | |
5cebce24 | 147 | if [ $exitcode -ne 0 ]; then |
1169eaef | 148 | echo "recCPass1.C exited with code $exitcode" > ../validation_error.message |
149 | exit 10 | |
5cebce24 | 150 | fi |
383fa54e | 151 | |
5cebce24 | 152 | mv syswatch.log ../syswatch_rec_Barrel.log |
153 | ||
154 | echo "* Running AliRoot to make calibration..." | |
155 | ||
1169eaef | 156 | echo executing aliroot -l -b -q -x "runCalibTrain.C($runNum,\"AliESDs.root\",\"$ocdbPath\")" |
157 | time aliroot -l -b -q -x "runCalibTrain.C($runNum,\"AliESDs.root\",\"$ocdbPath\")" &> ../calib.log | |
5cebce24 | 158 | exitcode=$? |
159 | echo "Exit code: $exitcode" | |
160 | ||
161 | if [ $exitcode -ne 0 ]; then | |
1169eaef | 162 | echo "runCalibTrain.C exited with code $exitcode" > ../validation_error.message |
163 | exit 40 | |
383fa54e | 164 | fi |
d74ff87e | 165 | |
5cebce24 | 166 | mv syswatch.log ../syswatch_calib.log |
167 | ||
168 | if [ -f QAtrain_duo.C ]; then | |
169 | echo "* Running the QA train (barrel) ..." | |
170 | ||
1169eaef | 171 | # echo executing aliroot -b -q "QAtrain_duo.C(\"_barrel\",$runNum,\"$ocdbPath\")" |
172 | # time aliroot -b -q "QAtrain_duo.C(\"_barrel\",$runNum,\"$ocdbPath\")" &> ../qa_barrel.log | |
173 | ||
174 | echo executing aliroot -b -q -x "QAtrain_duo.C(\"_barrel\",$runNum)" | |
175 | time aliroot -b -q -x "QAtrain_duo.C(\"_barrel\",$runNum)" &> ../qa_barrel.log | |
e6844064 | 176 | |
5cebce24 | 177 | exitcode=$? |
178 | echo "Exit code: $exitcode" | |
d74ff87e | 179 | |
5cebce24 | 180 | if [ $exitcode -ne 0 ]; then |
1169eaef | 181 | echo "QAtrain_duo.C / barrel exited with code $exitcode" > ../validation_error.message |
182 | exit 100 | |
5cebce24 | 183 | fi |
66c736ae | 184 | |
5cebce24 | 185 | for file in *.stat; do |
186 | mv $file ../$file.qa_barrel | |
187 | done | |
188 | fi | |
189 | ||
fcb0741e | 190 | mv AliESDs.root ../AliESDs_Barrel.root |
191 | mv AliESDfriends.root ../AliESDfriends_Barrel.root | |
192 | ||
1169eaef | 193 | for file in AliESDfriends_v1.root QAresults_barrel.root EventStat_temp_barrel.root AODtpITS.root Run*.Event*_*.ESD.tag.root; do |
5cebce24 | 194 | if [ -f "$file" ]; then |
195 | mv "$file" ../ | |
196 | fi | |
66c736ae | 197 | done |
d74ff87e | 198 | |
5cebce24 | 199 | #################################### Outer ####################################### |
200 | ||
201 | cd ../OuterDet | |
202 | ||
203 | echo "* Running AliRoot to reconstruct outer of $CHUNKNAME" | |
204 | ||
1169eaef | 205 | echo executing aliroot -l -b -q -x "recCPass1_OuterDet.C(\"$CHUNKNAME\", $nEvents, \"$ocdbPath\")" |
206 | time aliroot -l -b -q -x "recCPass1_OuterDet.C(\"$CHUNKNAME\", $nEvents, \"$ocdbPath\")" &> ../rec_Outer.log | |
5cebce24 | 207 | exitcode=$? |
208 | echo "Exit code: $exitcode" | |
209 | ||
210 | if [ $exitcode -ne 0 ]; then | |
1169eaef | 211 | echo "recCPass1_OuterDet.C exited with code $exitcode" > ../validation_error.message |
212 | exit 11 | |
5cebce24 | 213 | fi |
214 | ||
215 | mv syswatch.log ../syswatch_rec_Outer.log | |
216 | ||
217 | if [ -f QAtrain_duo.C ]; then | |
218 | echo "* Running the QA train (outer) ..." | |
219 | ||
1169eaef | 220 | # echo executing aliroot -b -q "QAtrain_duo.C(\"_outer\",$runNum,\"$ocdbPath\")" |
221 | # time aliroot -b -q "QAtrain_duo.C(\"_outer\",$runNum,\"$ocdbPath\")" &> ../qa_outer.log | |
222 | ||
223 | echo executing aliroot -b -q -x "QAtrain_duo.C(\"_outer\",$runNum)" | |
224 | time aliroot -b -q -x "QAtrain_duo.C(\"_outer\",$runNum)" &> ../qa_outer.log | |
e6844064 | 225 | |
5cebce24 | 226 | exitcode=$? |
227 | echo "Exit code: $exitcode" | |
228 | ||
229 | if [ $exitcode -ne 0 ]; then | |
1169eaef | 230 | echo "QAtrain_duo.C / outer exited with code $exitcode" > ../validation_error.message |
231 | exit 101 | |
5cebce24 | 232 | fi |
233 | ||
234 | for file in *.stat ; do | |
235 | mv $file ../$file.qa_outer | |
236 | done | |
237 | fi | |
238 | ||
383fa54e | 239 | mv AliESDs.root ../AliESDs_Outer.root |
5cebce24 | 240 | mv AliESDfriends.root ../AliESDfriends_Outer.root |
9e160db9 | 241 | |
5cebce24 | 242 | for file in QAresults_outer.root EventStat_temp_outer.root; do |
243 | if [ -f "$file" ]; then | |
244 | mv "$file" ../ | |
245 | fi | |
246 | done | |
9e160db9 | 247 | |
1169eaef | 248 | exit 0 |