diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c9282b22..cbf37de0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -186,6 +186,7 @@ deploy_results: - "collect_results:zdc_lambda" - "collect_results:insert_neutron" - "collect_results:tracking_performances_dis" + - "collect_results:tracking_performances_dis:campaign" - "collect_results:zdc" - "collect_results:zdc_lyso" - "collect_results:zdc_neutron" diff --git a/Snakefile b/Snakefile index d3459615..9a40ec0e 100644 --- a/Snakefile +++ b/Snakefile @@ -107,7 +107,6 @@ echo 'Unexpected value for config["remote_provider"]: {config["remote_provider"] exit 1 """ - rule warmup_run: output: "warmup.edm4hep.root", diff --git a/benchmarks/tracking_performances_dis/Snakefile b/benchmarks/tracking_performances_dis/Snakefile index dca2f117..7fd58c81 100644 --- a/benchmarks/tracking_performances_dis/Snakefile +++ b/benchmarks/tracking_performances_dis/Snakefile @@ -1,5 +1,14 @@ import os +# Campaign configuration defaults — override via snakemake --config or CI variables +# (CI yml passes these via snakemake --config dis_campaign=... etc.) +DIS_CAMPAIGN_CONFIG = { + "campaign": config.get("dis_campaign", "26.05.0"), + "beam": config.get("dis_beam", "9x130"), + "q2_range": config.get("dis_q2_range", "q2_10to100"), + "nfiles": int(config.get("dis_nfiles", 5)), +} + rule trk_dis_compile: input: "benchmarks/tracking_performances_dis/analysis/trk_dis_analysis_cxx.so", @@ -191,6 +200,174 @@ rule vtx_dis_plots: root -l -b -q '{input.script}+("{input.config}")' """ +# Campaign mode: stream pre-reconstructed files directly from BNL xrootd +# ROOT TChain supports xrootd URLs natively — no local copy needed +rule dis_campaign_analysis: + input: + script_trk="benchmarks/tracking_performances_dis/analysis/trk_dis_analysis.cxx", + script_trk_compiled="benchmarks/tracking_performances_dis/analysis/trk_dis_analysis_cxx.so", + script_vtx="benchmarks/tracking_performances_dis/analysis/vtx_dis_analysis.cxx", + script_vtx_compiled="benchmarks/tracking_performances_dis/analysis/vtx_dis_analysis_cxx.so", + output: + config_trk="results/tracking_performances_dis/campaign_{CAMPAIGN}/epic_craterlake/{BEAM}/{Q2_RANGE}/{STEM}/config.json", + hists_trk="results/tracking_performances_dis/campaign_{CAMPAIGN}/epic_craterlake/{BEAM}/{Q2_RANGE}/{STEM}/hists.root", + config_vtx="results/vertexing_performances_dis/campaign_{CAMPAIGN}/epic_craterlake/{BEAM}/{Q2_RANGE}/{STEM}/config.json", + hists_vtx="results/vertexing_performances_dis/campaign_{CAMPAIGN}/epic_craterlake/{BEAM}/{Q2_RANGE}/{STEM}/hists.root", + wildcard_constraints: + CAMPAIGN=r"[\d.]+", + BEAM=r"\d+x\d+", + Q2_RANGE=r"q2_\w+", + STEM=r"(?!combined_)\S+", + params: + EBEAM=lambda wildcards: wildcards.BEAM.split("x")[0], + PBEAM=lambda wildcards: wildcards.BEAM.split("x")[1], + MINQ2=lambda wildcards: wildcards.Q2_RANGE.split("_")[1].split("to")[0], + xrd_url="root://epicxrd1.sdcc.bnl.gov:1095//eic/EPIC/RECO/{CAMPAIGN}/epic_craterlake/DIS/pythia8.316-1.0/NC/noRad/ep/{BEAM}/{Q2_RANGE}/{STEM}.eicrecon.edm4eic.root", + shell: + """ +cat > {output.config_trk} < {output.config_vtx} < {output} +if [ ! -s {output} ]; then + echo "Empty file listing for path /eic/EPIC/{params.search_path}" + exit 1 +fi +""" + +def _dis_campaign_stems(wildcards): + listing = checkpoints.dis_campaign_sim_list.get( + CAMPAIGN=wildcards.CAMPAIGN, + BEAM=wildcards.BEAM, + Q2_RANGE=wildcards.Q2_RANGE, + ).output[0] + with open(listing) as f: + return [line.strip() for line in f if line.strip()] + +rule dis_campaign_combine: + input: + trk=lambda wildcards: [ + f"results/tracking_performances_dis/campaign_{wildcards.CAMPAIGN}/epic_craterlake/{wildcards.BEAM}/{wildcards.Q2_RANGE}/{stem}/hists.root" + for stem in _dis_campaign_stems(wildcards)[:int(wildcards.NFILES)] + ], + vtx=lambda wildcards: [ + f"results/vertexing_performances_dis/campaign_{wildcards.CAMPAIGN}/epic_craterlake/{wildcards.BEAM}/{wildcards.Q2_RANGE}/{stem}/hists.root" + for stem in _dis_campaign_stems(wildcards)[:int(wildcards.NFILES)] + ], + output: + config_trk="results/tracking_performances_dis/campaign_{CAMPAIGN}/epic_craterlake/{BEAM}/{Q2_RANGE}/combined_{NFILES}/config.json", + hists_trk="results/tracking_performances_dis/campaign_{CAMPAIGN}/epic_craterlake/{BEAM}/{Q2_RANGE}/combined_{NFILES}/hists.root", + config_vtx="results/vertexing_performances_dis/campaign_{CAMPAIGN}/epic_craterlake/{BEAM}/{Q2_RANGE}/combined_{NFILES}/config.json", + hists_vtx="results/vertexing_performances_dis/campaign_{CAMPAIGN}/epic_craterlake/{BEAM}/{Q2_RANGE}/combined_{NFILES}/hists.root", + wildcard_constraints: + CAMPAIGN=r"[\d.]+", + BEAM=r"\d+x\d+", + Q2_RANGE=r"q2_\w+", + NFILES=r"\d+", + params: + EBEAM=lambda wildcards: wildcards.BEAM.split("x")[0], + PBEAM=lambda wildcards: wildcards.BEAM.split("x")[1], + MINQ2=lambda wildcards: wildcards.Q2_RANGE.split("_")[1].split("to")[0], + shell: + """ +cat > {output.config_trk} < {output.config_vtx} <