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.root",
0007     params:
0008         N_EVENTS=10000,
0009         SEED=lambda wildcards: "1" + wildcards.INDEX,
0010         DETECTOR_PATH=os.environ["DETECTOR_PATH"],
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     --outputFile {output}
0031 """
0032 
0033 
0034 rule nhcal_acceptance_combine:
0035     input:
0036         lambda wildcards: expand(
0037             "sim_output/nhcal_acceptance/E{ENERGY}GeV/sim_{DETECTOR_CONFIG}.{INDEX:02d}.edm4hep.root", 
0038             DETECTOR_CONFIG=wildcards.DETECTOR_CONFIG,
0039             ENERGY=wildcards.ENERGY,
0040             INDEX=range(int(wildcards.N)),
0041         ),
0042     wildcard_constraints:
0043         N=r"\d+",
0044         ENERGY=r"\d+"
0045     output:
0046         temp("sim_output/nhcal_acceptance/sim_{DETECTOR_CONFIG}_E{ENERGY}GeV_combined_{N}files.edm4hep.root"),
0047     singularity: EIC_SINGULARITY_CONTAINER,
0048     shell:
0049         """
0050 hadd -f {output} {input} 
0051 """
0052 
0053 rule nhcal_acceptance_analysis:
0054     input:
0055         combined="sim_output/nhcal_acceptance/sim_{DETECTOR_CONFIG}_E{ENERGY}GeV_combined_{N}files.edm4hep.root",
0056         script=workflow.source_path("scripts/acceptance_analysis.cxx"),
0057     output:
0058         png=f"results/nhcal_acceptance/analysis_{{DETECTOR_CONFIG}}_E{{ENERGY}}GeV_combined_{{N}}files.png",
0059         pdf=f"results/nhcal_acceptance/analysis_{{DETECTOR_CONFIG}}_E{{ENERGY}}GeV_combined_{{N}}files.pdf",
0060     singularity: EIC_SINGULARITY_CONTAINER,
0061     shell:
0062         """
0063     root -l -b -q '{input.script}("{input.combined}","{output.pdf}","{output.png}")'
0064 """