Warning, /detector_benchmarks/benchmarks/insert_neutron/Snakefile is written in an unsupported language. File is not indexed.
0001 rule insert_neutron_generate:
0002 input:
0003 script=workflow.source_path("analysis/gen_particles.cxx"),
0004 output:
0005 GEN_FILE="sim_output/insert_neutron/neutron_{P}GeV.hepmc",
0006 params:
0007 NEVENTS_GEN=1000,
0008 th_max=5.7,
0009 th_min=2.0,
0010 P=lambda wildcards: wildcards.P,
0011 SEED=lambda wildcards: stable_seed("insert_neutron", wildcards.P),
0012 singularity: EIC_SINGULARITY_CONTAINER,
0013 shell:
0014 """
0015 mkdir -p sim_output/insert_neutron
0016 root -l -b -q '{input.script}({params.NEVENTS_GEN},"{output.GEN_FILE}", "neutron", {params.th_min}, {params.th_max}, 0., 360., {params.P}, 0, 1, {params.SEED})'
0017 """
0018
0019 rule insert_neutron_simulate:
0020 input:
0021 GEN_FILE="sim_output/insert_neutron/neutron_{P}GeV.hepmc",
0022 warmup="warmup.edm4hep.root",
0023 geometry_lib=find_epic_libraries(),
0024 output:
0025 SIM_FILE="sim_output/insert_neutron/{DETECTOR_CONFIG}_sim_neutron_{P}GeV_{INDEX}.edm4hep.rnt.root",
0026 params:
0027 INDEX=lambda wildcards: wildcards.INDEX,
0028 SEED=lambda wildcards: "1" + wildcards.INDEX,
0029 PHYSICS_LIST="FTFP_BERT",
0030 DETECTOR_PATH=config["DETECTOR_PREFIX"] + "/share/epic",
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 NEVENTS_SIM=200
0039 exec npsim \
0040 --compactFile {params.DETECTOR_PATH}/{params.DETECTOR_CONFIG}.xml \
0041 --random.seed {params.SEED} \
0042 --skipNEvents $(( $NEVENTS_SIM * {params.INDEX} )) \
0043 --numberOfEvents $NEVENTS_SIM \
0044 --physicsList {params.PHYSICS_LIST} \
0045 --inputFiles {input.GEN_FILE} \
0046 --outputConfig.useRNTuple true \
0047 --outputFile {output.SIM_FILE}
0048 """
0049
0050 rule insert_neutron_recon:
0051 input:
0052 SIM_FILE="sim_output/insert_neutron/{DETECTOR_CONFIG}_sim_neutron_{P}GeV_{INDEX}.edm4hep.rnt.root",
0053 warmup="warmup.edm4hep.root",
0054 output:
0055 REC_FILE="sim_output/insert_neutron/{DETECTOR_CONFIG}_rec_neutron_{P}GeV_{INDEX}.edm4eic.root",
0056 params:
0057 DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG,
0058 EICRECON_HASH=get_spack_package_hash("eicrecon"),
0059 cache: True
0060 singularity: EIC_SINGULARITY_CONTAINER,
0061 shell:
0062 """
0063 NEVENTS_REC=200
0064 env DETECTOR_CONFIG={params.DETECTOR_CONFIG} \
0065 eicrecon {input.SIM_FILE} -Ppodio:output_file={output.REC_FILE} -Ppodio:output_collections=MCParticles,HcalEndcapPInsertRecHits,HcalEndcapPInsertClusters,HcalEndcapPInsertSubcellHits,EcalEndcapPClusters -Pjana:nevents=$NEVENTS_REC
0066 """
0067
0068 rule insert_neutron_analysis:
0069 input:
0070 expand("sim_output/insert_neutron/{DETECTOR_CONFIG}_rec_neutron_{P}GeV_{INDEX}.edm4eic.root",
0071 P=[20, 30, 40, 50, 60, 70, 80],
0072 DETECTOR_CONFIG=["{DETECTOR_CONFIG}"],
0073 INDEX=range(5),
0074 ),
0075 script=workflow.source_path("analysis/neutron_plots.py"),
0076 output:
0077 results_dir=directory("results/{DETECTOR_CONFIG}/insert_neutron"),
0078 singularity: EIC_SINGULARITY_CONTAINER,
0079 shell:
0080 """
0081 mkdir -p {output.results_dir}
0082 python {input.script} {output.results_dir}
0083 """