Skip to content

[math][fitter] Fix crash when doing a weighted likelihood fit#14459

Merged
lmoneta merged 1 commit intoroot-project:masterfrom
lmoneta:fix_fitter_fit_WL
Jan 30, 2024
Merged

[math][fitter] Fix crash when doing a weighted likelihood fit#14459
lmoneta merged 1 commit intoroot-project:masterfrom
lmoneta:fix_fitter_fit_WL

Conversation

@lmoneta
Copy link
Copy Markdown
Member

@lmoneta lmoneta commented Jan 26, 2024

A bug was introduced in #10439 affecting the weighted likelihood fits

This PR fixes #14458

@lmoneta lmoneta self-assigned this Jan 26, 2024
@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-performance-centos8-multicore/soversion, ROOT-ubuntu2204/nortcxxmod, ROOT-ubuntu2004/python3, mac12arm/cxx20, windows10/default
How to customize builds

@lmoneta lmoneta requested a review from guitargeek January 26, 2024 16:21
A bug was introduced in root-project#10439 affecting the weighted likelihood fits

Add missing test for Weighted likelihood fits in stressHistoFit
@lmoneta lmoneta requested a review from dpiparo as a code owner January 26, 2024 16:50
@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-performance-centos8-multicore/soversion, ROOT-ubuntu2204/nortcxxmod, ROOT-ubuntu2004/python3, mac12arm/cxx20, windows10/default
How to customize builds

@github-actions
Copy link
Copy Markdown

Test Results

    10 files      10 suites   1d 23h 33m 57s ⏱️
 2 497 tests  2 486 ✅   0 💤 11 ❌
23 867 runs  23 720 ✅ 136 💤 11 ❌

For more details on these failures, see this check.

Results for commit c911204.

@dpiparo
Copy link
Copy Markdown
Member

dpiparo commented Jan 27, 2024

@phsft-bot build

@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-performance-centos8-multicore/soversion, ROOT-ubuntu2204/nortcxxmod, ROOT-ubuntu2004/python3, mac12arm/cxx20, windows10/default
How to customize builds

Comment on lines +858 to +859
sObjFunc->UseSumOfWeightSquare();
return ApplyWeightCorrection(*sObjFunc);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sObjFunc->UseSumOfWeightSquare();
return ApplyWeightCorrection(*sObjFunc);
fObjFunction->UseSumOfWeightSquare();
return ApplyWeightCorrection(*fObjFunction);

When then problem is that objFunc is invalid because if was moved to fObjFunc, I think the simplest solution is to simply use that one. Then you don't need to create this extra shared pointer.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is the type required is of the derived class, you would need to do a dynamic_cast. I think is more efficient to just copy the pointer

Copy link
Copy Markdown
Contributor

@guitargeek guitargeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this undefined behavior! I just have one suggestions to simplify the fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crash when doing Weighted Likelihood fit

4 participants