Warning, /detector_benchmarks/benchmarks/zdc_neutron/Snakefile is written in an unsupported language. File is not indexed.
0001 # Generate the single neutrons and put them into a HepMC file
0002 rule zdc_neutron_hepmc:
0003 input:
0004 script = workflow.source_path("gen_forward_neutrons.cxx"),
0005 output:
0006 hepmcfile="sim_output/zdc_neutron/{DETECTOR_CONFIG}/fwd_neutrons.hepmc",
0007 params:
0008 num_events=1000,
0009 singularity: EIC_SINGULARITY_CONTAINER,
0010 shell:
0011 """
0012 root -l -b -q '{input.script}({params.num_events}, 0, "{output.hepmcfile}")'
0013 """
0014
0015 # Run the generated events through the Geant simulation
0016 rule zdc_neutron_sim:
0017 input:
0018 hepmcfile="sim_output/zdc_neutron/{DETECTOR_CONFIG}/fwd_neutrons.hepmc",
0019 warmup="warmup.edm4hep.root",
0020 geometry_lib=find_epic_libraries(),
0021 output:
0022 "sim_output/zdc_neutron/{DETECTOR_CONFIG}/fwd_neutrons.edm4hep.root",
0023 params:
0024 num_events=100,
0025 DD4HEP_HASH=get_spack_package_hash("dd4hep"),
0026 NPSIM_HASH=get_spack_package_hash("npsim"),
0027 cache: True
0028 singularity: EIC_SINGULARITY_CONTAINER,
0029 shell:
0030 """
0031 exec npsim \
0032 --runType batch \
0033 -v WARNING \
0034 --compactFile $DETECTOR_PATH/{wildcards.DETECTOR_CONFIG}.xml \
0035 --random.seed 1 \
0036 --numberOfEvents {params.num_events} \
0037 --inputFiles {input.hepmcfile} \
0038 --outputFile {output}
0039 """
0040
0041
0042 # Process the file produced in the previous step through EICRecon
0043 rule zdc_neutron_reco:
0044 input:
0045 sim="sim_output/zdc_neutron/{DETECTOR_CONFIG}/fwd_neutrons.edm4hep.root",
0046 warmup="warmup.edm4hep.root",
0047 output:
0048 "sim_output/zdc_neutron/{DETECTOR_CONFIG}/fwd_neutrons.edm4eic.root",
0049 params:
0050 EICRECON_HASH=get_spack_package_hash("eicrecon"),
0051 cache: True
0052 singularity: EIC_SINGULARITY_CONTAINER,
0053 shell:
0054 """
0055 set -m # monitor mode to prevent lingering processes
0056 exec env DETECTOR_CONFIG={wildcards.DETECTOR_CONFIG} \
0057 eicrecon {input.sim} -Ppodio:output_file={output} \
0058 -Ppodio:output_collections=MCParticles,EcalFarForwardZDCRawHits,EcalFarForwardZDCRecHits,EcalFarForwardZDCClusters,HcalFarForwardZDCRawHits,HcalFarForwardZDCRecHits,HcalFarForwardZDCClusters,ReconstructedFarForwardZDCNeutrals
0059 """
0060
0061
0062 # Run the analysis scripts
0063 rule zdc_neutron_analyses:
0064 input:
0065 geant_script = workflow.source_path("analysis/fwd_neutrons_geant.C"),
0066 data_geant = "sim_output/zdc_neutron/{DETECTOR_CONFIG}/fwd_neutrons.edm4hep.root",
0067 recon_script = workflow.source_path("analysis/fwd_neutrons_recon.C"),
0068 data_recon = "sim_output/zdc_neutron/{DETECTOR_CONFIG}/fwd_neutrons.edm4eic.root",
0069 output:
0070 geant_analysis_out = "results/zdc_neutron/{DETECTOR_CONFIG}/fwd_neutrons_geant.pdf",
0071 recon_analysis_out = "results/zdc_neutron/{DETECTOR_CONFIG}/fwd_neutrons_recon.pdf",
0072 singularity: EIC_SINGULARITY_CONTAINER,
0073 shell:
0074 """
0075 root -l -b -q '{input.geant_script}("{input.data_geant}","{output.geant_analysis_out}")'
0076 root -l -b -q '{input.recon_script}("{input.data_recon}","{output.recon_analysis_out}")'
0077 """