Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added benchmark for vertexing studies in DIS events #101

Merged
merged 5 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion benchmarks/tracking_performances_dis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ This benchmark generates and reconstructs DIS events. The generated charged-part
## Contact
[Barak Schmookler]([email protected])


[Khushi Singla]([email protected])
96 changes: 79 additions & 17 deletions benchmarks/tracking_performances_dis/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ rule trk_dis_compile:
input:
"benchmarks/tracking_performances_dis/analysis/trk_dis_analysis_cxx.so",
"benchmarks/tracking_performances_dis/analysis/trk_dis_plots_cxx.so"
"benchmarks/tracking_performances_dis/analysis/vtx_dis_analysis_cxx.so",
"benchmarks/tracking_performances_dis/analysis/vtx_dis_plots_cxx.so"

# Process the generated HepMC files through the simulation
rule trk_dis_sim:
Expand Down Expand Up @@ -49,46 +51,65 @@ rule trk_dis_reco:
set -m # monitor mode to prevent lingering processes
exec env DETECTOR_CONFIG={wildcards.DETECTOR_CONFIG} \
eicrecon {input} -Ppodio:output_file={output} \
-Ppodio:output_collections=MCParticles,ReconstructedChargedParticles,ReconstructedTruthSeededChargedParticles,CentralCKFTrackAssociations,CentralCKFTruthSeededTrackAssociations
-Ppodio:output_collections=MCParticles,ReconstructedChargedParticles,ReconstructedTruthSeededChargedParticles,CentralCKFTrackAssociations,CentralCKFTruthSeededTrackAssociations,CentralTrackVertices
"""

# Process the files -- either from the campaign or local running -- through the analysis script
rule trk_dis_analysis:
rule dis_analysis:
input:
script="benchmarks/tracking_performances_dis/analysis/trk_dis_analysis.cxx",
script_compiled="benchmarks/tracking_performances_dis/analysis/trk_dis_analysis_cxx.so",
script_trk="benchmarks/tracking_performances_dis/analysis/trk_dis_analysis.cxx",
script_trk_compiled="benchmarks/tracking_performances_dis/analysis/trk_dis_analysis_cxx.so",
script_vtx="benchmarks/tracking_performances_dis/analysis/vtx_dis_analysis.cxx",
script_vtx_compiled="benchmarks/tracking_performances_dis/analysis/vtx_dis_analysis_cxx.so",
data="sim_output/tracking_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_beamEffects_xAngle=-0.025_hiDiv_{INDEX}.edm4eic.root",
output:
config="results/tracking_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_{INDEX}/config.json",
hists="results/tracking_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_{INDEX}/hists.root",
config_trk="results/tracking_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_{INDEX}/config.json",
hists_trk="results/tracking_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_{INDEX}/hists.root",
config_vtx="results/vertexing_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_{INDEX}/config.json",
hists_vtx="results/vertexing_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_{INDEX}/hists.root",
wildcard_constraints:
PREFIX= ".*",
EBEAM="\d+",
PBEAM="\d+",
MINQ2="\d+",
MINQ2="\d+",
INDEX="\d+",
shell:
"""
cat > {output.config} <<EOF
cat > {output.config_trk} <<EOF
{{
"rec_file": "{input.data}",
"detector": "{wildcards.DETECTOR_CONFIG}",
"ebeam": {wildcards.EBEAM},
"pbeam": {wildcards.PBEAM},
"Min_Q2": {wildcards.MINQ2},
"output_prefix": "$(dirname "{output.hists_trk}")/hists"
}}
EOF
root -l -b -q '{input.script_trk}+("{output.config_trk}")'

