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 singularity: EIC_SINGULARITY_CONTAINER,
0018 shell:
0019 """
0020 root -l -b -q '{input.script}({params.num_events}, "{output.hepmcfile}", "{params.PARTICLE}", {params.THETA_MIN}, {params.THETA_MAX}, 0, 360, {params.BEAM_ENERGY})'
0021 """
0022
0023
0024 rule zdc_lyso_sim:
0025 input:
0026 hepmcfile="data/{PARTICLE}_{BEAM_ENERGY}GeV_theta_{THETA_MIN}deg_thru_{THETA_MAX}deg.hepmc",
0027 warmup="warmup.edm4hep.root",
0028 geometry_lib=find_epic_libraries(),
0029 output:
0030 "sim_output/zdc_lyso/{DETECTOR_CONFIG}_{PARTICLE}_{BEAM_ENERGY}GeV_theta_{THETA_MIN}deg_thru_{THETA_MAX}deg.edm4hep.root",
0031 log:
0032 "sim_output/zdc_lyso/{DETECTOR_CONFIG}_{PARTICLE}_{BEAM_ENERGY}GeV_theta_{THETA_MIN}deg_thru_{THETA_MAX}deg.edm4hep.root.log",
0033 params:
0034 num_events=1000,
0035 DETECTOR_PATH=os.environ["DETECTOR_PATH"],
0036 DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG,
0037 DD4HEP_HASH=get_spack_package_hash("dd4hep"),
0038 NPSIM_HASH=get_spack_package_hash("npsim"),
0039 cache: True
0040 singularity: EIC_SINGULARITY_CONTAINER,
0041 shell:
0042 """
0043 exec npsim \
0044 --runType batch \
0045 -v WARNING \
0046 --compactFile {params.DETECTOR_PATH}/{params.DETECTOR_CONFIG}.xml \
0047 --random.seed 1 \
0048 --numberOfEvents {params.num_events} \
0049 --inputFiles {input.hepmcfile} \
0050 --outputFile {output}
0051 """
0052
0053
0054 rule zdc_lyso_reco:
0055 input:
0056 sim="sim_output/zdc_lyso/{DETECTOR_CONFIG}_{PARTICLE}_{BEAM_ENERGY}GeV_theta_{THETA_MIN}deg_thru_{THETA_MAX}deg.edm4hep.root",
0057 warmup="warmup.edm4hep.root",
0058 output:
0059 "sim_output/zdc_lyso/{DETECTOR_CONFIG}_{PARTICLE}_{BEAM_ENERGY}GeV_theta_{THETA_MIN}deg_thru_{THETA_MAX}deg.eicrecon.edm4eic.root",
0060 log:
0061 "sim_output/zdc_lyso/{DETECTOR_CONFIG}_{PARTICLE}_{BEAM_ENERGY}GeV_theta_{THETA_MIN}deg_thru_{THETA_MAX}deg.eicrecon.edm4eic.root.log",
0062 params:
0063 DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG,
0064 EICRECON_HASH=get_spack_package_hash("eicrecon"),
0065 cache: True
0066 singularity: EIC_SINGULARITY_CONTAINER,
0067 shell:
0068 """
0069 env DETECTOR_CONFIG={params.DETECTOR_CONFIG} \
0070 eicrecon -Ppodio:output_file={output} -Ppodio:output_collections=HcalFarForwardZDCRawHits,HcalFarForwardZDCRecHits,HcalFarForwardZDCClusters,EcalFarForwardZDCRawHits,EcalFarForwardZDCRecHits,EcalFarForwardZDCClusters,MCParticles {input.sim}
0071 """
0072
0073
0074 rule zdc_lyso_analysis:
0075 input:
0076 expand("sim_output/zdc_lyso/{{DETECTOR_CONFIG}}_{PARTICLE}_{BEAM_ENERGY}GeV_theta_{THETA_MIN}deg_thru_{THETA_MAX}deg.eicrecon.edm4eic.root",
0077 PARTICLE=["gamma"],
0078 BEAM_ENERGY=["0.005", "0.01", "0.05", "0.1", "0.5", "1.0"],
0079 THETA_MIN=["0"],
0080 THETA_MAX=["0.3"]),
0081 script=workflow.source_path("analysis/analysis.py"),
0082 output:
0083 "results/{DETECTOR_CONFIG}/zdc_lyso/plots.pdf",
0084 singularity: EIC_SINGULARITY_CONTAINER,
0085 shell:
0086 """
0087 python {input.script}
0088 """
0089
0090
0091 # Examples of invocation
0092 rule zdc_lyso_hepmc:
0093 input:
0094 expand("data/{PARTICLE}_{BEAM_ENERGY}GeV_theta_{THETA_MIN}deg_thru_{THETA_MAX}deg.hepmc",
0095 PARTICLE=["gamma"],
0096 BEAM_ENERGY=["0.005", "0.01", "0.05", "0.1", "0.5", "1.0"],
0097 THETA_MIN=["0"],
0098 THETA_MAX=["0.3"])
0099
0100
0101 rule zdc_lyso_local:
0102 input:
0103 "results/" + os.environ["DETECTOR_CONFIG"] + "/zdc_lyso/plots.pdf",
0104 message:
0105 "See output in {input[0]}"