Back to home page

EIC code displayed by LXR

 
 

    


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