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