+#RUN=0 # run number for OCDB access
+SEED=1234567 # random number generator seed
+SIMDIR="generated" # sub-directory where to move simulated files prior to reco
+DUMPEVENT=5 # event to be dump on files (set to negative to skip dumps)
+
+SIMCONFIG="$ALICE_ROOT/MUON/"$MC"Config.C"
+EMBEDWITH="" # no embedding by default
+REALISTIC=0 # ideal simulation by default
+
+# next try to see if there are options of this script that want to change the
+# defaults
+
+EXIT=0
+
+while getopts "SRZX:srxzn:tg:p:d:c:e:b:" option
+do
+ case $option in
+ R ) RECONSTRUCTION=1;;
+ S ) SIMULATION=1;;
+ X )
+ CHECKS=1
+ DUMPEVENT=$OPTARG
+ ;;
+ Z ) RAW=1;;
+ r ) RECONSTRUCTION=0;;
+ s ) SIMULATION=0;;
+ x ) CHECKS=0;;
+ t ) SLASHTMP=0;;
+ z ) RAW=0;;
+ c ) SIMCONFIG=$OPTARG;;
+ d ) OUTDIR=$OPTARG;;
+ n ) NEVENTS=$OPTARG;;
+ g ) SEED=$OPTARG;;
+ p ) RECOPTIONS=$OPTARG;;
+ e ) EMBEDWITH=$OPTARG;;
+ b )
+ REALISTIC=$OPTARG
+ RAW=0
+ ;;
+ * ) echo "Unimplemented option chosen."
+ EXIT=1
+ ;;
+ esac
+done
+
+if [ ! -n "$OUTDIR" ]; then
+ if [ "$MC" = "" ]; then
+ OUTDIR=$CURDIR"/test_out."$NEVENTS
+ else
+ OUTDIR=$CURDIR"/"$MC"_test_out."$NEVENTS
+ fi
+fi
+
+# look if there are some leftover options
+shift $(($OPTIND - 1))
+
+if [ $# -gt 0 ] || [ "$EXIT" -eq 1 ]; then
+ echo "ERROR : extra option not recognized"
+ echo "Usage: `basename $0` options (-SRXsrxn:tg:p:d:c:)"
+ echo " -S (-s) perform (or not) simulation (default is do it, i.e -S)"
+ echo " -R (-r) perform (or not) reconstruction (default is do it, i.e. -R)"
+ echo " -X event (-x) perform (or not) checks and dumps (default is do it for event $DUMPEVENT, i.e. -X $DUMPEVENT)"
+ echo " -Z (-z) perform reconstruction from raw data (from digits) (default is from raw data, i.e. -Z)"
+ echo " -n nevents (int) number of events to simulate (default $NEVENTS)"
+ echo " -t will use OUTDIR as a tmp directory to generate raw data "
+ echo " -g seed (uint) seed to be used in simulation (default $SEED)"
+ echo " -p recoptions (quotified string) reconstruction options to use (default \"$RECOPTIONS\")"
+ echo " -d full path to output directory (default $OUTDIR)"
+ echo " -c full path to configuration file for simulation (default $SIMCONFIG)"
+ echo " -e full path to a galice.root file relating to SDigits to be merged (embedding)"
+ echo " -b runnumber (int) make a realistic simulation using runnumber as anchor (default 0=ideal simulation)"
+ exit 4;
+fi
+
+
+# printout the options
+echo "sim $SIMULATION rec $RECONSTRUCTION check $CHECKS"
+if [ "$SIMULATION" -eq 1 ]; then
+ echo "$NEVENTS events will be simulated, using the config found at $SIMCONFIG"
+fi
+if [ -n "$EMBEDWITH" ]; then
+ echo "Will embed simulation with $EMBEDWITH"
+fi
+if [ "$REALISTIC" -gt 0 ]; then
+ echo "Will use anchor run $REALISTIC"
+fi
+if [ "$RECONSTRUCTION" -eq 1 ]; then
+echo "Reconstruction options to be used : $RECOPTIONS"
+if [ "$RAW" -eq 0 ]; then
+echo "Will reconstruct from digits only (not from raw data)"
+fi
+fi
+echo "Output directory will be : $OUTDIR"
+
+if [ "$SIMULATION" -eq 1 ]; then
+
+ rm -fr $OUTDIR
+ mkdir $OUTDIR
+
+fi
+
+# Copy *ALL* the macros we need in the output directory, not to mess
+# with our source dir in any way.
+cp $ALICE_ROOT/MUON/.rootrc \
+ $ALICE_ROOT/MUON/rootlogon.C \
+ $ALICE_ROOT/MUON/runReconstruction.C $ALICE_ROOT/MUON/runSimulation.C \
+ $ALICE_ROOT/MUON/UpdateCDBCTPConfig.C \
+ $ALICE_ROOT/MUON/MUONefficiency.C \
+ $ALICE_ROOT/MUON/MUONTriggerEfficiency.C \
+ $ALICE_ROOT/MUON/MUONCheck.C \
+ $OUTDIR
+