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 SEED=lambda wildcards: stable_seed("insert_muon", wildcards.P),
0012 singularity: EIC_SINGULARITY_CONTAINER,
0013 shell:
0014 """
0015 root -l -b -q '{input.script}({params.NEVENTS_GEN},"{output.GEN_FILE}", "mu-", {params.th_min}, {params.th_max}, 0., 360., {params.P}, 0, 1, {params.SEED})'
0016 """
0017
0018 rule insert_muon_simulate:
0019 input:
0020 GEN_FILE="sim_output/insert_muon/mu-_{P}GeV.hepmc",
0021 warmup="warmup.edm4hep.root",
0022 geometry_lib=find_epic_libraries(),
0023 output:
0024 SIM_FILE="sim_output/insert_muon/{DETECTOR_CONFIG}_sim_mu-_{P}GeV_{INDEX}.edm4hep.rnt.root",
0025 params:
0026 INDEX=lambda wildcards: wildcards.INDEX,
0027 SEED=lambda wildcards: "1" + wildcards.INDEX,
0028 PHYSICS_LIST="FTFP_BERT",
0029 DETECTOR_PATH=config["DETECTOR_PREFIX"] + "/share/epic",
0030 DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG,
0031 DD4HEP_HASH=get_spack_package_hash("dd4hep"),
0032 NPSIM_HASH=get_spack_package_hash("npsim"),
0033 cache: True
0034 singularity: EIC_SINGULARITY_CONTAINER,
0035 shell:
0036 """
0037 NEVENTS_SIM=1000
0038 exec npsim \
0039 --compactFile {params.DETECTOR_PATH}/{params.DETECTOR_CONFIG}.xml \
0040 --random.seed {params.SEED} \
0041 --skipNEvents $(( $NEVENTS_SIM * {params.INDEX} )) \
0042 --numberOfEvents $NEVENTS_SIM \
0043 --physicsList {params.PHYSICS_LIST} \
0044 --inputFiles {input.GEN_FILE} \
0045 --outputConfig.useRNTuple true \
0046 --outputFile {output.SIM_FILE}
0047 """
0048
0049 rule insert_muon_recon:
0050 input:
0051 SIM_FILE="sim_output/insert_muon/{DETECTOR_CONFIG}_sim_mu-_{P}GeV_{INDEX}.edm4hep.rnt.root",
0052 warmup="warmup.edm4hep.root",
0053 output:
0054 REC_FILE="sim_output/insert_muon/{DETECTOR_CONFIG}_rec_mu-_{P}GeV_{INDEX}.edm4hep.root",
0055 params:
0056 DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG,
0057 EICRECON_HASH=get_spack_package_hash("eicrecon"),
0058 cache: True
0059 singularity: EIC_SINGULARITY_CONTAINER,
0060 shell:
0061 """
0062 NEVENTS_REC=1000
0063 env DETECTOR_CONFIG={params.DETECTOR_CONFIG} \
0064 eicrecon {input.SIM_FILE} -Ppodio:output_file={output.REC_FILE} -Ppodio:output_collections=MCParticles,HcalEndcapPInsertRecHits,HcalEndcapPInsertClusters,HcalEndcapPInsertSubcellHits -Pjana:nevents=$NEVENTS_REC
0065 """
0066
0067 rule insert_muon_analysis:
0068 input:
0069 expand("sim_output/insert_muon/{DETECTOR_CONFIG}_sim_mu-_{P}GeV_{INDEX}.edm4hep.rnt.root",
0070 P=[50],
0071 DETECTOR_CONFIG=["{DETECTOR_CONFIG}"],
0072 INDEX=range(5),
0073 ),
0074 script=workflow.source_path("analysis/muon_plots.py"),
0075 output:
0076 results_dir=directory("results/{DETECTOR_CONFIG}/insert_muon"),
0077 singularity: EIC_SINGULARITY_CONTAINER,
0078 shell:
0079 """
0080 mkdir -p {output.results_dir}
0081 python {input.script} {output.results_dir}
0082 """