Back to home page

EIC code displayed by LXR

 
 

    


Warning, /detector_benchmarks/benchmarks/zdc_photon/Snakefile is written in an unsupported language. File is not indexed.

0001 rule zdc_photon_generate:
0002     input:
0003         script=workflow.source_path("analysis/gen_particles.cxx"),
0004     output:
0005         GEN_FILE="sim_output/zdc_photon/zdc_photon_{P}GeV.hepmc",
0006     params:
0007         th_max=0.23,
0008         th_min=0,
0009         N_EVENTS=1000,
0010         P=lambda wildcards: wildcards.P,
0011     singularity: EIC_SINGULARITY_CONTAINER,
0012     shell:
0013         """
0014 mkdir -p sim_output/zdc_photon
0015 root -l -b -q '{input.script}('{params.N_EVENTS}',"{output.GEN_FILE}", "gamma", {params.th_min}, {params.th_max}, 0., 360., {params.P})'
0016 """
0017 
0018 rule zdc_photon_simulate:
0019     input:
0020         GEN_FILE="sim_output/zdc_photon/zdc_photon_{P}GeV.hepmc",
0021         warmup="warmup.edm4hep.root",
0022         geometry_lib=find_epic_libraries(),
0023     output:
0024         SIM_FILE="sim_output/zdc_photon/{DETECTOR_CONFIG}_sim_zdc_photon_{P}GeV_{INDEX}.edm4hep.root",
0025     params:
0026         N_EVENTS=200,
0027         INDEX=lambda wildcards: wildcards.INDEX,
0028         SEED=lambda wildcards: "1" + wildcards.INDEX,
0029         PHYSICS_LIST="FTFP_BERT",
0030         DETECTOR_PATH=os.environ["DETECTOR_PATH"],
0031         DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG,
0032         DD4HEP_HASH=get_spack_package_hash("dd4hep"),
0033         NPSIM_HASH=get_spack_package_hash("npsim"),
0034     cache: True
0035     singularity: EIC_SINGULARITY_CONTAINER,
0036     shell:
0037         """
0038 exec npsim \
0039    --compactFile {params.DETECTOR_PATH}/{params.DETECTOR_CONFIG}.xml \
0040    --random.seed {params.SEED} \
0041    --physicsList {params.PHYSICS_LIST} \
0042    --skipNEvents $(( {params.N_EVENTS} * {params.INDEX} )) \
0043    --numberOfEvents {params.N_EVENTS} \
0044    --inputFiles {input.GEN_FILE} \
0045    --outputFile {output.SIM_FILE}
0046 """
0047 
0048 rule zdc_photon_recon:
0049     input:
0050         SIM_FILE="sim_output/zdc_photon/{DETECTOR_CONFIG}_sim_zdc_photon_{P}GeV_{INDEX}.edm4hep.root",
0051         warmup="warmup.edm4hep.root",
0052     output:
0053         REC_FILE="sim_output/zdc_photon/{DETECTOR_CONFIG}_rec_zdc_photon_{P}GeV_{INDEX}.edm4eic.root",
0054     params:
0055         N_EVENTS=200,
0056         DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG,
0057         EICRECON_HASH=get_spack_package_hash("eicrecon"),
0058     cache: True
0059     singularity: EIC_SINGULARITY_CONTAINER,
0060     shell:
0061         """
0062 env DETECTOR_CONFIG={params.DETECTOR_CONFIG} \
0063   eicrecon {input.SIM_FILE} -Ppodio:output_file={output.REC_FILE} -Ppodio:output_collections=MCParticles,HcalFarForwardZDCRecHits,HcalFarForwardZDCClusters,HcalFarForwardZDCSubcellHits,ReconstructedFarForwardZDCNeutrals -Pjana:nevents={params.N_EVENTS}
0064 """
0065 
0066 rule zdc_photon_analysis:
0067     input:
0068         expand("sim_output/zdc_photon/{DETECTOR_CONFIG}_rec_zdc_photon_{P}GeV_{INDEX}.edm4eic.root",
0069             P=[20, 30, 50, 70, 100, 150, 200, 275],
0070             DETECTOR_CONFIG=["{DETECTOR_CONFIG}"],
0071             INDEX=range(5),
0072         ),
0073         script=workflow.source_path("analysis/zdc_photon_plots.py"),
0074     output:
0075         results_dir=directory("results/{DETECTOR_CONFIG}/zdc_photon"),
0076     singularity: EIC_SINGULARITY_CONTAINER,
0077     shell:
0078         """
0079 mkdir -p {output.results_dir}
0080 python {input.script} {output.results_dir}
0081 """