[PWGHF] HFInvMassFitter: stabilize fit quality, add fit-quality status to the output - #17348
[PWGHF] HFInvMassFitter: stabilize fit quality, add fit-quality status to the output#17348lubynets wants to merge 34 commits into
Conversation
|
O2 linter results: ❌ 0 errors, |
| auto setFixedValue = [&iSliceVar](bool const& isFix, std::vector<double> const& fixManual, const TH1* histToFix, std::function<void(double)> setFunc, std::string const& var) -> void { | ||
| auto setFixedValue = [&iSliceVar, massFitter](bool const& isFix, std::vector<double> const& fixManual, const TH1* histToFix, void (HFInvMassFitter::*setter)(double), std::string const& var) -> void { |
There was a problem hiding this comment.
What is the motivation for removing std::function here?
There was a problem hiding this comment.
I wanted to make setFixedValue() uniform with setDscbParameter()
There was a problem hiding this comment.
OK, thanks. What speaks against using std::function everywhere?
There was a problem hiding this comment.
No special reasoning against std::function, it was a random choice. Are there reasons not to use void()()?
There was a problem hiding this comment.
No special reasoning against
std::function, it was a random choice. Are there reasons not to usevoid()()?
Isn't it some kind of old unsafe C-style syntax that has been superseded by stuff in the standard library?
|
Error while checking build/O2Physics/code-check for 0336f86 at 2026-08-05 20:47: Full log here. |
1. Fit quality stabilization
With the existing version of the fitter some fits are exceptionally poor, and the shape of background and / or peak is completely wrong. It happens due to wrong estimation of initial values of background's and signal's integral. In this PR:
-- Estimate of background and signal integral was fixed;
-- Pre-fit of background sidebands is now done with
chi2FitTo()always, sincefitTo()function (likelihood) turned out to be agnostic to theRanges()parameter, i.e. it also fitted the peak when sidebands were requested (that's why at some fit plots the gray line representing sidebands pre-fit was sometimes completely misfittig, while the total fit looked healthy).2. Add fit-quality status to the output
--
hFitResulthistogram is added to the output, which contains RooFit'sstatus, covariance matrix quality (cov qual), estimated distance to minimum (edm), minimum value of the negative log-likelihood (minNLL) and global correlation coefficient of the signal's integral with other fit parameters (N Sig GCC);--
CovCorrMatrices/hCovCorrMatrixhistograms are added, which contain covariance and correlation across all fit parameters.3. Code cleaning
-- Avoided crash if a single histogram fitting is failed. Instead the exception is handled and fitting of remaining histograms continues;
-- Fixed (most of) clang-tidy and cpp check errors.