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="benchmarks/femc_pi0/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 shell:
0019 """
0020 mkdir -p sim_output/femc_pi0
0021 root -l -b -q '{input.script}({params.N_EVENTS},"{output.GEN_FILE}", "pi0", {params.th_min}, {params.th_max}, 0., 360., {params.P})'
0022 """
0023
0024 rule femc_pi0_simulate:
0025 input:
0026 GEN_FILE="sim_output/femc_pi0/pi0_{P}GeV.hepmc",
0027 warmup=ancient("warmup/{DETECTOR_CONFIG}.edm4hep.root"),
0028 geometry_lib=find_epic_libraries(),
0029 params:
0030 N_EVENTS=get_n_events,
0031 PHYSICS_LIST="FTFP_BERT",
0032 DETECTOR_PATH=os.environ["DETECTOR_PATH"],
0033 DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG,
0034 DD4HEP_HASH=get_spack_package_hash("dd4hep"),
0035 NPSIM_HASH=get_spack_package_hash("npsim"),
0036 cache: True
0037 output:
0038 SIM_FILE="sim_output/femc_pi0/{DETECTOR_CONFIG}_sim_pi0_{P}GeV.edm4hep.root"
0039 shell:
0040 """
0041 exec npsim \
0042 --compactFile {params.DETECTOR_PATH}/{params.DETECTOR_CONFIG}.xml \
0043 --random.seed 1 \
0044 --numberOfEvents {params.N_EVENTS} \
0045 --physicsList {params.PHYSICS_LIST} \
0046 --inputFiles {input.GEN_FILE} \
0047 --outputFile {output.SIM_FILE}
0048 """
0049
0050 rule femc_pi0_recon:
0051 input:
0052 SIM_FILE="sim_output/femc_pi0/{DETECTOR_CONFIG}_sim_pi0_{P}GeV.edm4hep.root",
0053 warmup=ancient("warmup/{DETECTOR_CONFIG}.edm4hep.root"),
0054 output:
0055 REC_FILE="sim_output/femc_pi0/{DETECTOR_CONFIG}_rec_pi0_{P}GeV.edm4eic.root",
0056 params:
0057 N_EVENTS=get_n_events,
0058 DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG,
0059 EICRECON_HASH=get_spack_package_hash("eicrecon"),
0060 cache: True
0061 shell:
0062 """
0063 env DETECTOR_CONFIG={params.DETECTOR_CONFIG} \
0064 eicrecon {input.SIM_FILE} -Ppodio:output_file={output.REC_FILE} -Ppodio:output_collections=MCParticles,EcalEndcapPClusters -Pjana:nevents={params.N_EVENTS}
0065 """
0066
0067 rule femc_pi0_analysis:
0068 input:
0069 expand("sim_output/femc_pi0/{DETECTOR_CONFIG}_rec_pi0_{P}GeV.edm4eic.root",
0070 P=[10, 20, 30, 40, 50, 60, 70, 80],
0071 DETECTOR_CONFIG=["{DETECTOR_CONFIG}"]),
0072 script="benchmarks/femc_pi0/analysis/femc_pi0_plots.py",
0073 output:
0074 results_dir=directory("results/{DETECTOR_CONFIG}/femc_pi0"),
0075 shell:
0076 """
0077 mkdir -p {output.results_dir}
0078 python {input.script} {output.results_dir}
0079 """