Skip to content

Commit 374bcda

Browse files
authored
add far_forward_dvcs benchmark (#222)
1 parent c6ab334 commit 374bcda

File tree

8 files changed

+959
-13
lines changed

8 files changed

+959
-13
lines changed

.gitlab-ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ include:
128128
- local: 'benchmarks/calo_pid/config.yml'
129129
- local: 'benchmarks/campaign/config.yml'
130130
- local: 'benchmarks/ecal_gaps/config.yml'
131+
- local: 'benchmarks/far_forward_dvcs/config.yml'
131132
- local: 'benchmarks/lowq2_reconstruction/config.yml'
132133
- local: 'benchmarks/tracking_detectors/config.yml'
133134
- local: 'benchmarks/tracking_performances/config.yml'
@@ -165,6 +166,7 @@ deploy_results:
165166
- "collect_results:calo_pid"
166167
- "collect_results:campaign"
167168
- "collect_results:ecal_gaps"
169+
- "collect_results:far_forward_dvcs"
168170
- "collect_results:lfhcal"
169171
- "collect_results:lowq2_reconstruction"
170172
- "collect_results:material_scan"

Snakefile

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,19 @@ import os
55
from snakemake.logging import logger
66

77

8+
rule compile_analysis:
9+
input:
10+
"{path}/{filename}.cxx",
11+
output:
12+
"{path}/{filename}_cxx.d",
13+
"{path}/{filename}_cxx.so",
14+
"{path}/{filename}_cxx_ACLiC_dict_rdict.pcm",
15+
shell:
16+
"""
17+
root -l -b -q -e '.L {input}+'
18+
"""
19+
20+
821
@functools.cache
922
def get_spack_package_hash(package_name):
1023
import json
@@ -37,7 +50,8 @@ include: "benchmarks/beamline/Snakefile"
3750
include: "benchmarks/calo_pid/Snakefile"
3851
include: "benchmarks/campaign/Snakefile"
3952
include: "benchmarks/ecal_gaps/Snakefile"
40-
include : "benchmarks/lowq2_reconstruction/Snakefile"
53+
include: "benchmarks/far_forward_dvcs/Snakefile"
54+
include: "benchmarks/lowq2_reconstruction/Snakefile"
4155
include: "benchmarks/material_scan/Snakefile"
4256
include: "benchmarks/tracking_performances/Snakefile"
4357
include: "benchmarks/tracking_performances_dis/Snakefile"
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
rule far_forward_dvcs_compile:
2+
input:
3+
"benchmarks/far_forward_dvcs/analysis/analyze_DVCS_eicrecon_cxx.so",
4+
5+
# Process the generated HepMC files through the simulation
6+
rule far_forward_dvcs_sim:
7+
input:
8+
warmup="warmup/{DETECTOR_CONFIG}.edm4hep.root",
9+
geometry_lib=find_epic_libraries(),
10+
output:
11+
"sim_output/far_forward_dvcs/{DETECTOR_CONFIG}/DVCS.{INDEX}.ab.hiAcc.{EBEAM}x{PBEAM}.edm4hep.root",
12+
params:
13+
N_EVENTS=1000,
14+
EBEAM=lambda wildcards: wildcards.EBEAM,
15+
INDEX=lambda wildcards: wildcards.INDEX,
16+
PBEAM=lambda wildcards: wildcards.PBEAM,
17+
SEED=lambda wildcards: "1" + wildcards.INDEX,
18+
DETECTOR_PATH=os.environ["DETECTOR_PATH"],
19+
DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG,
20+
DD4HEP_HASH=get_spack_package_hash("dd4hep"),
21+
NPSIM_HASH=get_spack_package_hash("npsim"),
22+
cache: True
23+
shell:
24+
"""
25+
npsim \
26+
--runType batch \
27+
--part.minimalKineticEnergy 1000*GeV \
28+
--random.seed {params.SEED} \
29+
--filter.tracker edep0 \
30+
-v WARNING \
31+
--numberOfEvents {params.N_EVENTS} \
32+
--compactFile {params.DETECTOR_PATH}/{params.DETECTOR_CONFIG}.xml \
33+
--inputFiles root://dtn-eic.jlab.org//volatile/eic/EPIC/EVGEN/EXCLUSIVE/DVCS_ABCONV/{params.EBEAM}x{params.PBEAM}/DVCS.{params.INDEX}.ab.hiAcc.{params.EBEAM}x{params.PBEAM}.hepmc3.tree.root \
34+
--outputFile {output}
35+
"""
36+
37+
rule foo:
38+
input:
39+
'sim_output/far_forward_dvcs/epic_craterlake_10x100/DVCS.1.ab.hiAcc.10x100.edm4hep.root'
40+
41+
# Process the files produced in the previous step through EICRecon
42+
rule far_forward_dvcs_reco:
43+
input:
44+
sim="sim_output/far_forward_dvcs/{DETECTOR_CONFIG}/DVCS.{INDEX}.ab.hiAcc.{EBEAM}x{PBEAM}.edm4hep.root",
45+
warmup=ancient("warmup/{DETECTOR_CONFIG}.edm4hep.root"),
46+
output:
47+
"sim_output/far_forward_dvcs/{DETECTOR_CONFIG}/DVCS.{INDEX}.ab.hiAcc.{EBEAM}x{PBEAM}.eicrecon.edm4eic.root",
48+
params:
49+
DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG,
50+
EBEAM=lambda wildcards: wildcards.EBEAM,
51+
PBEAM=lambda wildcards: wildcards.PBEAM,
52+
INDEX=lambda wildcards: wildcards.INDEX,
53+
EICRECON_HASH=get_spack_package_hash("eicrecon"),
54+
cache: True
55+
shell:
56+
"""
57+
set -m # monitor mode to prevent lingering processes
58+
exec env DETECTOR_CONFIG={wildcards.DETECTOR_CONFIG} \
59+
eicrecon {input.sim} -Ppodio:output_file={output} \
60+
-Ppodio:output_collections=B0ECalClusters,B0TrackerHits,B0TrackerRecHits,EcalEndcapPTruthClusters,ForwardOffMRecParticles,ForwardRomanPotRecParticles,MCParticles,MCParticlesHeadOnFrameNoBeamFX,ReconstructedChargedParticles,ReconstructedTruthSeededChargedParticles,ZDCEcalClusters
61+
"""
62+
63+
#Process the merged file through the plotting script
64+
rule far_forward_dvcs_plots:
65+
input:
66+
workflow.source_path("analysis/render.hpp"),
67+
workflow.source_path("analysis/detectorResolution.hpp"),
68+
script="benchmarks/far_forward_dvcs/analysis/analyze_DVCS_eicrecon.cxx",
69+
script_compiled="benchmarks/far_forward_dvcs/analysis/analyze_DVCS_eicrecon_cxx.so",
70+
reco="sim_output/far_forward_dvcs/{DETECTOR_CONFIG}/DVCS.1.ab.hiAcc.{EBEAM}x{PBEAM}.eicrecon.edm4eic.root",
71+
output:
72+
dir=directory("results/far_forward_dvcs/{DETECTOR_CONFIG}/{EBEAM}x{PBEAM}"),
73+
list=temp("results/far_forward_dvcs/{DETECTOR_CONFIG}/{EBEAM}x{PBEAM}.lst"),
74+
wildcard_constraints:
75+
EBEAM=r"\d+",
76+
PBEAM=r"\d+",
77+
shell:
78+
"""
79+
mkdir -p "{output.dir}"
80+
echo "{input.reco}" > "{output.list}"
81+
root -l -b -q '{input.script}+("{output.list}", "{output.dir}")'
82+
"""
83+
84+
#Examples of invocation
85+
rule far_forward_dvcs_run_locally:
86+
input:
87+
"results/far_forward_dvcs/epic_craterlake_10x100/10x100/",
88+
message:
89+
"See output in {input[0]}"

0 commit comments

Comments
 (0)