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