Warning, /detector_benchmarks/benchmarks/insert_tau/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 rule insert_tau_generate:
0008 input:
0009 script=workflow.source_path("analysis/gen_particles.cxx"),
0010 output:
0011 GEN_FILE="sim_output/insert_tau/tau-_{P}GeV.hepmc",
0012 params:
0013 N_EVENTS=get_n_events,
0014 th_max=7.0,
0015 th_min=1.7,
0016 P=lambda wildcards: wildcards.P,
0017 singularity: EIC_SINGULARITY_CONTAINER,
0018 shell:
0019 """
0020 root -l -b -q '{input.script}({params.N_EVENTS},"{output.GEN_FILE}", "tau-", {params.th_min}, {params.th_max}, 0., 360., {params.P})'
0021 """
0022
0023 rule insert_tau_simulate:
0024 input:
0025 GEN_FILE="sim_output/insert_tau/tau-_{P}GeV.hepmc",
0026 warmup="warmup.edm4hep.root",
0027 geometry_lib=find_epic_libraries(),
0028 output:
0029 SIM_FILE="sim_output/insert_tau/{DETECTOR_CONFIG}_sim_tau-_{P}GeV_{INDEX}.edm4hep.root",
0030 params:
0031 N_EVENTS=get_n_events,
0032 INDEX=lambda wildcards: wildcards.INDEX,
0033 SEED=lambda wildcards: "1" + wildcards.INDEX,
0034 PHYSICS_LIST="FTFP_BERT",
0035 DETECTOR_PATH=os.environ["DETECTOR_PATH"],
0036 DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG,
0037 DD4HEP_HASH=get_spack_package_hash("dd4hep"),
0038 NPSIM_HASH=get_spack_package_hash("npsim"),
0039 cache: True
0040 singularity: EIC_SINGULARITY_CONTAINER,
0041 shell:
0042 """
0043 exec npsim \
0044 --compactFile {params.DETECTOR_PATH}/{params.DETECTOR_CONFIG}.xml \
0045 --random.seed {params.SEED} \
0046 --numberOfEvents {params.N_EVENTS} \
0047 --skipNEvents $(( {params.N_EVENTS} * {params.INDEX} )) \
0048 --physicsList {params.PHYSICS_LIST} \
0049 --inputFiles {input.GEN_FILE} \
0050 --outputFile {output.SIM_FILE}
0051 """
0052
0053 rule insert_tau_recon:
0054 input:
0055 SIM_FILE="sim_output/insert_tau/{DETECTOR_CONFIG}_sim_tau-_{P}GeV_{INDEX}.edm4hep.root",
0056 warmup="warmup.edm4hep.root",
0057 output:
0058 REC_FILE="sim_output/insert_tau/{DETECTOR_CONFIG}_rec_tau-_{P}GeV_{INDEX}.edm4eic.root",
0059 params:
0060 N_EVENTS=get_n_events,
0061 DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG,
0062 EICRECON_HASH=get_spack_package_hash("eicrecon"),
0063 cache: True
0064 singularity: EIC_SINGULARITY_CONTAINER,
0065 shell:
0066 """
0067 env DETECTOR_CONFIG={params.DETECTOR_CONFIG} \
0068 eicrecon {input.SIM_FILE} -Ppodio:output_file={output.REC_FILE} -Ppodio:output_collections=MCParticles,HcalEndcapPInsertRecHits,HcalEndcapPInsertClusters,HcalEndcapPInsertSubcellHits,EcalEndcapPClusters,LFHCALClusters -Pjana:nevents={params.N_EVENTS}
0069 """
0070
0071 rule insert_tau_analysis:
0072 input:
0073 expand("sim_output/insert_tau/{DETECTOR_CONFIG}_rec_tau-_{P}GeV_{INDEX}.edm4eic.root",
0074 P=[20, 30, 40, 50, 60, 80, 100],
0075 DETECTOR_CONFIG=["{DETECTOR_CONFIG}"],
0076 INDEX=range(5),
0077 ),
0078 script=workflow.source_path("analysis/tau_plots.py"),
0079 output:
0080 results_dir=directory("results/{DETECTOR_CONFIG}/insert_tau"),
0081 singularity: EIC_SINGULARITY_CONTAINER,
0082 shell:
0083 """
0084 mkdir -p {output.results_dir}
0085 python {input.script} {output.results_dir}
0086 """