4 # first declare default values
6 SIMULATION=1 # will perform simulation
7 RECONSTRUCTION=1 # will perform reconstruction
8 RAW=1 # will reconstruct from raw data
9 CHECKS=1 # will perform checks
10 SLASHTMP=1 #will use /tmp to put the temporary raw data
11 NEVENTS=100 # will simulate 100 events
13 #RECOPTIONS="SAVEDIGITS NOFASTDECODERS" # reconstruction options with non-high performance decoders
14 RECOPTIONS="SAVEDIGITS" # default reconstruction options
15 SIMCONFIG="$ALICE_ROOT/MUON/Config.C" # default simulation configuration file
19 #RUN=0 # run number for OCDB access
20 SEED=1234567 # random number generator seed
21 SIMDIR="generated" # sub-directory where to move simulated files prior to reco
22 DUMPEVENT=5 # event to be dump on files
24 # next try to see if there are options of this script that want to change the
29 while getopts "SRZX:srxzn:tg:p:d:c:" option
32 R ) RECONSTRUCTION=1;;
39 r ) RECONSTRUCTION=0;;
44 c ) SIMCONFIG=$OPTARG;;
48 p ) RECOPTIONS=$OPTARG;;
49 * ) echo "Unimplemented option chosen."
55 if [ ! -n "$OUTDIR" ]; then
56 OUTDIR="$CURDIR/test_out.$NEVENTS"
59 # look if there are some leftover options
60 shift $(($OPTIND - 1))
62 if [ $# -gt 0 ] || [ "$EXIT" -eq 1 ]; then
63 echo "ERROR : extra option not recognized"
64 echo "Usage: `basename $0` options (-SRXsrxn:tg:p:d:c:)"
65 echo " -S (-s) perform (or not) simulation (default is do it, i.e -S)"
66 echo " -R (-r) perform (or not) reconstruction (default is do it, i.e. -R)"
67 echo " -X event (-x) perform (or not) checks and dumps (default is do it for event $DUMPEVENT, i.e. -X $DUMPEVENT)"
68 echo " -Z (-z) perform reconstruction from raw data (from digits) (default is from raw data, i.e. -Z)"
69 echo " -n nevents (int) number of events to simulate (default $NEVENTS)"
70 echo " -t will use OUTDIR as a tmp directory to generate raw data "
71 echo " -g seed (uint) seed to be used in simulation (default $SEED)"
72 echo " -p recoptions (quotified string) reconstruction options to use (default \"$RECOPTIONS\")"
73 echo " -d full path to output directory (default $OUTDIR)"
74 echo " -c full path to configuration file for simulation (default $SIMCONFIG)"
78 # printout the options
79 echo "sim $SIMULATION rec $RECONSTRUCTION check $CHECKS"
80 if [ "$SIMULATION" -eq 1 ]; then
81 echo "$NEVENTS events will be simulated, using the config found at $SIMCONFIG"
83 if [ "$RECONSTRUCTION" -eq 1 ]; then
84 echo "Reconstruction options to be used : $RECOPTIONS"
85 if [ "$RAW" -eq 0 ]; then
86 echo "Will reconstruct from digits only (not from raw data)"
89 echo "Output directory will be : $OUTDIR"
91 if [ "$SIMULATION" -eq 1 ]; then
98 # Copy *ALL* the macros we need in the output directory, not to mess
99 # with our source dir in any way.
100 cp $ALICE_ROOT/MUON/.rootrc \
101 $ALICE_ROOT/MUON/rootlogon.C \
102 $ALICE_ROOT/MUON/runReconstruction.C $ALICE_ROOT/MUON/runSimulation.C \
103 $ALICE_ROOT/MUON/UpdateCDBCTPConfig.C \
104 $ALICE_ROOT/MUON/MUONefficiency.C \
105 $ALICE_ROOT/MUON/MUONTriggerEfficiency.C \
106 $ALICE_ROOT/MUON/MUONCheck.C \
111 if [ "$SLASHTMP" -eq 0 ]; then
115 mkdir ./tmp/mdc1/tags
120 chmod 777 ./tmp/mdc1/tags
122 export ALIMDC_RAWDB1=./tmp/mdc1
123 export ALIMDC_RAWDB2=./tmp/mdc2
124 export ALIMDC_TAGDB=./tmp/mdc1/tags
127 ###############################################################################
129 # Update CTP in OCDB for MUON Trigger
131 ###############################################################################
133 if [ ! -f $ALICE_ROOT/OCDB/GRP/CTP/Config/Run0_999999999_v0_s1.root ]; then
135 echo "Updating GRP CTP config ..."
137 aliroot -b >& $OUTDIR/updateCDBCTPConfig.out << EOF
138 .L UpdateCDBCTPConfig.C+
139 UpdateCDBCTPConfig();
146 ###############################################################################
148 # Performing SIMULATION
150 ###############################################################################
152 if [ "$SIMULATION" -eq 1 ]; then
154 echo "Running simulation ..."
156 aliroot -l -b -q runSimulation.C\($SEED,$NEVENTS,\""$SIMCONFIG"\"\) >& $OUTDIR/testSim.out
158 mkdir $OUTDIR/$SIMDIR
160 if [ "$RAW" -eq 1 ]; then
161 echo "Moving generated files to $SIMDIR"
162 mv $OUTDIR/*QA*.root $OUTDIR/*.log $OUTDIR/$SIMDIR
163 mv $OUTDIR/MUON*.root $OUTDIR/Kinematics*.root $OUTDIR/galice.root $OUTDIR/TrackRefs*.root $OUTDIR/$SIMDIR
165 echo "Copying generated files to $SIMDIR"
166 cp $OUTDIR/*QA*.root $OUTDIR/*.log $OUTDIR/$SIMDIR
167 cp $OUTDIR/MUON*.root $OUTDIR/Kinematics*.root $OUTDIR/galice.root $OUTDIR/TrackRefs*.root $OUTDIR/$SIMDIR
172 ###############################################################################
174 # Performing RECONSTRUCTION
176 ###############################################################################
178 if [ "$RECONSTRUCTION" -eq 1 ]; then
180 if [ "$RAW" -eq 1 ]; then
184 rm -f AliESD*.root *QA*.root
186 echo "Running reconstruction ..."
190 if [ "$RAW" -eq 1 ]; then
192 aliroot -l -b -q runReconstruction\.C\($SEED,\""$OUTDIR/raw.root"\",\""$RECOPTIONS"\"\) >& $OUTDIR/testReco.out
196 aliroot -l -b -q runReconstruction\.C\($SEED,\"""\",\""$RECOPTIONS"\"\) >& $OUTDIR/testReco.out
202 ###############################################################################
204 # Performing CHECKS (and dumps)
206 ###############################################################################
208 if [ "$CHECKS" -eq 1 ]; then
210 if [ -f "$OUTDIR/$SIMDIR/galice.root" ]; then
212 echo "Running efficiency ..."
214 aliroot -b >& $OUTDIR/testResults.out << EOF
216 // no argument assumes Upsilon but MUONefficiency(443) works on Jpsi
217 MUONefficiency("$OUTDIR/$SIMDIR/galice.root");
221 if [ -f "$OUTDIR/galice.root" ]; then
223 echo "Running Trigger efficiency ..."
224 aliroot -b >& $OUTDIR/testTriggerResults.out << EOF
225 .L MUONTriggerEfficiency.C+
226 MUONTriggerEfficiency("$OUTDIR/$SIMDIR/galice.root", "$OUTDIR/galice.root", 1);
230 if [ -f "$OUTDIR/AliESDs.root" ]; then
232 echo "Running check ..."
233 aliroot -b >& $OUTDIR/testCheck.out << EOF
234 gSystem->Load("libMUONevaluation");
236 MUONCheck(0, $NEVENTS-1, "$OUTDIR/$SIMDIR/galice.root", "$OUTDIR/galice.root", "$OUTDIR/AliESDs.root");
243 echo "Running dumps for selected event ($DUMPEVENT) ..."
245 if [ -f "$OUTDIR/$SIMDIR/galice.root" ]; then
247 AliCDBManager* man = AliCDBManager::Instance();
248 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
249 AliMUONMCDataInterface mcdSim("$OUTDIR/$SIMDIR/galice.root");
250 mcdSim.DumpKine($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.kine
251 mcdSim.DumpHits($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.hits
252 mcdSim.DumpTrackRefs($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.trackrefs
253 mcdSim.DumpDigits($DUMPEVENT,true); > $OUTDIR/dump.$DUMPEVENT.simdigits
254 mcdSim.DumpSDigits($DUMPEVENT,true); > $OUTDIR/dump.$DUMPEVENT.sdigits
258 echo "$OUTDIR/$SIMDIR/galice.root is not there. Skipping sim dumps"
261 if [ -f "$OUTDIR/galice.root" ]; then
263 AliCDBManager* man = AliCDBManager::Instance();
264 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
265 AliMUONDataInterface dRec("$OUTDIR/galice.root");
266 dRec.DumpDigits($DUMPEVENT,true); > $OUTDIR/dump.$DUMPEVENT.recdigits
267 dRec.DumpRecPoints($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.recpoints
268 dRec.DumpTrigger($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.trigger
272 echo "$OUTDIR/galice.root is not there. Skipping rec dumps"
277 echo "... see results in $OUTDIR"