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