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