Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
8d690b2
Adding benchmark sampF
Jun 25, 2025
39ff9b9
Reducing number of benchmarks to be done
MSieczczynski Jun 25, 2025
0c06353
Merge remote-tracking branch 'origin/master' into pr/nhcal
MSieczczynski Jul 14, 2025
ca2ef53
Lowering amount of benchmarks to be done after merge
MSieczczynski Jul 14, 2025
332c6e9
New benchmark (light by light) in development
MSieczczynski Jul 15, 2025
beaf6f2
Include files in config and snakefile
MSieczczynski Jul 16, 2025
df3b7df
parallel:matrix error
MSieczczynski Jul 16, 2025
26d1bf6
Rename and fix dimuon_fotoproduction
MSieczczynski Jul 16, 2025
248fe64
Delete previous name
MSieczczynski Jul 16, 2025
59b66b2
Add new module for linking hits with tracks
Aug 13, 2025
0b2475c
New graphs for reconstruction
MSieczczynski Sep 24, 2025
1ecb2ad
Add new histograms and new muon matching change
MSieczczynski Sep 28, 2025
fff5346
Change in energy matching
MSieczczynski Sep 28, 2025
53d63b8
Second change in matching
MSieczczynski Sep 28, 2025
3422512
Change matching hit and tracks, add new graphs
MSieczczynski Oct 9, 2025
ed9abcd
Fix minor bugs
MSieczczynski Oct 10, 2025
a8dc1e5
New benchmark - pion rejection
Oct 19, 2025
4b70010
Change the title of graphs
MSieczczynski Oct 19, 2025
890772c
Change geometry of sampling fraction
MSieczczynski Oct 29, 2025
2dcb212
Fix name
MSieczczynski Oct 29, 2025
c3b51dc
Add presimulate and new condition for dimuon, new graphs
MSieczczynski Nov 2, 2025
a73c3f1
Fix Snakefile
MSieczczynski Nov 4, 2025
ceba67e
Fix Snakefile - names
MSieczczynski Nov 4, 2025
4cc2c1d
Fix snakefile sampling_fraction
MSieczczynski Nov 5, 2025
04a8431
params need `params.`, unlike wildcards
veprbl Nov 6, 2025
7388620
Add calculating energy resolution to basic_distribution
MSieczczynski Nov 9, 2025
43bae26
Add and fix error bars
MSieczczynski Nov 11, 2025
6ea4b81
Update input path for simulation rule
veprbl Nov 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 62 additions & 56 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,69 +121,75 @@ common:setup:
- runner_system_failure

