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