]>
Commit | Line | Data |
---|---|---|
fa701981 | 1 | #!/bin/sh |
2 | # $Id$ | |
3 | ||
aefc4e02 | 4 | # first declare default values |
5 | ||
6 | SIMULATION=1 # will perform simulation | |
7 | RECONSTRUCTION=1 # will perform reconstruction | |
388c6fb1 | 8 | RAW=1 # will reconstruct from raw data |
aefc4e02 | 9 | CHECKS=1 # will perform checks |
0be3d079 | 10 | SLASHTMP=1 #will use /tmp to put the temporary raw data |
ed90feae | 11 | NEVENTS=50 # will simulate 100 events |
32bf5f82 | 12 | |
5f3519d9 | 13 | #RECOPTIONS="SAVEDIGITS NOFASTDECODERS" # reconstruction options with non-high performance decoders |
aefc4e02 | 14 | RECOPTIONS="SAVEDIGITS" # default reconstruction options |
6ef73001 | 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) | |
ca8c8223 | 18 | |
aefc4e02 | 19 | OUTDIR="" |
fa701981 | 20 | CURDIR=`pwd` |
fa701981 | 21 | |
745f6baf | 22 | #RUN=0 # run number for OCDB access |
aefc4e02 | 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 | |
26 | ||
ca8c8223 | 27 | SIMCONFIG="$ALICE_ROOT/MUON/"$MC"Config.C" |
28 | EMBEDWITH="" # no embedding by default | |
29 | ||
aefc4e02 | 30 | # next try to see if there are options of this script that want to change the |
31 | # defaults | |
32 | ||
33 | EXIT=0 | |
34 | ||
ca8c8223 | 35 | while getopts "SRZX:srxzn:tg:p:d:c:e:" option |
aefc4e02 | 36 | do |
37 | case $option in | |
38 | R ) RECONSTRUCTION=1;; | |
39 | S ) SIMULATION=1;; | |
40 | X ) | |
41 | CHECKS=1 | |
42 | DUMPEVENT=$OPTARG | |
43 | ;; | |
388c6fb1 | 44 | Z ) RAW=1;; |
aefc4e02 | 45 | r ) RECONSTRUCTION=0;; |
46 | s ) SIMULATION=0;; | |
47 | x ) CHECKS=0;; | |
0be3d079 | 48 | t ) SLASHTMP=0;; |
388c6fb1 | 49 | z ) RAW=0;; |
aefc4e02 | 50 | c ) SIMCONFIG=$OPTARG;; |
51 | d ) OUTDIR=$OPTARG;; | |
52 | n ) NEVENTS=$OPTARG;; | |
0be3d079 | 53 | g ) SEED=$OPTARG;; |
aefc4e02 | 54 | p ) RECOPTIONS=$OPTARG;; |
ca8c8223 | 55 | e ) EMBEDWITH=$OPTARG;; |
aefc4e02 | 56 | * ) echo "Unimplemented option chosen." |
57 | EXIT=1 | |
58 | ;; | |
59 | esac | |
60 | done | |
61 | ||
62 | if [ ! -n "$OUTDIR" ]; then | |
6ef73001 | 63 | if [ "$MC" = "" ]; then |
64 | OUTDIR=$CURDIR"/test_out."$NEVENTS | |
65 | else | |
66 | OUTDIR=$CURDIR"/"$MC"_test_out."$NEVENTS | |
67 | fi | |
aefc4e02 | 68 | fi |
69 | ||
70 | # look if there are some leftover options | |
71 | shift $(($OPTIND - 1)) | |
72 | ||
73 | if [ $# -gt 0 ] || [ "$EXIT" -eq 1 ]; then | |
74 | echo "ERROR : extra option not recognized" | |
0be3d079 | 75 | echo "Usage: `basename $0` options (-SRXsrxn:tg:p:d:c:)" |
aefc4e02 | 76 | echo " -S (-s) perform (or not) simulation (default is do it, i.e -S)" |
77 | echo " -R (-r) perform (or not) reconstruction (default is do it, i.e. -R)" | |
78 | echo " -X event (-x) perform (or not) checks and dumps (default is do it for event $DUMPEVENT, i.e. -X $DUMPEVENT)" | |
388c6fb1 | 79 | echo " -Z (-z) perform reconstruction from raw data (from digits) (default is from raw data, i.e. -Z)" |
aefc4e02 | 80 | echo " -n nevents (int) number of events to simulate (default $NEVENTS)" |
0be3d079 | 81 | echo " -t will use OUTDIR as a tmp directory to generate raw data " |
82 | echo " -g seed (uint) seed to be used in simulation (default $SEED)" | |
aefc4e02 | 83 | echo " -p recoptions (quotified string) reconstruction options to use (default \"$RECOPTIONS\")" |
84 | echo " -d full path to output directory (default $OUTDIR)" | |
85 | echo " -c full path to configuration file for simulation (default $SIMCONFIG)" | |
ca8c8223 | 86 | echo " -e full path to a galice.root file relating to SDigits to be merged (embedding)" |
aefc4e02 | 87 | exit 4; |
88 | fi | |
89 | ||
ca8c8223 | 90 | |
aefc4e02 | 91 | # printout the options |
92 | echo "sim $SIMULATION rec $RECONSTRUCTION check $CHECKS" | |
93 | if [ "$SIMULATION" -eq 1 ]; then | |
94 | echo "$NEVENTS events will be simulated, using the config found at $SIMCONFIG" | |
95 | fi | |
ca8c8223 | 96 | if [ -n "$EMBEDWITH" ]; then |
97 | echo "Will embed simulation with $EMBEDWITH" | |
98 | fi | |
aefc4e02 | 99 | if [ "$RECONSTRUCTION" -eq 1 ]; then |
100 | echo "Reconstruction options to be used : $RECOPTIONS" | |
388c6fb1 | 101 | if [ "$RAW" -eq 0 ]; then |
102 | echo "Will reconstruct from digits only (not from raw data)" | |
103 | fi | |
aefc4e02 | 104 | fi |
105 | echo "Output directory will be : $OUTDIR" | |
106 | ||
107 | if [ "$SIMULATION" -eq 1 ]; then | |
108 | ||
109 | rm -fr $OUTDIR | |
110 | mkdir $OUTDIR | |
111 | ||
112 | fi | |
113 | ||
8601c864 | 114 | # Copy *ALL* the macros we need in the output directory, not to mess |
115 | # with our source dir in any way. | |
116 | cp $ALICE_ROOT/MUON/.rootrc \ | |
117 | $ALICE_ROOT/MUON/rootlogon.C \ | |
118 | $ALICE_ROOT/MUON/runReconstruction.C $ALICE_ROOT/MUON/runSimulation.C \ | |
119 | $ALICE_ROOT/MUON/UpdateCDBCTPConfig.C \ | |
120 | $ALICE_ROOT/MUON/MUONefficiency.C \ | |
121 | $ALICE_ROOT/MUON/MUONTriggerEfficiency.C \ | |
122 | $ALICE_ROOT/MUON/MUONCheck.C \ | |
123 | $OUTDIR | |
aefc4e02 | 124 | |
fa701981 | 125 | cd $OUTDIR |
126 | ||
0be3d079 | 127 | if [ "$SLASHTMP" -eq 0 ]; then |
128 | mkdir ./tmp | |
129 | mkdir ./tmp/mdc1 | |
130 | mkdir ./tmp/mdc2 | |
131 | mkdir ./tmp/mdc1/tags | |
132 | ||
133 | chmod 777 ./tmp | |
134 | chmod 777 ./tmp/mdc1 | |
135 | chmod 777 ./tmp/mdc2 | |
136 | chmod 777 ./tmp/mdc1/tags | |
137 | ||
138 | export ALIMDC_RAWDB1=./tmp/mdc1 | |
139 | export ALIMDC_RAWDB2=./tmp/mdc2 | |
140 | export ALIMDC_TAGDB=./tmp/mdc1/tags | |
141 | fi | |
142 | ||
cbb5526b | 143 | ############################################################################### |
144 | # | |
145 | # Update CTP in OCDB for MUON Trigger | |
146 | # | |
147 | ############################################################################### | |
148 | ||
6468ad42 | 149 | if [ ! -f $ALICE_ROOT/OCDB/GRP/CTP/Config/Run0_999999999_v0_s1.root ]; then |
cbb5526b | 150 | |
151 | echo "Updating GRP CTP config ..." | |
152 | ||
81b089d7 | 153 | aliroot -b > $OUTDIR/updateCDBCTPConfig.out 2>&1 << EOF |
ca8c8223 | 154 | .L UpdateCDBCTPConfig.C++g |
cbb5526b | 155 | UpdateCDBCTPConfig(); |
156 | .q | |
157 | EOF | |
158 | ||
159 | fi | |
160 | ||
161 | ||
aefc4e02 | 162 | ############################################################################### |
163 | # | |
164 | # Performing SIMULATION | |
165 | # | |
166 | ############################################################################### | |
fa701981 | 167 | |
aefc4e02 | 168 | if [ "$SIMULATION" -eq 1 ]; then |
fa701981 | 169 | |
aefc4e02 | 170 | echo "Running simulation ..." |
858e5b75 | 171 | |
ca8c8223 | 172 | aliroot -l -b -q runSimulation.C\($SEED,$NEVENTS,\""$SIMCONFIG"\"\,\""$EMBEDWITH"\"\) > $OUTDIR/testSim.out 2>&1 |
388c6fb1 | 173 | |
aefc4e02 | 174 | mkdir $OUTDIR/$SIMDIR |
fa701981 | 175 | |
388c6fb1 | 176 | if [ "$RAW" -eq 1 ]; then |
177 | echo "Moving generated files to $SIMDIR" | |
178 | mv $OUTDIR/*QA*.root $OUTDIR/*.log $OUTDIR/$SIMDIR | |
179 | mv $OUTDIR/MUON*.root $OUTDIR/Kinematics*.root $OUTDIR/galice.root $OUTDIR/TrackRefs*.root $OUTDIR/$SIMDIR | |
180 | else | |
181 | echo "Copying generated files to $SIMDIR" | |
182 | cp $OUTDIR/*QA*.root $OUTDIR/*.log $OUTDIR/$SIMDIR | |
183 | cp $OUTDIR/MUON*.root $OUTDIR/Kinematics*.root $OUTDIR/galice.root $OUTDIR/TrackRefs*.root $OUTDIR/$SIMDIR | |
184 | fi | |
6ef73001 | 185 | |
186 | # save geometry file in a separate directory | |
187 | if [ "$MC" = "g3" ]; then | |
188 | rm -fr $ALICE_ROOT/MUON/geometry | |
189 | mkdir $ALICE_ROOT/MUON/geometry | |
190 | cp $OUTDIR/geometry.root $ALICE_ROOT/MUON/geometry | |
191 | fi | |
192 | ||
193 | # copy input geometry file in a current directory | |
194 | if [ "$MC" = "g4" ]; then | |
195 | cp $ALICE_ROOT/MUON/geometry/geometry.root $OUTDIR | |
196 | fi | |
aefc4e02 | 197 | fi |
fa701981 | 198 | |
aefc4e02 | 199 | ############################################################################### |
200 | # | |
201 | # Performing RECONSTRUCTION | |
202 | # | |
203 | ############################################################################### | |
204 | ||
205 | if [ "$RECONSTRUCTION" -eq 1 ]; then | |
206 | ||
388c6fb1 | 207 | if [ "$RAW" -eq 1 ]; then |
208 | rm -f galice.root | |
209 | fi | |
210 | ||
211 | rm -f AliESD*.root *QA*.root | |
212 | ||
aefc4e02 | 213 | echo "Running reconstruction ..." |
214 | ||
215 | cd $OUTDIR | |
216 | ||
ca8c8223 | 217 | BOOLEMBED=kFALSE |
218 | ||
219 | if [ -n "$EMBEDWITH" ]; then | |
220 | BOOLEMBED=kTRUE | |
221 | fi | |
222 | ||
388c6fb1 | 223 | if [ "$RAW" -eq 1 ]; then |
224 | ||
ca8c8223 | 225 | aliroot -l -b -q runReconstruction\.C\($SEED,\""$OUTDIR/raw.root"\",\""$RECOPTIONS"\",$BOOLEMBED\) > $OUTDIR/testReco.out 2>&1 |
388c6fb1 | 226 | |
227 | else | |
aefc4e02 | 228 | |
ca8c8223 | 229 | aliroot -l -b -q runReconstruction\.C\($SEED,\"""\",\""$RECOPTIONS"\",$BOOLEMBED\) > $OUTDIR/testReco.out 2>&1 |
388c6fb1 | 230 | |
231 | fi | |
232 | ||
aefc4e02 | 233 | fi |
858e5b75 | 234 | |
aefc4e02 | 235 | ############################################################################### |
236 | # | |
237 | # Performing CHECKS (and dumps) | |
238 | # | |
239 | ############################################################################### | |
32bf5f82 | 240 | |
aefc4e02 | 241 | if [ "$CHECKS" -eq 1 ]; then |
8dc57946 | 242 | |
029d450d | 243 | if [ -f "$OUTDIR/$SIMDIR/galice.root" ]; then |
32bf5f82 | 244 | |
aefc4e02 | 245 | echo "Running efficiency ..." |
246 | ||
81b089d7 | 247 | aliroot -b > $OUTDIR/testResults.out 2>&1 << EOF |
ca8c8223 | 248 | .L MUONefficiency.C++g |
aefc4e02 | 249 | // no argument assumes Upsilon but MUONefficiency(443) works on Jpsi |
250 | MUONefficiency("$OUTDIR/$SIMDIR/galice.root"); | |
251 | .q | |
252 | EOF | |
253 | ||
029d450d | 254 | if [ -f "$OUTDIR/galice.root" ]; then |
aefc4e02 | 255 | |
256 | echo "Running Trigger efficiency ..." | |
81b089d7 | 257 | aliroot -b > $OUTDIR/testTriggerResults.out 2>&1 << EOF |
ca8c8223 | 258 | .L MUONTriggerEfficiency.C++g |
aefc4e02 | 259 | MUONTriggerEfficiency("$OUTDIR/$SIMDIR/galice.root", "$OUTDIR/galice.root", 1); |
260 | .q | |
8dc57946 | 261 | EOF |
858e5b75 | 262 | |
029d450d | 263 | if [ -f "$OUTDIR/AliESDs.root" ]; then |
264 | ||
265 | echo "Running check ..." | |
81b089d7 | 266 | aliroot -b > $OUTDIR/testCheck.out 2>&1 << EOF |
029d450d | 267 | gSystem->Load("libMUONevaluation"); |
ca8c8223 | 268 | .L MUONCheck.C++g |
029d450d | 269 | MUONCheck(0, $NEVENTS-1, "$OUTDIR/$SIMDIR/galice.root", "$OUTDIR/galice.root", "$OUTDIR/AliESDs.root"); |
270 | .q | |
aefc4e02 | 271 | EOF |
029d450d | 272 | fi |
aefc4e02 | 273 | fi |
274 | fi | |
275 | ||
276 | echo "Running dumps for selected event ($DUMPEVENT) ..." | |
277 | ||
278 | if [ -f "$OUTDIR/$SIMDIR/galice.root" ]; then | |
0d2fa09b | 279 | aliroot -l -b << EOF |
ca8c8223 | 280 | AliCDBManager* man = AliCDBManager::Instance(); |
162637e4 | 281 | man->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); |
aefc4e02 | 282 | AliMUONMCDataInterface mcdSim("$OUTDIR/$SIMDIR/galice.root"); |
283 | mcdSim.DumpKine($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.kine | |
284 | mcdSim.DumpHits($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.hits | |
285 | mcdSim.DumpTrackRefs($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.trackrefs | |
286 | mcdSim.DumpDigits($DUMPEVENT,true); > $OUTDIR/dump.$DUMPEVENT.simdigits | |
287 | mcdSim.DumpSDigits($DUMPEVENT,true); > $OUTDIR/dump.$DUMPEVENT.sdigits | |
288 | .q | |
289 | EOF | |
290 | else | |
291 | echo "$OUTDIR/$SIMDIR/galice.root is not there. Skipping sim dumps" | |
292 | fi | |
293 | ||
294 | if [ -f "$OUTDIR/galice.root" ]; then | |
0d2fa09b | 295 | aliroot -l -b << EOF |
07be5a4f | 296 | AliCDBManager* man = AliCDBManager::Instance(); |
162637e4 | 297 | man->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); |
aefc4e02 | 298 | AliMUONDataInterface dRec("$OUTDIR/galice.root"); |
299 | dRec.DumpDigits($DUMPEVENT,true); > $OUTDIR/dump.$DUMPEVENT.recdigits | |
300 | dRec.DumpRecPoints($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.recpoints | |
aefc4e02 | 301 | dRec.DumpTrigger($DUMPEVENT); > $OUTDIR/dump.$DUMPEVENT.trigger |
302 | .q | |
303 | EOF | |
304 | else | |
305 | echo "$OUTDIR/galice.root is not there. Skipping rec dumps" | |
306 | fi | |
307 | fi | |
32bf5f82 | 308 | |
fa701981 | 309 | echo "Finished" |
aefc4e02 | 310 | echo "... see results in $OUTDIR" |
fa701981 | 311 | |
312 | cd $CURDIR |