|
| 1 | +#!/bin/bash |
| 2 | +# shellcheck disable=SC2034 # Ignore unused parameters. |
| 3 | + |
| 4 | +DATABASE_O2="workflows_run5.yml" # Workflow specification database |
| 5 | + |
| 6 | +# Activation of O2 workflows |
| 7 | +DOO2_CAND_X=0 # hf-candidate-creator-x |
| 8 | +DOO2_CAND_CHIC=0 # hf-candidate-creator-chic |
| 9 | +DOO2_CAND_XICC=0 # hf-candidate-creator-xicc |
| 10 | +# Selectors |
| 11 | +DOO2_SEL_JPSI=0 # hf-candidate-selector-jpsi |
| 12 | +DOO2_SEL_X=0 # hf-candidate-selector-x-to-jpsi-pi-pi |
| 13 | +DOO2_SEL_CHIC=0 # hf-candidate-selector-chic-to-jpsi-gamma |
| 14 | +DOO2_SEL_XICC=0 # hf-candidate-selector-xicc-to-p-k-pi-pi |
| 15 | +# Analysis tasks |
| 16 | +DOO2_TASK_JPSI=0 # hf-task-jpsi |
| 17 | +DOO2_TASK_X=0 # hf-task-x |
| 18 | +DOO2_TASK_CHIC=0 # hf-task-chic |
| 19 | +DOO2_TASK_XICC=0 # hf-task-xicc |
| 20 | +# Tree creators |
| 21 | +DOO2_TREE_X=0 # hf-tree-creator-x-to-jpsi-pi-pi |
| 22 | +DOO2_TREE_CHIC=0 # hf-tree-creator-chic-to-jpsi-gamma |
| 23 | +DOO2_TREE_XICC=0 # hf-tree-creator-xicc-to-p-k-pi-pi |
| 24 | +# QA |
| 25 | +DOO2_REJ_ALICE3=0 # hf-task-qa-pid-rejection |
| 26 | + |
| 27 | +# Selection cuts |
| 28 | +APPLYCUTS_JPSI=0 # Apply J/ψ selection cuts. |
| 29 | +APPLYCUTS_X=0 # Apply X selection cuts. |
| 30 | +APPLYCUTS_CHIC=0 # Apply χc(1p) selection cuts. |
| 31 | +APPLYCUTS_XICC=0 # Apply Ξcc selection cuts. |
| 32 | + |
| 33 | +#################################################################################################### |
| 34 | + |
| 35 | +# Modify the JSON file. |
| 36 | +function AdjustJson { |
| 37 | + # Enable J/ψ selection. |
| 38 | + if [ $APPLYCUTS_JPSI -eq 1 ]; then |
| 39 | + MsgWarn "Using J/ψ selection cuts" |
| 40 | + ReplaceString "\"selectionFlagJpsi\": \"0\"" "\"selectionFlagJpsi\": \"1\"" "$JSON" || ErrExit "Failed to edit $JSON." |
| 41 | + fi |
| 42 | + |
| 43 | + # Enable X(3872) selection. |
| 44 | + if [ $APPLYCUTS_X -eq 1 ]; then |
| 45 | + MsgWarn "Using X(3872) selection cuts" |
| 46 | + ReplaceString "\"selectionFlagX\": \"0\"" "\"selectionFlagX\": \"1\"" "$JSON" || ErrExit "Failed to edit $JSON." |
| 47 | + fi |
| 48 | + |
| 49 | + # Enable χc(1p) selection. |
| 50 | + if [ $APPLYCUTS_CHIC -eq 1 ]; then |
| 51 | + MsgWarn "Using χc(1p) selection cuts" |
| 52 | + ReplaceString "\"selectionFlagChic\": \"0\"" "\"selectionFlagChic\": \"1\"" "$JSON" || ErrExit "Failed to edit $JSON." |
| 53 | + fi |
| 54 | + |
| 55 | + # Enable Ξcc selection. |
| 56 | + if [ $APPLYCUTS_XICC -eq 1 ]; then |
| 57 | + MsgWarn "Using Ξcc selection cuts" |
| 58 | + ReplaceString "\"selectionFlagXicc\": \"0\"" "\"selectionFlagXicc\": \"1\"" "$JSON" || ErrExit "Failed to edit $JSON." |
| 59 | + fi |
| 60 | +} |
| 61 | + |
| 62 | +# Generate the O2 script containing the full workflow specification. |
| 63 | +function MakeScriptO2 { |
| 64 | + WORKFLOWS="" |
| 65 | + # Vertexing |
| 66 | + [ $DOO2_CAND_X -eq 1 ] && WORKFLOWS+=" o2-analysis-hf-candidate-creator-x" |
| 67 | + [ $DOO2_CAND_CHIC -eq 1 ] && WORKFLOWS+=" o2-analysis-hf-candidate-creator-chic" |
| 68 | + [ $DOO2_CAND_XICC -eq 1 ] && WORKFLOWS+=" o2-analysis-hf-candidate-creator-xicc" |
| 69 | + # Selectors |
| 70 | + [ $DOO2_SEL_JPSI -eq 1 ] && WORKFLOWS+=" o2-analysis-hf-candidate-selector-jpsi${SUFFIX_RUN}" |
| 71 | + [ $DOO2_SEL_X -eq 1 ] && WORKFLOWS+=" o2-analysis-hf-candidate-selector-x-to-jpsi-pi-pi" |
| 72 | + [ $DOO2_SEL_CHIC -eq 1 ] && WORKFLOWS+=" o2-analysis-hf-candidate-selector-chic-to-jpsi-gamma" |
| 73 | + [ $DOO2_SEL_XICC -eq 1 ] && WORKFLOWS+=" o2-analysis-hf-candidate-selector-xicc-to-p-k-pi-pi" |
| 74 | + # Analysis tasks |
| 75 | + [ $DOO2_TASK_JPSI -eq 1 ] && WORKFLOWS+=" o2-analysis-hf-task-jpsi" |
| 76 | + [ $DOO2_TASK_X -eq 1 ] && WORKFLOWS+=" o2-analysis-hf-task-x" |
| 77 | + [ $DOO2_TASK_CHIC -eq 1 ] && WORKFLOWS+=" o2-analysis-hf-task-chic" |
| 78 | + [ $DOO2_TASK_XICC -eq 1 ] && WORKFLOWS+=" o2-analysis-hf-task-xicc" |
| 79 | + # Tree creators |
| 80 | + [ $DOO2_TREE_X -eq 1 ] && WORKFLOWS+=" o2-analysis-hf-tree-creator-x-to-jpsi-pi-pi" |
| 81 | + [ $DOO2_TREE_CHIC -eq 1 ] && WORKFLOWS+=" o2-analysis-hf-tree-creator-chic-to-jpsi-gamma" |
| 82 | + [ $DOO2_TREE_XICC -eq 1 ] && WORKFLOWS+=" o2-analysis-hf-tree-creator-xicc-to-p-k-pi-pi" |
| 83 | + # QA |
| 84 | + [ $DOO2_REJ_ALICE3 -eq 1 ] && WORKFLOWS+=" o2-analysis-hf-task-qa-pid-rejection" |
| 85 | +} |
| 86 | + |
| 87 | +function MakeScriptPostprocess { |
| 88 | + # Compare AliPhysics and O2 histograms. |
| 89 | + [[ $DOALI -eq 1 && $DOO2 -eq 1 ]] && { |
| 90 | + OPT_COMPARE="" |
| 91 | + [ $DOO2_TASK_JPSI -eq 1 ] && OPT_COMPARE+=" jpsi " |
| 92 | + } |
| 93 | + # Plot particle reconstruction efficiencies. |
| 94 | + [[ $DOO2 -eq 1 && $INPUT_IS_MC -eq 1 ]] && { |
| 95 | + PARTICLES="" |
| 96 | + [ $DOO2_TASK_JPSI -eq 1 ] && PARTICLES+=" jpsi " |
| 97 | + [ $DOO2_TASK_XICC -eq 1 ] && PARTICLES+=" xicc-mc " |
| 98 | + } |
| 99 | +} |
0 commit comments