Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
08586ff
Added files
simonge Sep 16, 2024
df1b38e
Update
simonge Oct 30, 2024
810cc3b
Make canvas name more useful
simonge Mar 11, 2025
0973e5d
Add beam generator macro
simonge Mar 11, 2025
1323fe0
Update analysis
simonge Apr 30, 2025
6329372
Add phasespace scripts
simonge May 2, 2025
67d765c
Change name of functors
simonge May 2, 2025
3afabcb
Remove image and acceptance benchmarks for now
simonge Jun 4, 2025
99633c2
Prepare for CI testing
simonge Jun 4, 2025
0deb701
Remove other benchmarks
simonge Jun 4, 2025
163341b
Add missing config.yml
simonge Jun 4, 2025
7a58355
Correct typo
simonge Jun 4, 2025
5cd62be
Re-enable other benchmarks and update cores
simonge Jun 17, 2025
312ca42
Add some pass fail checks
simonge Jun 18, 2025
02e0c0e
Set sim and analysis dir by variable
simonge Jun 18, 2025
e39d0f9
Revert exclusion of other benchmarks
simonge Jun 19, 2025
67d4206
Review suggestions
simonge Jun 19, 2025
81fad99
Snakefile: fix for out-of-tree running
veprbl Jun 19, 2025
6b21ff1
Snakefile restore indentation
veprbl Jun 19, 2025
b18bf3f
Add header to inputs too
simonge Jun 23, 2025
c7e268f
Add low-q2 phase space electron tests
simonge May 20, 2025
c964d40
Add acceptance sim
simonge Jun 19, 2025
8b98ed6
Make simulation run with correct range and 1000x faster
simonge Jun 20, 2025
31fe8ef
Add outputs from script
simonge Jun 20, 2025
ccddf53
Change code inputs to workflow source path
simonge Jun 23, 2025
f44d690
rename phasespace to acceptance
simonge Jun 23, 2025
4df2119
Remove unused code
simonge Jun 23, 2025
96e8b50
Define both simulations in the yml
simonge Jun 23, 2025
40d4fe8
Merge remote-tracking branch 'origin/master' into beamline_acceptance
simonge Jun 23, 2025
6878af8
Add entry fraction plot
simonge Jun 24, 2025
09f8681
Make filtering more robust
simonge Jun 24, 2025
40e1fa9
Change entry limit warning
simonge Jun 24, 2025
158c8ef
Add reconstruction training based on beampipe exit
simonge Jun 25, 2025
d937fdb
Update model and atempt to setup snakemake
simonge Jun 25, 2025
e5a4ab8
Fix snakemane rule and silence npsim info
simonge Jun 25, 2025
13030cc
Fix snakemake attribute
simonge Jun 25, 2025
02665c3
Scale momentum to unit vector
simonge Jun 26, 2025
16adc7f
Add tensors to device too
simonge Jun 27, 2025
a208cd7
Update benchmarks/beamline/Snakefile
simonge Jul 7, 2025
d2ebe91
Various improvements
simonge Jul 14, 2025
c02b517
Merge branch 'beamline_training' of github.com:eic/detector_benchmark…
simonge Jul 14, 2025
48b1e11
Merge remote-tracking branch 'origin/master' into beamline_training
simonge Jul 14, 2025
ae27686
Lots of updates, filtering of lowq2 hepmc events
simonge Jul 25, 2025
3075944
Add some versitility
simonge Jul 28, 2025
ecd5829
Add resolution test
simonge Jul 28, 2025
91b5041
Change phi plots to degrees
simonge Jul 28, 2025
7723f89
Extra workflow steps and fixes
simonge Jul 29, 2025
322768a
Swapping to huberloss helps
simonge Jul 30, 2025
5613274
Merge remote-tracking branch 'origin/master' into beamline_training
simonge Jul 30, 2025
0238978
Move reconstruction to separate benchmark
simonge Aug 4, 2025
6a27a3e
include lowq2_reconstruction in snakefile
simonge Aug 4, 2025
fafb5e1
Rename processData to cleanData
simonge Aug 4, 2025
ec179b4
Rename ProcessData to LoadData
simonge Aug 4, 2025
5dc2f28
Add lowq2_reconstruction snakefile
simonge Aug 4, 2025
1fcba19
Update CI bits
simonge Aug 4, 2025
c0855b8
Temporarily comment out other benchmarks
simonge Aug 4, 2025
999fb63
Fix namings maybe
simonge Aug 4, 2025
2e50f83
Add failure conditions on resolutions
simonge Aug 4, 2025
e44eac7
Fix benchmark stage
simonge Aug 4, 2025
1fddc48
Fix naming
simonge Aug 4, 2025
7e38cdc
Allow int return to flag fail
simonge Aug 5, 2025
673af74
Separate resolution check from plot creation
simonge Aug 5, 2025
9dbd3aa
Fix naming and add onnx
simonge Aug 12, 2025
b6cde3b
Merge remote-tracking branch 'origin/master' into beamline_training
simonge Aug 12, 2025
7606250
Merge updates from training-CI branch
simonge Aug 19, 2025
06ba1dc
Fix beamline running
simonge Aug 19, 2025
f4f68e9
Require successful beamline benchmark before triggering reconstructio…
simonge Aug 19, 2025
0a89651
Remove optional projection from old inputs
simonge Aug 19, 2025
0f8f68d
Reinclude beamline benchmarks
simonge Aug 19, 2025
349cc53
Re-enable in snakefile too
simonge Aug 20, 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
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ __pycache__/
*$py.class
.ipynb_checkpoints

