Skip to content
Snippets Groups Projects
Commit c46707ed authored by Dmitry Kalinkin's avatar Dmitry Kalinkin
Browse files

tracking_performance: enable running over campaigns

parent 80a8746b
No related branches found
No related tags found
No related merge requests found
Pipeline #98229 passed with warnings
......@@ -121,6 +121,9 @@ get_data:
- mkdir "${DETECTOR_CONFIG}"
- ln -s "${LOCAL_DATA_PATH}/sim_output" "${DETECTOR_CONFIG}/sim_output"
- ln -s "../results" "${DETECTOR_CONFIG}/results"
# cache downloaded artifacts
- if [ -d /scratch ]; then mkdir -p /scratch/EPIC; ln -sf /scratch/EPIC ./EPIC; fi
- du -hs /scratch/EPIC
- ls -lrtha
retry:
max: 2
......
......@@ -4,7 +4,16 @@ The scripts can be used to create the debug plots for the momentum resolutions.
To run a full simulation-reconstruction-analysis chain do:
```
snakemake --cores 1 tracking_performance
snakemake -c2 results/tracking_performances/local
```
or, referencing it by the rule name:
```
snakemake --cores 1 tracking_performance_local
```
To process an individual campaign do:
```
snakemake -c2 results/tracking_performances/24.04.0
```
It will produce the results with truth/realistic seeding.
......@@ -48,27 +48,26 @@ rule tracking_performance_at_momentum:
input:
script="benchmarks/tracking_performances/Tracking_Performances.C",
# TODO pass as a file list?
sim=lambda wildcards: branch(
wildcards.CAMPAIGN == "local",
then=expand(
sim=lambda wildcards:
expand(
"sim_output/tracking_performance/{DETECTOR_CONFIG}/{{PARTICLE}}/{ENERGY}/{PHASE_SPACE}/{{PARTICLE}}_{ENERGY}_{PHASE_SPACE}.{INDEX:04d}.eicrecon.tree.edm4eic.root",
DETECTOR_CONFIG="epic_craterlake_tracking_only",
ENERGY=f"{float(wildcards.MOMENTUM):.0f}GeV" if float(wildcards.MOMENTUM) >= 1 else f"{float(wildcards.MOMENTUM) * 1000:.0f}MeV",
PHASE_SPACE=["3to50deg", "45to135deg", "130to177deg"],
INDEX=range(1),
),
otherwise=expand(
)
if wildcards.CAMPAIGN == "local" else
expand(
"EPIC/RECO/{{CAMPAIGN}}/epic_craterlake/SINGLE/{{PARTICLE}}/{ENERGY}/{PHASE_SPACE}/{{PARTICLE}}_{ENERGY}_{PHASE_SPACE}.{INDEX:04d}.eicrecon.tree.edm4eic.root",
DETECTOR_CONFIG="epic_craterlake",
ENERGY=f"{float(wildcards.MOMENTUM):.0f}GeV" if float(wildcards.MOMENTUM) >= 1 else f"{float(wildcards.MOMENTUM) * 1000:.0f}MeV",
PHASE_SPACE=["3to50deg", "45to135deg", "130to177deg"],
INDEX=range(1),
),
),
output:
"{SEEDING}/pi-/mom/Performances_mom_{MOMENTUM}_mom_resol_{SEEDING_IGNORE}_{PARTICLE}.root",
"{SEEDING}/pi-/dca/Performances_dca_{MOMENTUM}_dca_resol_{SEEDING_IGNORE}_{PARTICLE}.root",
combined_root=temp("sim_{SEEDING}_{MOMENTUM}_{SEEDING_IGNORE}_{PARTICLE}.root"),
"{CAMPAIGN}/{SEEDING}/pi-/mom/Performances_mom_{MOMENTUM}_mom_resol_{SEEDING_IGNORE}_{PARTICLE}.root",
"{CAMPAIGN}/{SEEDING}/pi-/dca/Performances_dca_{MOMENTUM}_dca_resol_{SEEDING_IGNORE}_{PARTICLE}.root",
combined_root=temp("{CAMPAIGN}/sim_{SEEDING}_{MOMENTUM}_{SEEDING_IGNORE}_{PARTICLE}.root"),
shell:
"""
if [[ "{wildcards.SEEDING}" == "truthseed" ]]; then
......@@ -77,7 +76,8 @@ elif [[ "{wildcards.SEEDING}" == "realseed" ]]; then
SEEDING="Seeded"
fi
hadd {output.combined_root} {input.sim}
root -l -b -q {input.script}'("{output.combined_root}", "{wildcards.PARTICLE}", {wildcards.MOMENTUM}, 0.15, "'$SEEDING'")'
cd {wildcards.CAMPAIGN}
root -l -b -q ../{input.script}'("../{output.combined_root}", "{wildcards.PARTICLE}", {wildcards.MOMENTUM}, 0.15, "'$SEEDING'")'
"""
......@@ -85,25 +85,26 @@ rule tracking_performance_summary_at_eta:
input:
expand(
[
"truthseed/pi-/mom/Performances_mom_{MOMENTUM:.1f}_mom_resol_truth_pi-.root",
"truthseed/pi-/dca/Performances_dca_{MOMENTUM:.1f}_dca_resol_truth_pi-.root",
"realseed/pi-/mom/Performances_mom_{MOMENTUM:.1f}_mom_resol_realseed_pi-.root",
"realseed/pi-/dca/Performances_dca_{MOMENTUM:.1f}_dca_resol_realseed_pi-.root",
"{{CAMPAIGN}}/truthseed/pi-/mom/Performances_mom_{MOMENTUM:.1f}_mom_resol_truth_pi-.root",
"{{CAMPAIGN}}/truthseed/pi-/dca/Performances_dca_{MOMENTUM:.1f}_dca_resol_truth_pi-.root",
"{{CAMPAIGN}}/realseed/pi-/mom/Performances_mom_{MOMENTUM:.1f}_mom_resol_realseed_pi-.root",
"{{CAMPAIGN}}/realseed/pi-/dca/Performances_dca_{MOMENTUM:.1f}_dca_resol_realseed_pi-.root",
],
MOMENTUM=[0.5, 1.0, 2.0, 5.0, 10.0, 20.0],
),
script="benchmarks/tracking_performances/doCompare_truth_real_widebins_mom.C",
output:
expand(
"Debug_Plots/{SEEDING}/pi-/mom/{SEEDING}_mom_resol_mom{MOMENTUM:.1f}_{{ETA_MIN}}_eta_{{ETA_MAX}}.png",
"{{CAMPAIGN}}/Debug_Plots/{SEEDING}/pi-/mom/{SEEDING}_mom_resol_mom{MOMENTUM:.1f}_{{ETA_MIN}}_eta_{{ETA_MAX}}.png",
SEEDING=["real", "truth"],
MOMENTUM=[0.5, 1.0, 2.0, 5.0, 10.0, 20.0],
),
"Final_Results/pi-/mom/mom_resol_{ETA_MIN}_eta_{ETA_MAX}.png",
"Final_Results/pi-/mom/mom_resol_{ETA_MIN}_eta_{ETA_MAX}.root",
"{CAMPAIGN}/Final_Results/pi-/mom/mom_resol_{ETA_MIN}_eta_{ETA_MAX}.png",
"{CAMPAIGN}/Final_Results/pi-/mom/mom_resol_{ETA_MIN}_eta_{ETA_MAX}.root",
shell:
"""
root -l -b -q {input.script}'("pi-", {wildcards.ETA_MIN}, {wildcards.ETA_MAX}, 1.)'
cd {wildcards.CAMPAIGN}
root -l -b -q ../{input.script}'("pi-", {wildcards.ETA_MIN}, {wildcards.ETA_MAX}, 1.)'
"""
......@@ -113,15 +114,34 @@ rule tracking_performance:
input:
expand(
[
"Final_Results/pi-/mom/mom_resol_{ETA_BIN}.png",
"Final_Results/pi-/mom/mom_resol_{ETA_BIN}.root",
"{{CAMPAIGN}}/Final_Results/pi-/mom/mom_resol_{ETA_BIN}.png",
"{{CAMPAIGN}}/Final_Results/pi-/mom/mom_resol_{ETA_BIN}.root",
],
ETA_BIN=[f"{eta_min:.1f}_eta_{eta_max:.1f}" for eta_min, eta_max in zip(TRACKING_PERFORMANCE_ETA_BINS[:-1], TRACKING_PERFORMANCE_ETA_BINS[1:])],
),
output:
directory("results/tracking_performances")
directory("results/tracking_performances/{CAMPAIGN}/")
shell:
"""
mkdir {output}
cp {input} {output}
"""
rule tracking_performance_local:
input:
"results/tracking_performances/local",
rule tracking_performance_campaigns:
input:
expand(
"results/tracking_performances/{CAMPAIGN}",
CAMPAIGN=[
"23.10.0",
"23.11.0",
"23.12.0",
"24.03.1",
"24.04.0",
],
)
......@@ -18,7 +18,7 @@ bench:tracking_performance:
needs:
- ["sim:tracking_performance"]
script:
- snakemake --cores 1 tracking_performance
- snakemake --cores 1 tracking_performance_local
collect_results:tracking_performance:
extends: .det_benchmark
......@@ -27,3 +27,18 @@ collect_results:tracking_performance:
- "bench:tracking_performance"
script:
- ls -lrht
bench:tracking_performance_campaigns:
extends: .det_benchmark
stage: benchmarks
#when: manual
script:
- snakemake --cores 1 tracking_performance_campaigns
collect_results:tracking_performance_campaigns:
extends: .det_benchmark
stage: collect
needs:
- "bench:tracking_performance_campaigns"
script:
- ls -lrht
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