]>
Commit | Line | Data |
---|---|---|
5934a3e3 | 1 | #!/bin/bash |
2 | # | |
3 | # BEGIN_MANUAL | |
4 | # | |
5 | # First, one need to figure out what to analyse. Visit the MonAlisa | |
6 | # pages and find | |
7 | # | |
8 | # * The list of runs and put that in a file - say runs.list | |
9 | # * The directory where the ESD files are stored | |
10 | # - and the pattern that will match these for all runs | |
11 | # * The directory where the MC ESD files are stored | |
12 | # - and the pattern that will match these for all runs | |
13 | # | |
14 | # Then, one needs to run this script in set-up mode e.g., | |
15 | # | |
1ff25622 | 16 | # $0 --what=setup \ |
8449e3e0 | 17 | # --name=LHC10h \ |
5934a3e3 | 18 | # --real-dir=/alice/data/2010/LHC10h \ |
19 | # --real-pattern=ESDs/pass2/*/AliESDs.root \ | |
1ff25622 | 20 | # --mc-dir=/alice/sim/LHC10h11 \ |
5934a3e3 | 21 | # --mc-pattern=*/AliESDs.root \ |
8449e3e0 | 22 | # --runs=LHC10.list \ |
23 | # --par | |
5934a3e3 | 24 | # |
25 | # Note, all the settings are written to the file .config in the | |
26 | # current directory, so you do not need to give the parameters at | |
27 | # subsequent steps. As an alternative to giving the parameters, one | |
28 | # can create the file by hand. | |
29 | # | |
30 | # Next, we need to generate the corrections. Do | |
31 | # | |
1ff25622 | 32 | # $0 --what=corrs |
5934a3e3 | 33 | # |
8449e3e0 | 34 | # and wait for the jobs to finish and terminate. If 'watching' is |
35 | # turned off, one can also monitor output on MonAlisa, and then when | |
36 | # enough has finished, execute | |
5934a3e3 | 37 | # |
1ff25622 | 38 | # $0 --what=corrs --step=terminate |
5934a3e3 | 39 | # |
1ff25622 | 40 | # enough times to get the final merged result. Next, we need to |
41 | # extract and upload the corrections to our local corrections folder | |
5934a3e3 | 42 | # |
1ff25622 | 43 | # $0 --what=corrs --step=upload |
5934a3e3 | 44 | # |
45 | # Now we can submit our AOD generation jobs. Do | |
46 | # | |
1ff25622 | 47 | # $0 --what=aods |
5934a3e3 | 48 | # |
8449e3e0 | 49 | # and wait for the jobs to finish and terminate. If 'watching' is |
50 | # turned off, one can also monitor output on MonAlisa, and then when | |
51 | # enough has finished, execute | |
5934a3e3 | 52 | # |
1ff25622 | 53 | # $0 --what=aods --step=terminate |
5934a3e3 | 54 | # |
1ff25622 | 55 | # enough times to get the final merged result. Next, we need to |
56 | # download the results and we draw the summary results | |
5934a3e3 | 57 | # |
1ff25622 | 58 | # $0 --what aods --step=draw |
5934a3e3 | 59 | # |
60 | # Now, we should do the dN/deta analysis. Do | |
61 | # | |
1ff25622 | 62 | # $0 --what=dndetas |
5934a3e3 | 63 | # |
8449e3e0 | 64 | # and wait for the jobs to finish and terminate. If 'watching' is |
65 | # turned off, one can also monitor output on MonAlisa, and then when | |
66 | # enough has finished, execute | |
5934a3e3 | 67 | # |
1ff25622 | 68 | # $0 --what=dndetas --step=terminate |
5934a3e3 | 69 | # |
70 | # enough times to get the final merged result. Next, we need to download | |
1ff25622 | 71 | # the results and we can draw the summary and final plot |
5934a3e3 | 72 | # |
1ff25622 | 73 | # $0 --what=dndetas --step=draw |
5934a3e3 | 74 | # |
75 | # Enjoy | |
76 | # | |
77 | # END_MANUAL | |
78 | ||
79 | runs= | |
80 | name= | |
81 | sys=1 | |
82 | snn=900 | |
83 | field=5 | |
84 | corrs=corrections | |
85 | dotconf=.config | |
86 | here=${PWD} | |
87 | par=0 | |
88 | noact=0 | |
8449e3e0 | 89 | # aliroot="&aliroot=v5-03-75pATF-AN" |
5934a3e3 | 90 | # root="root=v5-34-02-1" |
1ff25622 | 91 | fwd_dir=$ALICE_ROOT/PWGLF/FORWARD/analysis2 |
5934a3e3 | 92 | |
93 | real_dir= | |
94 | real_pat= | |
95 | mc_dir= | |
96 | mc_pat= | |
1ff25622 | 97 | my_real_dir= |
5934a3e3 | 98 | my_mc_dir= |
99 | ||
1ff25622 | 100 | # === Various functions ============================================== |
5934a3e3 | 101 | # --- Usage ---------------------------------------------------------- |
102 | usage() | |
103 | { | |
104 | cat <<EOF | |
105 | Usage: $0 --what OPERATION [OPTIONS] | |
106 | ||
107 | Options: | |
108 | -r,--runs=FILENAME Specify list of runs file ($runs) | |
109 | -n,--name=STRING Base name of jobs ($name) | |
110 | -S,--sys=SYSTEM Collision system ($sys) | |
111 | -E,--snn=ENERGY Center of mass energy per nuclean pair ($snn) | |
112 | -F,--field=FIELD L3 magnetic field ($field) | |
113 | -d,--real-dir=ALIEN_DIR Directory holding real data ($real_dir) | |
114 | -p,--real-pattern=PATTERN Glob pattern to match when searching ($real_pat) | |
115 | -D,--mc-dir=ALIEN_DIR Directory holding MC data ($mc_dir) | |
116 | -P,--mc-pattern=PATTERN Glob pattern to match when searching ($mc_pat) | |
117 | -s,--step=STEP Run stage ($step) | |
118 | -w,--what=TRAINS What to do | |
8449e3e0 | 119 | -W,--watch Watch for job status and terminate automatically |
5934a3e3 | 120 | -a,--par Use par files ($par) |
121 | -M,--man Show the manual | |
122 | -N,--noact Show what will be done | |
123 | ||
124 | TRAINS is one of | |
125 | ||
126 | clean Clean directory | |
127 | setup Do intial setup | |
128 | corrs Generate corrections | |
129 | aods Generate AODs | |
130 | dndeta Generate dNdeta | |
131 | ||
132 | and must be executed in that order. STEP is one of | |
133 | ||
134 | full Run the analysis | |
135 | terminate Terminate the job (may need iterations) | |
1ff25622 | 136 | upload Upload corrections (only for TRAINS=corrs) |
137 | draw Draw (partial) results (not for TRAINS=corrs) | |
5934a3e3 | 138 | EOF |
139 | } | |
140 | ||
141 | # --- Manual --------------------------------------------------------- | |
142 | manual() | |
143 | { | |
144 | grep ^# $0 | \ | |
145 | sed -n -e '/BEGIN_MANUAL/,/END_MANUAL/ p' | \ | |
146 | sed -e '/\(BEGIN\|END\)_MANUAL/ d' -e 's/^# //' -e "s,\$0,$0," | |
147 | } | |
148 | ||
1ff25622 | 149 | # === Utilities to execute scripts =================================== |
150 | # --- Run script ----------------------------------------------------- | |
151 | script() | |
152 | { | |
153 | local scr=$1 ; shift | |
154 | local args=$1 ; shift | |
155 | echo "Will run aliroot -l -b -q $scr($args)" | |
156 | if test $noact -gt 0 ; then return ; fi | |
157 | aliroot -l -b <<EOF | |
158 | .x $scr($args) | |
159 | .q | |
160 | EOF | |
161 | } | |
162 | # --- Run acceptance generation -------------------------------------- | |
163 | accGen() | |
164 | { | |
165 | local run=$1 | |
8449e3e0 | 166 | script ${fwd_dir}/corrs/ExtractAcceptance.C "${run}" |
1ff25622 | 167 | } |
168 | ||
169 | # --- Extract corrections -------------------------------------------- | |
170 | terminate() | |
171 | { | |
172 | script Terminate.C | |
173 | } | |
174 | # --- Extract corrections -------------------------------------------- | |
175 | download() | |
176 | { | |
8449e3e0 | 177 | if test -f .download ; then |
178 | echo "Already downloaded in `basename $PWD`" | |
179 | return 0 | |
180 | fi | |
1ff25622 | 181 | script Download.C |
182 | touch .download | |
183 | } | |
184 | # --- Extract corrections -------------------------------------------- | |
185 | extract() | |
186 | { | |
187 | test -f .extract && return 0 | |
188 | script Extract.C | |
189 | touch .extract | |
190 | } | |
8449e3e0 | 191 | # --- Extract corrections -------------------------------------------- |
192 | extract_up() | |
193 | { | |
194 | if test -f .extract ; then | |
195 | echo "Aldready extracted in `basename $PWD`" | |
196 | return 0; | |
197 | fi | |
198 | echo "= Extracting" | |
199 | script ../Extract.C > /dev/null 2>&1 | |
200 | touch .extract | |
201 | } | |
1ff25622 | 202 | # --- Upload a file -------------------------------------------------- |
203 | upload() | |
204 | { | |
8449e3e0 | 205 | if test -f .upload ; then |
206 | echo "Already uploaded in `basename $PWD`" | |
207 | return 0 | |
208 | fi | |
209 | echo "= Uploading" | |
210 | script Upload.C \"file://${here}/${name}_corrs_${now}/\" >/dev/null 2>&1 | |
1ff25622 | 211 | touch .upload |
212 | } | |
213 | # --- Extract and upload --------------------------------------------- | |
214 | extract_upload() | |
215 | { | |
8449e3e0 | 216 | echo "=== Download, extract, and uploade in `basename $PWD` ===" |
1ff25622 | 217 | download |
218 | for i in *.zip ; do | |
219 | if test ! -f $i ; then continue ; fi | |
1ff25622 | 220 | if test $noact -gt 0 ; then continue ; fi |
8449e3e0 | 221 | local d=`basename $i .zip` |
222 | if test ! -d $d ; then | |
223 | mkdir $d | |
224 | fi | |
225 | cd $d | |
226 | if test ! -f .zip ; then | |
227 | echo "= Unpacking ../$i" | |
228 | unzip ../$i > /dev/null 2>&1 | |
229 | touch .zip | |
230 | fi | |
231 | extract_up | |
232 | upload | |
233 | cd .. | |
1ff25622 | 234 | done |
235 | } | |
236 | ||
237 | # --- Draw ----------------------------------------------------------- | |
238 | draw() | |
239 | { | |
240 | local scr=$1 | |
241 | download | |
242 | for i in *.zip ; do | |
243 | d=`basename $i .zip` | |
73b32206 | 244 | if test ! -d $d ; then |
245 | mkdir -p $d | |
246 | unzip $i -d $d | |
247 | fi | |
1ff25622 | 248 | (cd $d && script $scr) |
249 | done | |
250 | } | |
251 | ||
5934a3e3 | 252 | # --- Get the grid home dir ------------------------------------------ |
253 | outputs() | |
254 | { | |
255 | l=`aliroot -l -b <<EOF | |
256 | gSystem->RedirectOutput("/dev/null"); | |
257 | TGrid::Connect("alien://"); | |
258 | gSystem->RedirectOutput(0); | |
259 | std::cout << gGrid->GetHomeDirectory() << std::endl; | |
260 | EOF` | |
73b32206 | 261 | my_real_dir="$l/${name}_aod_${now}/output" |
262 | my_mc_dir="$l/${name}_mcaod_${now}/output" | |
5934a3e3 | 263 | } |
264 | ||
1ff25622 | 265 | # === Trains ========================================================= |
266 | # --- Run set-ups ---------------------------------------------------- | |
267 | setup() | |
268 | { | |
8449e3e0 | 269 | run_for_acc=`grep -v ^# $runs | awk '{FS=" \n\t"}{printf "%d\n", $1}' | head -n 1` |
1ff25622 | 270 | if test x$run_for_acc = "x" || test $run_for_acc -lt 1; then |
271 | echo "No run for acceptance correction specified" > /dev/stderr | |
272 | exit 1 | |
273 | fi | |
274 | ||
275 | now=`date '+%Y%m%d_%H%M'` | |
276 | outputs | |
277 | ||
8449e3e0 | 278 | # Write settings to a file, which we later can source |
279 | cat > ${dotconf} <<EOF | |
1ff25622 | 280 | name="$name" |
281 | runs=${runs} | |
282 | sys=$sys | |
283 | snn=$snn | |
284 | field=$field | |
285 | real_dir=${real_dir} | |
286 | real_pat=${real_pat} | |
287 | mc_dir=${mc_dir} | |
288 | mc_pat=${mc_pat} | |
289 | my_real_dir=${my_real_dir} | |
290 | my_mc_dir=${my_mc_dir} | |
291 | par=${par} | |
292 | now=${now} | |
293 | EOF | |
294 | ||
295 | if test $noact -lt 1 ; then | |
296 | mkdir -p ${name}_acc_${now} | |
8449e3e0 | 297 | mkdir -p ${name}_corrs_${now} |
298 | rm -f last_${name}_acc last_${name}_corrs | |
299 | ln -sf ${name}_acc_${now} last_${name}_acc | |
300 | ln -sf ${name}_corrs_${now} last_${name}_corrs | |
301 | cat <<-EOF > ${name}_corrs_${now}/Browse.C | |
302 | TObject* Browse() | |
303 | { | |
304 | const char* fwd = "$ALICE_ROOT/PWGLF/FORWARD/analysis2"; | |
305 | if (!gROOT->GetClass("AliOADBForward")) | |
306 | gROOT->Macro(Form("%s/scripts/LoadLibs.C", fwd)); | |
307 | gROOT->LoadMacro(Form("%s/corrs/ForwardOADBGui.C++g", fwd)); | |
308 | ||
309 | AliOADBForward* db = new AliOADBForward; | |
310 | db->Open("fmd_corrections.root", "*"); | |
311 | ||
312 | ForwardOADBGui(db); | |
313 | ||
314 | return db; | |
315 | } | |
316 | EOF | |
1ff25622 | 317 | fi |
318 | echo "Make acceptance corrections" | |
319 | (cd ${name}_acc_${now} && \ | |
320 | accGen $run_for_acc && \ | |
321 | upload ) | |
322 | } | |
323 | ||
324 | # --- Run set-ups ---------------------------------------------------- | |
325 | cleanup() | |
326 | { | |
327 | rm -rf \ | |
328 | ${name}_acc_${now} \ | |
329 | ${name}_mccorr_${now} \ | |
330 | ${name}_mceloss_${now} \ | |
331 | ${name}_eloss_${now} \ | |
332 | ${name}_mcaod_${now} \ | |
333 | ${name}_aod_${now} \ | |
334 | ${name}_mcdndeta_${now} \ | |
335 | ${name}_dndeta_${now} \ | |
336 | ${name}_corrs_${now} | |
337 | } | |
338 | ||
5934a3e3 | 339 | # --- Check settings ------------------------------------------------- |
340 | check() | |
341 | { | |
342 | if test "x$runs" = "x" || test ! -f $runs ; then | |
343 | echo "List of run file $runs not found" > /dev/stderr | |
344 | exit 1 | |
345 | fi | |
346 | if test "X$name" = X ; then | |
347 | echo "No name specified" > /dev/stderr | |
348 | exit 1 | |
349 | fi | |
8449e3e0 | 350 | # if test "x$sys" = "x" ; then |
351 | # echo "No collision system specified" > /dev/stderr | |
352 | # exit 1 | |
353 | # fi | |
354 | # if test "x$snn" = "x" ; then | |
355 | # echo "No center of mass energy specified" > /dev/stderr | |
356 | # exit 1 | |
357 | # fi | |
358 | # if test "x$field" = "x" ; then | |
359 | # echo "No L3 field setting specified" > /dev/stderr | |
360 | # exit 1 | |
361 | # fi | |
5934a3e3 | 362 | if test "x$real_dir" = "x" ; then |
363 | echo "No real data directory specified" > /dev/stderr | |
364 | exit 1 | |
365 | fi | |
366 | if test "x$mc_dir" = "x" ; then | |
367 | echo "No MC data directory specified" > /dev/stderr | |
368 | exit 1 | |
369 | fi | |
370 | if test "x$real_pat" = "x" ; then | |
371 | echo "No real data pattern specified" > /dev/stderr | |
372 | exit 1 | |
373 | fi | |
374 | if test "x$mc_pat" = "x" ; then | |
375 | echo "No MC data pattern specified" > /dev/stderr | |
376 | exit 1 | |
377 | fi | |
378 | if test "X$1" != "Xsetup" && test x$now = x ; then | |
379 | echo "No date/time specified" > /dev/stderr | |
380 | exit 1 | |
381 | fi | |
8449e3e0 | 382 | # case $sys in |
383 | # pp|p-p) sys=1 ;; | |
384 | # pbpb|pb-pb|aa|a-a) sys=2 ;; | |
385 | # ppb|p-pb|pa|p-a) sys=3 ;; | |
386 | # 1|2|3) ;; | |
387 | # *) echo "$0: Unknown system: $sys" ; exit 1 ;; | |
388 | # esac | |
5934a3e3 | 389 | |
390 | cat <<EOF | |
391 | Name: $name | |
392 | Run file: ${runs} | |
393 | Collision system: $sys | |
394 | sqrt(s_NN): ${snn}GeV | |
395 | L3 Field: ${field}kG | |
396 | Real input directory: ${real_dir} | |
397 | Real file pattern: ${real_pat} | |
398 | MC input directory: ${mc_dir} | |
399 | MC file pattern: ${mc_pat} | |
400 | Real output: ${my_real_dir} | |
401 | MC output directory: ${my_mc_dir} | |
402 | Use PAR files: ${par} | |
403 | Date & time: ${now} | |
404 | ||
405 | EOF | |
406 | } | |
5934a3e3 | 407 | |
408 | # --- Run the train -------------------------------------------------- | |
409 | # Usage: | |
410 | # | |
411 | allAboard() | |
412 | { | |
413 | type=$1 ; shift | |
414 | cl= | |
415 | nme=${name}_${type} | |
416 | tree=esdTree | |
8449e3e0 | 417 | opts="--batch" |
418 | uopt="&merge=50&split=50" | |
5934a3e3 | 419 | mc=0 |
420 | dir=$real_dir | |
421 | pat=$real_pat | |
422 | ||
423 | case $type in | |
8449e3e0 | 424 | mc*) |
425 | mc=1 | |
426 | # Default dirs are production dirs | |
427 | dir=$mc_dir | |
428 | pat=$mc_pat | |
429 | ;; | |
5934a3e3 | 430 | *) ;; |
431 | esac | |
432 | case $type in | |
433 | *corr) cl=MakeMCCorrTrain ; mc=1 ;; | |
434 | *eloss) cl=MakeFMDELossTrain ;; | |
435 | *aod) cl=MakeAODTrain | |
8449e3e0 | 436 | opts="${opts} --corr=. --cent" |
437 | # opts="--corr=${name}_corrs_${now} --cent" | |
438 | # if test $sys -gt 0 && test $snn -gt 0 ; then | |
439 | # opts="$opts --sys=${sys} --snn=${snn} --field=${field}" | |
440 | # fi | |
5934a3e3 | 441 | ;; |
442 | *dndeta) cl=MakedNdetaTrain | |
443 | tree=aodTree | |
8449e3e0 | 444 | uopt="${uopt}&concat" |
445 | opts="${opts} --cent" | |
446 | # Modify for input dir for our files | |
5934a3e3 | 447 | dir=$my_real_dir |
448 | pat="*/AliAOD.root" | |
449 | if test $mc -gt 0 ; then | |
5934a3e3 | 450 | dir=$my_mc_dir |
451 | fi | |
452 | ;; | |
8449e3e0 | 453 | *) echo "$0: Unknown type of train: $type" > /dev/stderr ; exit 1 ;; |
5934a3e3 | 454 | esac |
8449e3e0 | 455 | if test $mc -gt 0; then |
456 | uopt="${uopt}&mc" | |
457 | fi | |
5934a3e3 | 458 | if test $par -gt 0 ; then |
459 | uopt="${uopt}&par" | |
460 | fi | |
461 | url="alien://${dir}?run=${runs}&pattern=${pat}${uopt}${aliroot}${root}#${tree}" | |
92f304b1 | 462 | opts="${opts} --include=$ALICE_ROOT/PWGLF/FORWARD/analysis2/trains" |
8449e3e0 | 463 | opts="${opts} --date=${now} --class=$cl --name=$nme --verbose=2" |
5934a3e3 | 464 | |
465 | echo "Running train: runTrain2 ${opts} --url=${url} $@" | |
466 | if test $noact -gt 0 ; then return ; fi | |
467 | ||
92f304b1 | 468 | runTrain ${opts} --overwrite --url=${url} $@ |
5934a3e3 | 469 | |
8449e3e0 | 470 | if test $watch -lt 1 ; then |
471 | cat <<-EOF | |
472 | Check https://alimonitor.cern.ch/users/jobs.jsp for progress | |
473 | ||
474 | Remember to do | |
475 | ||
476 | (cd ${nme}_${now} && aliroot -l -b -q Terminate.C) | |
477 | ||
478 | until the final merge stage, and then do | |
479 | ||
480 | (cd ${nme}_${now} && aliroot -l -b -q Download.C) | |
481 | ||
482 | to get the results. | |
483 | EOF | |
484 | ||
485 | case $type in | |
486 | *corr|*esd) | |
487 | cat <<-EOF | |
488 | Then, do | |
489 | ||
490 | (cd ${nme}_${now} && aliroot -l -b -q Extract.C) | |
491 | (cd ${nme}_${now} && aliroot -l -b -q 'Upload.C("local://${here}/${nam e}_corrs_${now}")') | |
492 | ||
493 | to upload the results to our local corrections store. | |
494 | EOF | |
495 | ;; | |
496 | *aod) | |
497 | cat <<-EOF | |
498 | Then, do | |
499 | ||
500 | (cd ${nme}_${now} && aliroot -l ${fwd_dir}/DrawAODSummary.C) | |
501 | ||
502 | to get a PDF of the diagnostics histograms | |
503 | EOF | |
504 | ;; | |
505 | *dndeta) | |
506 | cat <<-EOF | |
507 | Then, do | |
508 | ||
509 | (cd ${nme}_${now} && aliroot -l ${fwd_dir}/DrawdNdetaSummary.C) | |
510 | ||
511 | to get a PDF of the diagnostics histograms, and | |
512 | ||
513 | (cd ${nme}_${now} && aliroot -l Draw.C) | |
514 | ||
515 | to get the final plot. | |
516 | EOF | |
517 | ;; | |
518 | esac | |
519 | else | |
520 | echo "Now waiting for jobs to finish" | |
521 | (cd ${nme}_${now} && \ | |
522 | nice aliroot -l -b -x -q Watch.C\(1\) 2>&1 | \ | |
523 | tee watch.log > /dev/null &) | |
524 | fi | |
5934a3e3 | 525 | } |
526 | ||
527 | ||
1ff25622 | 528 | # === Wrappers ======================================================= |
5934a3e3 | 529 | # --- Run all correction jobs ---------------------------------------- |
530 | corrs() | |
531 | { | |
532 | allAboard mccorr $@ | |
533 | allAboard mceloss $@ | |
534 | allAboard eloss $@ | |
535 | } | |
536 | corrs_terminate() | |
537 | { | |
538 | (cd ${name}_mccorr_${now} && terminate) | |
539 | (cd ${name}_mceloss_${now} && terminate) | |
540 | (cd ${name}_eloss_${now} && terminate) | |
541 | } | |
5934a3e3 | 542 | corrs_upload() |
543 | { | |
544 | (cd ${name}_mccorr_${now} && extract_upload) | |
545 | (cd ${name}_mceloss_${now} && extract_upload) | |
546 | (cd ${name}_eloss_${now} && extract_upload) | |
8449e3e0 | 547 | rm -f fmd_corrections.root spd_corrections.root |
548 | ln -s ${name}_corrs_${now}/fmd_corrections.root . | |
549 | ln -s ${name}_corrs_${now}/spd_corrections.root . | |
5934a3e3 | 550 | } |
551 | corrs_draw() | |
552 | { | |
553 | echo "Draw does not make sense for Correction jobs" | |
554 | } | |
555 | # --- Run all AOD jobs ----------------------------------------------- | |
556 | aods() | |
557 | { | |
558 | allAboard mcaod $@ | |
559 | allAboard aod $@ | |
560 | } | |
561 | aods_terminate() | |
562 | { | |
563 | (cd ${name}_mcaod_${now} && terminate) | |
564 | (cd ${name}_aod_${now} && terminate) | |
565 | } | |
5934a3e3 | 566 | aods_upload() |
567 | { | |
568 | echo "Upload does not make sense for AOD jobs" | |
569 | } | |
570 | aods_draw() | |
571 | { | |
1ff25622 | 572 | (cd ${name}_mcaod_${now} && draw ${fwd_dir}/DrawAODSummary.C) |
573 | (cd ${name}_aod_${now} && draw ${fwd_dir}/DrawAODSummary.C) | |
5934a3e3 | 574 | } |
575 | ||
576 | # --- Run all dN/deta jobs ------------------------------------------- | |
577 | dndetas() | |
578 | { | |
579 | allAboard mcdndeta $@ | |
580 | allAboard dndeta $@ | |
581 | } | |
582 | dndetas_terminate() | |
583 | { | |
584 | (cd ${name}_mcdndeta_${now} && terminate) | |
585 | (cd ${name}_dndeta_${now} && terminate) | |
586 | } | |
5934a3e3 | 587 | dndetas_upload() |
588 | { | |
589 | echo "Upload does not make sense for dN/deta jobs" | |
590 | } | |
591 | dndetas_draw() | |
592 | { | |
1ff25622 | 593 | (cd ${name}_mcdndeta_${now} && draw ${fwd_dir}/DrawdNdetaSummary.C && \ |
73b32206 | 594 | draw ../Draw.C) |
1ff25622 | 595 | (cd ${name}_dndeta_${now} && draw ${fwd_dir}/DrawdNdetaSummary.C && \ |
73b32206 | 596 | draw ../Draw.C) |
5934a3e3 | 597 | } |
598 | ||
1ff25622 | 599 | # === Executable code |
5934a3e3 | 600 | # --- Source settings if found --------------------------------------- |
601 | if test -f $dotconf ; then | |
602 | source $dotconf | |
603 | fi | |
604 | ||
605 | ||
606 | # --- Process command line ------------------------------------------- | |
607 | what= | |
608 | step= | |
8449e3e0 | 609 | watch=1 |
5934a3e3 | 610 | while test $# -gt 0 ; do |
611 | arg=$1 | |
612 | opt= | |
613 | case $1 in | |
614 | --) shift ; break ;; | |
615 | --*=*) | |
616 | arg=`echo $1 | sed 's/=.*//'` ; | |
617 | opt=`echo $1 | sed 's/--[^=][^=]*=//'` | |
618 | ;; | |
619 | --*) | |
620 | ;; | |
621 | -h|-N|-H|-a) ;; | |
622 | -*) opt=$2 ; shift ;; | |
623 | esac | |
624 | shift | |
625 | ||
626 | case $arg in | |
627 | -r|--runs) runs=$opt ;; | |
628 | -n|--name) name=$opt ;; | |
629 | -S|--sys) sys=`echo $opt | tr '[A-Z]' '[a-z]'` ;; | |
630 | -E|--snn) snn=$opt ;; | |
631 | -F|--field) field=$opt ;; | |
632 | -d|--real-dir) real_dir=$opt ;; | |
633 | -p|--real-pattern) real_pat=$opt ;; | |
634 | -D|--mc-dir) mc_dir=$opt ;; | |
635 | -P|--mc-pattern) mc_pat=$opt ;; | |
636 | -w|--what) what=`echo $opt | tr '[A-Z]' '[a-z]'` ;; | |
637 | -s|--step) step=`echo $opt | tr '[A-Z]' '[a-z]'` ;; | |
8449e3e0 | 638 | -W|--watch) let watch=\!$watch ;; |
639 | -N|--noact) noact=1 ;; | |
5934a3e3 | 640 | -a|--par) par=1 ;; |
641 | -h|--help) usage ; exit 0 ;; | |
642 | -H|--manual) manual ; exit 0 ;; | |
643 | *) echo "$0: Unknown option $arg" ; exit 1 ;; | |
644 | esac | |
645 | done | |
646 | ||
647 | # --- Check settings ------------------------------------------------- | |
648 | check $what | |
649 | ||
650 | # --- Select what to do ---------------------------------------------- | |
651 | func= | |
652 | case $what in | |
653 | setup) setup ; exit 0 ;; | |
654 | clean) cleanup ; exit 0 ;; | |
655 | corr*) func=corrs;; | |
656 | aod*) func=aods ;; | |
73b32206 | 657 | dndeta*) func=dndetas ;; |
5934a3e3 | 658 | *) echo "$0: Unknown operation: $what" > /dev/stderr ; exit 1 ;; |
659 | esac | |
660 | ||
1ff25622 | 661 | case x$step in |
662 | x|xfull) ;; | |
663 | xterm*) func=${func}_terminate ;; | |
664 | xup*) func=${func}_upload ;; | |
665 | xdr*) func=${func}_draw ;; | |
666 | *) echo "$0: Unknown step $step" > /dev/stderr ; exit 1 ;; | |
5934a3e3 | 667 | esac |
668 | ||
669 | echo "Will execute $func" | |
670 | $func $@ | |
671 | ||
672 | # | |
673 | # EOF | |
674 | # | |
675 |