include:
- local: 'benchmarks/backgrounds/config.yml'
- local: 'benchmarks/backwards_ecal/config.yml'
- local: 'benchmarks/beamline/config.yml'
- local: 'benchmarks/calo_pid/config.yml'
- local: 'benchmarks/ecal_gaps/config.yml'
- local: 'benchmarks/tracking_detectors/config.yml'
- local: 'benchmarks/tracking_performances/config.yml'
- local: 'benchmarks/tracking_performances_dis/config.yml'
- local: 'benchmarks/barrel_ecal/config.yml'
- local: 'benchmarks/lfhcal/config.yml'
- local: 'benchmarks/zdc/config.yml'
- local: 'benchmarks/zdc_lyso/config.yml'
- local: 'benchmarks/zdc_neutron/config.yml'
- local: 'benchmarks/zdc_photon/config.yml'
- local: 'benchmarks/zdc_pi0/config.yml'
- local: 'benchmarks/material_scan/config.yml'
- local: 'benchmarks/pid/config.yml'
- local: 'benchmarks/rich/config.yml'
- local: 'benchmarks/timing/config.yml'
- local: 'benchmarks/b0_tracker/config.yml'
- local: 'benchmarks/insert_muon/config.yml'
- local: 'benchmarks/insert_tau/config.yml'
- local: 'benchmarks/zdc_sigma/config.yml'
- local: 'benchmarks/zdc_lambda/config.yml'
- local: 'benchmarks/insert_neutron/config.yml'
- local: 'benchmarks/femc_electron/config.yml'
- local: 'benchmarks/femc_photon/config.yml'
- local: 'benchmarks/femc_pi0/config.yml'
- local: 'benchmarks/nhcal_acceptance/config.yml'
# - local: 'benchmarks/backgrounds/config.yml'
# - local: 'benchmarks/backwards_ecal/config.yml'
# - local: 'benchmarks/beamline/config.yml'
# - local: 'benchmarks/calo_pid/config.yml'
# - local: 'benchmarks/ecal_gaps/config.yml'
# - local: 'benchmarks/tracking_detectors/config.yml'
# - local: 'benchmarks/tracking_performances/config.yml'
# - local: 'benchmarks/tracking_performances_dis/config.yml'
# - local: 'benchmarks/barrel_ecal/config.yml'
# - local: 'benchmarks/lfhcal/config.yml'
# - local: 'benchmarks/zdc/config.yml'
# - local: 'benchmarks/zdc_lyso/config.yml'
# - local: 'benchmarks/zdc_neutron/config.yml'
# - local: 'benchmarks/zdc_photon/config.yml'
# - local: 'benchmarks/zdc_pi0/config.yml'
# - local: 'benchmarks/material_scan/config.yml'
# - local: 'benchmarks/pid/config.yml'
# - local: 'benchmarks/rich/config.yml'
# - local: 'benchmarks/timing/config.yml'
# - local: 'benchmarks/b0_tracker/config.yml'
# - local: 'benchmarks/insert_muon/config.yml'
# - local: 'benchmarks/insert_tau/config.yml'
# - local: 'benchmarks/zdc_sigma/config.yml'
# - local: 'benchmarks/zdc_lambda/config.yml'
# - local: 'benchmarks/insert_neutron/config.yml'
# - local: 'benchmarks/femc_electron/config.yml'
# - local: 'benchmarks/femc_photon/config.yml'
# - local: 'benchmarks/femc_pi0/config.yml'
# - local: 'benchmarks/nhcal_acceptance/config.yml'
- local: 'benchmarks/nhcal_basic_distribution/config.yml'
- local: 'benchmarks/nhcal_sampling_fraction/config.yml'
- local: 'benchmarks/nhcal_dimuon_fotoproduction/config.yml'
- local: 'benchmarks/nhcal_pion_rejection/config.yml'

deploy_results:
allow_failure: true
stage: deploy
needs:
- "collect_results:backgrounds"
- "collect_results:backwards_ecal"
- "collect_results:barrel_ecal"
- "collect_results:beamline"
- "collect_results:calo_pid"
- "collect_results:ecal_gaps"
- "collect_results:lfhcal"
- "collect_results:material_scan"
- "collect_results:pid"
- "collect_results:rich"
- "collect_results:tracking_performance"
- "collect_results:tracking_performance_campaigns"
- "collect_results:zdc_sigma"
- "collect_results:zdc_lambda"
- "collect_results:insert_neutron"
- "collect_results:tracking_performances_dis"
- "collect_results:zdc"
- "collect_results:zdc_lyso"
- "collect_results:zdc_neutron"
- "collect_results:insert_muon"
- "collect_results:insert_tau"
- "collect_results:zdc_photon"
- "collect_results:zdc_pi0"
- "collect_results:femc_electron"
- "collect_results:femc_photon"
- "collect_results:femc_pi0"
- "collect_results:nhcal_acceptance"
# - "collect_results:backgrounds"
# - "collect_results:backwards_ecal"
# - "collect_results:barrel_ecal"
# - "collect_results:beamline"
# - "collect_results:calo_pid"
# - "collect_results:ecal_gaps"
# - "collect_results:lfhcal"
# - "collect_results:material_scan"
# - "collect_results:pid"
# - "collect_results:rich"
# - "collect_results:tracking_performance"
# - "collect_results:tracking_performance_campaigns"
# - "collect_results:zdc_sigma"
# - "collect_results:zdc_lambda"
# - "collect_results:insert_neutron"
# - "collect_results:tracking_performances_dis"
# - "collect_results:zdc"
# - "collect_results:zdc_lyso"
# - "collect_results:zdc_neutron"
# - "collect_results:insert_muon"
# - "collect_results:insert_tau"
# - "collect_results:zdc_photon"
# - "collect_results:zdc_pi0"
# - "collect_results:femc_electron"
# - "collect_results:femc_photon"
# - "collect_results:femc_pi0"
# - "collect_results:nhcal_acceptance"
- "collect_results:nhcal_basic_distribution"
- "collect_results:nhcal_sampling_fraction"
- "collect_results:nhcal_dimuon_fotoproduction"
- "collect_results:nhcal_pion_rejection"
script:
- snakemake $SNAKEMAKE_FLAGS --cores 1 results/metadata.json
- find results -print | sort | tee summary.txt
Expand Down
49 changes: 26 additions & 23 deletions Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,30 +30,33 @@ def find_epic_libraries():
return libs


