Warning, /detector_benchmarks/benchmarks/femc_pi0/Snakefile is written in an unsupported language. File is not indexed.
0001 def get_n_events(wildcards):
0002 energy = float(wildcards.P)
0003 n_events = 1000
0004 n_events = int(n_events // ((energy / 20) ** 0.5))
0005 return n_events
0006
0007
0008 rule femc_pi0_generate:
0009 input:
0010 script=workflow.source_path("analysis/gen_particles.cxx"),
0011 output:
0012 GEN_FILE="sim_output/femc_pi0/pi0_{P}GeV.hepmc",
0013 params:
0014 N_EVENTS=get_n_events,
0015 th_max=28,
0016 th_min=2.0,
0017 P=lambda wildcards: wildcards.P,
0018 SEED=lambda wildcards: stable_seed("femc_pi0", wildcards.P),
0019 singularity: EIC_SINGULARITY_CONTAINER,
0020 shell:
0021 """
0022 mkdir -p sim_output/femc_pi0
0023 root -l -b -q '{input.script}({params.N_EVENTS},"{output.GEN_FILE}", "pi0", {params.th_min}, {params.th_max}, 0., 360., {params.P}, 0, 1, {params.SEED})'
0024 """
0025
0026 rule femc_pi0_simulate:
0027 input:
0028 GEN_FILE="sim_output/femc_pi0/pi0_{P}GeV.hepmc",
0029 warmup="warmup.edm4hep.root",
0030 geometry_lib=find_epic_libraries(),
0031 params:
0032 N_EVENTS=get_n_events,
0033 PHYSICS_LIST="FTFP_BERT",
0034 DETECTOR_PATH=config["DETECTOR_PREFIX"] + "/share/epic",
0035 DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG,
0036 DD4HEP_HASH=get_spack_package_hash("dd4hep"),
0037 NPSIM_HASH=get_spack_package_hash("npsim"),
0038 cache: True
0039 output:
0040 SIM_FILE="sim_output/femc_pi0/{DETECTOR_CONFIG}_sim_pi0_{P}GeV.edm4hep.rnt.root"
0041 singularity: EIC_SINGULARITY_CONTAINER,
0042 shell:
0043 """
0044 exec npsim \
0045 --compactFile {params.DETECTOR_PATH}/{params.DETECTOR_CONFIG}.xml \
0046 --random.seed 1 \
0047 --numberOfEvents {params.N_EVENTS} \
0048 --physicsList {params.PHYSICS_LIST} \
0049 --inputFiles {input.GEN_FILE} \
0050 --outputConfig.useRNTuple true \
0051 --outputFile {output.SIM_FILE}
0052 """
0053
0054 rule femc_pi0_recon:
0055 input:
0056 SIM_FILE="sim_output/femc_pi0/{DETECTOR_CONFIG}_sim_pi0_{P}GeV.edm4hep.rnt.root",
0057 warmup="warmup.edm4hep.root",
0058 output:
0059 REC_FILE="sim_output/femc_pi0/{DETECTOR_CONFIG}_rec_pi0_{P}GeV.edm4eic.root",
0060 params:
0061 N_EVENTS=get_n_events,
0062 DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG,
0063 EICRECON_HASH=get_spack_package_hash("eicrecon"),
0064 cache: True
0065 singularity: EIC_SINGULARITY_CONTAINER,
0066 shell:
0067 """
0068 env DETECTOR_CONFIG={params.DETECTOR_CONFIG} \
0069 eicrecon {input.SIM_FILE} -Ppodio:output_file={output.REC_FILE} -Ppodio:output_collections=MCParticles,EcalEndcapPClusters -Pjana:nevents={params.N_EVENTS}
0070 """
0071
0072 rule femc_pi0_analysis:
0073 input:
0074 expand("sim_output/femc_pi0/{DETECTOR_CONFIG}_rec_pi0_{P}GeV.edm4eic.root",
0075 P=[10, 20, 30, 40, 50, 60, 70, 80],
0076 DETECTOR_CONFIG=["{DETECTOR_CONFIG}"]),
0077 script=workflow.source_path("analysis/femc_pi0_plots.py"),
0078 output:
0079 results_dir=directory("results/{DETECTOR_CONFIG}/femc_pi0"),
0080 singularity: EIC_SINGULARITY_CONTAINER,
0081 shell:
0082 """
0083 mkdir -p {output.results_dir}
0084 python {input.script} {output.results_dir}
0085 """