Back to home page

EIC code displayed by LXR

 
 

    


Warning, /physics_benchmarks/benchmarks/Inclusive/dis/Snakefile is written in an unsupported language. File is not indexed.

0001 import shutil
0002 
0003 
0004 rule dis_compile:
0005     input:
0006         ROOT_BUILD_DIR_PREFIX + "benchmarks/Inclusive/dis/analysis/dis_electrons_cxx.so",
0007 
0008 
0009 rule dis_sim:
0010     input:
0011         warmup="warmup/{DETECTOR_CONFIG}.edm4hep.root",
0012         geometry_lib=find_epic_libraries(),
0013     output:
0014         "sim_output/{DETECTOR_CONFIG}/pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_beamEffects_xAngle=-0.025_hiDiv_1.{INDEX}.edm4hep.root",
0015     wildcard_constraints:
0016         INDEX=r"\d{4}",
0017     params:
0018         N_EVENTS=100,
0019         SEED=lambda wildcards: "1" + wildcards.INDEX,
0020         EBEAM=lambda wildcards: wildcards.EBEAM,
0021         PBEAM=lambda wildcards: wildcards.PBEAM,
0022         MINQ2=lambda wildcards: wildcards.MINQ2,
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     cache: True
0028     shell:
0029         """
0030 npsim \
0031   --runType batch \
0032   --part.minimalKineticEnergy 1000*GeV  \
0033   --filter.tracker edep0 \
0034   -v WARNING \
0035   --numberOfEvents {params.N_EVENTS} \
0036   --compactFile $DETECTOR_PATH/{params.DETECTOR_CONFIG}.xml \
0037   --random.seed {params.SEED} \
0038   --inputFiles root://dtn-eic.jlab.org//volatile/eic/EPIC/EVGEN/DIS/NC/{params.EBEAM}x{params.PBEAM}/minQ2={params.MINQ2}/pythia8NCDIS_{params.EBEAM}x{params.PBEAM}_minQ2={params.MINQ2}_beamEffects_xAngle=-0.025_hiDiv_vtxfix_1.hepmc3.tree.root \
0039   --outputFile {output}
0040 """
0041 
0042 
0043 rule dis_reco_eicrecon:
0044     input:
0045         "sim_output/{DETECTOR_CONFIG}/pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_beamEffects_xAngle=-0.025_hiDiv_1.{INDEX}.edm4hep.root",
0046     output:
0047         "sim_output/{DETECTOR_CONFIG}/pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_beamEffects_xAngle=-0.025_hiDiv_1.{INDEX}.eicrecon.edm4eic.root",
0048     params:
0049         DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG,
0050         EICRECON_HASH=get_spack_package_hash("eicrecon"),
0051     cache: True
0052     shell:
0053         """
0054 DETECTOR_CONFIG={params.DETECTOR_CONFIG} eicrecon {input} -Ppodio:output_file={output}
0055 """
0056 
0057 
0058 rule dis_generate_config:
0059     input:
0060         data="sim_output/{DETECTOR_CONFIG}/pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_beamEffects_xAngle=-0.025_hiDiv_1.0000.eicrecon.edm4eic.root",
0061     output:
0062         config="results/{DETECTOR_CONFIG}/dis/{EBEAM}on{PBEAM}/minQ2={MINQ2}_config.json",
0063     shell: """
0064 cat > {output.config} <<EOF
0065 {{
0066   "rec_file": "{input.data}",
0067   "detector": "{wildcards.DETECTOR_CONFIG}",
0068   "output_prefix": "results/{wildcards.DETECTOR_CONFIG}/dis/{wildcards.EBEAM}on{wildcards.PBEAM}/minQ2={wildcards.MINQ2}/dis_{wildcards.EBEAM}x{wildcards.PBEAM}_minQ2={wildcards.MINQ2}",
0069   "results_path": "results/{wildcards.DETECTOR_CONFIG}/dis/{wildcards.EBEAM}on{wildcards.PBEAM}/minQ2={wildcards.MINQ2}",
0070   "ebeam": {wildcards.EBEAM},
0071   "pbeam": {wildcards.PBEAM},
0072   "minq2": {wildcards.MINQ2},
0073   "plot_tag": "dis_{wildcards.EBEAM}x{wildcards.PBEAM}_minQ2={wildcards.MINQ2}",
0074   "test_tag": "dis_{wildcards.EBEAM}x{wildcards.PBEAM}_minQ2={wildcards.MINQ2}"
0075 }}
0076 EOF
0077 """
0078 
0079 
0080 rule dis_analysis_electrons:
0081     input:
0082         script="benchmarks/Inclusive/dis/analysis/dis_electrons.cxx",
0083         script_compiled=ROOT_BUILD_DIR_PREFIX + "benchmarks/Inclusive/dis/analysis/dis_electrons_cxx.so",
0084         data="sim_output/{DETECTOR_CONFIG}/pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_beamEffects_xAngle=-0.025_hiDiv_1.0000.eicrecon.edm4eic.root",
0085         config="results/{DETECTOR_CONFIG}/dis/{EBEAM}on{PBEAM}/minQ2={MINQ2}_config.json",
0086     output:
0087         expand("results/{{DETECTOR_CONFIG}}/dis/{{EBEAM}}on{{PBEAM}}/minQ2={{MINQ2}}/{FILENAME}", FILENAME=[
0088           "dis_{EBEAM}x{PBEAM}_minQ2={MINQ2}_logQ2_panels.png",
0089           "dis_{EBEAM}x{PBEAM}_minQ2={MINQ2}_logQ2_overlays.png",
0090           "dis_{EBEAM}x{PBEAM}_minQ2={MINQ2}_Q2_res_panels.png",
0091           "dis_{EBEAM}x{PBEAM}_minQ2={MINQ2}_Q2_res_overlays.png",
0092           "dis_{EBEAM}x{PBEAM}_minQ2={MINQ2}_x_panels.png",
0093           "dis_{EBEAM}x{PBEAM}_minQ2={MINQ2}_x_overlays.png",
0094           "dis_{EBEAM}x{PBEAM}_minQ2={MINQ2}_x_res_panels.png",
0095           "dis_{EBEAM}x{PBEAM}_minQ2={MINQ2}_x_res_overlays.png",
0096           "dis_{EBEAM}x{PBEAM}_minQ2={MINQ2}dis_electrons.json"
0097         ]),
0098     shell: """
0099 root -l -b -q '{input.script}+("{input.config}")'
0100 """
0101 
0102 
0103 rule dis_analysis_kinematics_correlations:
0104     input:
0105         data="sim_output/{DETECTOR_CONFIG}/pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_beamEffects_xAngle=-0.025_hiDiv_1.0000.eicrecon.edm4eic.root",
0106     output:
0107         results_path=directory("results/{DETECTOR_CONFIG}/dis/{EBEAM}on{PBEAM}/minQ2={MINQ2}/kinematics_correlations"),
0108     params:
0109         N_EVENTS=100
0110     wildcard_constraints:
0111         EBEAM=r"\d+",
0112         PBEAM=r"\d+",
0113         MINQ2=r"\d+",
0114     shell: """
0115 mkdir {output.results_path}
0116 python benchmarks/Inclusive/dis/analysis/kinematics_correlations.py --rec_file "{input.data}" --config dis_{wildcards.EBEAM}x{wildcards.PBEAM}_minQ2={wildcards.MINQ2}_{wildcards.DETECTOR_CONFIG} --results_path {output.results_path} --nevents {params.N_EVENTS}
0117 """