From 4014d7da16602b055c4eed00e34e6aa2d269bc49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Sun, 22 Nov 2026 12:52:09 +0100 Subject: [PATCH 1/5] Enhance run_test.sh with logging and file checks Updated the simulation and reconstruction script to include new logging and configuration options. Added checks for existing output files to skip redundant processing. --- .../ALICE3/TRKFT3/TRK/macros/test/run_test.sh | 101 +++++++++++++++++- 1 file changed, 97 insertions(+), 4 deletions(-) diff --git a/Detectors/Upgrades/ALICE3/TRKFT3/TRK/macros/test/run_test.sh b/Detectors/Upgrades/ALICE3/TRKFT3/TRK/macros/test/run_test.sh index d0953a342af04..b90c2b9e10d1d 100644 --- a/Detectors/Upgrades/ALICE3/TRKFT3/TRK/macros/test/run_test.sh +++ b/Detectors/Upgrades/ALICE3/TRKFT3/TRK/macros/test/run_test.sh @@ -1,10 +1,103 @@ #Number of events to simulate -nEvents=10 +nEvents=${nEvents:-10} # Simulating -o2-sim-serial-run5 -n $nEvents -g pythia8hi -m TRK --configKeyValues "TRKBase.layoutML=kTurboStaves;TRKBase.layoutOT=kStaggered;">& sim_TRK.log +echo "=== Simulating $nEvents events ===" +o2-sim-serial-run5 -n "$nEvents" -g pythia8hi -m TRK --configKeyValues "TRKBase.layoutMLOT=kSegmented" >&sim_TRK.log # Digitizing -o2-sim-digitizer-workflow -b >& digiTRK.log +echo "=== Digitizing ===" +o2-sim-digitizer-workflow -b >&digiTRK.log -root.exe -b -q CheckDigits.C+ >& CheckDigits.log +root.exe -b -q CheckDigits.C+ >&CheckDigits.log + +PERFORM_RECO=${PERFORM_RECO:-0} + +if [ "$PERFORM_RECO" -eq 0 ]; then + exit 0 +fi + +echo "=== Performing reconstruction ===" + +# Reconstruction +if [[ -f "/tmp/trkft3_reco.json" ]]; then + echo ' +{ + "inputfiles": { + "hits": "o2sim_HitsTRK.root", + "geometry": "o2sim_geometry.root", + "mcHeader": "o2sim_MCHeader.root", + "kinematics": "o2sim_Kine.root" + }, + "geometry": { + "bz": 20.0, + "pitch": [0.001, 0.001, 0.001, 0.001, 0.004, 0.004, 0.004, 0.004, 0.004, 0.004, 0.004] + }, + "trackingparams": [{ + "NLayers": 11, + "DeltaROF": 0, + "LayerZ": [25.1, 25.1, 25.1, 64.2, 64.2, 64.2, 64.2, 64.2, 128.5, 128.5, 128.5], + "LayerRadii": [0.5, 1.2, 2.5, 7.05, 9.05, 12.05, 20.05, 30.05, 45.05, 60.5, 80.05], + "LayerxX0": [0.001, 0.001, 0.001, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01], + "LayerResolution": [0.0003, 0.0003, 0.0003, 0.0003, 0.0012, 0.0012, 0.0012, 0.0012, 0.0012, 0.0012, 0.0012], + "SystErrorY2": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + "SystErrorZ2": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + "AddTimeError": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + "ZBins": 256, + "PhiBins": 128, + "nROFsPerIterations": -1, + "UseDiamond": false, + "Diamond": [0.0, 0.0, 0.0], + "AllowSharingFirstCluster": false, + "ClusterSharing": 0, + "MinTrackLength": 7, + "NSigmaCut": 10, + "PVres": 0.01, + "TrackletMinPt": 0.1, + "TrackletsPerClusterLimit": 2.0, + "CellDeltaTanLambdaSigma": 0.007, + "CellsPerClusterLimit": 2.0, + "MaxChi2ClusterAttachment": 60.0, + "MaxChi2NDF": 30.0, + "ReseedIfShorter": 6, + "MinPt": [0.0, 0.0, 0.0, 0.0, 0.0], + "StartLayerMask": 4095, + "RepeatRefitOut": false, + "ShiftRefToCluster": true, + "FindShortTracks": false, + "PerPrimaryVertexProcessing": false, + "SaveTimeBenchmarks": false, + "DoUPCIteration": false, + "FataliseUponFailure": true, + "TrackFollower": "mix", + "TrackFollowerNSigmaCutZ": 1.0, + "TrackFollowerNSigmaCutPhi": 1.0, + "TrackFollowerMaxHypotheses": 1, + "createArtefactLabels": false, + "PrintMemory": false, + "DropTFUponFailure": false + }] +} +' >/tmp/trkft3_reco.json +fi + +OPT="" +OPT="$OPT -b " +OPT="$OPT --shm-segment-size 16000000000 " +# OPT="$OPT --severity debug" + +if [ ! -f o2trac_trk_acts.root ]; then + time o2-alice3-global-reconstruction-reco-workflow $OPT --useACTS --tracking-from-clusters-config /tmp/trkft3_reco.json + mv o2trac_trk.root o2trac_trk_acts.root +else + echo "o2trac_trk_acts.root already exists, skipping reconstruction" +fi +root.exe -b -q 'CheckTracksCA.C+("o2trac_trk_acts.root")' >&CheckTracksCA_acts.log + +if [ ! -f o2trac_trk_ca.root ]; then + time o2-alice3-global-reconstruction-reco-workflow $OPT --tracking-from-clusters-config /tmp/trkft3_reco.json + mv o2trac_trk.root o2trac_trk_ca.root +else + echo "o2trac_trk_ca.root already exists, skipping reconstruction" +fi +root.exe -b -q 'CheckTracksCA.C+("o2trac_trk_ca.root")' >&CheckTracksCA_ca.log From c9b8268606c2d9de5153e746f95551956378b4a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Tue, 1 Dec 2026 14:15:57 +0100 Subject: [PATCH 2/5] Refactor run_test.sh for improved structure and clarity --- .../ALICE3/TRKFT3/TRK/macros/test/run_test.sh | 208 ++++++++++-------- 1 file changed, 122 insertions(+), 86 deletions(-) diff --git a/Detectors/Upgrades/ALICE3/TRKFT3/TRK/macros/test/run_test.sh b/Detectors/Upgrades/ALICE3/TRKFT3/TRK/macros/test/run_test.sh index b90c2b9e10d1d..5f3067ca99354 100644 --- a/Detectors/Upgrades/ALICE3/TRKFT3/TRK/macros/test/run_test.sh +++ b/Detectors/Upgrades/ALICE3/TRKFT3/TRK/macros/test/run_test.sh @@ -1,84 +1,81 @@ -#Number of events to simulate +#!/bin/bash + +set -e +set -o pipefail + +######################################## +# Configuration +######################################## + nEvents=${nEvents:-10} +PERFORM_RECO=${PERFORM_RECO:-0} -# Simulating -echo "=== Simulating $nEvents events ===" -o2-sim-serial-run5 -n "$nEvents" -g pythia8hi -m TRK --configKeyValues "TRKBase.layoutMLOT=kSegmented" >&sim_TRK.log +######################################## +# Common execution function +######################################## -# Digitizing -echo "=== Digitizing ===" -o2-sim-digitizer-workflow -b >&digiTRK.log +run_step() { + local STEP="$1" + shift -root.exe -b -q CheckDigits.C+ >&CheckDigits.log + local LOG="${STEP}.log" + local DONE="${STEP}.done" -PERFORM_RECO=${PERFORM_RECO:-0} + if [[ -f "$DONE" ]]; then + echo "=== $STEP already completed, skipping ===" + return 0 + fi -if [ "$PERFORM_RECO" -eq 0 ]; then - exit 0 -fi + echo "=== Running $STEP ===" -echo "=== Performing reconstruction ===" - -# Reconstruction -if [[ -f "/tmp/trkft3_reco.json" ]]; then - echo ' -{ - "inputfiles": { - "hits": "o2sim_HitsTRK.root", - "geometry": "o2sim_geometry.root", - "mcHeader": "o2sim_MCHeader.root", - "kinematics": "o2sim_Kine.root" - }, - "geometry": { - "bz": 20.0, - "pitch": [0.001, 0.001, 0.001, 0.001, 0.004, 0.004, 0.004, 0.004, 0.004, 0.004, 0.004] - }, - "trackingparams": [{ - "NLayers": 11, - "DeltaROF": 0, - "LayerZ": [25.1, 25.1, 25.1, 64.2, 64.2, 64.2, 64.2, 64.2, 128.5, 128.5, 128.5], - "LayerRadii": [0.5, 1.2, 2.5, 7.05, 9.05, 12.05, 20.05, 30.05, 45.05, 60.5, 80.05], - "LayerxX0": [0.001, 0.001, 0.001, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01], - "LayerResolution": [0.0003, 0.0003, 0.0003, 0.0003, 0.0012, 0.0012, 0.0012, 0.0012, 0.0012, 0.0012, 0.0012], - "SystErrorY2": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], - "SystErrorZ2": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], - "AddTimeError": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], - "ZBins": 256, - "PhiBins": 128, - "nROFsPerIterations": -1, - "UseDiamond": false, - "Diamond": [0.0, 0.0, 0.0], - "AllowSharingFirstCluster": false, - "ClusterSharing": 0, - "MinTrackLength": 7, - "NSigmaCut": 10, - "PVres": 0.01, - "TrackletMinPt": 0.1, - "TrackletsPerClusterLimit": 2.0, - "CellDeltaTanLambdaSigma": 0.007, - "CellsPerClusterLimit": 2.0, - "MaxChi2ClusterAttachment": 60.0, - "MaxChi2NDF": 30.0, - "ReseedIfShorter": 6, - "MinPt": [0.0, 0.0, 0.0, 0.0, 0.0], - "StartLayerMask": 4095, - "RepeatRefitOut": false, - "ShiftRefToCluster": true, - "FindShortTracks": false, - "PerPrimaryVertexProcessing": false, - "SaveTimeBenchmarks": false, - "DoUPCIteration": false, - "FataliseUponFailure": true, - "TrackFollower": "mix", - "TrackFollowerNSigmaCutZ": 1.0, - "TrackFollowerNSigmaCutPhi": 1.0, - "TrackFollowerMaxHypotheses": 1, - "createArtefactLabels": false, - "PrintMemory": false, - "DropTFUponFailure": false - }] + if "$@" >"$LOG" 2>&1; then + touch "$DONE" + echo "=== $STEP completed successfully ===" + else + local STATUS=$? + echo "ERROR: $STEP failed (exit code $STATUS)" + echo "Check $LOG for details" + tail -n 30 "$LOG" + exit "$STATUS" + fi } -' >/tmp/trkft3_reco.json + +######################################## +# Simulation +######################################## + +run_step sim_TRK \ + o2-sim-serial-run5 \ + -n "$nEvents" \ + -g pythia8hi \ + -m TRK \ + --configKeyValues "TRKBase.layoutMLOT=kSegmented" + +######################################## +# Digitization +######################################## + +run_step digiTRK \ + o2-sim-digitizer-workflow \ + -b \ + --interactionRate 93e3 \ + --shm-segment-size 16000000000 \ + --condition-timestamp 1635659148972 \ + --configKeyValues="ITSAlpideParam.roFrameLengthInBC=322;" + +######################################## +# Check digits +######################################## + +run_step CheckDigits \ + root.exe -b -q CheckDigits.C+ + +######################################## +# Optional reconstruction +######################################## + +if [[ "$PERFORM_RECO" -eq 0 ]]; then + exit 0 fi OPT="" @@ -86,18 +83,57 @@ OPT="$OPT -b " OPT="$OPT --shm-segment-size 16000000000 " # OPT="$OPT --severity debug" -if [ ! -f o2trac_trk_acts.root ]; then - time o2-alice3-global-reconstruction-reco-workflow $OPT --useACTS --tracking-from-clusters-config /tmp/trkft3_reco.json - mv o2trac_trk.root o2trac_trk_acts.root -else - echo "o2trac_trk_acts.root already exists, skipping reconstruction" -fi -root.exe -b -q 'CheckTracksCA.C+("o2trac_trk_acts.root")' >&CheckTracksCA_acts.log +######################################## +# Clusterization +######################################## + +run_step clus \ + time o2-alice3-trk-reco-workflow \ + $OPT \ + --outfile o2clus_trk.root + +######################################## +# Check clusters +######################################## + +run_step CheckClusters \ + root -l -b -q 'CheckClusters.C("o2clus_trk.root")' + +######################################## +# Reconstruction with CA +######################################## + +reconstruct_ca() { + o2-alice3-trk-reco-workflow --disable-root-output | + o2-alice3-global-reconstruction-reco-workflow \ + --tracking-from-clusters-config trkft3_reco.json \ + -b || return $? -if [ ! -f o2trac_trk_ca.root ]; then - time o2-alice3-global-reconstruction-reco-workflow $OPT --tracking-from-clusters-config /tmp/trkft3_reco.json mv o2trac_trk.root o2trac_trk_ca.root -else - echo "o2trac_trk_ca.root already exists, skipping reconstruction" -fi -root.exe -b -q 'CheckTracksCA.C+("o2trac_trk_ca.root")' >&CheckTracksCA_ca.log +} + +run_step reco_ca reconstruct_ca + +run_step CheckTracksCA_ca \ + root -b -q 'CheckTracksCA.C+("o2trac_trk_ca.root")' + +######################################## +# Reconstruction with ACTS +######################################## + +reconstruct_acts() { + o2-alice3-trk-reco-workflow --disable-root-output | + o2-alice3-global-reconstruction-reco-workflow \ + --useACTS \ + --tracking-from-clusters-config trkft3_reco.json \ + -b || return $? + + mv o2trac_trk.root o2trac_trk_acts.root +} + +run_step reco_acts reconstruct_acts + +run_step CheckTracksCA_acts \ + root -b -q 'CheckTracksCA.C+("o2trac_trk_acts.root")' + +echo "=== All steps completed successfully ===" From 057f832db33c8546af63a0cecf1716af47bffb00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Tue, 1 Dec 2026 14:16:50 +0100 Subject: [PATCH 3/5] Add trktf3_reco.json configuration file --- .../TRKFT3/TRK/macros/test/trktf3_reco.json | 164 ++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100644 Detectors/Upgrades/ALICE3/TRKFT3/TRK/macros/test/trktf3_reco.json diff --git a/Detectors/Upgrades/ALICE3/TRKFT3/TRK/macros/test/trktf3_reco.json b/Detectors/Upgrades/ALICE3/TRKFT3/TRK/macros/test/trktf3_reco.json new file mode 100644 index 0000000000000..96706b1736c4f --- /dev/null +++ b/Detectors/Upgrades/ALICE3/TRKFT3/TRK/macros/test/trktf3_reco.json @@ -0,0 +1,164 @@ +{ + "inputfiles": { + "hits": "o2sim_HitsTRK.root", + "geometry": "o2sim_geometry.root", + "mcHeader": "o2sim_MCHeader.root", + "kinematics": "o2sim_Kine.root" + }, + "geometry": { + "bz": 20.0, + "pitch": [ + 0.001, + 0.001, + 0.001, + 0.001, + 0.004, + 0.004, + 0.004, + 0.004, + 0.004, + 0.004, + 0.004 + ] + }, + "trackingparams": [ + { + "NLayers": 11, + "DeltaROF": 0, + "LayerZ": [ + 25.1, + 25.1, + 25.1, + 64.2, + 64.2, + 64.2, + 64.2, + 64.2, + 128.5, + 128.5, + 128.5 + ], + "LayerRadii": [ + 0.5, + 1.2, + 2.5, + 7.05, + 9.05, + 12.05, + 20.05, + 30.05, + 45.05, + 60.5, + 80.05 + ], + "LayerxX0": [ + 0.001, + 0.001, + 0.001, + 0.01, + 0.01, + 0.01, + 0.01, + 0.01, + 0.01, + 0.01, + 0.01 + ], + "LayerResolution": [ + 0.0003, + 0.0003, + 0.0003, + 0.0003, + 0.0012, + 0.0012, + 0.0012, + 0.0012, + 0.0012, + 0.0012, + 0.0012 + ], + "SystErrorY2": [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + "SystErrorZ2": [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + "AddTimeError": [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + "ZBins": 256, + "PhiBins": 128, + "nROFsPerIterations": -1, + "UseDiamond": false, + "Diamond": [ + 0.0, + 0.0, + 0.0 + ], + "AllowSharingFirstCluster": false, + "ClusterSharing": 0, + "MinTrackLength": 7, + "NSigmaCut": 10, + "PVres": 0.01, + "TrackletMinPt": 0.1, + "TrackletsPerClusterLimit": 2.0, + "CellDeltaTanLambdaSigma": 0.007, + "CellsPerClusterLimit": 2.0, + "MaxChi2ClusterAttachment": 60.0, + "MaxChi2NDF": 30.0, + "ReseedIfShorter": 6, + "MinPt": [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + "StartLayerMask": 4095, + "RepeatRefitOut": false, + "ShiftRefToCluster": true, + "FindShortTracks": false, + "PerPrimaryVertexProcessing": false, + "SaveTimeBenchmarks": false, + "DoUPCIteration": false, + "FataliseUponFailure": true, + "TrackFollower": "mix", + "TrackFollowerNSigmaCutZ": 1.0, + "TrackFollowerNSigmaCutPhi": 1.0, + "TrackFollowerMaxHypotheses": 1, + "createArtefactLabels": false, + "PrintMemory": false, + "DropTFUponFailure": false + } + ] +} From 69a66b90a17833a8b6f4e88dbcb76e1a158088a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Tue, 1 Dec 2026 15:55:13 +0100 Subject: [PATCH 4/5] Update run_test.sh --- Detectors/Upgrades/ALICE3/TRKFT3/TRK/macros/test/run_test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Detectors/Upgrades/ALICE3/TRKFT3/TRK/macros/test/run_test.sh b/Detectors/Upgrades/ALICE3/TRKFT3/TRK/macros/test/run_test.sh index 5f3067ca99354..1c959f69ec4a7 100644 --- a/Detectors/Upgrades/ALICE3/TRKFT3/TRK/macros/test/run_test.sh +++ b/Detectors/Upgrades/ALICE3/TRKFT3/TRK/macros/test/run_test.sh @@ -67,8 +67,8 @@ run_step digiTRK \ # Check digits ######################################## -run_step CheckDigits \ - root.exe -b -q CheckDigits.C+ +run_step CheckDigitsTRK \ + root.exe -b -q CheckDigitsTRK.C+ ######################################## # Optional reconstruction From 386614116ce0b777b66f0ed388e22d8796bb659b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Tue, 1 Dec 2026 15:56:32 +0100 Subject: [PATCH 5/5] Rename trktf3_reco.json to trkft3_reco.json --- .../TRKFT3/TRK/macros/test/{trktf3_reco.json => trkft3_reco.json} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Detectors/Upgrades/ALICE3/TRKFT3/TRK/macros/test/{trktf3_reco.json => trkft3_reco.json} (100%) diff --git a/Detectors/Upgrades/ALICE3/TRKFT3/TRK/macros/test/trktf3_reco.json b/Detectors/Upgrades/ALICE3/TRKFT3/TRK/macros/test/trkft3_reco.json similarity index 100% rename from Detectors/Upgrades/ALICE3/TRKFT3/TRK/macros/test/trktf3_reco.json rename to Detectors/Upgrades/ALICE3/TRKFT3/TRK/macros/test/trkft3_reco.json