]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGPP/CalibMacros/CPass0/runCPass0.sh
Updating scripts, to have the same in master as those in alien
[u/mrichter/AliRoot.git] / PWGPP / CalibMacros / CPass0 / runCPass0.sh
CommitLineData
27eb9bff 1#!/bin/bash
2
3# Script to run:
4# 1. reconstruction
a6168b42 5# 2. calibration
27eb9bff 6#
7# Files assumed to be in working directory:
4c8432c7 8# recCPass0.C - reconstruction macro
27eb9bff 9# runCalibTrain.C - calibration/filtering macro
e6844064 10# Arguments (run locally):
27eb9bff 11# 1 - raw data file name
12# 2 - number of events to be processed
13# 3 - run number
e6844064 14
27eb9bff 15# example:
e6844064 16# runCPass0.sh raw.root 50 104892
27eb9bff 17
18#ALIEN setting
19# $1 = raw input filename
25e2b4b3 20runNum=`echo $1 | cut -d "/" -f 6 | sed 's/^0*//'`
e6844064 21
22if [ $# -lt 3 ]; then
23 # alien Setup
24 nEvents=99999999
25 ocdbPath="raw://"
1169eaef 26
27 # use the value passed by LPM, or by default use the kCalibBarrel alias
28 triggerAlias=${ALIEN_JDL_TRIGGERALIAS-?Trigger=kCalibBarrel}
29 #triggerAlias="?Trigger=kPhysicsAll"
e6844064 30fi
31
32if [ $# -ge 4 ]; then
27eb9bff 33 # local setup
34 nEvents=$2
35 runNum=$3
27eb9bff 36 ocdbPath=$4
5cebce24 37 triggerAlias="?Trigger=kCalibBarrel"
a6168b42 38fi
27eb9bff 39
e6844064 40if [ $# -eq 5 ]; then
41 # local setup in case we provide the trigger mask
42 # the trigger mask is first stripped of quotation characters
43 triggerAlias=${5//\"/}
44fi
27eb9bff 45
46if [ -f Run0_999999999_v3_s0.root ]; then
47 mkdir -p TPC/Calib/Correction
48 mv Run0_999999999_v3_s0.root TPC/Calib/Correction/
49fi
50
e6844064 51echo "File to be processed $1"
52echo "Number of events to be processed $nEvents"
27eb9bff 53
e6844064 54echo "* PATH: $PATH"
55echo "* LD_LIBRARY_PATH: $LD_LIBRARY_PATH"
27eb9bff 56echo
57
5cebce24 58if [ "$2" == "OCDB" ]; then
59 echo "Generating OCDB.root only"
60 export OCDB_SNAPSHOT_CREATE="kTRUE"
61 export OCDB_SNAPSHOT_FILENAME="OCDB.root"
1169eaef 62 touch OCDB.generating.job
5cebce24 63fi
64
65CHUNKNAME="$1"
66
67if [ "${CHUNKNAME:0:1}" = "/" ]; then
68 FILENAME=${CHUNKNAME##*/}
69
70 if [ -f "$FILENAME" ]; then
71 # locally downloaded chunk
72 CHUNKNAME="`pwd`/$FILENAME"
73 else
74 # one chunk from alien (nodownload option to the collection)
75 CHUNKNAME="alien://$CHUNKNAME"
76 fi
77fi
78
79if [ -f "wn.xml" ]; then
80 CHUNKNAME="collection://wn.xml"
81fi
82
83echo "* Running AliRoot to reconstruct $*"
84echo "* Chunk name: $CHUNKNAME"
85echo "* Run number: $runNum"
e6844064 86echo "* nEvents: $nEvents"
87echo "* ocdbPath: $ocdbPath"
88echo "* triggerAlias: $triggerAlias"
5cebce24 89echo ""
90
1169eaef 91echo executing aliroot -l -b -q -x "recCPass0.C(\"$CHUNKNAME\", $nEvents, \"$ocdbPath\", \"$triggerAlias\")"
92time aliroot -l -b -q -x "recCPass0.C(\"$CHUNKNAME\", $nEvents, \"$ocdbPath\", \"$triggerAlias\")" &> rec.log
5cebce24 93
94exitcode=$?
95
e6844064 96echo "*! Exit code of recCPass0.C: $exitcode"
97
98if [ $exitcode -ne 0 ]; then
1169eaef 99 echo "recCPass0.C exited with code $exitcode" > validation_error.message
100 exit 10
e6844064 101fi
5cebce24 102
27eb9bff 103mv syswatch.log syswatch_rec.log
104
5cebce24 105if [ "$2" == "OCDB" ]; then
106 echo "*! Reconstruction ran in fake mode to create OCDB.root, exiting quickly now"
5cebce24 107
108 if [ -f OCDB.root ]; then
109 echo "* OCDB.root was indeed produced"
110 else
111 echo "! Error: OCDB.root was NOT generated !!!"
1169eaef 112 echo "OCDB.root was not generated" > validation_error.message
5cebce24 113 exit 1
114 fi
1169eaef 115
5cebce24 116 exit 0
117fi
118
119echo "* Running AliRoot to make calibration..."
1169eaef 120echo executing aliroot -l -b -q -x "runCalibTrain.C($runNum,\"AliESDs.root\",\"$ocdbPath\")"
121time aliroot -l -b -q -x "runCalibTrain.C($runNum,\"AliESDs.root\",\"$ocdbPath\")" &> calib.log
5cebce24 122exitcode=$?
123
e6844064 124echo "*! Exit code of runCalibTrain.C: $exitcode"
9e160db9 125
1169eaef 126if [ $exitcode -ne 0 ]; then
127 echo "runCalibTrain.C exited with code $exitcode" > validation_error.message
128 exit 40
129fi
130
131exit 0