Back to home page

EIC code displayed by LXR

 
 

    


Warning, /detector_benchmarks/benchmarks/nhcal_acceptance/Snakefile is written in an unsupported language. File is not indexed.

0001 rule nhcal_acceptance_simulate:
0002     input:
0003         warmup="warmup.edm4hep.root",
0004         geometry_lib=find_epic_libraries(),
0005     output:
0006         "sim_output/nhcal_acceptance/E{ENERGY}GeV/sim_{DETECTOR_CONFIG}.{INDEX}.edm4hep.rnt.root",
0007     params:
0008         N_EVENTS=10000,
0009         SEED=lambda wildcards: "1" + wildcards.INDEX,
0010         DETECTOR_PATH=config["DETECTOR_PREFIX"] + "/share/epic",
0011         DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG,
0012         ENERGY=lambda wildcards: wildcards.ENERGY,
0013         DD4HEP_HASH=get_spack_package_hash("dd4hep"),
0014         NPSIM_HASH=get_spack_package_hash("npsim"),
0015     cache: True
0016     singularity: EIC_SINGULARITY_CONTAINER,
0017     shell:
0018         """
0019 exec npsim \
0020     --compactFile {params.DETECTOR_PATH}/{params.DETECTOR_CONFIG}.xml \
0021     --numberOfEvents {params.N_EVENTS} \
0022     --random.seed {params.SEED} \
0023     --enableGun \
0024     -v WARNING \
0025     --gun.particle pi- \
0026     --gun.thetaMin 120*degree \
0027     --gun.thetaMax 180*degree \
0028     --gun.distribution uniform \
0029     --gun.energy "{params.ENERGY}*GeV" \
0030     --outputConfig.useRNTuple true \
0031     --outputFile {output}
0032 """
0033 
0034 
0035 rule nhcal_acceptance_analysis:
0036     input:
0037         sim=lambda wildcards: expand(
0038             "sim_output/nhcal_acceptance/E{ENERGY}GeV/sim_{DETECTOR_CONFIG}.{INDEX:02d}.edm4hep.rnt.root",
0039             DETECTOR_CONFIG=wildcards.DETECTOR_CONFIG,
0040             ENERGY=wildcards.ENERGY,
0041             INDEX=range(int(wildcards.N)),
0042         ),
0043         script=workflow.source_path("scripts/acceptance_analysis.cxx"),
0044     output:
0045         png=f"results/nhcal_acceptance/analysis_{{DETECTOR_CONFIG}}_E{{ENERGY}}GeV_combined_{{N}}files.png",
0046         pdf=f"results/nhcal_acceptance/analysis_{{DETECTOR_CONFIG}}_E{{ENERGY}}GeV_combined_{{N}}files.pdf",
0047     wildcard_constraints:
0048         N=r"\d+",
0049         ENERGY=r"\d+",
0050     params:
0051         SIM_GLOB=lambda wildcards: f"sim_output/nhcal_acceptance/E{wildcards.ENERGY}GeV/sim_{wildcards.DETECTOR_CONFIG}.*.edm4hep.rnt.root",
0052     singularity: EIC_SINGULARITY_CONTAINER,
0053     shell:
0054         """
0055     root -l -b -q '{input.script}("{params.SIM_GLOB}","{output.pdf}","{output.png}")'
0056 """