Skip to content
Snippets Groups Projects
Commit a7c8b4aa authored by Wouter Deconinck's avatar Wouter Deconinck
Browse files

feat: parallel matrix for sim:hcal_barrel_*

parent f3ae7aae
No related branches found
No related tags found
1 merge request!162feat: parallel matrix for sim:hcal_barrel_*
sim:hcal_barrel_pions: sim:hcal_barrel:
extends: .det_benchmark extends: .det_benchmark
stage: simulate stage: simulate
parallel:
matrix:
- PARTICLE: ["piplus", "piminus", "kplus", "kminus", "kshort", "klong", "muon", "antimuon", "proton"]
script: script:
- bash benchmarks/barrel_hcal/run_hcal_barrel_particles.sh piplus - bash benchmarks/barrel_hcal/run_hcal_barrel_particles.sh ${PARTICLE}
- bash benchmarks/barrel_hcal/run_hcal_barrel_particles.sh piminus
sim:hcal_barrel_kaons: sim:hcal_barrel:scan:
extends: .det_benchmark extends: .det_benchmark
stage: simulate stage: simulate
parallel:
matrix:
- PARTICLE: ["muon", "antimuon", "proton"]
E: ["0.25", "0.5", "1", "2", "3", "4", "7", "15", "20"]
script: script:
- bash benchmarks/barrel_hcal/run_hcal_barrel_particles.sh kplus - bash benchmarks/barrel_hcal/run_hcal_barrel_energy_scan.sh ${PARTICLE} ${E}
- bash benchmarks/barrel_hcal/run_hcal_barrel_particles.sh kminus
- bash benchmarks/barrel_hcal/run_hcal_barrel_particles.sh kshort
- bash benchmarks/barrel_hcal/run_hcal_barrel_particles.sh klong
sim:hcal_barrel_muons: bench:hcal_barrel:
extends: .det_benchmark
stage: simulate
script:
- bash benchmarks/barrel_hcal/run_hcal_barrel_energy_scan.sh muon
- bash benchmarks/barrel_hcal/run_hcal_barrel_particles.sh muon
sim:hcal_barrel_antimuons:
extends: .det_benchmark
stage: simulate
script:
- bash benchmarks/barrel_hcal/run_hcal_barrel_energy_scan.sh antimuon
- bash benchmarks/barrel_hcal/run_hcal_barrel_particles.sh antimuon
sim:hcal_barrel_protons:
extends: .det_benchmark
stage: simulate
script:
- bash benchmarks/barrel_hcal/run_hcal_barrel_energy_scan.sh proton
- bash benchmarks/barrel_hcal/run_hcal_barrel_particles.sh proton
bench:hcal_barrel_protons:
extends: .det_benchmark
stage: benchmarks
needs:
- ["sim:hcal_barrel_protons"]
script:
- ls -lhtR sim_output/
- rootls -t sim_output/sim_hcal_barrel_proton.edm4hep.root
- root -b -q 'benchmarks/barrel_hcal/scripts/hcal_barrel_particles_analysis.cxx+("proton")'
- root -b -q 'benchmarks/barrel_hcal/scripts/hcal_barrel_energy_scan_analysis.cxx+("proton")'
bench:hcal_barrel_muons:
extends: .det_benchmark
stage: benchmarks
needs:
- ["sim:hcal_barrel_muons"]
script:
- ls -lhtR sim_output/
- rootls -t sim_output/sim_hcal_barrel_muon.edm4hep.root
- root -b -q 'benchmarks/barrel_hcal/scripts/hcal_barrel_particles_analysis.cxx+("muon")'
- root -b -q 'benchmarks/barrel_hcal/scripts/hcal_barrel_energy_scan_analysis.cxx+("muon")'
bench:hcal_barrel_antimuons:
extends: .det_benchmark
stage: benchmarks
needs:
- ["sim:hcal_barrel_antimuons"]
script:
- ls -lhtR sim_output/
- rootls -t sim_output/sim_hcal_barrel_antimuon.edm4hep.root
- root -b -q 'benchmarks/barrel_hcal/scripts/hcal_barrel_particles_analysis.cxx+("antimuon")'
- root -b -q 'benchmarks/barrel_hcal/scripts/hcal_barrel_energy_scan_analysis.cxx+("antimuon")'
bench:hcal_barrel_kaons:
extends: .det_benchmark extends: .det_benchmark
stage: benchmarks stage: benchmarks
needs: needs:
- ["sim:hcal_barrel_kaons"] - ["sim:hcal_barrel"]
parallel:
matrix:
- PARTICLE: ["piplus", "piminus", "kplus", "kminus", "kshort", "klong", "muon", "antimuon", "proton"]
script: script:
- ls -lhtR sim_output/ - ls -lhtR sim_output/
- rootls -t sim_output/sim_hcal_barrel_kplus.edm4hep.root - rootls -t sim_output/sim_hcal_barrel_${PARTICLE}.edm4hep.root
- root -b -q 'benchmarks/barrel_hcal/scripts/hcal_barrel_particles_analysis.cxx+("kplus")' - root -b -q 'benchmarks/barrel_hcal/scripts/hcal_barrel_particles_analysis.cxx+("'${PARTICLE}'")'
- rootls -t sim_output/sim_hcal_barrel_kminus.edm4hep.root
- root -b -q 'benchmarks/barrel_hcal/scripts/hcal_barrel_particles_analysis.cxx+("kminus")'
- rootls -t sim_output/sim_hcal_barrel_kshort.edm4hep.root
- root -b -q 'benchmarks/barrel_hcal/scripts/hcal_barrel_particles_analysis.cxx+("kshort")'
- rootls -t sim_output/sim_hcal_barrel_klong.edm4hep.root
- root -b -q 'benchmarks/barrel_hcal/scripts/hcal_barrel_particles_analysis.cxx+("klong")'
bench:hcal_barrel_pions: bench:hcal_barrel:scan:
extends: .det_benchmark extends: .det_benchmark
stage: benchmarks stage: benchmarks
needs: needs:
- ["sim:hcal_barrel_pions"] - ["sim:hcal_barrel:scan"]
parallel:
matrix:
- PARTICLE: ["muon", "antimuon", "proton"]
script: script:
- ls -lhtR sim_output/ - ls -lhtR sim_output/
- rootls -t sim_output/sim_hcal_barrel_piplus.edm4hep.root - sort -n sim_output/hcal_barrel_energy_scan_points_${PARTICLE}_*.txt > sim_output/hcal_barrel_energy_scan_points_${PARTICLE}.txt
- root -b -q 'benchmarks/barrel_hcal/scripts/hcal_barrel_particles_analysis.cxx+("piplus")' - root -b -q 'benchmarks/barrel_hcal/scripts/hcal_barrel_energy_scan_analysis.cxx+("'${PARTICLE}'")'
- rootls -t sim_output/sim_hcal_barrel_piminus.edm4hep.root
- root -b -q 'benchmarks/barrel_hcal/scripts/hcal_barrel_particles_analysis.cxx+("piminus")'
collect_results:barrel_hcal: collect_results:barrel_hcal:
extends: .det_benchmark extends: .det_benchmark
stage: collect stage: collect
needs: needs:
- ["bench:hcal_barrel_muons", "bench:hcal_barrel_protons", "bench:hcal_barrel_kaons", "bench:hcal_barrel_pions"] - ["bench:hcal_barrel", "bench:hcal_barrel:scan"]
script: script:
- ls -lrht - ls -lrht
- echo " FIX ME" - echo " FIX ME"
......
#!/bin/bash #!/bin/bash
export PARTICLE=$1 export PARTICLE=$1
E_file="sim_output/hcal_barrel_energy_scan_points_${PARTICLE}.txt" shift
E_file="sim_output/hcal_barrel_energy_scan_points_${PARTICLE}_${CI_JOB_ID}.txt"
#for E in 1 2 6 10 if [ $# -gt 0 ] ; then
for E in 0.25 0.5 1 2 3 4 7 15 20 E_VALUES=("$@")
else
E_VALUES=(0.25 0.5 1 2 3 4 7 15 20)
fi
for E in ${E_VALUES[@]}
do do
export E_START="$E" export E_START="$E"
export E_END="$E" export E_END="$E"
export JUGGLER_FILE_NAME_TAG=hcal_barrel_${PARTICLE}_${E}
bash benchmarks/barrel_hcal/run_hcal_barrel_particles.sh "${PARTICLE}" && echo "$E" >> "$E_file" || exit 1 bash benchmarks/barrel_hcal/run_hcal_barrel_particles.sh "${PARTICLE}" && echo "$E" >> "$E_file" || exit 1
path_rootfiles="sim_output/energy_scan/${E}/" path_rootfiles="sim_output/energy_scan/${E}/"
path_plots="results/energy_scan/${E}/" path_plots="results/energy_scan/${E}/"
mkdir -p "$path_rootfiles" mkdir -p "$path_rootfiles"
mkdir -p "$path_plots" mkdir -p "$path_plots"
ls -lthaR sim_output/ ls -lthaR sim_output/
mv "sim_output/sim_hcal_barrel_${PARTICLE}.edm4hep.root" "$path_rootfiles" mv "sim_output/sim_${JUGGLER_FILE_NAME_TAG}.edm4hep.root" "$path_rootfiles/sim_hcal_barrel_${PARTICLE}.edm4hep.root"
done done
ls -lthaR sim_output ls -lthaR sim_output
......
...@@ -21,10 +21,13 @@ if [[ ! -n "${PARTICLE}" ]] ; then ...@@ -21,10 +21,13 @@ if [[ ! -n "${PARTICLE}" ]] ; then
export PARTICLE="electron" export PARTICLE="electron"
fi fi
export JUGGLER_FILE_NAME_TAG="hcal_barrel_${PARTICLE}" if [[ ! -n "${JUGGLER_FILE_NAME_TAG}" ]] ; then
export JUGGLER_GEN_FILE="${JUGGLER_FILE_NAME_TAG}.hepmc" export JUGGLER_FILE_NAME_TAG="hcal_barrel_${PARTICLE}"
fi
export JUGGLER_GEN_FILE="data/${JUGGLER_FILE_NAME_TAG}.hepmc"
export JUGGLER_SIM_FILE="sim_${JUGGLER_FILE_NAME_TAG}.edm4hep.root" export JUGGLER_SIM_FILE="sim_output/sim_${JUGGLER_FILE_NAME_TAG}.edm4hep.root"
export JUGGLER_REC_FILE="rec_${JUGGLER_FILE_NAME_TAG}.root" export JUGGLER_REC_FILE="rec_${JUGGLER_FILE_NAME_TAG}.root"
echo "JUGGLER_N_EVENTS = ${JUGGLER_N_EVENTS}" echo "JUGGLER_N_EVENTS = ${JUGGLER_N_EVENTS}"
...@@ -51,8 +54,8 @@ ddsim --runType batch \ ...@@ -51,8 +54,8 @@ ddsim --runType batch \
--filter.tracker edep0 \ --filter.tracker edep0 \
--numberOfEvents ${JUGGLER_N_EVENTS} \ --numberOfEvents ${JUGGLER_N_EVENTS} \
--compactFile ${DETECTOR_PATH}/${DETECTOR_CONFIG}.xml \ --compactFile ${DETECTOR_PATH}/${DETECTOR_CONFIG}.xml \
--inputFiles data/${JUGGLER_FILE_NAME_TAG}.hepmc \ --inputFiles ${JUGGLER_GEN_FILE} \
--outputFile sim_output/${JUGGLER_SIM_FILE} --outputFile ${JUGGLER_SIM_FILE}
if [[ "$?" -ne "0" ]] ; then if [[ "$?" -ne "0" ]] ; then
echo "ERROR running npdet" echo "ERROR running npdet"
...@@ -61,7 +64,3 @@ fi ...@@ -61,7 +64,3 @@ fi
# Directory for plots # Directory for plots
mkdir -p results mkdir -p results
# Move ROOT output file
#mv ${JUGGLER_REC_FILE} sim_output/
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <fstream> #include <fstream>
#include <math.h> #include <math.h>
#include <random> #include <random>
#include <cstdlib>
#include <fmt/core.h> #include <fmt/core.h>
#include "hcal_barrel_common_functions.h" #include "hcal_barrel_common_functions.h"
...@@ -25,7 +26,12 @@ ...@@ -25,7 +26,12 @@
using namespace HepMC3; using namespace HepMC3;
void hcal_barrel_particles_gen(int n_events = 1e6, double e_start = 0.0, double e_end = 20.0, std::string particle_name = "muon") { void hcal_barrel_particles_gen(int n_events = 1e6, double e_start = 0.0, double e_end = 20.0, std::string particle_name = "muon") {
std::string out_fname = fmt::format("./data/hcal_barrel_{}.hepmc", particle_name); std::string out_fname;
auto env_fname = getenv("JUGGLER_GEN_FILE");
if (env_fname != nullptr)
out_fname = env_fname;
else
out_fname = fmt::format("./data/hcal_barrel_{}.hepmc", particle_name);
WriterAscii hepmc_output(out_fname); WriterAscii hepmc_output(out_fname);
int events_parsed = 0; int events_parsed = 0;
GenEvent evt(Units::GEV, Units::MM); GenEvent evt(Units::GEV, Units::MM);
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include <cstdlib>
#include <fmt/core.h> #include <fmt/core.h>
#include "hcal_barrel_common_functions.h" #include "hcal_barrel_common_functions.h"
...@@ -50,7 +51,12 @@ void hcal_barrel_particles_reader(std::string particle_name = "electron") ...@@ -50,7 +51,12 @@ void hcal_barrel_particles_reader(std::string particle_name = "electron")
gStyle->SetPadLeftMargin(0.14); gStyle->SetPadLeftMargin(0.14);
gStyle->SetPadRightMargin(0.17); gStyle->SetPadRightMargin(0.17);
std::string in_fname = fmt::format("./data/hcal_barrel_{}.hepmc",particle_name); std::string in_fname;
auto env_fname = getenv("JUGGLER_GEN_FILE");
if (env_fname != nullptr)
in_fname = env_fname;
else
in_fname = fmt::format("./data/hcal_barrel_{}.hepmc", particle_name);
ReaderAscii hepmc_input(in_fname); ReaderAscii hepmc_input(in_fname);
int events_parsed = 0; int events_parsed = 0;
GenEvent evt(Units::GEV, Units::MM); GenEvent evt(Units::GEV, Units::MM);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment