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" # default reconstruction options
12 SIMCONFIG="$ALICE_ROOT/MUON/Config.C" # default simulation configuration file
16 RUN=0 # run number for OCDB access
17 SEED=1234567 # random number generator seed
18 SIMDIR="generated" # sub-directory where to move simulated files prior to reco
19 DUMPEVENT=5 # event to be dump on files
21 # next try to see if there are options of this script that want to change the
26 while getopts "SRX:srxn:p:d:c:" option
29 R ) RECONSTRUCTION=1;;
35 r ) RECONSTRUCTION=0;;
38 c ) SIMCONFIG=$OPTARG;;
41 p ) RECOPTIONS=$OPTARG;;
42 * ) echo "Unimplemented option chosen."
48 if [ ! -n "$OUTDIR" ]; then
49 OUTDIR="$CURDIR/test_out.$NEVENTS"
52 # look if there are some leftover options
53 shift $(($OPTIND - 1))
55 if [ $# -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)"
68 # printout the options
69 echo "sim $SIMULATION rec $RECONSTRUCTION check $CHECKS"
70 if [ "$SIMULATION" -eq 1 ]; then
71 echo "$NEVENTS events will be simulated, using the config found at $SIMCONFIG"
73 if [ "$RECONSTRUCTION" -eq 1 ]; then
74 echo "Reconstruction options to be used : $RECOPTIONS"
76 echo "Output directory will be : $OUTDIR"
78 if [ "$SIMULATION" -eq 1 ]; then
85 cp $ALICE_ROOT/MUON/.rootrc $ALICE_ROOT/MUON/rootlogon.C \
86 $ALICE_ROOT/MUON/runReconstruction.C $ALICE_ROOT/MUON/runSimulation.C $OUTDIR
90 ###############################################################################
92 # Performing SIMULATION
94 ###############################################################################
96 if [ "$SIMULATION" -eq 1 ]; then
98 echo "Running simulation ..."
100 aliroot -b -q runSimulation.C\($RUN,$SEED,$NEVENTS,\""$SIMCONFIG"\"\) >& $OUTDIR/testSim.out
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
108 ###############################################################################
110 # Performing RECONSTRUCTION
112 ###############################################################################
114 if [ "$RECONSTRUCTION" -eq 1 ]; then
116 rm -f galice.root AliESD*.root
118 echo "Running reconstruction ..."
122 aliroot -b -q runReconstruction\.C\($RUN,$SEED,\""$OUTDIR/raw.root"\",\""$RECOPTIONS"\"\) >& $OUTDIR/testReco.out
126 ###############################################################################
128 # Performing CHECKS (and dumps)
130 ###############################################################################
132 if [ "$CHECKS" -eq 1 ]; then
134 if [ -f "$OUTDIR/$SIMDIR/galice.root" ]; then
136 echo "Running efficiency ..."
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");
145 if [ -f "$OUTDIR/galice.root" ]; then
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);
154 if [ -f "$OUTDIR/AliESDs.root" ]; then
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");
167 echo "Running dumps for selected event ($DUMPEVENT) ..."
169 if [ -f "$OUTDIR/$SIMDIR/galice.root" ]; then
171 AliMUONMCDataInterface mcdSim("$OUTDIR/$SIMDIR/galice.root");
172 mcdSim.DumpKine($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.kine
173 mcdSim.DumpHits($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.hits
174 mcdSim.DumpTrackRefs($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.trackrefs
175 mcdSim.DumpDigits($DUMPEVENT,true); > $OUTDIR/dump.$DUMPEVENT.simdigits
176 mcdSim.DumpSDigits($DUMPEVENT,true); > $OUTDIR/dump.$DUMPEVENT.sdigits
180 echo "$OUTDIR/$SIMDIR/galice.root is not there. Skipping sim dumps"
183 if [ -f "$OUTDIR/galice.root" ]; then
185 AliMUONDataInterface dRec("$OUTDIR/galice.root");
186 dRec.DumpDigits($DUMPEVENT,true); > $OUTDIR/dump.$DUMPEVENT.recdigits
187 dRec.DumpRecPoints($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.recpoints
188 dRec.DumpTracks($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.tracks
189 dRec.DumpTriggerTracks($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.triggertracks
190 dRec.DumpTrigger($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.trigger
194 echo "$OUTDIR/galice.root is not there. Skipping rec dumps"
199 echo "... see results in $OUTDIR"