7 # Files assumed to be in working directory:
8 # recCPass1.C - reconstruction macro
9 # runCalibTrain.C - calibration/filtering macro
10 # Arguments (run locally):
11 # 1 - raw data file name
12 # 2 - number of events to be processed
16 # runCPass1.sh raw.root 50 104892
19 # $1 = raw input filename
20 runNum=`echo $1 | cut -d "/" -f 6 | sed 's/^0*//'`
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"
36 triggerOptions="?Trigger=kCalibBarrel"
40 # local setup in case we specify the trigger mask
46 if [ "${CHUNKNAME:0:1}" = "/" ]; then
47 FILENAME=${CHUNKNAME##*/}
49 if [ -f "$FILENAME" ]; then
50 # locally downloaded chunk
51 CHUNKNAME="`pwd`/$FILENAME"
53 # one chunk from alien (nodownload option to the collection)
54 CHUNKNAME="alien://$CHUNKNAME"
58 if [ -f "wn.xml" ]; then
59 # several chunks accessed remotely
60 CHUNKNAME="collection://wn.xml"
63 echo "* ************************"
64 echo "* runCPass1.sh $*"
65 echo "* Chunk name: $CHUNKNAME"
66 echo "* Run number: $runNum"
67 echo "* nEvents: $nEvents"
68 echo "* runNum: $runNum"
69 echo "* ocdbPath: $ocdbPath"
70 echo "* triggerOptions: $triggerOptions"
71 echo "* ************************"
75 if [ -f Run0_999999999_v3_s0.root ]; then
76 echo "* TPC correction file found"
78 mkdir -p TPC/Calib/Correction
79 mv Run0_999999999_v3_s0.root TPC/Calib/Correction/
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
88 echo "* LD_LIBRARY_PATH: $LD_LIBRARY_PATH"
91 if [ "$2" == "OCDB" ]; then
92 export OCDB_SNAPSHOT_CREATE="kTRUE"
93 export OCDB_SNAPSHOT_FILENAME="OCDB.root"
94 touch OCDB.generating.job
96 echo "* Running AliRoot to generate the OCDB based on $CHUNKNAME"
98 echo "OCDB/recCPass1.C" >&2
99 time aliroot -l -b -q -x recCPass1.C\(\"$CHUNKNAME\"\) &> rec.log
101 echo "Exit code: $exitcode"
103 if [ $exitcode -ne 0 ]; then
104 echo "recCPass1.C for OCDB snapshot exited with code $exitcode" > validation_error.message
108 echo "* Reconstruction ran in fake mode to create OCDB.root, exiting quickly now"
110 if [ -f OCDB.root ]; then
111 echo "* OCDB.root was indeed produced"
113 echo "* Error: OCDB.root was NOT generated !!!"
114 echo "OCDB.root was not generated" > validation_error.message
121 for COMMON_FILE in wn.xml localOCDBaccessConfig.C AddTaskTPCCalib.C AddTaskTRDCalib.C OCDB.root QAtrain_duo.C; do
122 if [ -f $COMMON_FILE ]; then
123 ln -s ../$COMMON_FILE Barrel/$COMMON_FILE
124 ln -s ../$COMMON_FILE OuterDet/$COMMON_FILE
128 for BARREL_FILE in recCPass1.C runCalibTrain.C; do
129 ln -s ../$BARREL_FILE Barrel/$BARREL_FILE
132 for OUTER_FILE in recCPass1_OuterDet.C; do
133 ln -s ../$OUTER_FILE OuterDet/$OUTER_FILE
136 #################################### Barrel #######################################
140 echo "* Running AliRoot to reconstruct barrel of $CHUNKNAME"
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
145 echo "Exit code: $exitcode"
147 if [ $exitcode -ne 0 ]; then
148 echo "recCPass1.C exited with code $exitcode" > ../validation_error.message
152 mv syswatch.log ../syswatch_rec_Barrel.log
154 echo "* Running AliRoot to make calibration..."
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
159 echo "Exit code: $exitcode"
161 if [ $exitcode -ne 0 ]; then
162 echo "runCalibTrain.C exited with code $exitcode" > ../validation_error.message
166 mv syswatch.log ../syswatch_calib.log
168 if [ -f QAtrain_duo.C ]; then
169 echo "* Running the QA train (barrel) ..."
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
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
178 echo "Exit code: $exitcode"
180 if [ $exitcode -ne 0 ]; then
181 echo "QAtrain_duo.C / barrel exited with code $exitcode" > ../validation_error.message
185 for file in *.stat; do
186 mv $file ../$file.qa_barrel
190 mv AliESDs.root ../AliESDs_Barrel.root
191 mv AliESDfriends.root ../AliESDfriends_Barrel.root
193 for file in AliESDfriends_v1.root QAresults_barrel.root EventStat_temp_barrel.root AODtpITS.root Run*.Event*_*.ESD.tag.root; do
194 if [ -f "$file" ]; then
199 #################################### Outer #######################################
203 echo "* Running AliRoot to reconstruct outer of $CHUNKNAME"
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
208 echo "Exit code: $exitcode"
210 if [ $exitcode -ne 0 ]; then
211 echo "recCPass1_OuterDet.C exited with code $exitcode" > ../validation_error.message
215 mv syswatch.log ../syswatch_rec_Outer.log
217 if [ -f QAtrain_duo.C ]; then
218 echo "* Running the QA train (outer) ..."
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
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
227 echo "Exit code: $exitcode"
229 if [ $exitcode -ne 0 ]; then
230 echo "QAtrain_duo.C / outer exited with code $exitcode" > ../validation_error.message
234 for file in *.stat ; do
235 mv $file ../$file.qa_outer
239 mv AliESDs.root ../AliESDs_Outer.root
240 mv AliESDfriends.root ../AliESDfriends_Outer.root
242 for file in QAresults_outer.root EventStat_temp_outer.root; do
243 if [ -f "$file" ]; then