diff --git a/benchmarks/zdc_lambda/Snakefile b/benchmarks/zdc_lambda/Snakefile index 08158fb813a4709bfb0e53a1e0027ca3e3a85f6e..d4f89fac1e48ab547a489c62b71bb4cfa37fb51c 100644 --- a/benchmarks/zdc_lambda/Snakefile +++ b/benchmarks/zdc_lambda/Snakefile @@ -1,31 +1,37 @@ rule zdc_lambda_generate: input: script="benchmarks/zdc_lambda/analysis/gen_lambda_decay.cxx", - params: - NEVENTS_GEN=1000, output: - GEN_FILE="sim_output/zdc_lambda/lambda_decay_{P}GeV.hepmc" + GEN_FILE="sim_output/zdc_lambda/lambda_decay_{P}GeV.hepmc", + params: + N_EVENTS=1000, shell: """ -root -l -b -q '{input.script}({params.NEVENTS_GEN},0,"{output.GEN_FILE}",{wildcards.P},{wildcards.P})' +root -l -b -q '{input.script}({params.N_EVENTS},0,"{output.GEN_FILE}",{wildcards.P},{wildcards.P})' """ rule zdc_lambda_simulate: input: GEN_FILE="sim_output/zdc_lambda/lambda_decay_{P}GeV.hepmc", warmup="warmup/{DETECTOR_CONFIG}.edm4hep.root", - params: - PHYSICS_LIST="FTFP_BERT" + geometry_lib=find_epic_libraries(), output: - SIM_FILE="sim_output/zdc_lambda/{DETECTOR_CONFIG}_sim_lambda_dec_{P}GeV_{INDEX}.edm4hep.root" + SIM_FILE="sim_output/zdc_lambda/{DETECTOR_CONFIG}_sim_lambda_dec_{P}GeV_{INDEX}.edm4hep.root", + params: + N_EVENTS=200, + PHYSICS_LIST="FTFP_BERT", + DETECTOR_PATH=os.environ["DETECTOR_PATH"], + DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG, + DD4HEP_HASH=get_spack_package_hash("dd4hep"), + NPSIM_HASH=get_spack_package_hash("npsim"), + cache: True shell: """ -NEVENTS_SIM=200 # Running simulation npsim \ - --compactFile $DETECTOR_PATH/{wildcards.DETECTOR_CONFIG}.xml \ - --skipNEvents $(( $NEVENTS_SIM * {wildcards.INDEX} )) \ - --numberOfEvents $NEVENTS_SIM \ + --compactFile {params.DETECTOR_PATH}/{params.DETECTOR_CONFIG}.xml \ + --skipNEvents $(( {params.N_EVENTS} * {wildcards.INDEX} )) \ + --numberOfEvents {params.N_EVENTS} \ --physicsList {params.PHYSICS_LIST} \ --inputFiles {input.GEN_FILE} \ --outputFile {output.SIM_FILE} @@ -33,13 +39,18 @@ npsim \ rule zdc_lambda_recon: input: - SIM_FILE="sim_output/zdc_lambda/{DETECTOR_CONFIG}_sim_lambda_dec_{P}GeV_{INDEX}.edm4hep.root" + SIM_FILE="sim_output/zdc_lambda/{DETECTOR_CONFIG}_sim_lambda_dec_{P}GeV_{INDEX}.edm4hep.root", output: - REC_FILE="sim_output/zdc_lambda/{DETECTOR_CONFIG}_rec_lambda_dec_{P}GeV_{INDEX}.edm4eic.root" + REC_FILE="sim_output/zdc_lambda/{DETECTOR_CONFIG}_rec_lambda_dec_{P}GeV_{INDEX}.edm4eic.root", + params: + N_EVENTS=200, + DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG, + EICRECON_HASH=get_spack_package_hash("eicrecon"), + cache: True shell: """ -NEVENTS_REC=200 -eicrecon {input.SIM_FILE} -Ppodio:output_file={output.REC_FILE} -Pdd4hep:xml_files=$DETECTOR_PATH/{wildcards.DETECTOR_CONFIG}.xml -Ppodio:output_collections=MCParticles,HcalFarForwardZDCClusters,HcalFarForwardZDCRecHits,HcalFarForwardZDCSubcellHits -Pjana:nevents=$NEVENTS_REC +env DETECTOR_CONFIG={params.DETECTOR_CONFIG} \ + eicrecon {input.SIM_FILE} -Ppodio:output_file={output.REC_FILE} -Ppodio:output_collections=MCParticles,HcalFarForwardZDCClusters,HcalFarForwardZDCRecHits,HcalFarForwardZDCSubcellHits -Pjana:nevents={params.N_EVENTS} """ rule zdc_lambda_analysis: diff --git a/benchmarks/zdc_lyso/Snakefile b/benchmarks/zdc_lyso/Snakefile index 4e79e2279cab5079a3aef17f8c9278291f4297b0..cb77131e338e2635f3454daca3c3da6f3093aa1f 100644 --- a/benchmarks/zdc_lyso/Snakefile +++ b/benchmarks/zdc_lyso/Snakefile @@ -20,18 +20,24 @@ rule zdc_lyso_sim: input: hepmcfile="data/{PARTICLE}_{BEAM_ENERGY}GeV_theta_{THETA_MIN}deg_thru_{THETA_MAX}deg.hepmc", warmup="warmup/{DETECTOR_CONFIG}.edm4hep.root", + geometry_lib=find_epic_libraries(), output: "sim_output/zdc_lyso/{DETECTOR_CONFIG}_{PARTICLE}_{BEAM_ENERGY}GeV_theta_{THETA_MIN}deg_thru_{THETA_MAX}deg.edm4hep.root", log: "sim_output/zdc_lyso/{DETECTOR_CONFIG}_{PARTICLE}_{BEAM_ENERGY}GeV_theta_{THETA_MIN}deg_thru_{THETA_MAX}deg.edm4hep.root.log", params: num_events=1000, + DETECTOR_PATH=os.environ["DETECTOR_PATH"], + DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG, + DD4HEP_HASH=get_spack_package_hash("dd4hep"), + NPSIM_HASH=get_spack_package_hash("npsim"), + cache: True shell: """ npsim \ --runType batch \ -v WARNING \ - --compactFile $DETECTOR_PATH/{wildcards.DETECTOR_CONFIG}.xml \ + --compactFile {params.DETECTOR_PATH}/{params.DETECTOR_CONFIG}.xml \ --numberOfEvents {params.num_events} \ --inputFiles {input.hepmcfile} \ --outputFile {output} @@ -45,10 +51,14 @@ rule zdc_lyso_reco: "sim_output/zdc_lyso/{DETECTOR_CONFIG}_{PARTICLE}_{BEAM_ENERGY}GeV_theta_{THETA_MIN}deg_thru_{THETA_MAX}deg.eicrecon.tree.edm4eic.root", log: "sim_output/zdc_lyso/{DETECTOR_CONFIG}_{PARTICLE}_{BEAM_ENERGY}GeV_theta_{THETA_MIN}deg_thru_{THETA_MAX}deg.eicrecon.tree.edm4eic.root.log", + params: + DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG, + EICRECON_HASH=get_spack_package_hash("eicrecon"), + cache: True shell: """ -eicrecon -Ppodio:output_collections=HcalFarForwardZDCRawHits,HcalFarForwardZDCRecHits,HcalFarForwardZDCClusters,EcalFarForwardZDCRawHits,EcalFarForwardZDCRecHits,EcalFarForwardZDCClusters,MCParticles {input} -mv podio_output.root {output} +env DETECTOR_CONFIG={params.DETECTOR_CONFIG} \ + eicrecon -Ppodio:output_file={output} -Ppodio:output_collections=HcalFarForwardZDCRawHits,HcalFarForwardZDCRecHits,HcalFarForwardZDCClusters,EcalFarForwardZDCRawHits,EcalFarForwardZDCRecHits,EcalFarForwardZDCClusters,MCParticles {input} """ diff --git a/benchmarks/zdc_neutron/config.yml b/benchmarks/zdc_neutron/config.yml index 715a9b2033c286246e7bee4d2fe0426e1a75153a..ca8043044e024a98d178a74ae56ba1bd10dde19b 100644 --- a/benchmarks/zdc_neutron/config.yml +++ b/benchmarks/zdc_neutron/config.yml @@ -2,7 +2,7 @@ sim:zdc_neutron: extends: .det_benchmark stage: simulate script: - - snakemake --cache --cores 1 sim_output/zdc_neutron/epic_craterlake/fwd_neutrons.edm4eic.root + - snakemake $SNAKEMAKE_FLAGS --cores 5 sim_output/zdc_neutron/epic_craterlake/fwd_neutrons.edm4eic.root retry: max: 2 when: @@ -14,7 +14,7 @@ bench:zdc_neutron: needs: - ["sim:zdc_neutron"] script: - - snakemake --cores 1 results/zdc_neutron/epic_craterlake/fwd_neutrons_geant.pdf + - snakemake $SNAKEMAKE_FLAGS --cores 1 results/zdc_neutron/epic_craterlake/fwd_neutrons_geant.pdf collect_results:zdc_neutron: extends: .det_benchmark @@ -24,7 +24,7 @@ collect_results:zdc_neutron: script: - ls -lrht - mv results{,_save}/ # move results directory out of the way to preserve it - - snakemake --cores 1 --delete-all-output results/zdc_neutron/epic_craterlake/fwd_neutrons_geant.pdf + - snakemake $SNAKEMAKE_FLAGS --cores 1 --delete-all-output results/zdc_neutron/epic_craterlake/fwd_neutrons_geant.pdf - mv results{_save,}/ # convert to png - | diff --git a/benchmarks/zdc_photon/Snakefile b/benchmarks/zdc_photon/Snakefile index 6963ed7f9ee4daf54f6d5cef97065aaaa1c61a49..3e653a13e84fa80f939adc5f3844be507d45368a 100644 --- a/benchmarks/zdc_photon/Snakefile +++ b/benchmarks/zdc_photon/Snakefile @@ -1,35 +1,41 @@ rule zdc_photon_generate: input: script="benchmarks/zdc_photon/analysis/gen_particles.cxx", + output: + GEN_FILE="sim_output/zdc_photon/zdc_photon_{P}GeV.hepmc", params: th_max=0.23, - th_min=0 - output: - GEN_FILE="sim_output/zdc_photon/zdc_photon_{P}GeV.hepmc" + th_min=0, + N_EVENTS=1000, shell: """ -NEVENTS_GEN=200 mkdir -p sim_output/zdc_photon -root -l -b -q '{input.script}('$NEVENTS_GEN',"{output.GEN_FILE}", "gamma", {params.th_min}, {params.th_max}, 0., 360., {wildcards.P})' +root -l -b -q '{input.script}('{params.N_EVENTS}',"{output.GEN_FILE}", "gamma", {params.th_min}, {params.th_max}, 0., 360., {wildcards.P})' """ rule zdc_photon_simulate: input: GEN_FILE="sim_output/zdc_photon/zdc_photon_{P}GeV.hepmc", warmup="warmup/{DETECTOR_CONFIG}.edm4hep.root", - params: - PHYSICS_LIST="FTFP_BERT" + geometry_lib=find_epic_libraries(), output: - SIM_FILE="sim_output/zdc_photon/{DETECTOR_CONFIG}_sim_zdc_photon_{P}GeV_{INDEX}.edm4hep.root" + SIM_FILE="sim_output/zdc_photon/{DETECTOR_CONFIG}_sim_zdc_photon_{P}GeV_{INDEX}.edm4hep.root", + params: + N_EVENTS=200, + PHYSICS_LIST="FTFP_BERT", + DETECTOR_PATH=os.environ["DETECTOR_PATH"], + DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG, + DD4HEP_HASH=get_spack_package_hash("dd4hep"), + NPSIM_HASH=get_spack_package_hash("npsim"), + cache: True shell: """ # Running simulation -NEVENTS_SIM=200 npsim \ - --compactFile $DETECTOR_PATH/{wildcards.DETECTOR_CONFIG}.xml \ + --compactFile {params.DETECTOR_PATH}/{params.DETECTOR_CONFIG}.xml \ --physicsList {params.PHYSICS_LIST} \ - --skipNEvents $(( $NEVENTS_SIM * {wildcards.INDEX} )) \ - --numberOfEvents $NEVENTS_SIM \ + --skipNEvents $(( {params.N_EVENTS} * {wildcards.INDEX} )) \ + --numberOfEvents {params.N_EVENTS} \ --inputFiles {input.GEN_FILE} \ --outputFile {output.SIM_FILE} """ @@ -39,10 +45,15 @@ rule zdc_photon_recon: SIM_FILE="sim_output/zdc_photon/{DETECTOR_CONFIG}_sim_zdc_photon_{P}GeV_{INDEX}.edm4hep.root" output: REC_FILE="sim_output/zdc_photon/{DETECTOR_CONFIG}_rec_zdc_photon_{P}GeV_{INDEX}.edm4eic.root" + params: + N_EVENTS=200, + DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG, + EICRECON_HASH=get_spack_package_hash("eicrecon"), + cache: True shell: """ -NEVENTS_REC=200 -eicrecon {input.SIM_FILE} -Ppodio:output_file={output.REC_FILE} -Pdd4hep:xml_files=$DETECTOR_PATH/{wildcards.DETECTOR_CONFIG}.xml -Ppodio:output_collections=MCParticles,HcalFarForwardZDCRecHits,HcalFarForwardZDCClusters,HcalFarForwardZDCSubcellHits -Pjana:nevents=$NEVENTS_REC +env DETECTOR_CONFIG={params.DETECTOR_CONFIG} \ + eicrecon {input.SIM_FILE} -Ppodio:output_file={output.REC_FILE} -Ppodio:output_collections=MCParticles,HcalFarForwardZDCRecHits,HcalFarForwardZDCClusters,HcalFarForwardZDCSubcellHits -Pjana:nevents={params.N_EVENTS} """ rule zdc_photon_analysis: diff --git a/benchmarks/zdc_pi0/Snakefile b/benchmarks/zdc_pi0/Snakefile index 7c82f743cb2506e15fbb48a359511c184824a08f..320a20f31c6ea99992a8936bca6f79083789afc8 100644 --- a/benchmarks/zdc_pi0/Snakefile +++ b/benchmarks/zdc_pi0/Snakefile @@ -1,32 +1,38 @@ rule zdc_pi0_generate: input: script="benchmarks/zdc_pi0/analysis/gen_pi0_decay.cxx", - params: - NEVENTS_GEN=1000, output: - GEN_FILE="sim_output/zdc_pi0/zdc_pi0_{P}GeV.hepmc" + GEN_FILE="sim_output/zdc_pi0/zdc_pi0_{P}GeV.hepmc", + params: + N_EVENTS=1000, shell: """ mkdir -p sim_output/zdc_pi0 -root -l -b -q '{input.script}({params.NEVENTS_GEN},0,"{output.GEN_FILE}",{wildcards.P},{wildcards.P})' +root -l -b -q '{input.script}({params.N_EVENTS},0,"{output.GEN_FILE}",{wildcards.P},{wildcards.P})' """ rule zdc_pi0_simulate: input: GEN_FILE="sim_output/zdc_pi0/zdc_pi0_{P}GeV.hepmc", warmup="warmup/{DETECTOR_CONFIG}.edm4hep.root", - params: - PHYSICS_LIST="FTFP_BERT" + geometry_lib=find_epic_libraries(), output: - SIM_FILE="sim_output/zdc_pi0/{DETECTOR_CONFIG}_sim_zdc_pi0_{P}GeV_{INDEX}.edm4hep.root" + SIM_FILE="sim_output/zdc_pi0/{DETECTOR_CONFIG}_sim_zdc_pi0_{P}GeV_{INDEX}.edm4hep.root", + params: + N_EVENTS=200, + PHYSICS_LIST="FTFP_BERT", + DETECTOR_PATH=os.environ["DETECTOR_PATH"], + DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG, + DD4HEP_HASH=get_spack_package_hash("dd4hep"), + NPSIM_HASH=get_spack_package_hash("npsim"), + cache: True shell: """ -NEVENTS_SIM=200 # Running simulation npsim \ - --compactFile $DETECTOR_PATH/{wildcards.DETECTOR_CONFIG}.xml \ - --skipNEvents $(( $NEVENTS_SIM * {wildcards.INDEX} )) \ - --numberOfEvents $NEVENTS_SIM \ + --compactFile {params.DETECTOR_PATH}/{params.DETECTOR_CONFIG}.xml \ + --skipNEvents $(( {params.N_EVENTS} * {wildcards.INDEX} )) \ + --numberOfEvents {params.N_EVENTS} \ --physicsList {params.PHYSICS_LIST} \ --inputFiles {input.GEN_FILE} \ --outputFile {output.SIM_FILE} @@ -34,13 +40,18 @@ npsim \ rule zdc_pi0_recon: input: - SIM_FILE="sim_output/zdc_pi0/{DETECTOR_CONFIG}_sim_zdc_pi0_{P}GeV_{INDEX}.edm4hep.root" + SIM_FILE="sim_output/zdc_pi0/{DETECTOR_CONFIG}_sim_zdc_pi0_{P}GeV_{INDEX}.edm4hep.root", output: - REC_FILE="sim_output/zdc_pi0/{DETECTOR_CONFIG}_rec_zdc_pi0_{P}GeV_{INDEX}.edm4eic.root" + REC_FILE="sim_output/zdc_pi0/{DETECTOR_CONFIG}_rec_zdc_pi0_{P}GeV_{INDEX}.edm4eic.root", + params: + N_EVENTS=200, + DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG, + EICRECON_HASH=get_spack_package_hash("eicrecon"), + cache: True shell: """ -NEVENTS_REC=200 -eicrecon {input.SIM_FILE} -Ppodio:output_file={output.REC_FILE} -Pdd4hep:xml_files=$DETECTOR_PATH/{wildcards.DETECTOR_CONFIG}.xml -Ppodio:output_collections=MCParticles,HcalFarForwardZDCRecHits,HcalFarForwardZDCClusters,HcalFarForwardZDCSubcellHits -Pjana:nevents=$NEVENTS_REC +env DETECTOR_CONFIG={params.DETECTOR_CONFIG} \ + eicrecon {input.SIM_FILE} -Ppodio:output_file={output.REC_FILE} -Ppodio:output_collections=MCParticles,HcalFarForwardZDCRecHits,HcalFarForwardZDCClusters,HcalFarForwardZDCSubcellHits -Pjana:nevents={params.N_EVENTS} """ rule zdc_pi0_analysis: diff --git a/benchmarks/zdc_sigma/Snakefile b/benchmarks/zdc_sigma/Snakefile index 1f93e2754ba1e8d279b8bec2cbd236d3e0b18301..b7836e82ca1bf944566e099e6720a5a2b444e9ec 100644 --- a/benchmarks/zdc_sigma/Snakefile +++ b/benchmarks/zdc_sigma/Snakefile @@ -1,31 +1,37 @@ rule zdc_sigma_generate: input: script="benchmarks/zdc_sigma/analysis/gen_sigma_decay.cxx", - params: - NEVENTS_GEN=100000, output: - GEN_FILE="sim_output/zdc_sigma/sigma_decay_{P}GeV.hepmc" + GEN_FILE="sim_output/zdc_sigma/sigma_decay_{P}GeV.hepmc", + params: + N_EVENTS=100000, shell: """ -root -l -b -q '{input.script}({params.NEVENTS_GEN},0,"{output.GEN_FILE}",{wildcards.P},{wildcards.P})' +root -l -b -q '{input.script}({params.N_EVENTS},0,"{output.GEN_FILE}",{wildcards.P},{wildcards.P})' """ rule zdc_sigma_simulate: input: GEN_FILE="sim_output/zdc_sigma/sigma_decay_{P}GeV.hepmc", warmup="warmup/{DETECTOR_CONFIG}.edm4hep.root", - params: - PHYSICS_LIST="FTFP_BERT" + geometry_lib=find_epic_libraries(), output: - SIM_FILE="sim_output/zdc_sigma/{DETECTOR_CONFIG}_sim_sigma_dec_{P}GeV_{INDEX}.edm4hep.root" + SIM_FILE="sim_output/zdc_sigma/{DETECTOR_CONFIG}_sim_sigma_dec_{P}GeV_{INDEX}.edm4hep.root", + params: + N_EVENTS=200, + PHYSICS_LIST="FTFP_BERT", + DETECTOR_PATH=os.environ["DETECTOR_PATH"], + DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG, + DD4HEP_HASH=get_spack_package_hash("dd4hep"), + NPSIM_HASH=get_spack_package_hash("npsim"), + cache: True shell: """ -NEVENTS_SIM=200 # Running simulation npsim \ - --compactFile $DETECTOR_PATH/{wildcards.DETECTOR_CONFIG}.xml \ - --skipNEvents $(( $NEVENTS_SIM * {wildcards.INDEX} )) \ - --numberOfEvents $NEVENTS_SIM \ + --compactFile {params.DETECTOR_PATH}/{params.DETECTOR_CONFIG}.xml \ + --skipNEvents $(( {params.N_EVENTS} * {wildcards.INDEX} )) \ + --numberOfEvents {params.N_EVENTS} \ --physicsList {params.PHYSICS_LIST} \ --inputFiles {input.GEN_FILE} \ --outputFile {output.SIM_FILE} @@ -33,13 +39,18 @@ npsim \ rule zdc_sigma_recon: input: - SIM_FILE="sim_output/zdc_sigma/{DETECTOR_CONFIG}_sim_sigma_dec_{P}GeV_{INDEX}.edm4hep.root" + SIM_FILE="sim_output/zdc_sigma/{DETECTOR_CONFIG}_sim_sigma_dec_{P}GeV_{INDEX}.edm4hep.root", output: - REC_FILE="sim_output/zdc_sigma/{DETECTOR_CONFIG}_rec_sigma_dec_{P}GeV_{INDEX}.edm4eic.root" + REC_FILE="sim_output/zdc_sigma/{DETECTOR_CONFIG}_rec_sigma_dec_{P}GeV_{INDEX}.edm4eic.root", + params: + N_EVENTS=200, + DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG, + EICRECON_HASH=get_spack_package_hash("eicrecon"), + cache: True shell: """ -NEVENTS_REC=200 -eicrecon {input.SIM_FILE} -Ppodio:output_file={output.REC_FILE} -Pdd4hep:xml_files=$DETECTOR_PATH/{wildcards.DETECTOR_CONFIG}.xml -Ppodio:output_collections=MCParticles,HcalFarForwardZDCClusters,HcalFarForwardZDCRecHits,HcalFarForwardZDCSubcellHits -Pjana:nevents=$NEVENTS_REC +env DETECTOR_CONFIG={params.DETECTOR_CONFIG} \ + eicrecon {input.SIM_FILE} -Ppodio:output_file={output.REC_FILE} -Ppodio:output_collections=MCParticles,HcalFarForwardZDCClusters,HcalFarForwardZDCRecHits,HcalFarForwardZDCSubcellHits -Pjana:nevents={params.N_EVENTS} """ rule zdc_sigma_analysis: