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 MC="" # G3 Simulation with old Config.C
16 #MC="g3" # G3 Simulation (with new config macros)
17 #MC="g4" # G4 Simulation (with new config macros)
18 SIMCONFIG="$ALICE_ROOT/MUON/"$MC"Config.C" # default simulation configuration file
22 #RUN=0 # run number for OCDB access
23 SEED=1234567 # random number generator seed
24 SIMDIR="generated" # sub-directory where to move simulated files prior to reco
25 DUMPEVENT=5 # event to be dump on files
27 # next try to see if there are options of this script that want to change the
32 while getopts "SRZX:srxzn:tg:p:d:c:" option
35 R ) RECONSTRUCTION=1;;
42 r ) RECONSTRUCTION=0;;
47 c ) SIMCONFIG=$OPTARG;;
51 p ) RECOPTIONS=$OPTARG;;
52 * ) echo "Unimplemented option chosen."
58 if [ ! -n "$OUTDIR" ]; then
59 if [ "$MC" = "" ]; then
60 OUTDIR=$CURDIR"/test_out."$NEVENTS
62 OUTDIR=$CURDIR"/"$MC"_test_out."$NEVENTS
66 # look if there are some leftover options
67 shift $(($OPTIND - 1))
69 if [ $# -gt 0 ] || [ "$EXIT" -eq 1 ]; then
70 echo "ERROR : extra option not recognized"
71 echo "Usage: `basename $0` options (-SRXsrxn:tg:p:d:c:)"
72 echo " -S (-s) perform (or not) simulation (default is do it, i.e -S)"
73 echo " -R (-r) perform (or not) reconstruction (default is do it, i.e. -R)"
74 echo " -X event (-x) perform (or not) checks and dumps (default is do it for event $DUMPEVENT, i.e. -X $DUMPEVENT)"
75 echo " -Z (-z) perform reconstruction from raw data (from digits) (default is from raw data, i.e. -Z)"
76 echo " -n nevents (int) number of events to simulate (default $NEVENTS)"
77 echo " -t will use OUTDIR as a tmp directory to generate raw data "
78 echo " -g seed (uint) seed to be used in simulation (default $SEED)"
79 echo " -p recoptions (quotified string) reconstruction options to use (default \"$RECOPTIONS\")"
80 echo " -d full path to output directory (default $OUTDIR)"
81 echo " -c full path to configuration file for simulation (default $SIMCONFIG)"
85 # printout the options
86 echo "sim $SIMULATION rec $RECONSTRUCTION check $CHECKS"
87 if [ "$SIMULATION" -eq 1 ]; then
88 echo "$NEVENTS events will be simulated, using the config found at $SIMCONFIG"
90 if [ "$RECONSTRUCTION" -eq 1 ]; then
91 echo "Reconstruction options to be used : $RECOPTIONS"
92 if [ "$RAW" -eq 0 ]; then
93 echo "Will reconstruct from digits only (not from raw data)"
96 echo "Output directory will be : $OUTDIR"
98 if [ "$SIMULATION" -eq 1 ]; then
105 # Copy *ALL* the macros we need in the output directory, not to mess
106 # with our source dir in any way.
107 cp $ALICE_ROOT/MUON/.rootrc \
108 $ALICE_ROOT/MUON/rootlogon.C \
109 $ALICE_ROOT/MUON/runReconstruction.C $ALICE_ROOT/MUON/runSimulation.C \
110 $ALICE_ROOT/MUON/UpdateCDBCTPConfig.C \
111 $ALICE_ROOT/MUON/MUONefficiency.C \
112 $ALICE_ROOT/MUON/MUONTriggerEfficiency.C \
113 $ALICE_ROOT/MUON/MUONCheck.C \
118 if [ "$SLASHTMP" -eq 0 ]; then
122 mkdir ./tmp/mdc1/tags
127 chmod 777 ./tmp/mdc1/tags
129 export ALIMDC_RAWDB1=./tmp/mdc1
130 export ALIMDC_RAWDB2=./tmp/mdc2
131 export ALIMDC_TAGDB=./tmp/mdc1/tags
134 ###############################################################################
136 # Update CTP in OCDB for MUON Trigger
138 ###############################################################################
140 if [ ! -f $ALICE_ROOT/OCDB/GRP/CTP/Config/Run0_999999999_v0_s1.root ]; then
142 echo "Updating GRP CTP config ..."
144 aliroot -b >& $OUTDIR/updateCDBCTPConfig.out << EOF
145 .L UpdateCDBCTPConfig.C+
146 UpdateCDBCTPConfig();
153 ###############################################################################
155 # Performing SIMULATION
157 ###############################################################################
159 if [ "$SIMULATION" -eq 1 ]; then
161 echo "Running simulation ..."
163 aliroot -l -b -q runSimulation.C\($SEED,$NEVENTS,\""$SIMCONFIG"\"\) >& $OUTDIR/testSim.out
165 mkdir $OUTDIR/$SIMDIR
167 if [ "$RAW" -eq 1 ]; then
168 echo "Moving generated files to $SIMDIR"
169 mv $OUTDIR/*QA*.root $OUTDIR/*.log $OUTDIR/$SIMDIR
170 mv $OUTDIR/MUON*.root $OUTDIR/Kinematics*.root $OUTDIR/galice.root $OUTDIR/TrackRefs*.root $OUTDIR/$SIMDIR
172 echo "Copying generated files to $SIMDIR"
173 cp $OUTDIR/*QA*.root $OUTDIR/*.log $OUTDIR/$SIMDIR
174 cp $OUTDIR/MUON*.root $OUTDIR/Kinematics*.root $OUTDIR/galice.root $OUTDIR/TrackRefs*.root $OUTDIR/$SIMDIR
177 # save geometry file in a separate directory
178 if [ "$MC" = "g3" ]; then
179 rm -fr $ALICE_ROOT/MUON/geometry
180 mkdir $ALICE_ROOT/MUON/geometry
181 cp $OUTDIR/geometry.root $ALICE_ROOT/MUON/geometry
184 # copy input geometry file in a current directory
185 if [ "$MC" = "g4" ]; then
186 cp $ALICE_ROOT/MUON/geometry/geometry.root $OUTDIR
190 ###############################################################################
192 # Performing RECONSTRUCTION
194 ###############################################################################
196 if [ "$RECONSTRUCTION" -eq 1 ]; then
198 if [ "$RAW" -eq 1 ]; then
202 rm -f AliESD*.root *QA*.root
204 echo "Running reconstruction ..."
208 if [ "$RAW" -eq 1 ]; then
210 aliroot -l -b -q runReconstruction\.C\($SEED,\""$OUTDIR/raw.root"\",\""$RECOPTIONS"\"\) >& $OUTDIR/testReco.out
214 aliroot -l -b -q runReconstruction\.C\($SEED,\"""\",\""$RECOPTIONS"\"\) >& $OUTDIR/testReco.out
220 ###############################################################################
222 # Performing CHECKS (and dumps)
224 ###############################################################################
226 if [ "$CHECKS" -eq 1 ]; then
228 if [ -f "$OUTDIR/$SIMDIR/galice.root" ]; then
230 echo "Running efficiency ..."
232 aliroot -b >& $OUTDIR/testResults.out << EOF
234 // no argument assumes Upsilon but MUONefficiency(443) works on Jpsi
235 MUONefficiency("$OUTDIR/$SIMDIR/galice.root");
239 if [ -f "$OUTDIR/galice.root" ]; then
241 echo "Running Trigger efficiency ..."
242 aliroot -b >& $OUTDIR/testTriggerResults.out << EOF
243 .L MUONTriggerEfficiency.C+
244 MUONTriggerEfficiency("$OUTDIR/$SIMDIR/galice.root", "$OUTDIR/galice.root", 1);
248 if [ -f "$OUTDIR/AliESDs.root" ]; then
250 echo "Running check ..."
251 aliroot -b >& $OUTDIR/testCheck.out << EOF
252 gSystem->Load("libMUONevaluation");
254 MUONCheck(0, $NEVENTS-1, "$OUTDIR/$SIMDIR/galice.root", "$OUTDIR/galice.root", "$OUTDIR/AliESDs.root");
261 echo "Running dumps for selected event ($DUMPEVENT) ..."
263 if [ -f "$OUTDIR/$SIMDIR/galice.root" ]; then
265 AliCDBManager* man = AliCDBManager::Instance();
266 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
267 AliMUONMCDataInterface mcdSim("$OUTDIR/$SIMDIR/galice.root");
268 mcdSim.DumpKine($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.kine
269 mcdSim.DumpHits($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.hits
270 mcdSim.DumpTrackRefs($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.trackrefs
271 mcdSim.DumpDigits($DUMPEVENT,true); > $OUTDIR/dump.$DUMPEVENT.simdigits
272 mcdSim.DumpSDigits($DUMPEVENT,true); > $OUTDIR/dump.$DUMPEVENT.sdigits
276 echo "$OUTDIR/$SIMDIR/galice.root is not there. Skipping sim dumps"
279 if [ -f "$OUTDIR/galice.root" ]; then
281 AliCDBManager* man = AliCDBManager::Instance();
282 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
283 AliMUONDataInterface dRec("$OUTDIR/galice.root");
284 dRec.DumpDigits($DUMPEVENT,true); > $OUTDIR/dump.$DUMPEVENT.recdigits
285 dRec.DumpRecPoints($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.recpoints
286 dRec.DumpTrigger($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.trigger
290 echo "$OUTDIR/galice.root is not there. Skipping rec dumps"
295 echo "... see results in $OUTDIR"