From f6ce5f00ccc436b68d0462d115c0b7a2a228000d Mon Sep 17 00:00:00 2001 From: AJPfleger Date: Thu, 21 Nov 2024 17:07:01 +0100 Subject: [PATCH] add comparison --- CI/physmon/config/trackfitting_gx2f_vs_kf.yml | 7 ++ CI/physmon/phys_perf_mon.sh | 19 +++++- CI/physmon/summary.py | 18 +++-- .../physmon_trackfitting_gx2f_vs_kf.py | 68 +++++++++++++++++++ 4 files changed, 106 insertions(+), 6 deletions(-) create mode 100644 CI/physmon/config/trackfitting_gx2f_vs_kf.yml create mode 100755 CI/physmon/workflows/physmon_trackfitting_gx2f_vs_kf.py diff --git a/CI/physmon/config/trackfitting_gx2f_vs_kf.yml b/CI/physmon/config/trackfitting_gx2f_vs_kf.yml new file mode 100644 index 00000000000..ddcf38e9b03 --- /dev/null +++ b/CI/physmon/config/trackfitting_gx2f_vs_kf.yml @@ -0,0 +1,7 @@ +checks: + "*": + Chi2Test: null + KolmogorovTest: null + RatioCheck: null + ResidualCheck: null + IntegralCheck: null diff --git a/CI/physmon/phys_perf_mon.sh b/CI/physmon/phys_perf_mon.sh index c2944f0dd06..4314f4be6b6 100755 --- a/CI/physmon/phys_perf_mon.sh +++ b/CI/physmon/phys_perf_mon.sh @@ -20,8 +20,8 @@ shopt -s extglob mode=${1:-all} -if ! [[ $mode = @(all|kf|gsf|gx2f|refit_kf|refit_gsf|fullchains|simulation) ]]; then - echo "Usage: $0 (outdir)" +if ! [[ $mode = @(all|kf|gsf|gx2f|refit_kf|refit_gsf|fullchains|simulation|gx2f_vs_kf) ]]; then + echo "Usage: $0 (outdir)" exit 1 fi @@ -163,6 +163,9 @@ if [[ "$mode" == "all" || "$mode" == "fullchains" ]]; then run_physmon_gen "CKF muon 50" "trackfinding_4muon_50vertices" run_physmon_gen "CKF ttbar 200" "trackfinding_ttbar_pu200" fi +if [[ "$mode" == "all" || "$mode" == "gx2f_vs_kf" ]]; then + run_physmon_gen "Comparison - Truth Tracking GX2F vs KF" "trackfitting_gx2f_vs_kf" +fi echo "::endgroup::" @@ -459,6 +462,18 @@ if [[ "$mode" == "all" || "$mode" == "fullchains" ]]; then vertexing "trackfinding | ttbar with 200 pileup | default seeding" trackfinding_ttbar_pu200 CI/physmon/config/vertexing_ttbar_pu200.yml fi +if [[ "$mode" == "all" || "$mode" == "gx2f_vs_kf" ]]; then + run_histcmp \ + $outdir/data/trackfitting_gx2f_vs_kf/performance_trackfitting_gx2f.root \ + $outdir/data/trackfitting_gx2f_vs_kf/performance_trackfitting_kf.root \ + "Comparison - Truth tracking (GX2F vs KF)" \ + trackfitting_gx2f_vs_kf/performance_trackfitting.html \ + trackfitting_gx2f_vs_kf/performance_trackfitting_plots \ + --config CI/physmon/config/trackfitting_gx2f_vs_kf.yml \ + --label-reference=KF \ + --label-monitored=GX2F +fi + run CI/physmon/summary.py $histcmp_results \ --md $outdir/summary.md \ --html $outdir/summary.html diff --git a/CI/physmon/summary.py b/CI/physmon/summary.py index a7de3ed74c8..0601b2f9fe8 100755 --- a/CI/physmon/summary.py +++ b/CI/physmon/summary.py @@ -48,10 +48,16 @@ ) for s in summary: - f.write( - f""" + if s["title"].startswith("Comparison"): + f.write( + f""" +
  • 🔵 {s["title"]}
  • """ + ) + else: + f.write( + f"""
  • {"✅" if s["total"] else "🔴"} {s["title"]}
  • """ - ) + ) f.write( """ @@ -74,4 +80,8 @@ ) else: url = s["path"] - f.write(f" - {'✅' if s['total'] else '🔴'} [{s['title']}]({url})\n") + + if s["title"].startswith("Comparison"): + f.write(f" - 🔵️ [{s['title']}]({url})\n") + else: + f.write(f" - {'✅' if s['total'] else '🔴'} [{s['title']}]({url})\n") diff --git a/CI/physmon/workflows/physmon_trackfitting_gx2f_vs_kf.py b/CI/physmon/workflows/physmon_trackfitting_gx2f_vs_kf.py new file mode 100755 index 00000000000..384f924c05a --- /dev/null +++ b/CI/physmon/workflows/physmon_trackfitting_gx2f_vs_kf.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python3 + +import tempfile +from pathlib import Path +import shutil + +import acts +from truth_tracking_kalman import runTruthTrackingKalman +from truth_tracking_gx2f import runTruthTrackingGx2f + +from physmon_common import makeSetup + +setup = makeSetup() + +digiConfigFile = setup.digiConfig +nSkip = 0 +nEvents = 100000 +numThreads = -1 + +with tempfile.TemporaryDirectory() as temp: + s = acts.examples.Sequencer( + skip=nSkip, + events=nEvents, + numThreads=numThreads, + logLevel=acts.logging.INFO, + trackFpes=True, + ) + + tp = Path(temp) + runTruthTrackingKalman( + trackingGeometry=setup.trackingGeometry, + field=setup.field, + digiConfigFile=digiConfigFile, + outputDir=tp, + s=s, + ) + + s.run() + del s + + perf_file = tp / "performance_kf.root" + assert perf_file.exists(), "Performance file not found" + shutil.copy(perf_file, setup.outdir / "performance_trackfitting_kf.root") + +with tempfile.TemporaryDirectory() as temp: + s = acts.examples.Sequencer( + skip=nSkip, + events=nEvents, + numThreads=numThreads, + logLevel=acts.logging.INFO, + trackFpes=True, + ) + + tp = Path(temp) + runTruthTrackingGx2f( + trackingGeometry=setup.trackingGeometry, + field=setup.field, + digiConfigFile=digiConfigFile, + outputDir=tp, + s=s, + ) + + s.run() + del s + + perf_file = tp / "performance_gx2f.root" + assert perf_file.exists(), "Performance file not found" + shutil.copy(perf_file, setup.outdir / "performance_trackfitting_gx2f.root")