Warning, /detector_benchmarks/benchmarks/insert_muon/Snakefile is written in an unsupported language. File is not indexed.
0001 rule insert_muon_generate:
0002 input:
0003 script=workflow.source_path("analysis/gen_particles.cxx"),
0004 output:
0005 GEN_FILE="sim_output/insert_muon/mu-_{P}GeV.hepmc",
0006 params:
0007 NEVENTS_GEN=5000,
0008 th_max=7.0,
0009 th_min=1.7,
0010 P=lambda wildcards: wildcards.P,
0011 singularity: EIC_SINGULARITY_CONTAINER,
0012 shell:
0013 """
0014 root -l -b -q '{input.script}({params.NEVENTS_GEN},"{output.GEN_FILE}", "mu-", {params.th_min}, {params.th_max}, 0., 360., {params.P})'
0015 """
0016
0017 rule insert_muon_simulate:
0018 input:
0019 GEN_FILE="sim_output/insert_muon/mu-_{P}GeV.hepmc",
0020 warmup="warmup.edm4hep.root",
0021 geometry_lib=find_epic_libraries(),
0022 output:
0023 SIM_FILE="sim_output/insert_muon/{DETECTOR_CONFIG}_sim_mu-_{P}GeV_{INDEX}.edm4hep.root",
0024 params:
0025 INDEX=lambda wildcards: wildcards.INDEX,
0026 SEED=lambda wildcards: "1" + wildcards.INDEX,
0027 PHYSICS_LIST="FTFP_BERT",
0028 DETECTOR_PATH=os.environ["DETECTOR_PATH"],
0029 DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG,
0030 DD4HEP_HASH=get_spack_package_hash("dd4hep"),
0031 NPSIM_HASH=get_spack_package_hash("npsim"),
0032 cache: True
0033 singularity: EIC_SINGULARITY_CONTAINER,
0034 shell:
0035 """
0036 NEVENTS_SIM=1000
0037 exec npsim \
0038 --compactFile {params.DETECTOR_PATH}/{params.DETECTOR_CONFIG}.xml \
0039 --random.seed {params.SEED} \
0040 --skipNEvents $(( $NEVENTS_SIM * {params.INDEX} )) \
0041 --numberOfEvents $NEVENTS_SIM \
0042 --physicsList {params.PHYSICS_LIST} \
0043 --inputFiles {input.GEN_FILE} \
0044 --outputFile {output.SIM_FILE}
0045 """
0046
0047 rule insert_muon_recon:
0048 input:
0049 SIM_FILE="sim_output/insert_muon/{DETECTOR_CONFIG}_sim_mu-_{P}GeV_{INDEX}.edm4hep.root",
0050 warmup="warmup.edm4hep.root",
0051 output:
0052 REC_FILE="sim_output/insert_muon/{DETECTOR_CONFIG}_rec_mu-_{P}GeV_{INDEX}.edm4hep.root",
0053 params:
0054 DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG,
0055 EICRECON_HASH=get_spack_package_hash("eicrecon"),
0056 cache: True
0057 singularity: EIC_SINGULARITY_CONTAINER,
0058 shell:
0059 """
0060 NEVENTS_REC=1000
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 -Pjana:nevents=$NEVENTS_REC
0063 """
0064
0065 rule insert_muon_analysis:
0066 input:
0067 expand("sim_output/insert_muon/{DETECTOR_CONFIG}_sim_mu-_{P}GeV_{INDEX}.edm4hep.root",
0068 P=[50],
0069 DETECTOR_CONFIG=["{DETECTOR_CONFIG}"],
0070 INDEX=range(5),
0071 ),
0072 script=workflow.source_path("analysis/muon_plots.py"),
0073 output:
0074 results_dir=directory("results/{DETECTOR_CONFIG}/insert_muon"),
0075 singularity: EIC_SINGULARITY_CONTAINER,
0076 shell:
0077 """
0078 mkdir -p {output.results_dir}
0079 python {input.script} {output.results_dir}
0080 """