# results and simulation output
results/
sim_output/
.snakemake/
calibrations/
fieldmaps/

# test for calorimeter
calorimeters/test/
*.d
Expand Down
118 changes: 60 additions & 58 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,70 +122,72 @@ common:setup:
- runner_system_failure

include:
- local: 'benchmarks/backgrounds/config.yml'
- local: 'benchmarks/backwards_ecal/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/campaign/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/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/calo_pid/config.yml'
# - local: 'benchmarks/campaign/config.yml'
# - local: 'benchmarks/ecal_gaps/config.yml'
- local: 'benchmarks/lowq2_reconstruction/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/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'

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:campaign"
- "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:backgrounds"
# - "collect_results:backwards_ecal"
# - "collect_results:barrel_ecal"
# - "collect_results:beamline"
# - "collect_results:calo_pid"
# - "collect_results:campaign"
# - "collect_results:ecal_gaps"
# - "collect_results:lfhcal"
- "collect_results:lowq2_reconstruction"
# - "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"
script:
- snakemake $SNAKEMAKE_FLAGS --cores 1 results/metadata.json
- find results -print | sort | tee summary.txt
Expand Down
49 changes: 25 additions & 24 deletions Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,31 +30,32 @@ def find_epic_libraries():
return libs


include: "benchmarks/backgrounds/Snakefile"
include: "benchmarks/backwards_ecal/Snakefile"
include: "benchmarks/barrel_ecal/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/campaign/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/calo_pid/Snakefile"
# include: "benchmarks/campaign/Snakefile"
# include: "benchmarks/ecal_gaps/Snakefile"
include : "benchmarks/lowq2_reconstruction/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"

use_s3 = config["remote_provider"].lower() == "s3"
use_xrootd = config["remote_provider"].lower() == "xrootd"
Expand Down
59 changes: 36 additions & 23 deletions benchmarks/beamline/Snakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
SIMOUTDIR="sim_output/beamline/"
ANALYSISDIR=SIMOUTDIR+"analysis/"

##########################################################################################
### Rules for checking the steering of the electron beam through the magnets
##########################################################################################

