Back to home page

EIC code displayed by LXR

 
 

    


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     input:
0003         geometry_lib=find_epic_libraries(),
0004     output:
0005         "sim_output/nhcal_pion_rejection/sim_{DETECTOR_CONFIG}.{INDEX}.edm4hep.rnt.root",
0006     params:
0007         N_EVENTS=1000,
0008         SEED=lambda wildcards: "1" + wildcards.INDEX,
0009         DETECTOR_PATH=config["DETECTOR_PREFIX"] + "/share/epic",
0010         DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG,
0011         DD4HEP_HASH=get_spack_package_hash("dd4hep"),
0012         NPSIM_HASH=get_spack_package_hash("npsim"),
0013     wildcard_constraints:
0014         INDEX = r"\d+",
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.momentumMin "1*GeV" \
0030     --gun.momentumMax "18*GeV" \
0031     --outputConfig.useRNTuple true \
0032     --outputFile {output}
0033 """
0034 
0035 rule nhcal_pion_rejection_recon:
0036     input:
0037         "sim_output/nhcal_pion_rejection/sim_{DETECTOR_CONFIG}.{INDEX}.edm4hep.rnt.root"
0038     output:
0039         "sim_output/nhcal_pion_rejection/sim_{DETECTOR_CONFIG}.{INDEX}.eicrecon.edm4hep.root"
0040     params:
0041         DETECTOR_CONFIG = lambda wildcards: wildcards.DETECTOR_CONFIG,
0042         EICRECON_HASH=get_spack_package_hash("eicrecon"),
0043     cache: True
0044     singularity: EIC_SINGULARITY_CONTAINER,
0045     shell:
0046         """
0047 exec env DETECTOR_CONFIG={params.DETECTOR_CONFIG} \
0048           eicrecon {input} \
0049           -Ppodio:output_file={output} \
0050 
0051 """
0052 
0053 rule nhcal_pion_rejection_analysis:
0054     input:
0055         recon=lambda wildcards: expand(
0056             "sim_output/nhcal_pion_rejection/sim_{DETECTOR_CONFIG}.{INDEX}.eicrecon.edm4hep.root",
0057             DETECTOR_CONFIG=wildcards.DETECTOR_CONFIG,
0058             INDEX=range(int(wildcards.N)),
0059         ),
0060         script=workflow.source_path("scripts/pion_rejection_analysis.cxx"),
0061     output:
0062         png="results/nhcal_pion_rejection/analysis_{DETECTOR_CONFIG}_{N}files.png",
0063         pdf="results/nhcal_pion_rejection/analysis_{DETECTOR_CONFIG}_{N}files.pdf",
0064     wildcard_constraints:
0065         N=r"\d+",
0066     params:
0067         DETECTOR_PATH   = config["DETECTOR_PREFIX"] + "/share/epic",
0068         DETECTOR_CONFIG = lambda wildcards: f"{wildcards.DETECTOR_CONFIG}.xml",
0069         RECON_GLOB = lambda wildcards: f"sim_output/nhcal_pion_rejection/sim_{wildcards.DETECTOR_CONFIG}.*.eicrecon.edm4hep.root",
0070     singularity: EIC_SINGULARITY_CONTAINER,
0071     shell:
0072         """
0073     root -l -b -q '{input.script}+("{params.RECON_GLOB}","{output.pdf}","{output.png}","{params.DETECTOR_PATH}/{params.DETECTOR_CONFIG}")'
0074 """