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