|
| 1 | +#!/usr/bin/bash |
| 2 | + |
| 3 | +# This script performs an analysis task (given as first argument) |
| 4 | +# in a directory (produced) where a merged AO2D.root was produced |
| 5 | +# and individual timeframe AODs are still located in tf1...n folders. |
| 6 | +# The analysis is performed on the merged AOD as well as the original timeframe ones. |
| 7 | +# The tasks are executed using the graph pipeline mechanism. |
| 8 | + |
| 9 | +# Optionally, one may connect the analysis graph workflows to the simulation workflow. |
| 10 | +# (using the "needs" variable and doing a "merge" operation with the original workflow) |
| 11 | + |
| 12 | +# to be eventually given externally |
| 13 | +testanalysis=$1 # o2-analysistutorial-mc-histograms o2-analysis-spectra-tof-tiny o2-analysis-spectra-tpc-tiny o2-analysis-correlations |
| 14 | + |
| 15 | +# find out number of timeframes |
| 16 | +NTF=$(find ./ -name "tf*" -type d | wc | awk '//{print $1}') |
| 17 | +# |
| 18 | + |
| 19 | +# commonDPL="-b --run --fairmq-ipc-prefix ${FAIRMQ_IPC_PREFIX:-./.tmp} --driver-client-backend ws:// --rate 1000" |
| 20 | +commonDPL="-b --run --driver-client-backend ws:// --rate 1000" |
| 21 | +annaCMD="${testanalysis} ${commonDPL} --aod-file AO2D.root; mv AnalysisResults.root AnalysisResults_${testanalysis}.root; mv QAResults.root QAResults_${testanalysis}.root" |
| 22 | + |
| 23 | +rm workflow_ana.json |
| 24 | +# this is to analyse the global (merged) AOD |
| 25 | +${O2DPG_ROOT}/MC/bin/o2dpg-workflow-tools.py create workflow_ana --add-task ${testanalysis} |
| 26 | +needs="" |
| 27 | +for i in $(seq 1 ${NTF}) |
| 28 | +do |
| 29 | + needs="${needs} aodmerge_$i " |
| 30 | +done |
| 31 | + |
| 32 | +${O2DPG_ROOT}/MC/bin/o2dpg-workflow-tools.py modify workflow_ana ${testanalysis} --cmd "${annaCMD}" \ |
| 33 | + --cpu 1 --labels ANALYSIS |
| 34 | + |
| 35 | +# let's also add a task per timeframe (might expose different errors) |
| 36 | +for i in $(seq 1 ${NTF}) |
| 37 | +do |
| 38 | + ${O2DPG_ROOT}/MC/bin/o2dpg-workflow-tools.py create workflow_ana --add-task ${testanalysis}_${i} |
| 39 | + needs="aod_${i}" |
| 40 | + ${O2DPG_ROOT}/MC/bin/o2dpg-workflow-tools.py modify workflow_ana ${testanalysis}_${i} --cmd "${annaCMD}" \ |
| 41 | + --cpu 1 --labels ANALYSIS --cwd tf${i} |
| 42 | +done |
| 43 | + |
| 44 | +# run the individual AOD part |
| 45 | +$O2DPG_ROOT/MC/bin/o2_dpg_workflow_runner.py -f workflow_ana.json -tt ${testanalysis}_.*$ --rerun-from ${testanalysis}_.*$ |
| 46 | +RC1=$? |
| 47 | +echo "EXIT 1: $RC1" |
| 48 | + |
| 49 | +# run on the merged part |
| 50 | +$O2DPG_ROOT/MC/bin/o2_dpg_workflow_runner.py -f workflow_ana.json -tt ${testanalysis}$ --rerun-from ${testanalysis}$ |
| 51 | +RC2=$? |
| 52 | +echo "EXIT 2: $RC2" |
| 53 | + |
| 54 | +RC=0 |
| 55 | +let RC=RC+RC1 |
| 56 | +let RC=RC+RC2 |
| 57 | + |
| 58 | +exit ${RC} |
0 commit comments