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