Skip to content

fix: Gaussian histogram fit implementation in Core - #5831

Draft
benjaminhuth wants to merge 5 commits into
acts-project:mainfrom
benjaminhuth:feature/resolution-fit-without-root
Draft

fix: Gaussian histogram fit implementation in Core#5831
benjaminhuth wants to merge 5 commits into
acts-project:mainfrom
benjaminhuth:feature/resolution-fit-without-root

Conversation

@benjaminhuth

Copy link
Copy Markdown
Member

No description provided.

@github-actions github-actions Bot added this to the next milestone Aug 4, 2026
@github-actions github-actions Bot added Component - Core Affects the Core module Component - Examples Affects the Examples module Component - Plugins Affects one or more Plugins Public API API breaking labels Aug 4, 2026
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Public API surface diff

+8 added, 5 breaking.

⚠️ Breaking API changes (source-level)

Removed or changed call signatures (5)
  • ActsPlugins::extractMeanWidthProfiles(const TH2F &, const std::string &, const std::string &)
  • ActsPlugins::extractMeanWidthProfiles(const TH2F &, const std::string &, const std::string &, int)
  • ActsPlugins::extractMeanWidthProfiles(const TH2F &, const std::string &, const std::string &, int, double)
  • ActsPlugins::extractMeanWidthProfiles(const TH2F &, const std::string &, const std::string &, int, double, int)
  • ActsPlugins::extractMeanWidthProfiles(const TH2F &, const std::string &, const std::string &, int, double, int, const Acts::Logger &)

➕ Added public API

New types / aliases / enums / variables / concepts (2)
  • type ActsPlugins::RootHistogramFit
  • type ActsPlugins::RootHistogramFit::Config
New call signatures (incl. defaulted-arg overloads) (5)
  • ActsPlugins::RootHistogramFit::RootHistogramFit()
  • ActsPlugins::RootHistogramFit::RootHistogramFit(Config)
  • ActsPlugins::RootHistogramFit::config() const
  • ActsPlugins::RootHistogramFit::fit(const Acts::Experimental::Histogram1 &) const
  • ActsPlugins::RootHistogramFit::fit(const Acts::Experimental::Histogram1 &, double, double) const
New public data members (1)
  • ActsPlugins::RootHistogramFit::Config::fitOptions

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

📊: Physics performance monitoring for 898696d

Full contents

physmon summary

❗️: Downstream build failure

  • eic-shell EICrecon (cc @acts-project/epic-contacts)

@benjaminhuth benjaminhuth changed the title fix: copy bin contents in Histogram projectionX/projectionY fix: Gaussian histogram fit implementation in Core Aug 5, 2026
@benjaminhuth
benjaminhuth force-pushed the feature/resolution-fit-without-root branch from 52610d3 to 898696d Compare August 6, 2026 08:00
@paulgessinger

Copy link
Copy Markdown
Member

Honestly I'm not sure this should be in core. I'm assuming this is for the python use case? Can't we fit in python directly with scikit?

@benjaminhuth

Copy link
Copy Markdown
Member Author

Hmm python based fit would be an option, but then we would have divergence between the ROOT and Python based metrics. The nice thing about having it in Core would be, we can unit-test equivalence against ROOT, which is our correctness reference.

@benjaminhuth

Copy link
Copy Markdown
Member Author

(okay, but we could in principle also check scikit fit against root in our CI...)

@paulgessinger

Copy link
Copy Markdown
Member

Right but it expands our footprint into functionality that's not really meant to be covered by the library. The histogram library is already pushing this line a bit, but mostly wraps boost-histogram

benjaminhuth and others added 5 commits August 7, 2026 18:39
…ance

Introduces HistogramFitFunction, a std::function-based abstraction over
"fit a Gaussian to a histogram, optionally in a range", so the resolution
fit backend used by TrackFitterPerformanceCollector is pluggable rather than
hard-coded. ActsPlugins::RootHistogramFit (ROOT's TH1::Fit) is the only
backend provided here; a ROOT-free C++ implementation follows in a later
change, and a Python callable (e.g. scipy.optimize.curve_fit) already works
today via pybind11's functional.h conversion -- no C++ changes needed on that
side.

TrackFitterPerformanceCollector now owns fitProfiles() (mean/width profile
extraction via the pluggable fit backend), absorbing logic that both
RootTrackFitterPerformanceWriter and PythonTrackFitterPerformanceWriter used
to duplicate. Config::fitFunction defaults to an empty std::function; if left
unset, fitProfiles() logs a warning and returns no profiles instead of
crashing. RootTrackFitterPerformanceWriter hard-wires RootHistogramFit as its
own backend, since it already depends on ROOT. Python's
PythonTrackFitterPerformanceWriter.Config.fitFunction has no default --
callers must pick a backend explicitly.

Also adds ValueHistogram (a Histogram-like type for derived per-bin
values/errors, e.g. a fitted mean or width) and generic histogram
infrastructure (setBinContent/binContent, sliceLastAxis, totalContent) needed
by the fit interface, plus their Python bindings and toRoot() converters.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013s1fSXsr4v6mPs8DcmezD4
@benjaminhuth
benjaminhuth force-pushed the feature/resolution-fit-without-root branch from 898696d to 446fce2 Compare August 10, 2026 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API breaking Component - Core Affects the Core module Component - Examples Affects the Examples module Component - Plugins Affects one or more Plugins Public API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants