Back to home page

EIC code displayed by LXR

 
 

    


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

0001 rule nhcal_dimuon_photoproduction_presimulate:
0002     output:
0003         "sim_input/DiMuon_ep_18x275GeV.{INDEX}.hepmc3",
0004     params:
0005         outdir=lambda wc, output: os.path.dirname(output[0]),
0006         SEED=lambda wildcards: "1" + wildcards.INDEX,
0007     singularity: EIC_SINGULARITY_CONTAINER,
0008     shell:
0009         """
0010             pwd
0011             echo "Output dir: {params.outdir}"
0012             make -C benchmarks/nhcal_dimuon_photoproduction/scripts
0013             benchmarks/nhcal_dimuon_photoproduction/scripts/run.sh {wildcards.INDEX:q} {params.outdir:q} {params.SEED:q}
0014             ls -la {params.outdir}/
0015         """
0016 
0017 rule nhcal_dimuon_photoproduction_simulate:
0018     input:
0019         hepmc="sim_input/DiMuon_ep_18x275GeV.{INDEX}.hepmc3",
0020         geometry_lib=find_epic_libraries(),
0021     output:
0022         "sim_output/nhcal_dimuon_photoproduction/sim_{DETECTOR_CONFIG}.{INDEX}.edm4hep.rnt.root",
0023     params:
0024         N_EVENTS=1000,
0025         SEED=lambda wildcards: "1" + wildcards.INDEX,
0026         DETECTOR_PATH=config["DETECTOR_PREFIX"] + "/share/epic",
0027         DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG,
0028         DD4HEP_HASH=get_spack_package_hash("dd4hep"),
0029         NPSIM_HASH=get_spack_package_hash("npsim"),
0030     wildcard_constraints:
0031         INDEX = r"\d+",
0032     cache: True
0033     singularity: EIC_SINGULARITY_CONTAINER,
0034     shell:
0035         """
0036             exec npsim \
0037                 --compactFile {params.DETECTOR_PATH}/{params.DETECTOR_CONFIG}.xml \
0038                 --inputFile {input.hepmc} \
0039                 -v WARNING \
0040                 --random.seed {params.SEED} \
0041                 --numberOfEvents {params.N_EVENTS} \
0042                 --outputConfig.useRNTuple true \
0043                 --outputFile {output}
0044         """
0045 
0046 rule nhcal_dimuon_photoproduction_recon:
0047     input:
0048         "sim_output/nhcal_dimuon_photoproduction/sim_{DETECTOR_CONFIG}.{INDEX}.edm4hep.rnt.root"
0049     output:
0050         "sim_output/nhcal_dimuon_photoproduction/sim_{DETECTOR_CONFIG}.{INDEX}.eicrecon.edm4hep.root"
0051     params:
0052         DETECTOR_CONFIG = lambda wildcards: wildcards.DETECTOR_CONFIG,
0053         EICRECON_HASH=get_spack_package_hash("eicrecon"),
0054     cache: True
0055     singularity: EIC_SINGULARITY_CONTAINER,
0056     shell:
0057         """
0058             exec env DETECTOR_CONFIG={params.DETECTOR_CONFIG} \
0059                 eicrecon {input} \
0060                 -Ppodio:output_file={output} \
0061 
0062         """
0063 
0064 rule nhcal_dimuon_photoproduction_analysis:
0065     input:
0066         recon=lambda wildcards: expand(
0067             "sim_output/nhcal_dimuon_photoproduction/sim_{DETECTOR_CONFIG}.{INDEX}.eicrecon.edm4hep.root",
0068             DETECTOR_CONFIG=wildcards.DETECTOR_CONFIG,
0069             INDEX=range(int(wildcards.N)),
0070         ),
0071         script=workflow.source_path("scripts/dimuon_photoproduction_analysis.cxx"),
0072     output:
0073         png="results/nhcal_dimuon_photoproduction/analysis_{DETECTOR_CONFIG}_{N}files.png",
0074         pdf="results/nhcal_dimuon_photoproduction/analysis_{DETECTOR_CONFIG}_{N}files.pdf",
0075     wildcard_constraints:
0076         N=r"\d+",
0077     params:
0078         DETECTOR_PATH   = config["DETECTOR_PREFIX"] + "/share/epic",
0079         DETECTOR_CONFIG = lambda wildcards: f"{wildcards.DETECTOR_CONFIG}.xml",
0080         RECON_GLOB = lambda wildcards: f"sim_output/nhcal_dimuon_photoproduction/sim_{wildcards.DETECTOR_CONFIG}.*.eicrecon.edm4hep.root",
0081     singularity: EIC_SINGULARITY_CONTAINER,
0082     shell:
0083         """
0084             root -l -b -q '{input.script}+("{params.RECON_GLOB}","{output.pdf}","{output.png}","{params.DETECTOR_PATH}/{params.DETECTOR_CONFIG}")'
0085         """