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