Skip to content

Conversation

@lubynets
Copy link
Contributor

@lubynets lubynets commented Dec 23, 2025

Bugfix:

  • Before the json configurable UseLikelihood did not have any effect: independently on its value true or false, always likelihood fit was performed. This bug is fixed now. Note: it seems that in Chi2 mode (when RooAbsPdf::chi2FitTo() function is called) setting the fitting range has no effect. This problem is to be investigated, any help will be highly appreciated;

Code cleaning and refactoring:

  • Reduced code repetition in several places;
  • Used enums instead of magic values for fit functions and config parameters;
  • Used std::array instead of std::vectors when the size is known at the compilation time;
  • ROOT types replaced with standard c++ types (with an exception for TString in several places);
  • Got rid of compilation warnings;
  • Deleted the default constructor UPD: since it was not used and served exclusively as an entry point for running the fitter as a Root macro. Now the instructions how to run the fitter as a Root macro are fixed and do not require default constructor as an entry point any more;
  • Factored out into a function:
    • open file and check for nullptr;
    • get object from file and check for nullptr;
    • read variables and vectors from json configurables; avoid crash when the field is optional and crash with explicit error message when the field is mandatory;
    • check whether the vector of configurables has the same size as number of fitting ranges (or zero if the vector is optional);
  • Got rid of unnecessary histograms cloning when passing them from file to the fitter and when rebinning them;
  • Function implementations, which occupy more than 1 line, moved from header to the source file.

@github-actions github-actions bot added the pwghf PWG-HF label Dec 23, 2025
@github-actions github-actions bot changed the title HFInvMassFitter: code cleaning and refactoring [PWGHF] HFInvMassFitter: code cleaning and refactoring Dec 23, 2025
@github-actions
Copy link

github-actions bot commented Dec 23, 2025

O2 linter results: ❌ 1 errors, ⚠️ 0 warnings, 🔕 0 disabled

@vkucera
Copy link
Collaborator

vkucera commented Dec 24, 2025

Hi @lubynets , thanks for the extensive improvement. Can you please also fix the issues reported in the bug tracker?

@lubynets
Copy link
Contributor Author

Hi @lubynets , thanks for the extensive improvement. Can you please also fix the issues reported in the bug tracker?

Done.

@vkucera
Copy link
Collaborator

vkucera commented Dec 27, 2025

Hi @lubynets , thanks for the extensive improvement. Can you please also fix the issues reported in the bug tracker?

Done.

Thanks but it doesn't seem you fixed the issues found by Clang-Tidy, e.g. setNumberOfSigmaForSidebands still assigns double to int.

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

Labels

pwghf PWG-HF

Development

Successfully merging this pull request may close these issues.

2 participants