]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AlirootRun_MUONtest.sh
AliHLTTPCCAMerger.cxx added to compilation
[u/mrichter/AliRoot.git] / MUON / AlirootRun_MUONtest.sh
CommitLineData
fa701981 1#!/bin/sh
2# $Id$
3
aefc4e02 4# first declare default values
5
6SIMULATION=1 # will perform simulation
7RECONSTRUCTION=1 # will perform reconstruction
388c6fb1 8RAW=1 # will reconstruct from raw data
aefc4e02 9CHECKS=1 # will perform checks
0be3d079 10SLASHTMP=1 #will use /tmp to put the temporary raw data
aefc4e02 11NEVENTS=100 # will simulate 100 events
32bf5f82 12
5f3519d9 13#RECOPTIONS="SAVEDIGITS NOFASTDECODERS" # reconstruction options with non-high performance decoders
aefc4e02 14RECOPTIONS="SAVEDIGITS" # default reconstruction options
15SIMCONFIG="$ALICE_ROOT/MUON/Config.C" # default simulation configuration file
16OUTDIR=""
fa701981 17CURDIR=`pwd`
fa701981 18
745f6baf 19#RUN=0 # run number for OCDB access
aefc4e02 20SEED=1234567 # random number generator seed
21SIMDIR="generated" # sub-directory where to move simulated files prior to reco
22DUMPEVENT=5 # event to be dump on files
23
24# next try to see if there are options of this script that want to change the
25# defaults
26
27EXIT=0
28
388c6fb1 29while getopts "SRZX:srxzn:tg:p:d:c:" option
aefc4e02 30do
31 case $option in
32 R ) RECONSTRUCTION=1;;
33 S ) SIMULATION=1;;
34 X )
35 CHECKS=1
36 DUMPEVENT=$OPTARG
37 ;;
388c6fb1 38 Z ) RAW=1;;
aefc4e02 39 r ) RECONSTRUCTION=0;;
40 s ) SIMULATION=0;;
41 x ) CHECKS=0;;
0be3d079 42 t ) SLASHTMP=0;;
388c6fb1 43 z ) RAW=0;;
aefc4e02 44 c ) SIMCONFIG=$OPTARG;;
45 d ) OUTDIR=$OPTARG;;
46 n ) NEVENTS=$OPTARG;;
0be3d079 47 g ) SEED=$OPTARG;;
aefc4e02 48 p ) RECOPTIONS=$OPTARG;;
49 * ) echo "Unimplemented option chosen."
50 EXIT=1
51 ;;
52 esac
53done
54
55if [ ! -n "$OUTDIR" ]; then
56 OUTDIR="$CURDIR/test_out.$NEVENTS"
57fi
58
59# look if there are some leftover options
60shift $(($OPTIND - 1))
61
62if [ $# -gt 0 ] || [ "$EXIT" -eq 1 ]; then
63 echo "ERROR : extra option not recognized"
0be3d079 64 echo "Usage: `basename $0` options (-SRXsrxn:tg:p:d:c:)"
aefc4e02 65 echo " -S (-s) perform (or not) simulation (default is do it, i.e -S)"
66 echo " -R (-r) perform (or not) reconstruction (default is do it, i.e. -R)"
67 echo " -X event (-x) perform (or not) checks and dumps (default is do it for event $DUMPEVENT, i.e. -X $DUMPEVENT)"
388c6fb1 68 echo " -Z (-z) perform reconstruction from raw data (from digits) (default is from raw data, i.e. -Z)"
aefc4e02 69 echo " -n nevents (int) number of events to simulate (default $NEVENTS)"
0be3d079 70 echo " -t will use OUTDIR as a tmp directory to generate raw data "
71 echo " -g seed (uint) seed to be used in simulation (default $SEED)"
aefc4e02 72 echo " -p recoptions (quotified string) reconstruction options to use (default \"$RECOPTIONS\")"
73 echo " -d full path to output directory (default $OUTDIR)"
74 echo " -c full path to configuration file for simulation (default $SIMCONFIG)"
75 exit 4;
76fi
77
78# printout the options
79echo "sim $SIMULATION rec $RECONSTRUCTION check $CHECKS"
80if [ "$SIMULATION" -eq 1 ]; then
81 echo "$NEVENTS events will be simulated, using the config found at $SIMCONFIG"
82fi
83if [ "$RECONSTRUCTION" -eq 1 ]; then
84echo "Reconstruction options to be used : $RECOPTIONS"
388c6fb1 85if [ "$RAW" -eq 0 ]; then
86echo "Will reconstruct from digits only (not from raw data)"
87fi
aefc4e02 88fi
89echo "Output directory will be : $OUTDIR"
90
91if [ "$SIMULATION" -eq 1 ]; then
92
93 rm -fr $OUTDIR
94 mkdir $OUTDIR
95
96fi
97
98cp $ALICE_ROOT/MUON/.rootrc $ALICE_ROOT/MUON/rootlogon.C \
99 $ALICE_ROOT/MUON/runReconstruction.C $ALICE_ROOT/MUON/runSimulation.C $OUTDIR
100
fa701981 101cd $OUTDIR
102
0be3d079 103if [ "$SLASHTMP" -eq 0 ]; then
104 mkdir ./tmp
105 mkdir ./tmp/mdc1
106 mkdir ./tmp/mdc2
107 mkdir ./tmp/mdc1/tags
108
109 chmod 777 ./tmp
110 chmod 777 ./tmp/mdc1
111 chmod 777 ./tmp/mdc2
112 chmod 777 ./tmp/mdc1/tags
113
114 export ALIMDC_RAWDB1=./tmp/mdc1
115 export ALIMDC_RAWDB2=./tmp/mdc2
116 export ALIMDC_TAGDB=./tmp/mdc1/tags
117fi
118
cbb5526b 119###############################################################################
120#
121# Update CTP in OCDB for MUON Trigger
122#
123###############################################################################
124
6468ad42 125if [ ! -f $ALICE_ROOT/OCDB/GRP/CTP/Config/Run0_999999999_v0_s1.root ]; then
cbb5526b 126
127 echo "Updating GRP CTP config ..."
128
129 aliroot -b >& $OUTDIR/updateCDBCTPConfig.out << EOF
130 .L $ALICE_ROOT/MUON/UpdateCDBCTPConfig.C+
131 UpdateCDBCTPConfig();
132 .q
133EOF
134
135fi
136
137
aefc4e02 138###############################################################################
139#
140# Performing SIMULATION
141#
142###############################################################################
fa701981 143
aefc4e02 144if [ "$SIMULATION" -eq 1 ]; then
fa701981 145
aefc4e02 146 echo "Running simulation ..."
858e5b75 147
0d2fa09b 148 aliroot -l -b -q runSimulation.C\($SEED,$NEVENTS,\""$SIMCONFIG"\"\) >& $OUTDIR/testSim.out
388c6fb1 149
aefc4e02 150 mkdir $OUTDIR/$SIMDIR
fa701981 151
388c6fb1 152 if [ "$RAW" -eq 1 ]; then
153 echo "Moving generated files to $SIMDIR"
154 mv $OUTDIR/*QA*.root $OUTDIR/*.log $OUTDIR/$SIMDIR
155 mv $OUTDIR/MUON*.root $OUTDIR/Kinematics*.root $OUTDIR/galice.root $OUTDIR/TrackRefs*.root $OUTDIR/$SIMDIR
156 else
157 echo "Copying generated files to $SIMDIR"
158 cp $OUTDIR/*QA*.root $OUTDIR/*.log $OUTDIR/$SIMDIR
159 cp $OUTDIR/MUON*.root $OUTDIR/Kinematics*.root $OUTDIR/galice.root $OUTDIR/TrackRefs*.root $OUTDIR/$SIMDIR
160 fi
161
aefc4e02 162fi
fa701981 163
aefc4e02 164###############################################################################
165#
166# Performing RECONSTRUCTION
167#
168###############################################################################
169
170if [ "$RECONSTRUCTION" -eq 1 ]; then
171
388c6fb1 172 if [ "$RAW" -eq 1 ]; then
173 rm -f galice.root
174 fi
175
176 rm -f AliESD*.root *QA*.root
177
aefc4e02 178 echo "Running reconstruction ..."
179
180 cd $OUTDIR
181
388c6fb1 182 if [ "$RAW" -eq 1 ]; then
183
184 aliroot -l -b -q runReconstruction\.C\($SEED,\""$OUTDIR/raw.root"\",\""$RECOPTIONS"\"\) >& $OUTDIR/testReco.out
185
186 else
aefc4e02 187
388c6fb1 188 aliroot -l -b -q runReconstruction\.C\($SEED,\"""\",\""$RECOPTIONS"\"\) >& $OUTDIR/testReco.out
189
190 fi
191
aefc4e02 192fi
858e5b75 193
aefc4e02 194###############################################################################
195#
196# Performing CHECKS (and dumps)
197#
198###############################################################################
32bf5f82 199
aefc4e02 200if [ "$CHECKS" -eq 1 ]; then
8dc57946 201
029d450d 202 if [ -f "$OUTDIR/$SIMDIR/galice.root" ]; then
32bf5f82 203
aefc4e02 204 echo "Running efficiency ..."
205
206 aliroot -b >& $OUTDIR/testResults.out << EOF
207 .L $ALICE_ROOT/MUON/MUONefficiency.C+
208 // no argument assumes Upsilon but MUONefficiency(443) works on Jpsi
209 MUONefficiency("$OUTDIR/$SIMDIR/galice.root");
210 .q
211EOF
212
029d450d 213 if [ -f "$OUTDIR/galice.root" ]; then
aefc4e02 214
215 echo "Running Trigger efficiency ..."
216 aliroot -b >& $OUTDIR/testTriggerResults.out << EOF
217 .L $ALICE_ROOT/MUON/MUONTriggerEfficiency.C+
218 MUONTriggerEfficiency("$OUTDIR/$SIMDIR/galice.root", "$OUTDIR/galice.root", 1);
219 .q
8dc57946 220EOF
858e5b75 221
029d450d 222 if [ -f "$OUTDIR/AliESDs.root" ]; then
223
224 echo "Running check ..."
225 aliroot -b >& $OUTDIR/testCheck.out << EOF
226 gSystem->Load("libMUONevaluation");
227 .L $ALICE_ROOT/MUON/MUONCheck.C+
228 MUONCheck(0, $NEVENTS-1, "$OUTDIR/$SIMDIR/galice.root", "$OUTDIR/galice.root", "$OUTDIR/AliESDs.root");
229 .q
aefc4e02 230EOF
029d450d 231 fi
aefc4e02 232 fi
233 fi
234
235 echo "Running dumps for selected event ($DUMPEVENT) ..."
236
237 if [ -f "$OUTDIR/$SIMDIR/galice.root" ]; then
0d2fa09b 238 aliroot -l -b << EOF
07be5a4f 239 AliCDBManager* man = AliCDBManager::Instance();
162637e4 240 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
aefc4e02 241 AliMUONMCDataInterface mcdSim("$OUTDIR/$SIMDIR/galice.root");
242 mcdSim.DumpKine($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.kine
243 mcdSim.DumpHits($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.hits
244 mcdSim.DumpTrackRefs($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.trackrefs
245 mcdSim.DumpDigits($DUMPEVENT,true); > $OUTDIR/dump.$DUMPEVENT.simdigits
246 mcdSim.DumpSDigits($DUMPEVENT,true); > $OUTDIR/dump.$DUMPEVENT.sdigits
247 .q
248EOF
249 else
250 echo "$OUTDIR/$SIMDIR/galice.root is not there. Skipping sim dumps"
251 fi
252
253 if [ -f "$OUTDIR/galice.root" ]; then
0d2fa09b 254 aliroot -l -b << EOF
07be5a4f 255 AliCDBManager* man = AliCDBManager::Instance();
162637e4 256 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
aefc4e02 257 AliMUONDataInterface dRec("$OUTDIR/galice.root");
258 dRec.DumpDigits($DUMPEVENT,true); > $OUTDIR/dump.$DUMPEVENT.recdigits
259 dRec.DumpRecPoints($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.recpoints
aefc4e02 260 dRec.DumpTrigger($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.trigger
261 .q
262EOF
263 else
264 echo "$OUTDIR/galice.root is not there. Skipping rec dumps"
265 fi
266fi
32bf5f82 267
fa701981 268echo "Finished"
aefc4e02 269echo "... see results in $OUTDIR"
fa701981 270
271cd $CURDIR