Warning, /detector_benchmarks/benchmarks/femc_electron/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_electron_generate:
0009 input:
0010 script="benchmarks/femc_electron/analysis/gen_particles.cxx",
0011 output:
0012 GEN_FILE="sim_output/femc_electron/e-_{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_electron
0021 root -l -b -q '{input.script}({params.N_EVENTS},"{output.GEN_FILE}", "e-", {params.th_min}, {params.th_max}, 0., 360., {params.P})'
0022 """
0023
0024 rule femc_electron_simulate:
0025 input:
0026 GEN_FILE="sim_output/femc_electron/e-_{P}GeV.hepmc",
0027 warmup=ancient("warmup/{DETECTOR_CONFIG}.edm4hep.root"),
0028 geometry_lib=find_epic_libraries(),
0029 output:
0030 SIM_FILE="sim_output/femc_electron/{DETECTOR_CONFIG}_sim_e-_{P}GeV.edm4hep.root",
0031 params:
0032 N_EVENTS=get_n_events,
0033 PHYSICS_LIST="FTFP_BERT",
0034 DETECTOR_PATH=os.environ["DETECTOR_PATH"],
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 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_electron_recon:
0051 input:
0052 SIM_FILE="sim_output/femc_electron/{DETECTOR_CONFIG}_sim_e-_{P}GeV.edm4hep.root",
0053 warmup=ancient("warmup/{DETECTOR_CONFIG}.edm4hep.root"),
0054 output:
0055 REC_FILE="sim_output/femc_electron/{DETECTOR_CONFIG}_rec_e-_{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_electron_analysis:
0068 input:
0069 expand("sim_output/femc_electron/{DETECTOR_CONFIG}_rec_e-_{P}GeV.edm4eic.root",
0070 P=[10, 20, 30, 40, 50, 60, 70, 80],
0071 DETECTOR_CONFIG=["{DETECTOR_CONFIG}"]),
0072 script="benchmarks/femc_electron/analysis/femc_electron_plots.py",
0073 output:
0074 results_dir=directory("results/{DETECTOR_CONFIG}/femc_electron"),
0075 shell:
0076 """
0077 mkdir -p {output.results_dir}
0078 python {input.script} {output.results_dir}
0079 """