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\($SEED,$NEVENTS,\""$SIMCONFIG"\"\) >& $OUTDIR/testSim.out
102 echo "Moving generated files to $SIMDIR"
103 mkdir $OUTDIR/$SIMDIR
104 mv $OUTDIR/*QA*.root $OUTDIR/*.log $OUTDIR/$SIMDIR
105 mv $OUTDIR/MUON*.root $OUTDIR/Kinematics*.root $OUTDIR/galice.root $OUTDIR/TrackRefs*.root $OUTDIR/$SIMDIR
109 ###############################################################################
111 # Performing RECONSTRUCTION
113 ###############################################################################
115 if [ "$RECONSTRUCTION" -eq 1 ]; then
117 rm -f galice.root AliESD*.root
119 echo "Running reconstruction ..."
123 aliroot -b -q runReconstruction\.C\($SEED,\""$OUTDIR/raw.root"\",\""$RECOPTIONS"\"\) >& $OUTDIR/testReco.out
127 ###############################################################################
129 # Performing CHECKS (and dumps)
131 ###############################################################################
133 if [ "$CHECKS" -eq 1 ]; then
135 if [ -f "$OUTDIR/$SIMDIR/galice.root" ]; then
137 echo "Running efficiency ..."
139 aliroot -b >& $OUTDIR/testResults.out << EOF
140 .L $ALICE_ROOT/MUON/MUONefficiency.C+
141 // no argument assumes Upsilon but MUONefficiency(443) works on Jpsi
142 MUONefficiency("$OUTDIR/$SIMDIR/galice.root");
146 if [ -f "$OUTDIR/galice.root" ]; then
148 echo "Running Trigger efficiency ..."
149 aliroot -b >& $OUTDIR/testTriggerResults.out << EOF
150 .L $ALICE_ROOT/MUON/MUONTriggerEfficiency.C+
151 MUONTriggerEfficiency("$OUTDIR/$SIMDIR/galice.root", "$OUTDIR/galice.root", 1);
155 if [ -f "$OUTDIR/AliESDs.root" ]; then
157 echo "Running check ..."
158 aliroot -b >& $OUTDIR/testCheck.out << EOF
159 gSystem->Load("libMUONevaluation");
160 .L $ALICE_ROOT/MUON/MUONCheck.C+
161 MUONCheck(0, $NEVENTS-1, "$OUTDIR/$SIMDIR/galice.root", "$OUTDIR/galice.root", "$OUTDIR/AliESDs.root");
168 echo "Running dumps for selected event ($DUMPEVENT) ..."
170 if [ -f "$OUTDIR/$SIMDIR/galice.root" ]; then
172 AliCDBManager* man = AliCDBManager::Instance();
173 man->SetDefaultStorage("local://$ALICE_ROOT");
174 AliMUONMCDataInterface mcdSim("$OUTDIR/$SIMDIR/galice.root");
175 mcdSim.DumpKine($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.kine
176 mcdSim.DumpHits($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.hits
177 mcdSim.DumpTrackRefs($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.trackrefs
178 mcdSim.DumpDigits($DUMPEVENT,true); > $OUTDIR/dump.$DUMPEVENT.simdigits
179 mcdSim.DumpSDigits($DUMPEVENT,true); > $OUTDIR/dump.$DUMPEVENT.sdigits
183 echo "$OUTDIR/$SIMDIR/galice.root is not there. Skipping sim dumps"
186 if [ -f "$OUTDIR/galice.root" ]; then
188 AliCDBManager* man = AliCDBManager::Instance();
189 man->SetDefaultStorage("local://$ALICE_ROOT");
190 AliMUONDataInterface dRec("$OUTDIR/galice.root");
191 dRec.DumpDigits($DUMPEVENT,true); > $OUTDIR/dump.$DUMPEVENT.recdigits
192 dRec.DumpRecPoints($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.recpoints
193 dRec.DumpTrigger($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.trigger
197 echo "$OUTDIR/galice.root is not there. Skipping rec dumps"
202 echo "... see results in $OUTDIR"