]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGPP/CalibMacros/CPass1/runCPass1.sh
additional protection
[u/mrichter/AliRoot.git] / PWGPP / CalibMacros / CPass1 / runCPass1.sh
CommitLineData
a45764d9 1#!/bin/bash
2
3# Script to run:
4# 1. reconstruction
a6168b42 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
a6168b42 14# 4 - OCDBPath
15# 5 - optional trigger mask
a45764d9 16# example:
a6168b42 17# runCPass1.sh raw.root 50 104892 raw://
a45764d9 18
19#ALIEN setting
20# $1 = raw input filename
25e2b4b3 21runNum=`echo $1 | cut -d "/" -f 6 | sed 's/^0*//'`
a45764d9 22if [ $# -eq 1 ] ; then
23 # alien Setup
24 nEvents=99999999
25 fileName="alien://"$1
26 ocdbPath="raw://"
5cebce24 27 triggerOptions="?Trigger=kCalibBarrel"
a45764d9 28fi;
a6168b42 29if [ $# -ge 4 ] ; then
a45764d9 30 # local setup
a6168b42 31 fileName=$1
a45764d9 32 nEvents=$2
33 runNum=$3
a45764d9 34 ocdbPath=$4
a6168b42 35 triggerOptions="?Trigger=kCalibBarrel"
36fi
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
61echo xxxxxxxxxxxxxxxxxxxxxxxxxxx
054d9070 62echo runCPass1.sh Input arguments
a45764d9 63echo fileName=$fileName
64echo nEvents=$nEvents
65echo runNum=$runNum
66echo ocdbPath=$ocdbPath
5cebce24 67echo triggerOptions=$triggerOptions
a45764d9 68echo xxxxxxxxxxxxxxxxxxxxxxxxxxx
5cebce24 69echo "* ************************"
70echo "* runCPass1.sh $*"
71echo "* Chunk name: $CHUNKNAME"
72echo "* Run number: $runNum"
73echo "* ************************"
a45764d9 74
75if [ -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
81 mkdir -p Barrel/TPC/Calib/Correction
82 ln -s ../../../../TPC/Calib/Correction/Run0_999999999_v3_s0.root Barrel/TPC/Calib/Correction/Run0_999999999_v3_s0.root
83
84 mkdir -p OuterDet/TPC/Calib/Correction
85 ln -s ../../../../TPC/Calib/Correction/Run0_999999999_v3_s0.root OuterDet/TPC/Calib/Correction/Run0_999999999_v3_s0.root
a45764d9 86fi
87
5cebce24 88echo "* PATH: $PATH"
89echo "* LD_LIBRARY_PATH: $LD_LIBRARY_PATH"
90echo
a45764d9 91
5cebce24 92if [ "$2" == "OCDB" ]; then
93 export OCDB_SNAPSHOT_CREATE="kTRUE"
94 export OCDB_SNAPSHOT_FILENAME="OCDB.root"
a45764d9 95
5cebce24 96 echo "* Running AliRoot to generate the OCDB based on $CHUNKNAME"
a45764d9 97
5cebce24 98 echo "OCDB/recCPass1.C" >&2
99 time aliroot -l -b -q recCPass1.C\(\"$CHUNKNAME\"\) &> rec.log
100 exitcode=$?
101 echo "Exit code: $exitcode"
102
103 echo "* Reconstruction ran in fake mode to create OCDB.root, exiting quickly now"
104 touch OCDB.generating.job
a45764d9 105
5cebce24 106 if [ -f OCDB.root ]; then
107 echo "* OCDB.root was indeed produced"
108 else
109 echo "* Error: OCDB.root was NOT generated !!!"
110 exit 1
111 fi
a45764d9 112
5cebce24 113 exit $exitcode
114fi
115
116mkdir Barrel OuterDet
383fa54e 117
9e160db9 118[[ -f localOCDBaccessConfig.C ]] && cp localOCDBaccessConfig.C Barrel
119[[ -f localOCDBaccessConfig.C ]] && cp localOCDBaccessConfig.C OuterDet
120
5cebce24 121cp recCPass1.C Barrel/
122cp runCalibTrain.C Barrel/
123cp QAtrain_duo.C Barrel/
124
125cp recCPass1_OuterDet.C OuterDet/
126cp QAtrain_duo.C OuterDet/
127
128if [ -f wn.xml ]; then
129 cp wn.xml Barrel/
130 cp wn.xml OuterDet/
131fi
132
133if [ -f OCDB.root ]; then
134 ln -s ../OCDB.root Barrel/OCDB.root
135 ln -s ../OCDB.root OuterDet/OCDB.root
136fi
137
138#################################### Barrel #######################################
139
383fa54e 140cd Barrel
a45764d9 141
5cebce24 142echo "* Running AliRoot to reconstruct barrel of $CHUNKNAME"
d74ff87e 143
5cebce24 144echo "Barrel/recCPass1.C" >&2
145echo executing time aliroot -l -b -q "recCPass1.C(\"$CHUNKNAME\", $nEvents, \"$ocdbPath\", \"$triggerOptions\")"
146time aliroot -l -b -q "recCPass1.C(\"$CHUNKNAME\", $nEvents, \"$ocdbPath\", \"$triggerOptions\")" &> ../rec_Barrel.log
147exitcode=$?
148echo "Exit code: $exitcode"
383fa54e 149
5cebce24 150if [ $exitcode -ne 0 ]; then
151 exit $exitcode
152fi
383fa54e 153
5cebce24 154mv syswatch.log ../syswatch_rec_Barrel.log
155
156echo "* Running AliRoot to make calibration..."
157
158echo "Barrel/recCalibTrain.C" >&2
159echo executing time aliroot -l -b -q "runCalibTrain.C($runNum,\"AliESDs.root\",\"$ocdbPath\")"
160time aliroot -l -b -q "runCalibTrain.C($runNum,\"AliESDs.root\",\"$ocdbPath\")" &> ../calib.log
161exitcode=$?
162echo "Exit code: $exitcode"
163
164if [ $exitcode -ne 0 ]; then
165 exit $exitcode
383fa54e 166fi
d74ff87e 167
5cebce24 168mv syswatch.log ../syswatch_calib.log
169
170if [ -f QAtrain_duo.C ]; then
171 echo "* Running the QA train (barrel) ..."
172
173 echo "Barrel/QAtrain_duo.C" >&2
174 echo executing time aliroot -b -q "QAtrain_duo.C(\"_barrel\",$runNum,\"$ocdbPath\")"
175 time aliroot -b -q "QAtrain_duo.C(\"_barrel\",$runNum,\"$ocdbPath\")" &> ../qa_barrel.log
176 exitcode=$?
177 echo "Exit code: $exitcode"
d74ff87e 178
5cebce24 179 if [ $exitcode -ne 0 ]; then
180 exit $exitcode
181 fi
66c736ae 182
5cebce24 183 for file in *.stat; do
184 mv $file ../$file.qa_barrel
185 done
186fi
187
188mv AliESDs.root ../AliESDs_Barrel.root
189mv AliESDfriends.root ../AliESDfriends_Barrel.root
190
191for file in AliESDfriends_v1.root QAresults_barrel.root EventStat_temp_barrel.root AODtpITS.root; do
192 if [ -f "$file" ]; then
193 mv "$file" ../
194 fi
66c736ae 195done
d74ff87e 196
5cebce24 197#################################### Outer #######################################
198
199cd ../OuterDet
200
201echo "* Running AliRoot to reconstruct outer of $CHUNKNAME"
202
203echo "OuterDet/recCPass1_OuterDet" >&2
204echo executing aliroot -l -b -q "recCPass1_OuterDet.C(\"$CHUNKNAME\", $nEvents, \"$ocdbPath\")"
205time aliroot -l -b -q "recCPass1_OuterDet.C(\"$CHUNKNAME\", $nEvents, \"$ocdbPath\")" &> ../rec_Outer.log
206exitcode=$?
207echo "Exit code: $exitcode"
208
209if [ $exitcode -ne 0 ]; then
210 exit $exitcode
211fi
212
213mv syswatch.log ../syswatch_rec_Outer.log
214
215if [ -f QAtrain_duo.C ]; then
216 echo "* Running the QA train (outer) ..."
217
218 echo "OuterDet/QAtrain_duo.C" >&2
219 echo executing time aliroot -b -q "QAtrain_duo.C(\"_outer\",$runNum,\"$ocdbPath\")"
220 time aliroot -b -q "QAtrain_duo.C(\"_outer\",$runNum,\"$ocdbPath\")" &> ../qa_outer.log
221 exitcode=$?
222 echo "Exit code: $exitcode"
223
224 if [ $exitcode -ne 0 ]; then
225 exit $exitcode
226 fi
227
228 for file in *.stat ; do
229 mv $file ../$file.qa_outer
230 done
231fi
232
383fa54e 233mv AliESDs.root ../AliESDs_Outer.root
5cebce24 234mv AliESDfriends.root ../AliESDfriends_Outer.root
9e160db9 235
5cebce24 236for file in QAresults_outer.root EventStat_temp_outer.root; do
237 if [ -f "$file" ]; then
238 mv "$file" ../
239 fi
240done
9e160db9 241
3aabeebe 242if [[ -f $ALICE_ROOT/PWGPP/CalibMacros/CPass1/makeSyswatchCPass1.C ]]; then
243 echo ">>>>>>> Extracting system information..."
244 echo executing aliroot -b -q "$ALICE_ROOT/PWGPP/CalibMacros/CPass1/makeSyswatchCPass1.C(\"AliESDfriends_v1.root\")"
245 aliroot -b -q "$ALICE_ROOT/PWGPP/CalibMacros/CPass1/makeSyswatchCPass1.C(\"AliESDfriends_v1.root\")"
246else
247 echo $ALICE_ROOT/PWGPP/CalibMacros/CPass1/makeSyswatchCPass1.C not there
248fi