]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - MUON/AlirootRun_MUONtest.sh
Temporary fix waiting for M.Ivanov
[u/mrichter/AliRoot.git] / MUON / AlirootRun_MUONtest.sh
... / ...
CommitLineData
1#!/bin/sh
2# $Id$
3
4# first declare default values
5
6SIMULATION=1 # will perform simulation
7RECONSTRUCTION=1 # will perform reconstruction
8RAW=1 # will reconstruct from raw data
9CHECKS=1 # will perform checks
10SLASHTMP=1 #will use /tmp to put the temporary raw data
11NEVENTS=100 # will simulate 100 events
12
13#RECOPTIONS="SAVEDIGITS NOFASTDECODERS" # reconstruction options with non-high performance decoders
14RECOPTIONS="SAVEDIGITS" # default reconstruction options
15SIMCONFIG="$ALICE_ROOT/MUON/Config.C" # default simulation configuration file
16OUTDIR=""
17CURDIR=`pwd`
18
19#RUN=0 # run number for OCDB access
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
29while getopts "SRZX:srxzn:tg:p:d:c:" option
30do
31 case $option in
32 R ) RECONSTRUCTION=1;;
33 S ) SIMULATION=1;;
34 X )
35 CHECKS=1
36 DUMPEVENT=$OPTARG
37 ;;
38 Z ) RAW=1;;
39 r ) RECONSTRUCTION=0;;
40 s ) SIMULATION=0;;
41 x ) CHECKS=0;;
42 t ) SLASHTMP=0;;
43 z ) RAW=0;;
44 c ) SIMCONFIG=$OPTARG;;
45 d ) OUTDIR=$OPTARG;;
46 n ) NEVENTS=$OPTARG;;
47 g ) SEED=$OPTARG;;
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"
64 echo "Usage: `basename $0` options (-SRXsrxn:tg:p:d:c:)"
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)"
68 echo " -Z (-z) perform reconstruction from raw data (from digits) (default is from raw data, i.e. -Z)"
69 echo " -n nevents (int) number of events to simulate (default $NEVENTS)"
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)"
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"
85if [ "$RAW" -eq 0 ]; then
86echo "Will reconstruct from digits only (not from raw data)"
87fi
88fi
89echo "Output directory will be : $OUTDIR"
90
91if [ "$SIMULATION" -eq 1 ]; then
92
93 rm -fr $OUTDIR
94 mkdir $OUTDIR
95
96fi
97
98# Copy *ALL* the macros we need in the output directory, not to mess
99# with our source dir in any way.
100cp $ALICE_ROOT/MUON/.rootrc \
101 $ALICE_ROOT/MUON/rootlogon.C \
102 $ALICE_ROOT/MUON/runReconstruction.C $ALICE_ROOT/MUON/runSimulation.C \
103 $ALICE_ROOT/MUON/UpdateCDBCTPConfig.C \
104 $ALICE_ROOT/MUON/MUONefficiency.C \
105 $ALICE_ROOT/MUON/MUONTriggerEfficiency.C \
106 $ALICE_ROOT/MUON/MUONCheck.C \
107 $OUTDIR
108
109cd $OUTDIR
110
111if [ "$SLASHTMP" -eq 0 ]; then
112 mkdir ./tmp
113 mkdir ./tmp/mdc1
114 mkdir ./tmp/mdc2
115 mkdir ./tmp/mdc1/tags
116
117 chmod 777 ./tmp
118 chmod 777 ./tmp/mdc1
119 chmod 777 ./tmp/mdc2
120 chmod 777 ./tmp/mdc1/tags
121
122 export ALIMDC_RAWDB1=./tmp/mdc1
123 export ALIMDC_RAWDB2=./tmp/mdc2
124 export ALIMDC_TAGDB=./tmp/mdc1/tags
125fi
126
127###############################################################################
128#
129# Update CTP in OCDB for MUON Trigger
130#
131###############################################################################
132
133if [ ! -f $ALICE_ROOT/OCDB/GRP/CTP/Config/Run0_999999999_v0_s1.root ]; then
134
135 echo "Updating GRP CTP config ..."
136
137 aliroot -b >& $OUTDIR/updateCDBCTPConfig.out << EOF
138 .L UpdateCDBCTPConfig.C+
139 UpdateCDBCTPConfig();
140 .q
141EOF
142
143fi
144
145
146###############################################################################
147#
148# Performing SIMULATION
149#
150###############################################################################
151
152if [ "$SIMULATION" -eq 1 ]; then
153
154 echo "Running simulation ..."
155
156 aliroot -l -b -q runSimulation.C\($SEED,$NEVENTS,\""$SIMCONFIG"\"\) >& $OUTDIR/testSim.out
157
158 mkdir $OUTDIR/$SIMDIR
159
160 if [ "$RAW" -eq 1 ]; then
161 echo "Moving generated files to $SIMDIR"
162 mv $OUTDIR/*QA*.root $OUTDIR/*.log $OUTDIR/$SIMDIR
163 mv $OUTDIR/MUON*.root $OUTDIR/Kinematics*.root $OUTDIR/galice.root $OUTDIR/TrackRefs*.root $OUTDIR/$SIMDIR
164 else
165 echo "Copying generated files to $SIMDIR"
166 cp $OUTDIR/*QA*.root $OUTDIR/*.log $OUTDIR/$SIMDIR
167 cp $OUTDIR/MUON*.root $OUTDIR/Kinematics*.root $OUTDIR/galice.root $OUTDIR/TrackRefs*.root $OUTDIR/$SIMDIR
168 fi
169
170fi
171
172###############################################################################
173#
174# Performing RECONSTRUCTION
175#
176###############################################################################
177
178if [ "$RECONSTRUCTION" -eq 1 ]; then
179
180 if [ "$RAW" -eq 1 ]; then
181 rm -f galice.root
182 fi
183
184 rm -f AliESD*.root *QA*.root
185
186 echo "Running reconstruction ..."
187
188 cd $OUTDIR
189
190 if [ "$RAW" -eq 1 ]; then
191
192 aliroot -l -b -q runReconstruction\.C\($SEED,\""$OUTDIR/raw.root"\",\""$RECOPTIONS"\"\) >& $OUTDIR/testReco.out
193
194 else
195
196 aliroot -l -b -q runReconstruction\.C\($SEED,\"""\",\""$RECOPTIONS"\"\) >& $OUTDIR/testReco.out
197
198 fi
199
200fi
201
202###############################################################################
203#
204# Performing CHECKS (and dumps)
205#
206###############################################################################
207
208if [ "$CHECKS" -eq 1 ]; then
209
210 if [ -f "$OUTDIR/$SIMDIR/galice.root" ]; then
211
212 echo "Running efficiency ..."
213
214 aliroot -b >& $OUTDIR/testResults.out << EOF
215 .L MUONefficiency.C+
216 // no argument assumes Upsilon but MUONefficiency(443) works on Jpsi
217 MUONefficiency("$OUTDIR/$SIMDIR/galice.root");
218 .q
219EOF
220
221 if [ -f "$OUTDIR/galice.root" ]; then
222
223 echo "Running Trigger efficiency ..."
224 aliroot -b >& $OUTDIR/testTriggerResults.out << EOF
225 .L MUONTriggerEfficiency.C+
226 MUONTriggerEfficiency("$OUTDIR/$SIMDIR/galice.root", "$OUTDIR/galice.root", 1);
227 .q
228EOF
229
230 if [ -f "$OUTDIR/AliESDs.root" ]; then
231
232 echo "Running check ..."
233 aliroot -b >& $OUTDIR/testCheck.out << EOF
234 gSystem->Load("libMUONevaluation");
235 .L MUONCheck.C+
236 MUONCheck(0, $NEVENTS-1, "$OUTDIR/$SIMDIR/galice.root", "$OUTDIR/galice.root", "$OUTDIR/AliESDs.root");
237 .q
238EOF
239 fi
240 fi
241 fi
242
243 echo "Running dumps for selected event ($DUMPEVENT) ..."
244
245 if [ -f "$OUTDIR/$SIMDIR/galice.root" ]; then
246 aliroot -l -b << EOF
247 AliCDBManager* man = AliCDBManager::Instance();
248 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
249 AliMUONMCDataInterface mcdSim("$OUTDIR/$SIMDIR/galice.root");
250 mcdSim.DumpKine($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.kine
251 mcdSim.DumpHits($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.hits
252 mcdSim.DumpTrackRefs($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.trackrefs
253 mcdSim.DumpDigits($DUMPEVENT,true); > $OUTDIR/dump.$DUMPEVENT.simdigits
254 mcdSim.DumpSDigits($DUMPEVENT,true); > $OUTDIR/dump.$DUMPEVENT.sdigits
255 .q
256EOF
257 else
258 echo "$OUTDIR/$SIMDIR/galice.root is not there. Skipping sim dumps"
259 fi
260
261 if [ -f "$OUTDIR/galice.root" ]; then
262 aliroot -l -b << EOF
263 AliCDBManager* man = AliCDBManager::Instance();
264 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
265 AliMUONDataInterface dRec("$OUTDIR/galice.root");
266 dRec.DumpDigits($DUMPEVENT,true); > $OUTDIR/dump.$DUMPEVENT.recdigits
267 dRec.DumpRecPoints($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.recpoints
268 dRec.DumpTrigger($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.trigger
269 .q
270EOF
271 else
272 echo "$OUTDIR/galice.root is not there. Skipping rec dumps"
273 fi
274fi
275
276echo "Finished"
277echo "... see results in $OUTDIR"
278
279cd $CURDIR