Warning, /detector_benchmarks/benchmarks/nhcal_pion_rejection/Snakefile is written in an unsupported language. File is not indexed.
0001 rule nhcal_pion_rejection_simulate:
0002 output:
0003 "sim_output/nhcal_pion_rejection/sim_{DETECTOR_CONFIG}.{INDEX}.edm4hep.root",
0004 params:
0005 N_EVENTS=1000,
0006 SEED=lambda wildcards: "1" + wildcards.INDEX,
0007 DETECTOR_PATH=os.environ["DETECTOR_PATH"],
0008 DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG,
0009 DD4HEP_HASH=get_spack_package_hash("dd4hep"),
0010 NPSIM_HASH=get_spack_package_hash("npsim"),
0011 wildcard_constraints:
0012 INDEX = r"\d+",
0013 cache: True
0014 singularity: EIC_SINGULARITY_CONTAINER,
0015 shell:
0016 """
0017 exec npsim \
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 pi- \
0024 --gun.thetaMin 120*degree \
0025 --gun.thetaMax 180*degree \
0026 --gun.distribution uniform \
0027 --gun.momentumMin "1*GeV" \
0028 --gun.momentumMax "18*GeV" \
0029 --outputFile {output}
0030 """
0031
0032 rule nhcal_pion_rejection_recon:
0033 input:
0034 "sim_output/nhcal_pion_rejection/sim_{DETECTOR_CONFIG}.{INDEX}.edm4hep.root"
0035 output:
0036 "sim_output/nhcal_pion_rejection/sim_{DETECTOR_CONFIG}.{INDEX}.eicrecon.edm4hep.root"
0037 params:
0038 DETECTOR_CONFIG = lambda wildcards: wildcards.DETECTOR_CONFIG,
0039 cache: True
0040 singularity: EIC_SINGULARITY_CONTAINER,
0041 shell:
0042 """
0043 exec env DETECTOR_CONFIG={params.DETECTOR_CONFIG} \
0044 eicrecon {input} \
0045 -Ppodio:output_file={output} \
0046
0047 """
0048
0049 rule nhcal_pion_rejection_combine:
0050 input:
0051 lambda wildcards: expand(
0052 "sim_output/nhcal_pion_rejection/sim_{DETECTOR_CONFIG}.{INDEX}.eicrecon.edm4hep.root",
0053 DETECTOR_CONFIG=wildcards.DETECTOR_CONFIG,
0054 INDEX=range(int(wildcards.N)),
0055 )
0056 output:
0057 "sim_output/nhcal_pion_rejection/sim_{DETECTOR_CONFIG}_{N}files.eicrecon.edm4hep.root",
0058 wildcard_constraints:
0059 N = r"\d+",
0060 singularity: EIC_SINGULARITY_CONTAINER,
0061 shell:
0062 """
0063 hadd -f {output} {input}
0064 """
0065
0066 rule nhcal_pion_rejection_analysis:
0067 input:
0068 combined="sim_output/nhcal_pion_rejection/sim_{DETECTOR_CONFIG}_{N}files.eicrecon.edm4hep.root",
0069 script=workflow.source_path("scripts/pion_rejection_analysis.cxx"),
0070 output:
0071 png="results/nhcal_pion_rejection/analysis_{DETECTOR_CONFIG}_{N}files.png",
0072 pdf="results/nhcal_pion_rejection/analysis_{DETECTOR_CONFIG}_{N}files.pdf",
0073 params:
0074 DETECTOR_PATH = os.environ["DETECTOR_PATH"],
0075 DETECTOR_CONFIG = lambda wildcards: f"{wildcards.DETECTOR_CONFIG}.xml",
0076 singularity: EIC_SINGULARITY_CONTAINER,
0077 shell:
0078 """
0079 root -l -b -q '{input.script}+("{input.combined}","{output.pdf}","{output.png}","{params.DETECTOR_PATH}/{params.DETECTOR_CONFIG}")'
0080 """