Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
detector_benchmarks
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
EIC
benchmarks
detector_benchmarks
Commits
2a39b59c
Unverified
Commit
2a39b59c
authored
5 months ago
by
Dmitry Kalinkin
Committed by
GitHub
5 months ago
Browse files
Options
Downloads
Patches
Plain Diff
backwards_ecal: add simulation caching (#83)
parent
939acc45
No related branches found
No related tags found
No related merge requests found
Pipeline
#105123
passed
5 months ago
Stage: status-pending
Stage: config
Stage: data_init
Stage: simulate
Stage: calibrate
Stage: benchmarks
Stage: collect
Stage: deploy
Stage: status-report
Changes
1
Pipelines
77
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
benchmarks/backwards_ecal/Snakefile
+27
-3
27 additions, 3 deletions
benchmarks/backwards_ecal/Snakefile
with
27 additions
and
3 deletions
benchmarks/backwards_ecal/Snakefile
+
27
−
3
View file @
2a39b59c
...
...
@@ -4,11 +4,29 @@ def get_n_events(wildcards):
n_events = int(n_events // (energy ** 0.5))
return n_events
import functools
import json
import ctypes.util
import warnings
from snakemake.logging import logger
@functools.cache
def get_spack_package_hash(package_name):
try:
ver_info = json.loads(subprocess.check_output(["spack", "find", "--json", package_name]))
return ver_info[0]["package_hash"]
except FileNotFoundError as e:
logger.warning("Spack is not installed")
return ""
except subprocess.CalledProcessError as e:
print(e)
return ""
rule backwards_ecal_sim:
input:
steering_file=ancient("EPIC/EVGEN/SINGLE/{PARTICLE}/{ENERGY}/{PHASE_SPACE}/{PARTICLE}_{ENERGY}_{PHASE_SPACE}.steer"),
warmup="warmup/{DETECTOR_CONFIG}.edm4hep.root",
geometry_lib=os.environ["DETECTOR_PATH"] + "/../../lib/" + ctypes.util.find_library("epic"),
output:
"sim_output/backwards_ecal/{DETECTOR_CONFIG}/{PARTICLE}/{ENERGY}/{PHASE_SPACE}/{PARTICLE}_{ENERGY}_{PHASE_SPACE}.{INDEX}.edm4hep.root",
log:
...
...
@@ -19,7 +37,13 @@ rule backwards_ecal_sim:
PHASE_SPACE="(3to50|45to135|130to177)deg",
INDEX="\d{4}",
params:
N_EVENTS=get_n_events
N_EVENTS=get_n_events,
SEED=lambda wildcards: "1" + wildcards.INDEX,
DETECTOR_PATH=os.environ["DETECTOR_PATH"],
DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG,
DD4HEP_HASH=get_spack_package_hash("dd4hep"),
NPSIM_HASH=get_spack_package_hash("npsim"),
cache: True
shell:
"""
set -m # monitor mode to prevent lingering processes
...
...
@@ -27,11 +51,11 @@ exec ddsim \
--runType batch \
--enableGun \
--steeringFile "{input.steering_file}" \
--random.seed
1{wildcards.INDEX
} \
--random.seed
{params.SEED
} \
--filter.tracker edep0 \
-v WARNING \
--numberOfEvents {params.N_EVENTS} \
--compactFile
$
DETECTOR_PATH/{
wildcard
s.DETECTOR_CONFIG}.xml \
--compactFile
{params.
DETECTOR_PATH
}
/{
param
s.DETECTOR_CONFIG}.xml \
--outputFile {output}
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment