Warning, /detector_benchmarks/benchmarks/zdc_lyso/Snakefile is written in an unsupported language. File is not indexed.
0001 import os
0002
0003
0004 rule zdc_lyso_sim_hepmc:
0005 input:
0006 script = workflow.source_path("gen_particles.cxx"),
0007 output:
0008 hepmcfile="data/{PARTICLE}_{BEAM_ENERGY}GeV_theta_{THETA_MIN}deg_thru_{THETA_MAX}deg.hepmc",
0009 log:
0010 "data/{PARTICLE}_{BEAM_ENERGY}GeV_theta_{THETA_MIN}deg_thru_{THETA_MAX}deg.hepmc.log",
0011 params:
0012 num_events=1000,
0013 PARTICLE=lambda wildcards: wildcards.PARTICLE,
0014 BEAM_ENERGY=lambda wildcards: wildcards.BEAM_ENERGY,
0015 THETA_MIN=lambda wildcards: wildcards.THETA_MIN,
0016 THETA_MAX=lambda wildcards: wildcards.THETA_MAX,
0017 SEED=lambda wildcards: stable_seed("zdc_lyso", wildcards.PARTICLE, wildcards.BEAM_ENERGY, wildcards.THETA_MIN, wildcards.THETA_MAX),
0018 singularity: EIC_SINGULARITY_CONTAINER,
0019 shell:
0020 """
0021 root -l -b -q '{input.script}({params.num_events}, "{output.hepmcfile}", "{params.PARTICLE}", {params.THETA_MIN}, {params.THETA_MAX}, 0, 360, {params.BEAM_ENERGY}, 0, {params.SEED})'
0022 """
0023
0024
0025 rule zdc_lyso_sim:
0026 input:
0027 hepmcfile="data/{PARTICLE}_{BEAM_ENERGY}GeV_theta_{THETA_MIN}deg_thru_{THETA_MAX}deg.hepmc",
0028 warmup="warmup.edm4hep.root",
0029 geometry_lib=find_epic_libraries(),
0030 output:
0031 "sim_output/zdc_lyso/{DETECTOR_CONFIG}_{PARTICLE}_{BEAM_ENERGY}GeV_theta_{THETA_MIN}deg_thru_{THETA_MAX}deg.edm4hep.rnt.root",
0032 log:
0033 "sim_output/zdc_lyso/{DETECTOR_CONFIG}_{PARTICLE}_{BEAM_ENERGY}GeV_theta_{THETA_MIN}deg_thru_{THETA_MAX}deg.edm4hep.rnt.root.log",
0034 params:
0035 num_events=1000,
0036 DETECTOR_PATH=config["DETECTOR_PREFIX"] + "/share/epic",
0037 DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG,
0038 DD4HEP_HASH=get_spack_package_hash("dd4hep"),
0039 NPSIM_HASH=get_spack_package_hash("npsim"),
0040 cache: True
0041 singularity: EIC_SINGULARITY_CONTAINER,
0042 shell:
0043 """
0044 exec npsim \
0045 --runType batch \
0046 -v WARNING \
0047 --compactFile {params.DETECTOR_PATH}/{params.DETECTOR_CONFIG}.xml \
0048 --random.seed 1 \
0049 --numberOfEvents {params.num_events} \
0050 --inputFiles {input.hepmcfile} \
0051 --outputConfig.useRNTuple true \
0052 --outputFile {output}
0053 """
0054
0055
0056 rule zdc_lyso_reco:
0057 input:
0058 sim="sim_output/zdc_lyso/{DETECTOR_CONFIG}_{PARTICLE}_{BEAM_ENERGY}GeV_theta_{THETA_MIN}deg_thru_{THETA_MAX}deg.edm4hep.rnt.root",
0059 warmup="warmup.edm4hep.root",
0060 output:
0061 "sim_output/zdc_lyso/{DETECTOR_CONFIG}_{PARTICLE}_{BEAM_ENERGY}GeV_theta_{THETA_MIN}deg_thru_{THETA_MAX}deg.eicrecon.edm4eic.root",
0062 log:
0063 "sim_output/zdc_lyso/{DETECTOR_CONFIG}_{PARTICLE}_{BEAM_ENERGY}GeV_theta_{THETA_MIN}deg_thru_{THETA_MAX}deg.eicrecon.edm4eic.root.log",
0064 params:
0065 DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG,
0066 EICRECON_HASH=get_spack_package_hash("eicrecon"),
0067 cache: True
0068 singularity: EIC_SINGULARITY_CONTAINER,
0069 shell:
0070 """
0071 env DETECTOR_CONFIG={params.DETECTOR_CONFIG} \
0072 eicrecon -Ppodio:output_file={output} -Ppodio:output_collections=HcalFarForwardZDCRawHits,HcalFarForwardZDCRecHits,HcalFarForwardZDCClusters,EcalFarForwardZDCRawHits,EcalFarForwardZDCRecHits,EcalFarForwardZDCClusters,MCParticles {input.sim}
0073 """
0074
0075
0076 rule zdc_lyso_analysis:
0077 input:
0078 expand("sim_output/zdc_lyso/{{DETECTOR_CONFIG}}_{PARTICLE}_{BEAM_ENERGY}GeV_theta_{THETA_MIN}deg_thru_{THETA_MAX}deg.eicrecon.edm4eic.root",
0079 PARTICLE=["gamma"],
0080 BEAM_ENERGY=["0.005", "0.01", "0.05", "0.1", "0.5", "1.0"],
0081 THETA_MIN=["0"],
0082 THETA_MAX=["0.3"]),
0083 script=workflow.source_path("analysis/analysis.py"),
0084 output:
0085 "results/{DETECTOR_CONFIG}/zdc_lyso/plots.pdf",
0086 singularity: EIC_SINGULARITY_CONTAINER,
0087 shell:
0088 """
0089 env DETECTOR_CONFIG={wildcards.DETECTOR_CONFIG} python {input.script}
0090 """
0091
0092
0093 # Examples of invocation
0094 rule zdc_lyso_hepmc:
0095 input:
0096 expand("data/{PARTICLE}_{BEAM_ENERGY}GeV_theta_{THETA_MIN}deg_thru_{THETA_MAX}deg.hepmc",
0097 PARTICLE=["gamma"],
0098 BEAM_ENERGY=["0.005", "0.01", "0.05", "0.1", "0.5", "1.0"],
0099 THETA_MIN=["0"],
0100 THETA_MAX=["0.3"])
0101
0102
0103 rule zdc_lyso_local:
0104 input:
0105 "results/" + config["DETECTOR_CONFIG"] + "/zdc_lyso/plots.pdf",
0106 message:
0107 "See output in {input[0]}"