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