Skip to content

Commit

Permalink
add comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
AJPfleger committed Nov 22, 2024
1 parent 11746d1 commit f6ce5f0
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 6 deletions.
7 changes: 7 additions & 0 deletions CI/physmon/config/trackfitting_gx2f_vs_kf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
checks:
"*":
Chi2Test: null
KolmogorovTest: null
RatioCheck: null
ResidualCheck: null
IntegralCheck: null
19 changes: 17 additions & 2 deletions CI/physmon/phys_perf_mon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <all|kf|gsf|gx2f|refit_kf|refit_gsf|fullchains|simulation> (outdir)"
if ! [[ $mode = @(all|kf|gsf|gx2f|refit_kf|refit_gsf|fullchains|simulation|gx2f_vs_kf) ]]; then
echo "Usage: $0 <all|kf|gsf|gx2f|refit_kf|refit_gsf|fullchains|simulation|gx2f_vs_kf> (outdir)"
exit 1
fi

Expand Down Expand Up @@ -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::"


Expand Down Expand Up @@ -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
Expand Down
18 changes: 14 additions & 4 deletions CI/physmon/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,16 @@
)

for s in summary:
f.write(
f"""
if s["title"].startswith("Comparison"):
f.write(
f"""
<li>🔵 <a href="{s["path"]}">{s["title"]}</a></li>"""
)
else:
f.write(
f"""
<li>{"✅" if s["total"] else "🔴"} <a href="{s["path"]}">{s["title"]}</a></li>"""
)
)

f.write(
"""
Expand All @@ -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")
68 changes: 68 additions & 0 deletions CI/physmon/workflows/physmon_trackfitting_gx2f_vs_kf.py
Original file line number Diff line number Diff line change
@@ -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")

0 comments on commit f6ce5f0

Please sign in to comment.