include: "benchmarks/backgrounds/Snakefile"
include: "benchmarks/backwards_ecal/Snakefile"
include: "benchmarks/barrel_ecal/Snakefile"
include: "benchmarks/beamline/Snakefile"
include: "benchmarks/calo_pid/Snakefile"
include: "benchmarks/ecal_gaps/Snakefile"
include: "benchmarks/material_scan/Snakefile"
include: "benchmarks/tracking_performances/Snakefile"
include: "benchmarks/tracking_performances_dis/Snakefile"
include: "benchmarks/lfhcal/Snakefile"
include: "benchmarks/zdc_lyso/Snakefile"
include: "benchmarks/zdc_neutron/Snakefile"
include: "benchmarks/insert_muon/Snakefile"
include: "benchmarks/zdc_lambda/Snakefile"
include: "benchmarks/zdc_photon/Snakefile"
include: "benchmarks/zdc_pi0/Snakefile"
include: "benchmarks/zdc_sigma/Snakefile"
include: "benchmarks/insert_neutron/Snakefile"
include: "benchmarks/insert_tau/Snakefile"
include: "benchmarks/femc_electron/Snakefile"
include: "benchmarks/femc_photon/Snakefile"
include: "benchmarks/femc_pi0/Snakefile"
include: "benchmarks/nhcal_acceptance/Snakefile"
# include: "benchmarks/backgrounds/Snakefile"
# include: "benchmarks/backwards_ecal/Snakefile"
# include: "benchmarks/barrel_ecal/Snakefile"
# include: "benchmarks/beamline/Snakefile"
# include: "benchmarks/calo_pid/Snakefile"
# include: "benchmarks/ecal_gaps/Snakefile"
# include: "benchmarks/material_scan/Snakefile"
# include: "benchmarks/tracking_performances/Snakefile"
# include: "benchmarks/tracking_performances_dis/Snakefile"
# include: "benchmarks/lfhcal/Snakefile"
# include: "benchmarks/zdc_lyso/Snakefile"
# include: "benchmarks/zdc_neutron/Snakefile"
# include: "benchmarks/insert_muon/Snakefile"
# include: "benchmarks/zdc_lambda/Snakefile"
# include: "benchmarks/zdc_photon/Snakefile"
# include: "benchmarks/zdc_pi0/Snakefile"
# include: "benchmarks/zdc_sigma/Snakefile"
# include: "benchmarks/insert_neutron/Snakefile"
# include: "benchmarks/insert_tau/Snakefile"
# include: "benchmarks/femc_electron/Snakefile"
# include: "benchmarks/femc_photon/Snakefile"
# include: "benchmarks/femc_pi0/Snakefile"
# include: "benchmarks/nhcal_acceptance/Snakefile"
include: "benchmarks/nhcal_basic_distribution/Snakefile"
include: "benchmarks/nhcal_sampling_fraction/Snakefile"
include: "benchmarks/nhcal_dimuon_fotoproduction/Snakefile"
include: "benchmarks/nhcal_pion_rejection/Snakefile"