cat > {output.config_vtx} <<EOF
{{
"rec_file": "{input.data}",
"detector": "{wildcards.DETECTOR_CONFIG}",
"ebeam": {wildcards.EBEAM},
"pbeam": {wildcards.PBEAM},
"Min_Q2": {wildcards.MINQ2},
"output_prefix": "$(dirname "{output.hists}")/hists"
"output_prefix": "$(dirname "{output.hists_vtx}")/hists"
}}
EOF
root -l -b -q '{input.script}+("{output.config}")'
root -l -b -q '{input.script_vtx}+("{output.config_vtx}")'
"""

#Merge all the files produced in the previous step
rule trk_dis_combine:
rule dis_combine:
input:
lambda wildcards: [f"results/tracking_performances_dis/{wildcards.DETECTOR_CONFIG}/{wildcards.PREFIX}pythia8NCDIS_{wildcards.EBEAM}x{wildcards.PBEAM}_minQ2={wildcards.MINQ2}_{ix}/hists.root" for ix in range(1,int(wildcards.NUM_FILES)+1)],
lambda wildcards: [f"results/vertexing_performances_dis/{wildcards.DETECTOR_CONFIG}/{wildcards.PREFIX}pythia8NCDIS_{wildcards.EBEAM}x{wildcards.PBEAM}_minQ2={wildcards.MINQ2}_{ix}/hists.root" for ix in range(1,int(wildcards.NUM_FILES)+1)],
output:
config="results/tracking_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_combined_{NUM_FILES}/config.json",
hists="results/tracking_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_combined_{NUM_FILES}/hists.root",
config_trk="results/tracking_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_combined_{NUM_FILES}/config.json",
hists_trk="results/tracking_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_combined_{NUM_FILES}/hists.root",
config_vtx="results/vertexing_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_combined_{NUM_FILES}/config.json",
hists_vtx="results/vertexing_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_combined_{NUM_FILES}/hists.root",
wildcard_constraints:
PREFIX= ".*",
EBEAM="\d+",
Expand All @@ -97,18 +118,31 @@ rule trk_dis_combine:
NUM_FILES="\d+",
shell:
"""
cat > {output.config} <<EOF
cat > {output.config_trk} <<EOF
{{
"hists_file": "{output.hists_trk}",
"detector": "{wildcards.DETECTOR_CONFIG}",
"ebeam": {wildcards.EBEAM},
"pbeam": {wildcards.PBEAM},
"Min_Q2": {wildcards.MINQ2},
"nfiles": {wildcards.NUM_FILES},
"output_prefix": "$(dirname "{output.hists_trk}")/plots"
}}
EOF
hadd {output.hists_trk} {input}

cat > {output.config_vtx} <<EOF
{{
"hists_file": "{output.hists}",
"hists_file": "{output.hists_vtx}",
"detector": "{wildcards.DETECTOR_CONFIG}",
"ebeam": {wildcards.EBEAM},
"pbeam": {wildcards.PBEAM},
"Min_Q2": {wildcards.MINQ2},
"nfiles": {wildcards.NUM_FILES},
"output_prefix": "$(dirname "{output.hists}")/plots"
"output_prefix": "$(dirname "{output.hists_vtx}")/plots"
}}
EOF
hadd {output.hists} {input}
hadd {output.hists_vtx} {input}
"""

#Process the merged file through the plotting script
Expand All @@ -130,6 +164,23 @@ rule trk_dis_plots:
root -l -b -q '{input.script}+("{input.config}")'
"""

rule vtx_dis_plots:
input:
script="benchmarks/tracking_performances_dis/analysis/vtx_dis_plots.cxx",
script_compiled="benchmarks/tracking_performances_dis/analysis/vtx_dis_plots_cxx.so",
config="results/vertexing_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_combined_{NUM_FILES}/config.json",
output:
"results/vertexing_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_combined_{NUM_FILES}/plots.pdf"
wildcard_constraints:
PREFIX= ".*",
EBEAM="\d+",
PBEAM="\d+",
MINQ2="\d+",
NUM_FILES="\d+",
shell:
"""
root -l -b -q '{input.script}+("{input.config}")'
"""

#Examples of invocation
rule trk_dis_run_locally:
Expand All @@ -138,6 +189,12 @@ rule trk_dis_run_locally:
message:
"See output in {input[0]}"

rule vtx_dis_run_locally:
input:
"results/vertexing_performances_dis/" + os.environ["DETECTOR_CONFIG"] + "/pythia8NCDIS_18x275_minQ2=1_combined_5/plots.pdf",
message:
"See output in {input[0]}"


rule trk_dis_run_locally_trk_only:
input:
Expand All @@ -146,3 +203,8 @@ rule trk_dis_run_locally_trk_only:
"See output in {input[0]}"


rule vtx_dis_run_locally_trk_only:
input:
"results/vertexing_performances_dis/epic_craterlake_tracking_only/pythia8NCDIS_18x275_minQ2=1_combined_5/plots.pdf",
message:
"See output in {input[0]}"
Loading