|
musrfit 1.10.0
|
Objective function interface for ROOT Minuit2 minimization. More...
#include <PFitterFcn.h>


Public Member Functions | |
| PFitterFcn (PRunListCollection *runList, Bool_t useChi2) | |
| Constructor for objective function. | |
| ~PFitterFcn () | |
| Destructor. | |
| Double_t | Up () const |
| Returns error definition for Minuit2 (Up value). | |
| Double_t | operator() (const std::vector< Double_t > &par) const |
| Evaluates objective function for given parameters. | |
| UInt_t | GetTotalNoOfFittedBins () |
| Returns total number of bins used in the fit across all runs. | |
| UInt_t | GetNoOfFittedBins (const UInt_t idx) |
| Returns number of fitted bins for a specific run. | |
| void | CalcExpectedChiSquare (const std::vector< Double_t > &par, Double_t &totalExpectedChisq, std::vector< Double_t > &expectedChisqPerRun) |
| Calculates expected χ² (or maxLH) for quality assessment. | |
Private Attributes | |
| Double_t | fUp |
| Error definition: 1.0 for χ² (1σ = Δχ²=1), 0.5 for maxLH (1σ = ΔmaxLH=0.5) | |
| Bool_t | fUseChi2 |
| Fit mode flag: true = χ² minimization, false = max log-likelihood. | |
| PRunListCollection * | fRunListCollection |
| Pointer to preprocessed muSR data collection. | |
Objective function interface for ROOT Minuit2 minimization.
This class implements the FCNBase interface required by ROOT's Minuit2 minimizer. It provides the objective function (χ² or log-likelihood) that Minuit2 minimizes during parameter optimization.
The class serves as a bridge between musrfit's data structures (PRunListCollection) and Minuit2's optimization algorithms, calculating the goodness-of-fit measure for any given parameter set.
Definition at line 65 of file PFitterFcn.h.
| PFitterFcn::PFitterFcn | ( | PRunListCollection * | runList, |
| Bool_t | useChi2 ) |
Constructor for objective function.
Initializes the function evaluator with preprocessed data and configures the error definition based on the fitting mode.
| runList | Pointer to collection of preprocessed run data |
| useChi2 | If true, use χ² minimization; if false, use maximum likelihood |
Constructor.
| runList | run list collection |
| useChi2 | if true, a chisq fit will be performed, otherwise a log max-likelihood fit will be carried out. |
Definition at line 41 of file PFitterFcn.cpp.
References fRunListCollection, fUp, and fUseChi2.
| PFitterFcn::~PFitterFcn | ( | ) |
| void PFitterFcn::CalcExpectedChiSquare | ( | const std::vector< Double_t > & | par, |
| Double_t & | totalExpectedChisq, | ||
| std::vector< Double_t > & | expectedChisqPerRun ) |
Calculates expected χ² (or maxLH) for quality assessment.
Computes the theoretical expected value of χ² assuming the model is correct. This is used to assess goodness-of-fit:
For single histogram fits, expected χ² = NDF. For asymmetry fits, the calculation is more complex due to error propagation.
| par | Parameter vector for evaluation |
| totalExpectedChisq | Returns total expected χ²/maxLH (output) |
| expectedChisqPerRun | Returns expected χ²/maxLH for each run (output) |
Calculates the expected chisq, expected chisq per run, and chisq per run, if applicable.
| par | |
| totalExpectedChisq | expected chisq for all run blocks |
| expectedChisqPerRun | expected chisq vector for all the run blocks |
Definition at line 106 of file PFitterFcn.cpp.
References fRunListCollection, and fUseChi2.
|
inline |
Returns number of fitted bins for a specific run.
| idx | Run index (0-based) |
Definition at line 142 of file PFitterFcn.h.
References fRunListCollection.
|
inline |
Returns total number of bins used in the fit across all runs.
Definition at line 133 of file PFitterFcn.h.
References fRunListCollection.
| Double_t PFitterFcn::operator() | ( | const std::vector< Double_t > & | par | ) | const |
Evaluates objective function for given parameters.
This is the core function called by Minuit2 during minimization. It computes either χ² or negative log-likelihood by:
| par | Parameter vector with current trial values |
Minuit2 interface function call routine. This is the function which should be minimized.
| par | a vector with all the parameters of the function |
Definition at line 71 of file PFitterFcn.cpp.
References fRunListCollection, and fUseChi2.
|
inline |
Returns error definition for Minuit2 (Up value).
The "Up" value defines what change in the objective function corresponds to 1σ error bars on parameters:
This value is used by Minuit2's error analysis algorithms (HESSE, MINOS).
Definition at line 102 of file PFitterFcn.h.
References fUp.
|
private |
Pointer to preprocessed muSR data collection.
Definition at line 168 of file PFitterFcn.h.
Referenced by CalcExpectedChiSquare(), GetNoOfFittedBins(), GetTotalNoOfFittedBins(), operator()(), and PFitterFcn().
|
private |
Error definition: 1.0 for χ² (1σ = Δχ²=1), 0.5 for maxLH (1σ = ΔmaxLH=0.5)
Definition at line 166 of file PFitterFcn.h.
Referenced by PFitterFcn(), and Up().
|
private |
Fit mode flag: true = χ² minimization, false = max log-likelihood.
Definition at line 167 of file PFitterFcn.h.
Referenced by CalcExpectedChiSquare(), operator()(), and PFitterFcn().