4 # first declare default values
6 SIMULATION=1 # will perform simulation
7 RECONSTRUCTION=1 # will perform reconstruction
8 CHECKS=1 # will perform checks
9 NEVENTS=100 # will simulate 100 events
11 #RECOPTIONS="SAVEDIGITS NOFASTDECODERS" # reconstruction options with non-high performance decoders
12 RECOPTIONS="SAVEDIGITS" # default reconstruction options
13 SIMCONFIG="$ALICE_ROOT/MUON/Config.C" # default simulation configuration file
17 #RUN=0 # run number for OCDB access
18 SEED=1234567 # random number generator seed
19 SIMDIR="generated" # sub-directory where to move simulated files prior to reco
20 DUMPEVENT=5 # event to be dump on files
22 # next try to see if there are options of this script that want to change the
27 while getopts "SRX:srxn:p:d:c:" option
30 R ) RECONSTRUCTION=1;;
36 r ) RECONSTRUCTION=0;;
39 c ) SIMCONFIG=$OPTARG;;
42 p ) RECOPTIONS=$OPTARG;;
43 * ) echo "Unimplemented option chosen."
49 if [ ! -n "$OUTDIR" ]; then
50 OUTDIR="$CURDIR/test_out.$NEVENTS"
53 # look if there are some leftover options
54 shift $(($OPTIND - 1))
56 if [ $# -gt 0 ] || [ "$EXIT" -eq 1 ]; then
57 echo "ERROR : extra option not recognized"
58 echo "Usage: `basename $0` options (-SRXsrxn:p:d:c:)"
59 echo " -S (-s) perform (or not) simulation (default is do it, i.e -S)"
60 echo " -R (-r) perform (or not) reconstruction (default is do it, i.e. -R)"
61 echo " -X event (-x) perform (or not) checks and dumps (default is do it for event $DUMPEVENT, i.e. -X $DUMPEVENT)"
62 echo " -n nevents (int) number of events to simulate (default $NEVENTS)"
63 echo " -p recoptions (quotified string) reconstruction options to use (default \"$RECOPTIONS\")"
64 echo " -d full path to output directory (default $OUTDIR)"
65 echo " -c full path to configuration file for simulation (default $SIMCONFIG)"
69 # printout the options
70 echo "sim $SIMULATION rec $RECONSTRUCTION check $CHECKS"
71 if [ "$SIMULATION" -eq 1 ]; then
72 echo "$NEVENTS events will be simulated, using the config found at $SIMCONFIG"
74 if [ "$RECONSTRUCTION" -eq 1 ]; then
75 echo "Reconstruction options to be used : $RECOPTIONS"
77 echo "Output directory will be : $OUTDIR"
79 if [ "$SIMULATION" -eq 1 ]; then
86 cp $ALICE_ROOT/MUON/.rootrc $ALICE_ROOT/MUON/rootlogon.C \
87 $ALICE_ROOT/MUON/runReconstruction.C $ALICE_ROOT/MUON/runSimulation.C $OUTDIR
91 ###############################################################################
93 # Performing SIMULATION
95 ###############################################################################
97 if [ "$SIMULATION" -eq 1 ]; then
99 echo "Running simulation ..."
101 aliroot -l -b -q runSimulation.C\($SEED,$NEVENTS,\""$SIMCONFIG"\"\) >& $OUTDIR/testSim.out
103 echo "Moving generated files to $SIMDIR"
104 mkdir $OUTDIR/$SIMDIR
105 mv $OUTDIR/*QA*.root $OUTDIR/*.log $OUTDIR/$SIMDIR
106 mv $OUTDIR/MUON*.root $OUTDIR/Kinematics*.root $OUTDIR/galice.root $OUTDIR/TrackRefs*.root $OUTDIR/$SIMDIR
110 ###############################################################################
112 # Performing RECONSTRUCTION
114 ###############################################################################
116 if [ "$RECONSTRUCTION" -eq 1 ]; then
118 rm -f galice.root AliESD*.root *QA*.root
120 echo "Running reconstruction ..."
124 aliroot -l -b -q runReconstruction\.C\($SEED,\""$OUTDIR/raw.root"\",\""$RECOPTIONS"\"\) >& $OUTDIR/testReco.out
128 ###############################################################################
130 # Performing CHECKS (and dumps)
132 ###############################################################################
134 if [ "$CHECKS" -eq 1 ]; then
136 if [ -f "$OUTDIR/$SIMDIR/galice.root" ]; then
138 echo "Running efficiency ..."
140 aliroot -b >& $OUTDIR/testResults.out << EOF
141 .L $ALICE_ROOT/MUON/MUONefficiency.C+
142 // no argument assumes Upsilon but MUONefficiency(443) works on Jpsi
143 MUONefficiency("$OUTDIR/$SIMDIR/galice.root");
147 if [ -f "$OUTDIR/galice.root" ]; then
149 echo "Running Trigger efficiency ..."
150 aliroot -b >& $OUTDIR/testTriggerResults.out << EOF
151 .L $ALICE_ROOT/MUON/MUONTriggerEfficiency.C+
152 MUONTriggerEfficiency("$OUTDIR/$SIMDIR/galice.root", "$OUTDIR/galice.root", 1);
156 if [ -f "$OUTDIR/AliESDs.root" ]; then
158 echo "Running check ..."
159 aliroot -b >& $OUTDIR/testCheck.out << EOF
160 gSystem->Load("libMUONevaluation");
161 .L $ALICE_ROOT/MUON/MUONCheck.C+
162 MUONCheck(0, $NEVENTS-1, "$OUTDIR/$SIMDIR/galice.root", "$OUTDIR/galice.root", "$OUTDIR/AliESDs.root");
169 echo "Running dumps for selected event ($DUMPEVENT) ..."
171 if [ -f "$OUTDIR/$SIMDIR/galice.root" ]; then
173 AliCDBManager* man = AliCDBManager::Instance();
174 man->SetDefaultStorage("local://$ALICE_ROOT");
175 AliMUONMCDataInterface mcdSim("$OUTDIR/$SIMDIR/galice.root");
176 mcdSim.DumpKine($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.kine
177 mcdSim.DumpHits($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.hits
178 mcdSim.DumpTrackRefs($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.trackrefs
179 mcdSim.DumpDigits($DUMPEVENT,true); > $OUTDIR/dump.$DUMPEVENT.simdigits
180 mcdSim.DumpSDigits($DUMPEVENT,true); > $OUTDIR/dump.$DUMPEVENT.sdigits
184 echo "$OUTDIR/$SIMDIR/galice.root is not there. Skipping sim dumps"
187 if [ -f "$OUTDIR/galice.root" ]; then
189 AliCDBManager* man = AliCDBManager::Instance();
190 man->SetDefaultStorage("local://$ALICE_ROOT");
191 AliMUONDataInterface dRec("$OUTDIR/galice.root");
192 dRec.DumpDigits($DUMPEVENT,true); > $OUTDIR/dump.$DUMPEVENT.recdigits
193 dRec.DumpRecPoints($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.recpoints
194 dRec.DumpTrigger($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.trigger
198 echo "$OUTDIR/galice.root is not there. Skipping rec dumps"
203 echo "... see results in $OUTDIR"