Back to home page

EIC code displayed by LXR

 
 

    


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

0001 import os
0002 
0003 
0004 rule zdc_lyso_sim_hepmc:
0005     input:
0006         script = "benchmarks/zdc_lyso/gen_particles.cxx",
0007     output:
0008         hepmcfile="data/{PARTICLE}_{BEAM_ENERGY}GeV_theta_{THETA_MIN}deg_thru_{THETA_MAX}deg.hepmc",
0009     log:
0010         "data/{PARTICLE}_{BEAM_ENERGY}GeV_theta_{THETA_MIN}deg_thru_{THETA_MAX}deg.hepmc.log",
0011     params:
0012         num_events=1000,
0013         PARTICLE=lambda wildcards: wildcards.PARTICLE,
0014         BEAM_ENERGY=lambda wildcards: wildcards.BEAM_ENERGY,
0015         THETA_MIN=lambda wildcards: wildcards.THETA_MIN,
0016         THETA_MAX=lambda wildcards: wildcards.THETA_MAX,
0017     shell:
0018         """
0019 root -l -b -q '{input.script}({params.num_events}, "{output.hepmcfile}", "{params.PARTICLE}", {params.THETA_MIN}, {params.THETA_MAX}, 0, 360, {params.BEAM_ENERGY})'
0020 """
0021 
0022 
0023 rule zdc_lyso_sim:
0024     input:
0025         hepmcfile="data/{PARTICLE}_{BEAM_ENERGY}GeV_theta_{THETA_MIN}deg_thru_{THETA_MAX}deg.hepmc",
0026         warmup=ancient("warmup/{DETECTOR_CONFIG}.edm4hep.root"),
0027         geometry_lib=find_epic_libraries(),
0028     output:
0029         "sim_output/zdc_lyso/{DETECTOR_CONFIG}_{PARTICLE}_{BEAM_ENERGY}GeV_theta_{THETA_MIN}deg_thru_{THETA_MAX}deg.edm4hep.root",
0030     log:
0031         "sim_output/zdc_lyso/{DETECTOR_CONFIG}_{PARTICLE}_{BEAM_ENERGY}GeV_theta_{THETA_MIN}deg_thru_{THETA_MAX}deg.edm4hep.root.log",
0032     params:
0033         num_events=1000,
0034         DETECTOR_PATH=os.environ["DETECTOR_PATH"],
0035         DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG,
0036         DD4HEP_HASH=get_spack_package_hash("dd4hep"),
0037         NPSIM_HASH=get_spack_package_hash("npsim"),
0038     cache: True
0039     shell:
0040         """
0041 exec npsim \
0042   --runType batch \
0043   -v WARNING \
0044   --compactFile {params.DETECTOR_PATH}/{params.DETECTOR_CONFIG}.xml \
0045   --random.seed 1 \
0046   --numberOfEvents {params.num_events} \
0047   --inputFiles {input.hepmcfile} \
0048   --outputFile {output}
0049 """
0050 
0051 
0052 rule zdc_lyso_reco:
0053     input:
0054         "sim_output/zdc_lyso/{DETECTOR_CONFIG}_{PARTICLE}_{BEAM_ENERGY}GeV_theta_{THETA_MIN}deg_thru_{THETA_MAX}deg.edm4hep.root",
0055         warmup=ancient("warmup/{DETECTOR_CONFIG}.edm4hep.root"),
0056     output:
0057         "sim_output/zdc_lyso/{DETECTOR_CONFIG}_{PARTICLE}_{BEAM_ENERGY}GeV_theta_{THETA_MIN}deg_thru_{THETA_MAX}deg.eicrecon.edm4eic.root",
0058     log:
0059         "sim_output/zdc_lyso/{DETECTOR_CONFIG}_{PARTICLE}_{BEAM_ENERGY}GeV_theta_{THETA_MIN}deg_thru_{THETA_MAX}deg.eicrecon.edm4eic.root.log",
0060     params:
0061         DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG,
0062         EICRECON_HASH=get_spack_package_hash("eicrecon"),
0063     cache: True
0064     shell:
0065         """
0066 env DETECTOR_CONFIG={params.DETECTOR_CONFIG} \
0067   eicrecon -Ppodio:output_file={output} -Ppodio:output_collections=HcalFarForwardZDCRawHits,HcalFarForwardZDCRecHits,HcalFarForwardZDCClusters,EcalFarForwardZDCRawHits,EcalFarForwardZDCRecHits,EcalFarForwardZDCClusters,MCParticles {input}
0068 """
0069 
0070 
0071 rule zdc_lyso_analysis:
0072     input:
0073         expand("sim_output/zdc_lyso/{{DETECTOR_CONFIG}}_{PARTICLE}_{BEAM_ENERGY}GeV_theta_{THETA_MIN}deg_thru_{THETA_MAX}deg.eicrecon.edm4eic.root",
0074                PARTICLE=["gamma"],
0075                BEAM_ENERGY=["0.005", "0.01", "0.05", "0.1", "0.5", "1.0"],
0076                THETA_MIN=["0"],
0077                THETA_MAX=["0.3"]),
0078         script="benchmarks/zdc_lyso/analysis/analysis.py",
0079     output:
0080         "results/{DETECTOR_CONFIG}/zdc_lyso/plots.pdf",
0081     shell:
0082         """
0083 python {input.script}
0084 """
0085 
0086 
0087 # Examples of invocation
0088 rule zdc_lyso_hepmc:
0089     input:
0090         expand("data/{PARTICLE}_{BEAM_ENERGY}GeV_theta_{THETA_MIN}deg_thru_{THETA_MAX}deg.hepmc",
0091                PARTICLE=["gamma"],
0092                BEAM_ENERGY=["0.005", "0.01", "0.05", "0.1", "0.5", "1.0"],
0093                THETA_MIN=["0"],
0094                THETA_MAX=["0.3"])
0095 
0096 
0097 rule zdc_lyso_local:
0098    input:
0099         "results/" + os.environ["DETECTOR_CONFIG"] + "/zdc_lyso/plots.pdf",
0100    message:
0101         "See output in {input[0]}"
0102