G4ava/runskripts/generate_macros.sh
2026-05-11 16:58:54 +02:00

33 lines
No EOL
1 KiB
Bash
Executable file
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# 15 logspace Energien = 3 Macros × 5 pro Teilchen!
ENERGIES_15=(30 47 75 118 186 294 464 732 1155 1825 2884 4555 7193 11349 17908)
PARTICLES=(proton helium muon "e-")
cd /home/et189/Geant4/G4ava/macros/
cp template_5energies.mac temp_template.mac
for particle in "${PARTICLES[@]}"; do
for ((macro=1; macro<=3; macro++)); do
start=$(((macro-1)*5))
e1=${ENERGIES_15[start]}
e2=${ENERGIES_15[$((start+1))]}
e3=${ENERGIES_15[$((start+2))]}
e4=${ENERGIES_15[$((start+3))]}
e5=${ENERGIES_15[$((start+4))]}
sed -e "s|\${PARTICLE}|${particle}|g" \
-e "s|\${SETNR}|${macro}|g" \
-e "s|\${E1}|${e1}|g" \
-e "s|\${E2}|${e2}|g" \
-e "s|\${E3}|${e3}|g" \
-e "s|\${E4}|${e4}|g" \
-e "s|\${E5}|${e5}|g" \
temp_template.mac > "BGO6cm_${particle}_${macro}.mac"
echo "✅ BGO6cm_${particle}_${macro}.mac (${e1}-${e5} MeV)"
done
done
rm temp_template.mac
ls -la BGO6cm_*_*.mac