rule beamline_steering_sim:
input:
warmup="warmup/epic_ip6_extended.edm4hep.root",
Expand All @@ -20,25 +24,6 @@ rule beamline_steering_sim:
--physics.rangecut 100*m
"""

rule beamline_acceptance_sim:
input:
warmup="warmup/epic_ip6_extended.edm4hep.root",
macro=workflow.source_path("acceptanceGPS.mac"),
output:
SIMOUTDIR+"acceptanceTest{CAMPAIGN}.edm4hep.root",
shell:
"""
exec npsim \
--runType run \
--random.seed 1 \
--enableG4GPS \
--macroFile {input.macro} \
--compactFile $DETECTOR_PATH/epic_ip6_extended.xml \
--printLevel WARNING \
--outputFile {output} \
--physics.rangecut 100*m
"""

rule beamline_steering_analysis:
input:
warmup="warmup/epic_ip6_extended.edm4hep.root",
Expand All @@ -63,6 +48,28 @@ rule beamline_steering_analysis:
"{output.pipe_parameter_canvas}")'
"""

##########################################################################################
### Rules for checking the acceptance of electrons at each stage of the beamline
##########################################################################################

rule beamline_acceptance_sim:
input:
warmup="warmup/epic_ip6_extended.edm4hep.root",
macro=workflow.source_path("acceptanceGPS.mac"),
output:
SIMOUTDIR+"acceptanceTest{CAMPAIGN}.edm4hep.root",
shell:
"""
exec npsim \
--runType run \
--random.seed 1 \
--enableG4GPS \
--macroFile {input.macro} \
--compactFile $DETECTOR_PATH/epic_ip6_extended.xml \
--outputFile {output} \
--physics.rangecut 100*m
"""

rule beamline_acceptance_analysis:
input:
warmup="warmup/epic_ip6_extended.edm4hep.root",
Expand All @@ -80,9 +87,12 @@ rule beamline_acceptance_analysis:
shell:
"""
root -l -b -q '{input.script}("{input.data}", "{output.rootfile}", "{params.xml}", "{output.beampipe_canvas}","{output.etheta_canvas}","{output.etheta_acceptance_canvas}",
"{output.entries_canvas}")'
"{output.entrys_canvas}")'
"""

##########################################################################################
# Combine results
##########################################################################################
rule beamline:
input:
ANALYSISDIR+"beamlineTestAnalysis{CAMPAIGN}.root",
Expand All @@ -96,15 +106,18 @@ rule beamline:
ANALYSISDIR+"acceptance_in_beampipe_{CAMPAIGN}.png",
ANALYSISDIR+"acceptance_energy_theta_{CAMPAIGN}.png",
ANALYSISDIR+"acceptance_energy_theta_acceptance_{CAMPAIGN}.png",
ANALYSISDIR+"acceptance_entries_{CAMPAIGN}.png",
ANALYSISDIR+"acceptance_entries_{CAMPAIGN}.png"
output:
directory("results/beamline/{CAMPAIGN}/")
directory("results/beamline/steering_{CAMPAIGN}/")
shell:
"""
mkdir {output}
cp {input} {output}
cp -r {input} {output}
"""

##########################################################################################
# Defualt running
##########################################################################################
rule beamline_local:
input:
"results/beamline/local/"
2 changes: 2 additions & 0 deletions benchmarks/beamline/beamlineAnalysis.C
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,8 @@ int beamlineAnalysis( TString inFile = "/scratch/EIC/G4out/beamline/b
std::cout << "Warning: Only " << h->GetEntries()/nEntries << " of particles contributing to histogram " << name
<< " , which is below the accepted threshold of " << acceptableEntries/nEntries << std::endl;
pass = 1;
} else{
std::cout << "Histogram " << name << " has " << h->GetEntries() << " entries." << std::endl;
}

// Get the pipe radius for this histogram
Expand Down
15 changes: 15 additions & 0 deletions benchmarks/lowq2_reconstruction/LoadData.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import uproot
import awkward as ak

def create_arrays(dataFiles,featureName="_TaggerTrackerFeatureTensor_floatData",targetName="_TaggerTrackerTargetTensor_floatData", entries=None, treeName="events"):

# List of branches to load
branches = [featureName,targetName]

# Load data from concatenated list of files
data = uproot.concatenate([f"{file}:{treeName}" for file in dataFiles], branches, entry_stop=entries, library="ak")

input_data = data[featureName]
target_data = data[targetName]

return input_data, target_data
Loading