|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# |
| 4 | +# A example workflow MC->RECO->AOD for a simple pp min bias |
| 5 | +# production |
| 6 | +# |
| 7 | + |
| 8 | +# make sure O2DPG + O2 is loaded |
| 9 | +[ ! "${O2DPG_ROOT}" ] && echo "Error: This needs O2DPG loaded" && exit 1 |
| 10 | +[ ! "${O2_ROOT}" ] && echo "Error: This needs O2 loaded" && exit 1 |
| 11 | + |
| 12 | + |
| 13 | +# ----------- START ACTUAL JOB ----------------------------- |
| 14 | + |
| 15 | +# decide whether or not to do QC (if simulation was successful, default is not doing it) |
| 16 | +DOQC=${DOQC:+1} |
| 17 | +[ "${DOQC}" != "" ] && [ ! "${QUALITYCONTROL_ROOT}" ] && echo "Error: This needs QualityControl loaded" && exit 1 |
| 18 | +# decide whether or not to do test analyses (if simulation was successful, default is not doing it) |
| 19 | +DOANALYSIS=${DOANALYSIS:+1} |
| 20 | +[ "${DOANALYSIS}" != "" ] && [ ! "${O2PHYSICS_ROOT}" ] && echo "Error: This needs O2Physics loaded" && exit 1 |
| 21 | + |
| 22 | +# select transport engine |
| 23 | +SIMENGINE=${SIMENGINE:-TGeant4} |
| 24 | +# number of timeframes to simulate |
| 25 | +NTFS=${NTFS:-3} |
| 26 | +# number of simulation workers per timeframe |
| 27 | +NWORKERS=${NWORKERS:-8} |
| 28 | +# number of events to be simulated per timeframe |
| 29 | +NEVENTS=${NEVENTS:-20} |
| 30 | +# interaction rate |
| 31 | +INTRATE=${INTRATE:-500000} |
| 32 | + |
| 33 | +# memory limit in MB |
| 34 | +MEMLIMIT=${MEMLIMIT:+--mem-limit ${MEMLIMIT}} |
| 35 | +# number of CPUs |
| 36 | +CPULIMIT=${CPULIMIT:+--cpu-limit ${CPULIMIT}} |
| 37 | + |
| 38 | +# create workflow |
| 39 | +${O2DPG_ROOT}/MC/bin/o2dpg_sim_workflow.py -eCM 13600 -seed 12345 -col pp -gen pythia8 -proc inel -tf ${NTFS} \ |
| 40 | + -ns ${NEVENTS} -e ${SIMENGINE} -run 301000 \ |
| 41 | + -j ${NWORKERS} -interactionRate ${INTRATE} \ |
| 42 | + --include-qc --include-analysis |
| 43 | + |
| 44 | +# run workflow |
| 45 | +${O2DPG_ROOT}/MC/bin/o2_dpg_workflow_runner.py -f workflow.json -tt aod ${MEMLIMIT} ${CPULIMIT} |
| 46 | +RETMC=${?} |
| 47 | + |
| 48 | + |
| 49 | +RETQC=0 |
| 50 | +if [ "${DOQC}" != "" ] && [ "${RETMC}" = "0" ]; then |
| 51 | + # run QC if requested |
| 52 | + ${O2DPG_ROOT}/MC/bin/o2_dpg_workflow_runner.py -f workflow.json --target-labels QC ${MEMLIMIT} ${CPULIMIT} |
| 53 | + RETQC=${?} |
| 54 | +fi |
| 55 | + |
| 56 | +RETANA=0 |
| 57 | +if [ "${DOANALYSIS}" != "" ] && [ "${RETMC}" = "0" ]; then |
| 58 | + # run test analyses if requested |
| 59 | + ${O2DPG_ROOT}/MC/bin/o2_dpg_workflow_runner.py -f workflow.json --target-labels Analysis ${MEMLIMIT} ${CPULIMIT} |
| 60 | + RETANA=${?} |
| 61 | +fi |
| 62 | + |
| 63 | +RET=$((${RETMC} + ${RETQC} + ${RETANA})) |
| 64 | + |
| 65 | +return ${RET} 2>/dev/null || exit ${RET} |
0 commit comments