Files
minicalosim/run-sampling-batch.sh
T
lars 2715bc8d0d Add next_volume/next_material columns and sampling batch script
Records the volume and material a track is about to enter when a step
ends at a geometric boundary, since post-step's physical volume still
refers to the volume the step occurred in. Also adds
run-sampling-batch.sh to run all run_sampling configs in parallel from
isolated directories, avoiding output filename collisions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-24 19:24:35 +02:00

41 lines
905 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")"
CONFIGS=(pb_scint fe_scint w_scint_ecal pb_lar)
RUNS_PER_CONFIG=4
NEVENTS=10000
MAX_PARALLEL=16
EXE="$(pwd)/build/run_sampling"
OUTDIR="$(pwd)/sampling_batch_output"
WORKROOT="$OUTDIR/.work"
mkdir -p "$WORKROOT"
run_one() {
local config="$1" idx="$2"
local workdir="$WORKROOT/${config}_${idx}"
mkdir -p "$workdir"
(
cd "$workdir"
"$EXE" "$config" "$NEVENTS"
mv "sampling_${config}_${NEVENTS}events_hits.root" "$OUTDIR/sampling_${config}_10k_${idx}.root"
)
rmdir "$workdir"
}
export -f run_one
export EXE NEVENTS OUTDIR WORKROOT
jobs=()
for config in "${CONFIGS[@]}"; do
for idx in $(seq 0 $((RUNS_PER_CONFIG - 1))); do
jobs+=("$config $idx")
done
done
printf '%s\n' "${jobs[@]}" | xargs -P "$MAX_PARALLEL" -L 1 bash -c 'run_one "$1" "$2"' _
rmdir "$WORKROOT"