Back to home page

EIC code displayed by LXR

 
 

    


Warning, /physics_benchmarks/benchmarks/Exclusive-Diffraction-Tagging/dvcs/Snakefile is written in an unsupported language. File is not indexed.

0001 import os
0002 
0003 # Compile the analysis scripts
0004 rule dvcs_compile:
0005     input:
0006         ROOT_BUILD_DIR_PREFIX + "benchmarks/Exclusive-Diffraction-Tagging/dvcs/analysis/dvcs_tests_cxx.so",
0007 
0008 # Simulation rule
0009 rule dvcs_sim:
0010     input:
0011         warmup="warmup/{DETECTOR_CONFIG}.edm4hep.root",
0012         geometry_lib=find_epic_libraries(),
0013     output:
0014         "sim/{DETECTOR_CONFIG}/dvcs.edm4hep.root",
0015     params:
0016         N_EVENTS=os.getenv("JUGGLER_N_EVENTS", 100),
0017         DD4HEP_HASH=get_spack_package_hash("dd4hep"),
0018         NPSIM_HASH=get_spack_package_hash("npsim"),
0019         INPUT_FILE="root://dtn-eic.jlab.org//volatile/eic/EPIC/EVGEN/EXCLUSIVE/DVCS_ABCONV/10x100/DVCS.1.ab.hiDiv.10x100.hepmc3.tree.root",
0020     cache: True
0021     shell:
0022         """
0023 npsim \
0024   --runType batch \
0025   --part.minimalKineticEnergy 1000*GeV  \
0026   --filter.tracker edep0 \
0027   -v ERROR \
0028   --numberOfEvents {params.N_EVENTS} \
0029   --compactFile $DETECTOR_PATH/{wildcards.DETECTOR_CONFIG}.xml \
0030   --inputFiles {params.INPUT_FILE} \
0031   --outputFile {output}
0032 """
0033 
0034 # Reconstruction rule
0035 rule dvcs_reco:
0036     input:
0037         "sim/{DETECTOR_CONFIG}/dvcs.edm4hep.root",
0038     output:
0039         "reco/{DETECTOR_CONFIG}/dvcs.edm4eic.root",
0040     params:
0041         EICRECON_HASH=get_spack_package_hash("eicrecon"),
0042     cache: True
0043     shell:
0044         """
0045 DETECTOR_CONFIG={wildcards.DETECTOR_CONFIG} eicrecon {input} -Ppodio:output_file={output}
0046 """
0047 
0048 # Analysis rule - runs from repo root, script writes to results/dvcs/
0049 rule dvcs_analysis:
0050     input:
0051         script="benchmarks/Exclusive-Diffraction-Tagging/dvcs/analysis/dvcs_tests.cxx",
0052         script_compiled=ROOT_BUILD_DIR_PREFIX + "benchmarks/Exclusive-Diffraction-Tagging/dvcs/analysis/dvcs_tests_cxx.so",
0053         data="reco/{DETECTOR_CONFIG}/dvcs.edm4eic.root",
0054     output:
0055         "results/{DETECTOR_CONFIG}/dvcs/Q2.png",
0056         "results/{DETECTOR_CONFIG}/dvcs/Q2.pdf",
0057         "results/{DETECTOR_CONFIG}/dvcs/n_parts.png",
0058         "results/{DETECTOR_CONFIG}/dvcs/n_parts.pdf",
0059     shell:
0060         """
0061 mkdir -p results/dvcs results/{wildcards.DETECTOR_CONFIG}/dvcs
0062 root -l -b -q '{input.script}+("{input.data}")'
0063 # Move plots to detector-specific directory since script outputs to results/dvcs/
0064 mv results/dvcs/*.png results/dvcs/*.pdf results/{wildcards.DETECTOR_CONFIG}/dvcs/
0065 """
0066 
0067 # Top-level rule to run everything
0068 rule dvcs_run_locally:
0069     input:
0070         expand("results/{DETECTOR_CONFIG}/dvcs/{plot}.{ext}",
0071                DETECTOR_CONFIG=[os.getenv("DETECTOR_CONFIG", "epic")],
0072                plot=["Q2", "n_parts"],
0073                ext=["png", "pdf"]),
0074     message:
0075         "DVCS benchmark complete. See output in results/dvcs/"