|
1 | 1 | #!/bin/bash |
2 | 2 |
|
3 | | -if [ "0$O2_ROOT" == "0" ]; then |
4 | | - echo O2 environment not loaded 1>&2 |
5 | | - exit 1 |
| 3 | +# used to avoid sourcing this file 2x |
| 4 | +if [[ -z ${SOURCE_GUARD_WORKFLOW_SETUP:-} ]]; then |
| 5 | +SOURCE_GUARD_WORKFLOW_SETUP=1 |
| 6 | + |
| 7 | +# --------------------------------------------------------------------------------------------------------------------- |
| 8 | +#Some additional settings used in this workflow |
| 9 | + |
| 10 | +if [[ $SYNCMODE == 1 ]]; then |
| 11 | + if [[ -z "${WORKFLOW_DETECTORS_MATCHING+x}" ]]; then export WORKFLOW_DETECTORS_MATCHING="ITSTPC,ITSTPCTRD,ITSTPCTOF,ITSTPCTRDTOF,PRIMVTX"; fi # Select matchings that are enabled in sync mode |
| 12 | +else |
| 13 | + if [[ -z "${WORKFLOW_DETECTORS_MATCHING+x}" ]]; then export WORKFLOW_DETECTORS_MATCHING="ALL"; fi # All matching / vertexing enabled in async mode |
| 14 | +fi |
| 15 | + |
| 16 | +MID_FEEID_MAP="$FILEWORKDIR/mid-feeId_mapper.txt" |
| 17 | + |
| 18 | +ITSMFT_STROBES="" |
| 19 | +[[ ! -z ${ITS_STROBE:-} ]] && ITSMFT_STROBES+="ITSAlpideParam.roFrameLengthInBC=$ITS_STROBE;" |
| 20 | +[[ ! -z ${MFT_STROBE:-} ]] && ITSMFT_STROBES+="MFTAlpideParam.roFrameLengthInBC=$MFT_STROBE;" |
| 21 | + |
| 22 | +LIST_OF_ASYNC_RECO_STEPS="MID MCH MFT FDD FV0 ZDC HMP" |
| 23 | + |
| 24 | +DISABLE_DIGIT_ROOT_INPUT="--disable-root-input" |
| 25 | +if [[ -z ${DISABLE_DIGIT_CLUSTER_INPUT+x} ]]; then DISABLE_DIGIT_CLUSTER_INPUT="--clusters-from-upstream"; fi |
| 26 | + |
| 27 | +# --------------------------------------------------------------------------------------------------------------------- |
| 28 | +# Set active reconstruction steps (defaults added according to SYNCMODE) |
| 29 | + |
| 30 | +has_processing_step() |
| 31 | +{ |
| 32 | + [[ ${WORKFLOW_EXTRA_PROCESSING_STEPS:-} =~ (^|,)"$1"(,|$) ]] |
| 33 | +} |
| 34 | + |
| 35 | +for i in `echo $LIST_OF_GLORECO | sed "s/,/ /g"`; do |
| 36 | + has_processing_step MATCH_$i && add_comma_separated WORKFLOW_DETECTORS_MATCHING $i # Enable extra matchings requested via WORKFLOW_EXTRA_PROCESSING_STEPS |
| 37 | +done |
| 38 | +if [[ $SYNCMODE == 1 ]]; then # Add default steps for synchronous mode |
| 39 | + add_comma_separated WORKFLOW_EXTRA_PROCESSING_STEPS ENTROPY_ENCODER |
| 40 | +else # Add default steps for async mode |
| 41 | + for i in $LIST_OF_ASYNC_RECO_STEPS; do |
| 42 | + has_detector_reco $i && add_comma_separated WORKFLOW_EXTRA_PROCESSING_STEPS ${i}_RECO |
| 43 | + done |
| 44 | + add_comma_separated WORKFLOW_EXTRA_PROCESSING_STEPS TPC_DEDX |
6 | 45 | fi |
7 | 46 |
|
8 | | -source $O2_ROOT/prodtests/full-system-test/workflow-setup.sh || { echo "workflow-setup.sh failed" 1>&2 && exit 1; } |
| 47 | +# --------------------------------------------------------------------------------------------------------------------- |
| 48 | +# Assemble matching sources |
| 49 | + |
| 50 | +TRD_SOURCES= |
| 51 | +TOF_SOURCES= |
| 52 | +TRACK_SOURCES= |
| 53 | +has_detectors_reco ITS TPC && has_detector_matching ITSTPC && add_comma_separated TRACK_SOURCES "ITS-TPC" |
| 54 | +has_detectors_reco TPC TRD && has_detector_matching TPCTRD && { add_comma_separated TRD_SOURCES TPC; add_comma_separated TRACK_SOURCES "TPC-TRD"; } |
| 55 | +has_detectors_reco ITS TPC TRD && has_detector_matching ITSTPCTRD && { add_comma_separated TRD_SOURCES ITS-TPC; add_comma_separated TRACK_SOURCES "ITS-TPC-TRD"; } |
| 56 | +has_detectors_reco TPC TOF && has_detector_matching TPCTOF && { add_comma_separated TOF_SOURCES TPC; add_comma_separated TRACK_SOURCES "TPC-TOF"; } |
| 57 | +has_detectors_reco ITS TPC TOF && has_detector_matching ITSTPC && has_detector_matching ITSTPCTOF && { add_comma_separated TOF_SOURCES ITS-TPC; add_comma_separated TRACK_SOURCES "ITS-TPC-TOF"; } |
| 58 | +has_detectors_reco TPC TRD TOF && has_detector_matching TPCTRD && has_detector_matching TPCTRDTOF && { add_comma_separated TOF_SOURCES TPC-TRD; add_comma_separated TRACK_SOURCES "TPC-TRD-TOF"; } |
| 59 | +has_detectors_reco ITS TPC TRD TOF && has_detector_matching ITSTPCTRD && has_detector_matching ITSTPCTRDTOF && { add_comma_separated TOF_SOURCES ITS-TPC-TRD; add_comma_separated TRACK_SOURCES "ITS-TPC-TRD-TOF"; } |
| 60 | +has_detectors_reco MFT MCH && has_detector_matching MFTMCH && add_comma_separated TRACK_SOURCES "MFT-MCH" |
| 61 | +has_detectors_reco MCH MID && has_detector_matching MCHMID && add_comma_separated TRACK_SOURCES "MCH-MID" |
| 62 | +for det in `echo $LIST_OF_DETECTORS | sed "s/,/ /g"`; do |
| 63 | + if [[ $LIST_OF_ASYNC_RECO_STEPS =~ (^| )${det}( |$) ]]; then |
| 64 | + has_detector ${det} && has_processing_step ${det}_RECO && add_comma_separated TRACK_SOURCES "$det" |
| 65 | + else |
| 66 | + has_detector_reco $det && add_comma_separated TRACK_SOURCES "$det" |
| 67 | + fi |
| 68 | +done |
| 69 | + |
| 70 | +[[ -z ${VERTEXING_SOURCES:-} ]] && VERTEXING_SOURCES="$TRACK_SOURCES" |
| 71 | +[[ -z ${VERTEX_TRACK_MATCHING_SOURCES:-} ]] && VERTEX_TRACK_MATCHING_SOURCES="$TRACK_SOURCES" |
| 72 | +[[ ! -z $VERTEXING_SOURCES ]] && PVERTEX_CONFIG+=" --vertexing-sources $VERTEXING_SOURCES" |
| 73 | +[[ ! -z $VERTEX_TRACK_MATCHING_SOURCES ]] && PVERTEX_CONFIG+=" --vertex-track-matching-sources $VERTEX_TRACK_MATCHING_SOURCES" |
| 74 | + |
| 75 | +if [[ -z ${SVERTEXING_SOURCES:-} ]]; then |
| 76 | + SVERTEXING_SOURCES="$VERTEXING_SOURCES" |
| 77 | + [[ -z ${TPC_TRACKS_SVERTEXING:-} ]] && SVERTEXING_SOURCES=$(echo $SVERTEXING_SOURCES | sed -E -e "s/(^|,)TPC(-TRD|-TOF)+//g" -e "s/,TPC,/,/") |
| 78 | +fi |
| 79 | + |
| 80 | +# this option requires well calibrated timing beween different detectors, at the moment suppress it |
| 81 | +#has_detector_reco FT0 && PVERTEX_CONFIG+=" --validate-with-ft0" |
| 82 | + |
| 83 | +# --------------------------------------------------------------------------------------------------------------------- |
| 84 | +# Helper functions for multiplicities |
| 85 | + |
| 86 | +get_N() # USAGE: get_N [processor-name] [DETECTOR_NAME] [RAW|CTF|REST] [threads, to be used for process scaling. 0 = do not scale this one process] [optional name [FOO] of variable "$N_[FOO]" with default, default = 1] |
| 87 | +{ |
| 88 | + local NAME_FACTOR="N_F_$3" |
| 89 | + local NAME_DET="MULTIPLICITY_FACTOR_DETECTOR_$2" |
| 90 | + local NAME_PROC="MULTIPLICITY_PROCESS_${1//-/_}" |
| 91 | + local NAME_PROC_FACTOR="MULTIPLICITY_FACTOR_PROCESS_${1//-/_}" |
| 92 | + local NAME_DEFAULT="N_${5:-}" |
| 93 | + local MULT=${!NAME_PROC:-$((${!NAME_FACTOR} * ${!NAME_DET:-1} * ${!NAME_PROC_FACTOR:-1} * ${!NAME_DEFAULT:-1}))} |
| 94 | + [[ ! -z ${EPN_GLOBAL_SCALING:-} && $1 != "gpu-reconstruction" ]] && MULT=$(($MULT * $EPN_GLOBAL_SCALING)) |
| 95 | + if [[ -z ${NAME_PROC} && "0$GEN_TOPO_AUTOSCALE_PROCESSES" == "01" && ($WORKFLOWMODE != "print" || $GEN_TOPO_RUN_HOME_TEST == 1) && $4 != 0 ]]; then |
| 96 | + echo $1:\$\(\(\($MULT*\$AUTOSCALE_PROCESS_FACTOR/100\) \< 16 ? \($MULT*\$AUTOSCALE_PROCESS_FACTOR/100\) : 16\)\) |
| 97 | + else |
| 98 | + echo $1:$MULT |
| 99 | + fi |
| 100 | +} |
| 101 | + |
| 102 | +math_max() |
| 103 | +{ |
| 104 | + echo $(($1 > $2 ? $1 : $2)) |
| 105 | +} |
| 106 | +math_min() |
| 107 | +{ |
| 108 | + echo $(($1 < $2 ? $1 : $2)) |
| 109 | +} |
| 110 | + |
| 111 | +# --------------------------------------------------------------------------------------------------------------------- |
| 112 | +# Helper to check if root ouput is requested for certain process |
| 113 | + |
| 114 | +needs_root_output() |
| 115 | +{ |
| 116 | + local NAME_PROC_ENABLE_ROOT_OUTPUT="ENABLE_ROOT_OUTPUT_${1//-/_}" |
| 117 | + [[ ! -z ${!NAME_PROC_ENABLE_ROOT_OUTPUT+x} ]] |
| 118 | +} |
| 119 | + |
| 120 | +# --------------------------------------------------------------------------------------------------------------------- |
| 121 | +# Helper to add binaries to workflow adding automatic and custom arguments |
| 122 | + |
| 123 | +add_W() # Add binarry to workflow command USAGE: add_W [BINARY] [COMMAND_LINE_OPTIONS] [CONFIG_KEY_VALUES] [Add ARGS_ALL_CONFIG, optional, default = 1] |
| 124 | +{ |
| 125 | + local NAME_PROC_ARGS="ARGS_EXTRA_PROCESS_${1//-/_}" |
| 126 | + local NAME_PROC_CONFIG="CONFIG_EXTRA_PROCESS_${1//-/_}" |
| 127 | + local KEY_VALUES= |
| 128 | + [[ "0${4:-}" != "00" ]] && KEY_VALUES+="$ARGS_ALL_CONFIG;" |
| 129 | + [[ ! -z "${3:-}" ]] && KEY_VALUES+="$3;" |
| 130 | + [[ ! -z ${!NAME_PROC_CONFIG:-} ]] && KEY_VALUES+="${!NAME_PROC_CONFIG};" |
| 131 | + [[ ! -z "$KEY_VALUES" ]] && KEY_VALUES="--configKeyValues \"$KEY_VALUES\"" |
| 132 | + local WFADD="$1 $ARGS_ALL ${2:-} ${!NAME_PROC_ARGS:-} $KEY_VALUES | " |
| 133 | + local NAME_PROC_ENABLE_ROOT_OUTPUT="ENABLE_ROOT_OUTPUT_${1//-/_}" |
| 134 | + if [[ ! -z $DISABLE_ROOT_OUTPUT ]] && needs_root_output $1 ; then |
| 135 | + WFADD=${WFADD//$DISABLE_ROOT_OUTPUT/} |
| 136 | + fi |
| 137 | + WORKFLOW+=$WFADD |
| 138 | +} |
| 139 | + |
| 140 | +fi # workflow-setup.sh sourced |
0 commit comments