Warning, /detector_benchmarks/benchmarks/nhcal_basic_distribution/Snakefile is written in an unsupported language. File is not indexed.
0001 rule nhcal_basic_distribution_simulate:
0002 input:
0003 warmup=ancient("warmup/{DETECTOR_CONFIG}.edm4hep.root"),
0004 output:
0005 "sim_output/nhcal_basic_distribution/E{ENERGY}GeV/sim_{DETECTOR_CONFIG}.{INDEX}.edm4hep.root",
0006 params:
0007 N_EVENTS=10000,
0008 SEED=lambda wildcards: "1" + wildcards.INDEX,
0009 DETECTOR_PATH=os.environ["DETECTOR_PATH"],
0010 DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG,
0011 ENERGY=lambda wildcards: wildcards.ENERGY,
0012 DD4HEP_HASH=get_spack_package_hash("dd4hep"),
0013 NPSIM_HASH=get_spack_package_hash("npsim"),
0014 cache: True
0015 shell:
0016 """
0017 exec ddsim \
0018 --compactFile {params.DETECTOR_PATH}/{params.DETECTOR_CONFIG}.xml \
0019 --numberOfEvents {params.N_EVENTS} \
0020 --random.seed {params.SEED} \
0021 --enableGun \
0022 -v WARNING \
0023 --gun.particle neutron \
0024 --gun.thetaMin 120*degree \
0025 --gun.thetaMax 180*degree \
0026 --gun.distribution uniform \
0027 --gun.energy "{params.ENERGY}*GeV" \
0028 --outputFile {output}
0029 """
0030
0031
0032 rule nhcal_basic_distribution_combine:
0033 input:
0034 lambda wildcards: expand(
0035 "sim_output/nhcal_basic_distribution/E{ENERGY:.1f}GeV/sim_{DETECTOR_CONFIG}.{INDEX:02d}.edm4hep.root",
0036 DETECTOR_CONFIG=wildcards.DETECTOR_CONFIG,
0037 ENERGY=float(wildcards.ENERGY),
0038 INDEX=range(int(wildcards.N)),
0039 ),
0040 wildcard_constraints:
0041 N=r"\d+",
0042 ENERGY=r"\d+(\.\d+)?"
0043 output:
0044 temp("sim_output/nhcal_basic_distribution/sim_{DETECTOR_CONFIG}_E{ENERGY}GeV_combined_{N}files.edm4hep.root"),
0045 shell:
0046 """
0047 hadd -f {output} {input}
0048 """
0049
0050 rule nhcal_basic_distribution_analysis:
0051 input:
0052 combined="sim_output/nhcal_basic_distribution/sim_{DETECTOR_CONFIG}_E{ENERGY}GeV_combined_{N}files.edm4hep.root",
0053 script="benchmarks/nhcal_basic_distribution/scripts/basic_distribution_analysis.cxx",
0054 output:
0055 pdf=f"results/nhcal_basic_distribution/analysis_{{DETECTOR_CONFIG}}_E{{ENERGY}}GeV_combined_{{N}}files.pdf",
0056 png=f"results/nhcal_basic_distribution/analysis_{{DETECTOR_CONFIG}}_E{{ENERGY}}GeV_combined_{{N}}files.png",
0057 shell:
0058 """
0059 root -l -b -q '{input.script}("{input.combined}","{output.pdf}","{output.png}")'
0060 """