Back to home page

EIC code displayed by LXR

 
 

    


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         DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG,
0026         DD4HEP_HASH=get_spack_package_hash("dd4hep"),
0027         NPSIM_HASH=get_spack_package_hash("npsim"),
0028     cache: True
0029     singularity: EIC_SINGULARITY_CONTAINER,
0030     shell:
0031         """
0032 exec npsim \
0033   --runType batch \
0034   -v WARNING \
0035   --compactFile $DETECTOR_PATH/{wildcards.DETECTOR_CONFIG}.xml \
0036   --random.seed 1 \
0037   --numberOfEvents {params.num_events} \
0038   --inputFiles {input.hepmcfile} \
0039   --outputFile {output}
0040 """
0041 
0042 
0043 # Process the file produced in the previous step through EICRecon
0044 rule zdc_neutron_reco:
0045     input:
0046         sim="sim_output/zdc_neutron/{DETECTOR_CONFIG}/fwd_neutrons.edm4hep.root",
0047         warmup="warmup.edm4hep.root",
0048     output:
0049         "sim_output/zdc_neutron/{DETECTOR_CONFIG}/fwd_neutrons.edm4eic.root",
0050     params:
0051         EICRECON_HASH=get_spack_package_hash("eicrecon"),
0052     cache: True
0053     singularity: EIC_SINGULARITY_CONTAINER,
0054     shell:
0055         """
0056 set -m # monitor mode to prevent lingering processes
0057 exec env DETECTOR_CONFIG={wildcards.DETECTOR_CONFIG} \
0058   eicrecon {input.sim} -Ppodio:output_file={output} \
0059   -Ppodio:output_collections=MCParticles,EcalFarForwardZDCRawHits,EcalFarForwardZDCRecHits,EcalFarForwardZDCClusters,HcalFarForwardZDCRawHits,HcalFarForwardZDCRecHits,HcalFarForwardZDCClusters,ReconstructedFarForwardZDCNeutrals
0060 """
0061 
0062 
0063 # Run the analysis scripts
0064 rule zdc_neutron_analyses:
0065     input:
0066         geant_script = workflow.source_path("analysis/fwd_neutrons_geant.C"),
0067         data_geant = "sim_output/zdc_neutron/{DETECTOR_CONFIG}/fwd_neutrons.edm4hep.root",
0068         recon_script = workflow.source_path("analysis/fwd_neutrons_recon.C"),
0069         data_recon = "sim_output/zdc_neutron/{DETECTOR_CONFIG}/fwd_neutrons.edm4eic.root",
0070     output:
0071         geant_analysis_out = "results/zdc_neutron/{DETECTOR_CONFIG}/fwd_neutrons_geant.pdf",
0072         recon_analysis_out = "results/zdc_neutron/{DETECTOR_CONFIG}/fwd_neutrons_recon.pdf",
0073     singularity: EIC_SINGULARITY_CONTAINER,
0074     shell:
0075         """
0076 root -l -b -q '{input.geant_script}("{input.data_geant}","{output.geant_analysis_out}")'
0077 root -l -b -q '{input.recon_script}("{input.data_recon}","{output.recon_analysis_out}")'
0078 """