diff --git a/benchmarks/lfhcal/Snakefile b/benchmarks/lfhcal/Snakefile index cef068e5087ede6def76573a26a172c30a3733b4..8f4bd6851bb3816aa6b123df61d60133f39a08dc 100644 --- a/benchmarks/lfhcal/Snakefile +++ b/benchmarks/lfhcal/Snakefile @@ -15,7 +15,7 @@ rule lfhcal_sim: "sim_output/lfhcal/{DETECTOR_CONFIG}/{PARTICLE}/{ENERGY}/{PHASE_SPACE}/{PARTICLE}_{ENERGY}_{PHASE_SPACE}.{INDEX}.edm4hep.root.log", wildcard_constraints: ENERGY="[0-9]+[kMG]eV", - PARTICLE="(neutron|pi-|gamma)", + PARTICLE="(neutron|pi-|gamma)", PHASE_SPACE="3to50deg", INDEX="\d{4}", params: @@ -95,18 +95,18 @@ rule lfhcal_summary_at_eta: shell: """ if [[ "{wildcards.CAMPAIGN}" == "local" ]]; then - set +e - EPIC_VERSION="${{DETECTOR_VERSION:-}}" - EICRECON_VERSION="$(eicrecon -v | sed -n -e 's/.*\(v[0-9\.]\+\).*/\\1/p')" - # Legacy detection - : ${{EPIC_VERSION:="$(echo $DETECTOR_PATH | sed -n -e 's/.*epic-\([^-/]\+\).*/\\1/p')"}} - set -e + set +e + EPIC_VERSION="${{DETECTOR_VERSION:-}}" + EICRECON_VERSION="$(eicrecon -v | sed -n -e 's/.*\(v[0-9\.]\+\).*/\\1/p')" + # Legacy detection + : ${{EPIC_VERSION:="$(echo $DETECTOR_PATH | sed -n -e 's/.*epic-\([^-/]\+\).*/\\1/p')"}} + set -e - echo "ePIC version: $EPIC_VERSION" - echo "EICrecon version: $EICRECON_VERSION" - EXTRA_LEGEND="ePIC $EPIC_VERSION / EICrecon $EICRECON_VERSION" + echo "ePIC version: $EPIC_VERSION" + echo "EICrecon version: $EICRECON_VERSION" + EXTRA_LEGEND="ePIC $EPIC_VERSION / EICrecon $EICRECON_VERSION" else - EXTRA_LEGEND="ePIC Simulation {wildcards.CAMPAIGN}" + EXTRA_LEGEND="ePIC Simulation {wildcards.CAMPAIGN}" fi cd {wildcards.CAMPAIGN} root -l -b -q ../{input.script}'("{wildcards.PARTICLE}", {wildcards.ETA_MIN}, {wildcards.ETA_MAX}, 1., true, "'"$EXTRA_LEGEND"'")' @@ -118,11 +118,11 @@ rule lfhcal: input: lambda wildcards: expand( [ - "{{CAMPAIGN}}/Final_Results/{PARTICLE}/mom/lfhcal_mom_resol_{PARTICLE}_{ETA_BIN}.png", - "{{CAMPAIGN}}/Final_Results/{PARTICLE}/mom/lfhcal_mom_resol_{PARTICLE}_{ETA_BIN}.root", + "{{CAMPAIGN}}/Final_Results/{PARTICLE}/mom/lfhcal_mom_resol_{PARTICLE}_{ETA_BIN}.png", + "{{CAMPAIGN}}/Final_Results/{PARTICLE}/mom/lfhcal_mom_resol_{PARTICLE}_{ETA_BIN}.root", ], - ETA_BIN=[f"{eta_min:.1f}_eta_{eta_max:.1f}" for eta_min, eta_max in zip(LFHCAL_ETA_BINS[:-1], LFHCAL_ETA_BINS[1:])], - PARTICLE=["neutron", "pi-", "gamma"] if wildcards.CAMPAIGN == "local" else ["pi-"], + ETA_BIN=[f"{eta_min:.1f}_eta_{eta_max:.1f}" for eta_min, eta_max in zip(LFHCAL_ETA_BINS[:-1], LFHCAL_ETA_BINS[1:])], + PARTICLE=["neutron", "pi-", "gamma"] if wildcards.CAMPAIGN == "local" else ["pi-"], ) output: directory("results/lfhcal/{CAMPAIGN}/") diff --git a/benchmarks/tracking_performances/Snakefile b/benchmarks/tracking_performances/Snakefile index 15e7ba5afdc8b6dd49108a868fee09fc1fa618fa..454abb33d52715f6f9deff23fc379631f98ab52c 100644 --- a/benchmarks/tracking_performances/Snakefile +++ b/benchmarks/tracking_performances/Snakefile @@ -141,18 +141,18 @@ rule tracking_performance_summary_at_eta: shell: """ if [[ "{wildcards.CAMPAIGN}" == "local" ]]; then - set +e - EPIC_VERSION="${{DETECTOR_VERSION:-}}" - EICRECON_VERSION="$(eicrecon -v | sed -n -e 's/.*\(v[0-9\.]\+\).*/\\1/p')" - # Legacy detection - : ${{EPIC_VERSION:="$(echo $DETECTOR_PATH | sed -n -e 's/.*epic-\([^-/]\+\).*/\\1/p')"}} - set -e - - echo "ePIC version: $EPIC_VERSION" - echo "EICrecon version: $EICRECON_VERSION" - EXTRA_LEGEND="ePIC $EPIC_VERSION / EICrecon $EICRECON_VERSION" + set +e + EPIC_VERSION="${{DETECTOR_VERSION:-}}" + EICRECON_VERSION="$(eicrecon -v | sed -n -e 's/.*\(v[0-9\.]\+\).*/\\1/p')" + # Legacy detection + : ${{EPIC_VERSION:="$(echo $DETECTOR_PATH | sed -n -e 's/.*epic-\([^-/]\+\).*/\\1/p')"}} + set -e + + echo "ePIC version: $EPIC_VERSION" + echo "EICrecon version: $EICRECON_VERSION" + EXTRA_LEGEND="ePIC $EPIC_VERSION / EICrecon $EICRECON_VERSION" else - EXTRA_LEGEND="ePIC Simulation {wildcards.CAMPAIGN}" + EXTRA_LEGEND="ePIC Simulation {wildcards.CAMPAIGN}" fi cd {wildcards.CAMPAIGN} root -l -b -q ../{input.script_mom}'("pi-", {wildcards.ETA_MIN}, {wildcards.ETA_MAX}, 1., true, "'"$EXTRA_LEGEND"'")' diff --git a/benchmarks/zdc_lambda/Snakefile b/benchmarks/zdc_lambda/Snakefile index 9ffd1701a3e7d315e077e1160348046b78ee9b9f..08158fb813a4709bfb0e53a1e0027ca3e3a85f6e 100644 --- a/benchmarks/zdc_lambda/Snakefile +++ b/benchmarks/zdc_lambda/Snakefile @@ -1,25 +1,25 @@ rule zdc_lambda_generate: - input: + 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" - shell: - """ + params: + NEVENTS_GEN=1000, + output: + GEN_FILE="sim_output/zdc_lambda/lambda_decay_{P}GeV.hepmc" + shell: + """ root -l -b -q '{input.script}({params.NEVENTS_GEN},0,"{output.GEN_FILE}",{wildcards.P},{wildcards.P})' """ rule zdc_lambda_simulate: - input: + input: GEN_FILE="sim_output/zdc_lambda/lambda_decay_{P}GeV.hepmc", warmup="warmup/{DETECTOR_CONFIG}.edm4hep.root", - params: - PHYSICS_LIST="FTFP_BERT" - output: - SIM_FILE="sim_output/zdc_lambda/{DETECTOR_CONFIG}_sim_lambda_dec_{P}GeV_{INDEX}.edm4hep.root" - shell: - """ + params: + PHYSICS_LIST="FTFP_BERT" + output: + SIM_FILE="sim_output/zdc_lambda/{DETECTOR_CONFIG}_sim_lambda_dec_{P}GeV_{INDEX}.edm4hep.root" + shell: + """ NEVENTS_SIM=200 # Running simulation npsim \ @@ -43,17 +43,17 @@ eicrecon {input.SIM_FILE} -Ppodio:output_file={output.REC_FILE} -Pdd4hep:xml_fil """ rule zdc_lambda_analysis: - input: + input: expand("sim_output/zdc_lambda/{DETECTOR_CONFIG}_rec_lambda_dec_{P}GeV_{INDEX}.edm4eic.root", - P=[100, 125, 150,175, 200, 225, 250, 275], + P=[100, 125, 150,175, 200, 225, 250, 275], DETECTOR_CONFIG=["{DETECTOR_CONFIG}"], INDEX=range(5), ), script="benchmarks/zdc_lambda/analysis/lambda_plots.py", - output: - results_dir=directory("results/{DETECTOR_CONFIG}/zdc_lambda"), - shell: - """ + output: + results_dir=directory("results/{DETECTOR_CONFIG}/zdc_lambda"), + shell: + """ mkdir -p {output.results_dir} python {input.script} {output.results_dir} """ diff --git a/benchmarks/zdc_lyso/Snakefile b/benchmarks/zdc_lyso/Snakefile index a0b6cbfcc7d656be8b7781b4c2739f4719bd9cc1..71d3fe0e381b115e938ff98f0409245a7301464a 100644 --- a/benchmarks/zdc_lyso/Snakefile +++ b/benchmarks/zdc_lyso/Snakefile @@ -58,8 +58,8 @@ rule zdc_lyso_analysis: PARTICLE=["gamma"], BEAM_ENERGY=["0.005", "0.01", "0.05", "0.1", "0.5", "1.0"], THETA_MIN=["0"], - THETA_MAX=["0.3"]), - script="benchmarks/zdc_lyso/analysis/analysis.py", + THETA_MAX=["0.3"]), + script="benchmarks/zdc_lyso/analysis/analysis.py", output: "results/{DETECTOR_CONFIG}/zdc_lyso/plots.pdf", shell: diff --git a/benchmarks/zdc_photon/Snakefile b/benchmarks/zdc_photon/Snakefile index 2ca2ad3d10de372f6f368861bc40f6baadec3229..6963ed7f9ee4daf54f6d5cef97065aaaa1c61a49 100644 --- a/benchmarks/zdc_photon/Snakefile +++ b/benchmarks/zdc_photon/Snakefile @@ -1,28 +1,28 @@ rule zdc_photon_generate: - input: + input: script="benchmarks/zdc_photon/analysis/gen_particles.cxx", - params: - th_max=0.23, - th_min=0 - output: - GEN_FILE="sim_output/zdc_photon/zdc_photon_{P}GeV.hepmc" - shell: - """ + params: + th_max=0.23, + th_min=0 + output: + GEN_FILE="sim_output/zdc_photon/zdc_photon_{P}GeV.hepmc" + 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})' """ rule zdc_photon_simulate: - input: + input: GEN_FILE="sim_output/zdc_photon/zdc_photon_{P}GeV.hepmc", warmup="warmup/{DETECTOR_CONFIG}.edm4hep.root", - params: - PHYSICS_LIST="FTFP_BERT" - output: - SIM_FILE="sim_output/zdc_photon/{DETECTOR_CONFIG}_sim_zdc_photon_{P}GeV_{INDEX}.edm4hep.root" - shell: - """ + params: + PHYSICS_LIST="FTFP_BERT" + output: + SIM_FILE="sim_output/zdc_photon/{DETECTOR_CONFIG}_sim_zdc_photon_{P}GeV_{INDEX}.edm4hep.root" + shell: + """ # Running simulation NEVENTS_SIM=200 npsim \ @@ -46,17 +46,17 @@ eicrecon {input.SIM_FILE} -Ppodio:output_file={output.REC_FILE} -Pdd4hep:xml_fil """ rule zdc_photon_analysis: - input: + input: expand("sim_output/zdc_photon/{DETECTOR_CONFIG}_rec_zdc_photon_{P}GeV_{INDEX}.edm4eic.root", - P=[20, 30, 50, 70, 100, 150, 200, 275], + P=[20, 30, 50, 70, 100, 150, 200, 275], DETECTOR_CONFIG=["{DETECTOR_CONFIG}"], INDEX=range(5), ), script="benchmarks/zdc_photon/analysis/zdc_photon_plots.py", - output: - results_dir=directory("results/{DETECTOR_CONFIG}/zdc_photon"), - shell: - """ + output: + results_dir=directory("results/{DETECTOR_CONFIG}/zdc_photon"), + shell: + """ mkdir -p {output.results_dir} python {input.script} {output.results_dir} """ diff --git a/benchmarks/zdc_pi0/Snakefile b/benchmarks/zdc_pi0/Snakefile index c2a67993dbc33e32264faf6a96f055f0a373a413..7c82f743cb2506e15fbb48a359511c184824a08f 100644 --- a/benchmarks/zdc_pi0/Snakefile +++ b/benchmarks/zdc_pi0/Snakefile @@ -1,26 +1,26 @@ rule zdc_pi0_generate: - input: + 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" - shell: - """ + params: + NEVENTS_GEN=1000, + output: + GEN_FILE="sim_output/zdc_pi0/zdc_pi0_{P}GeV.hepmc" + shell: + """ mkdir -p sim_output/zdc_pi0 root -l -b -q '{input.script}({params.NEVENTS_GEN},0,"{output.GEN_FILE}",{wildcards.P},{wildcards.P})' """ rule zdc_pi0_simulate: - input: + input: GEN_FILE="sim_output/zdc_pi0/zdc_pi0_{P}GeV.hepmc", warmup="warmup/{DETECTOR_CONFIG}.edm4hep.root", - params: - PHYSICS_LIST="FTFP_BERT" - output: - SIM_FILE="sim_output/zdc_pi0/{DETECTOR_CONFIG}_sim_zdc_pi0_{P}GeV_{INDEX}.edm4hep.root" - shell: - """ + params: + PHYSICS_LIST="FTFP_BERT" + output: + SIM_FILE="sim_output/zdc_pi0/{DETECTOR_CONFIG}_sim_zdc_pi0_{P}GeV_{INDEX}.edm4hep.root" + shell: + """ NEVENTS_SIM=200 # Running simulation npsim \ @@ -44,17 +44,17 @@ eicrecon {input.SIM_FILE} -Ppodio:output_file={output.REC_FILE} -Pdd4hep:xml_fil """ rule zdc_pi0_analysis: - input: + input: expand("sim_output/zdc_pi0/{DETECTOR_CONFIG}_rec_zdc_pi0_{P}GeV_{INDEX}.edm4eic.root", - P=[60, 80, 100, 130, 160], - DETECTOR_CONFIG=["{DETECTOR_CONFIG}"], + P=[60, 80, 100, 130, 160], + DETECTOR_CONFIG=["{DETECTOR_CONFIG}"], INDEX=range(5), ), script="benchmarks/zdc_pi0/analysis/zdc_pi0_plots.py", - output: - results_dir=directory("results/{DETECTOR_CONFIG}/zdc_pi0"), - shell: - """ + output: + results_dir=directory("results/{DETECTOR_CONFIG}/zdc_pi0"), + shell: + """ mkdir -p {output.results_dir} python {input.script} {output.results_dir} """ diff --git a/benchmarks/zdc_sigma/Snakefile b/benchmarks/zdc_sigma/Snakefile index 80e8b25d3721f6f8f38d35748834fc9c00b822c2..1f93e2754ba1e8d279b8bec2cbd236d3e0b18301 100644 --- a/benchmarks/zdc_sigma/Snakefile +++ b/benchmarks/zdc_sigma/Snakefile @@ -1,25 +1,25 @@ rule zdc_sigma_generate: - input: + 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" - shell: - """ + params: + NEVENTS_GEN=100000, + output: + GEN_FILE="sim_output/zdc_sigma/sigma_decay_{P}GeV.hepmc" + shell: + """ root -l -b -q '{input.script}({params.NEVENTS_GEN},0,"{output.GEN_FILE}",{wildcards.P},{wildcards.P})' """ rule zdc_sigma_simulate: - input: + input: GEN_FILE="sim_output/zdc_sigma/sigma_decay_{P}GeV.hepmc", warmup="warmup/{DETECTOR_CONFIG}.edm4hep.root", - params: - PHYSICS_LIST="FTFP_BERT" - output: - SIM_FILE="sim_output/zdc_sigma/{DETECTOR_CONFIG}_sim_sigma_dec_{P}GeV_{INDEX}.edm4hep.root" - shell: - """ + params: + PHYSICS_LIST="FTFP_BERT" + output: + SIM_FILE="sim_output/zdc_sigma/{DETECTOR_CONFIG}_sim_sigma_dec_{P}GeV_{INDEX}.edm4hep.root" + shell: + """ NEVENTS_SIM=200 # Running simulation npsim \ @@ -43,17 +43,17 @@ eicrecon {input.SIM_FILE} -Ppodio:output_file={output.REC_FILE} -Pdd4hep:xml_fil """ rule zdc_sigma_analysis: - input: + input: expand("sim_output/zdc_sigma/{DETECTOR_CONFIG}_rec_sigma_dec_{P}GeV_{INDEX}.edm4eic.root", - P=[100, 125, 150,175, 200, 225, 250, 275], - DETECTOR_CONFIG=["{DETECTOR_CONFIG}"], + P=[100, 125, 150,175, 200, 225, 250, 275], + DETECTOR_CONFIG=["{DETECTOR_CONFIG}"], INDEX=range(5), ), script="benchmarks/zdc_sigma/analysis/sigma_plots.py", - output: - results_dir=directory("results/{DETECTOR_CONFIG}/zdc_sigma"), - shell: - """ + output: + results_dir=directory("results/{DETECTOR_CONFIG}/zdc_sigma"), + shell: + """ mkdir -p {output.results_dir} python {input.script} {output.results_dir} """