ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
ActsPlugins::RootHistogramFit Class Reference

Fit a Gaussian to a histogram via ROOT's TH1::Fit. More...

#include <ActsPlugins/Root/RootHistogramFit.hpp>

Classes

struct  Config
 Configuration for RootHistogramFit. More...

Public Types

using Range = std::pair<double, double>
 Fit range [xMin, xMax], closed, selected by bin centre.
using Result = std::tuple<double, double, double, double>
 Outcome of the fit: (mean, sigma, meanError, sigmaError).

Public Member Functions

 RootHistogramFit (Config config)
 Construct with the given configuration.
const Configconfig () const
 The fit configuration.
std::optional< Resultoperator() (const Acts::Experimental::Histogram1 &hist, std::optional< Range > range=std::nullopt) const
 Fit a Gaussian to a histogram, optionally restricted to a range.

Detailed Description

Fit a Gaussian to a histogram via ROOT's TH1::Fit.

operator()'s signature matches ActsExamples::HistogramFitFunction exactly, so a RootHistogramFit instance can be used directly as one with no adapter.

Constructor & Destructor Documentation

◆ RootHistogramFit()

ActsPlugins::RootHistogramFit::RootHistogramFit ( Config config)
explicit

Construct with the given configuration.

Parameters
configThe fit configuration

Member Function Documentation

◆ config()

const Config & ActsPlugins::RootHistogramFit::config ( ) const

The fit configuration.

Returns
The configuration this instance was constructed with

◆ operator()()

std::optional< Result > ActsPlugins::RootHistogramFit::operator() ( const Acts::Experimental::Histogram1 & hist,
std::optional< Range > range = std::nullopt ) const

Fit a Gaussian to a histogram, optionally restricted to a range.

Parameters
histThe histogram to fit
rangeIf set, only bins whose centre lies in [range->first, range->second] enter the fit
Returns
(mean, sigma, meanError, sigmaError), or std::nullopt if the fit could not be performed