use_s3 = config["remote_provider"].lower() == "s3"
use_xrootd = config["remote_provider"].lower() == "xrootd"
Expand Down
78 changes: 54 additions & 24 deletions benchmarks/nhcal_basic_distribution/Snakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import glob
from pathlib import Path

def get_energy_resolution_files(wildcards):
pattern = f"sim_output/nhcal_basic_distribution/energy_resolution_E*GeV_{wildcards.DETECTOR_CONFIG}_*files.root"
return sorted(glob.glob(pattern))

rule nhcal_basic_distribution_simulate:
input:
warmup=ancient("warmup/{DETECTOR_CONFIG}.edm4hep.root"),
warmup=ancient("warmup/{DETECTOR_CONFIG}.edm4hep.root"),
output:
"sim_output/nhcal_basic_distribution/E{ENERGY}GeV/sim_{DETECTOR_CONFIG}.{INDEX}.edm4hep.root",
params:
Expand All @@ -11,28 +18,28 @@ rule nhcal_basic_distribution_simulate:
ENERGY=lambda wildcards: wildcards.ENERGY,
DD4HEP_HASH=get_spack_package_hash("dd4hep"),
NPSIM_HASH=get_spack_package_hash("npsim"),
cache: True
# cache: True
shell:
"""
exec ddsim \
--compactFile {params.DETECTOR_PATH}/{params.DETECTOR_CONFIG}.xml \
--numberOfEvents {params.N_EVENTS} \
--random.seed {params.SEED} \
--enableGun \
-v WARNING \
--gun.particle neutron \
--gun.thetaMin 120*degree \
--gun.thetaMax 180*degree \
--gun.distribution uniform \
--gun.energy "{params.ENERGY}*GeV" \
--outputFile {output}
"""
exec npsim \
--compactFile {params.DETECTOR_PATH}/{params.DETECTOR_CONFIG}.xml \
--numberOfEvents {params.N_EVENTS} \
--random.seed {params.SEED} \
--enableGun \
-v WARNING \
--gun.particle neutron \
--gun.thetaMin 120*degree \
--gun.thetaMax 180*degree \
--gun.distribution uniform \
--gun.energy "{params.ENERGY}*GeV" \
--outputFile {output}
"""


rule nhcal_basic_distribution_combine:
input:
lambda wildcards: expand(
"sim_output/nhcal_basic_distribution/E{ENERGY:.1f}GeV/sim_{DETECTOR_CONFIG}.{INDEX:02d}.edm4hep.root",
"sim_output/nhcal_basic_distribution/E{ENERGY:.1f}GeV/sim_{DETECTOR_CONFIG}.{INDEX}.edm4hep.root",
DETECTOR_CONFIG=wildcards.DETECTOR_CONFIG,
ENERGY=float(wildcards.ENERGY),
INDEX=range(int(wildcards.N)),
Expand All @@ -41,20 +48,43 @@ rule nhcal_basic_distribution_combine:
N=r"\d+",
ENERGY=r"\d+(\.\d+)?"
output:
temp("sim_output/nhcal_basic_distribution/sim_{DETECTOR_CONFIG}_E{ENERGY}GeV_combined_{N}files.edm4hep.root"),
temp("sim_output/nhcal_basic_distribution/sim_E{ENERGY}GeV_{DETECTOR_CONFIG}_{N}files.edm4hep.root"),
shell:
"""
hadd -f {output} {input}
"""
hadd -f {output} {input}
"""


rule nhcal_basic_distribution_analysis:
input:
combined="sim_output/nhcal_basic_distribution/sim_{DETECTOR_CONFIG}_E{ENERGY}GeV_combined_{N}files.edm4hep.root",
combined="sim_output/nhcal_basic_distribution/sim_E{ENERGY}GeV_{DETECTOR_CONFIG}_{N}files.edm4hep.root",
script="benchmarks/nhcal_basic_distribution/scripts/basic_distribution_analysis.cxx",
output:
pdf=f"results/nhcal_basic_distribution/analysis_{{DETECTOR_CONFIG}}_E{{ENERGY}}GeV_combined_{{N}}files.pdf",
png=f"results/nhcal_basic_distribution/analysis_{{DETECTOR_CONFIG}}_E{{ENERGY}}GeV_combined_{{N}}files.png",
png="results/nhcal_basic_distribution/analysis_E{ENERGY}GeV_{DETECTOR_CONFIG}_{N}files.png",
root="sim_output/nhcal_basic_distribution/energy_resolution_E{ENERGY}GeV_{DETECTOR_CONFIG}_{N}files.root",
shell:
"""
root -l -b -q '{input.script}("{input.combined}","{output.png}","{output.root}")'
"""

rule nhcal_basic_distribution_combine_energy_resolution:
input:
get_energy_resolution_files
output:
temp("sim_output/nhcal_basic_distribution/energy_resolution_combined_{DETECTOR_CONFIG}.root"),
shell:
"""
root -l -b -q '{input.script}("{input.combined}","{output.pdf}","{output.png}")'
"""
hadd -f {output} {input}
"""

rule nhcal_basic_distribution_analysis_energy_resolution:
input:
root="sim_output/nhcal_basic_distribution/energy_resolution_combined_{DETECTOR_CONFIG}.root",
script="benchmarks/nhcal_basic_distribution/scripts/basic_distribution_energy_resolution.cxx",
output:
png="results/nhcal_basic_distribution/energy_resolution_analysis_{DETECTOR_CONFIG}.png",
shell:
"""
root -l -b -q '{input.script}("{input.root}","{output.png}")'
"""

35 changes: 24 additions & 11 deletions benchmarks/nhcal_basic_distribution/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ sim:nhcal_basic_distribution:
stage: simulate
parallel:
matrix:
- ENERGY: ["0.5GeV", "0.7GeV", "1.0GeV", "2.0GeV", "5.0GeV"]
- ENERGY: ["0.5", "0.7", "1.0", "2.0", "5.0"]
INDEX_RANGE: ["0 4","5 9"]
script:
- snakemake $SNAKEMAKE_FLAGS --cores $MAX_CORES_PER_JOB $(for INDEX in $(seq -f '%02.0f' $INDEX_RANGE); do echo sim_output/nhcal_basic_distribution/E${ENERGY}/sim_epic_backward_hcal_only.${INDEX}.edm4hep.root; done)
- snakemake $SNAKEMAKE_FLAGS --cores $MAX_CORES_PER_JOB $(for INDEX in $(seq -f '%02.0f' $INDEX_RANGE); do echo sim_output/nhcal_basic_distribution/E${ENERGY}GeV/sim_epic_backward_hcal_only.${INDEX}.edm4hep.root; done)

sim:nhcal_basic_distribution_full:
extends: .det_benchmark
stage: simulate
parallel:
matrix:
- ENERGY: ["0.5GeV", "0.7GeV", "1.0GeV", "2.0GeV", "5.0GeV"]
- ENERGY: ["0.5", "0.7", "1.0", "2.0", "5.0"]
INDEX_RANGE: ["0 4","5 9"]
script:
- snakemake $SNAKEMAKE_FLAGS --cores $MAX_CORES_PER_JOB $(for INDEX in $(seq -f '%02.0f' $INDEX_RANGE); do echo sim_output/nhcal_basic_distribution/E${ENERGY}/sim_epic_full.${INDEX}.edm4hep.root; done)
- snakemake $SNAKEMAKE_FLAGS --cores $MAX_CORES_PER_JOB $(for INDEX in $(seq -f '%02.0f' $INDEX_RANGE); do echo sim_output/nhcal_basic_distribution/E${ENERGY}GeV/sim_epic_full.${INDEX}.edm4hep.root; done)

bench:nhcal_basic_distribution_analysis:
extends: .det_benchmark
Expand All @@ -25,9 +25,16 @@ bench:nhcal_basic_distribution_analysis:
- "sim:nhcal_basic_distribution"
parallel:
matrix:
- ENERGY: ["0.5GeV", "0.7GeV", "1.0GeV", "2.0GeV", "5.0GeV"]
- ENERGY: ["0.5", "0.7", "1.0", "2.0", "5.0"]
script:
- snakemake $SNAKEMAKE_FLAGS --cores 1 results/nhcal_basic_distribution/analysis_epic_backward_hcal_only_E${ENERGY}_combined_10files.pdf
- |
for ENERGY in 0.5 0.7 1.0 2.0 5.0; do
snakemake $SNAKEMAKE_FLAGS --cores 1 \
results/nhcal_basic_distribution/analysis_E${ENERGY}GeV_epic_backward_hcal_only_10files.png \
sim_output/nhcal_basic_distribution/energy_resolution_E${ENERGY}GeV_epic_backward_hcal_only.root
done
- snakemake $SNAKEMAKE_FLAGS --cores 1 \
results/nhcal_basic_distribution/energy_resolution_analysis_epic_backward_hcal_only.png

bench:nhcal_basic_distribution_analysis_full:
extends: .det_benchmark
Expand All @@ -36,9 +43,16 @@ bench:nhcal_basic_distribution_analysis_full:
- "sim:nhcal_basic_distribution_full"
parallel:
matrix:
- ENERGY: ["0.5GeV", "0.7GeV", "1.0GeV", "2.0GeV", "5.0GeV"]
- ENERGY: ["0.5", "0.7", "1.0", "2.0", "5.0"]
script:
- snakemake $SNAKEMAKE_FLAGS --cores 1 results/nhcal_basic_distribution/analysis_epic_full_E${ENERGY}_combined_10files.pdf
- |
for ENERGY in 0.5 0.7 1.0 2.0 5.0; do
snakemake $SNAKEMAKE_FLAGS --cores 1 \
results/nhcal_basic_distribution/analysis_E${ENERGY}GeV_epic_full_10files.png \
sim_output/nhcal_basic_distribution/energy_resolution_E${ENERGY}GeV_epic_full.root
done
- snakemake $SNAKEMAKE_FLAGS --cores 1 \
results/nhcal_basic_distribution/energy_resolution_analysis_epic_full.png


collect_results:nhcal_basic_distribution:
Expand All @@ -49,11 +63,10 @@ collect_results:nhcal_basic_distribution:
- "bench:nhcal_basic_distribution_analysis_full"
parallel:
matrix:
- ENERGY: ["0.5GeV", "0.7GeV", "1.0GeV", "2.0GeV", "5.0GeV"]
DETECTOR_CONFIG: ["epic_backward_hcal_only", "epic_full"]
- DETECTOR_CONFIG: ["epic_backward_hcal_only", "epic_full"]
script:
- ls -lrht
- mv results{,_save}/
- snakemake $SNAKEMAKE_FLAGS --cores 1 --delete-all-output results/nhcal_basic_distribution/analysis_${DETECTOR_CONFIG}_E${ENERGY}_combined_10files.pdf
- snakemake $SNAKEMAKE_FLAGS --cores 1 --delete-all-output results/nhcal_basic_distribution/energy_resolution_analysis_{DETECTOR_CONFIG}.png
- mv results{_save,}/

Loading