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