rest-for-physics / rest-for-physics/framework
TRestMetadata::InstantiateChildMetadata resets metadata after loading parameters
@jgalan is already working on this.
Since Apr 11, 2024.
- Dominant language
- C++
- Stars
- 19
- Forks
- 14
- PR merge metrics
- No merged PRs in 30d
Description
TRestMetadata::InstantiateChildMetadata calls the metadata Initialize() method after loading its members from the config element. Thus, the child metadata members are reset. I think the call to Initialize() should be before the LoadConfigFromElement() call.
https://github.com/rest-for-physics/framework/blob/df3eb05696193a230e5157f8e1cbdcc0f9a40e68/source/framework/core/src/TRestMetadata.cxx#L801-L802
This was added in commit https://github.com/rest-for-physics/framework/commit/5d8cb719483909822acc4d57a8b6a84cc1fc2686 but I dont know what was the reason for it.
I found this when trying to debug the TRestCut applied in TRestDataSetPlot, where the cuts are loaded using this TRestMetadata::InstantiateChildMetadata
https://github.com/rest-for-physics/framework/blob/df3eb05696193a230e5157f8e1cbdcc0f9a40e68/source/framework/core/src/TRestDataSetPlot.cxx#L324
It also appears for loading the TRestCut in TRestDataSet https://github.com/rest-for-physics/framework/blob/df3eb05696193a230e5157f8e1cbdcc0f9a40e68/source/framework/core/src/TRestDataSet.cxx#L768
and was recently added in TRestDataSetGainMap https://github.com/rest-for-physics/framework/blob/df3eb05696193a230e5157f8e1cbdcc0f9a40e68/source/framework/analysis/src/TRestDataSetGainMap.cxx#L189
They still work as expected because the TRestCut::Initialize() method https://github.com/rest-for-physics/framework/blob/df3eb05696193a230e5157f8e1cbdcc0f9a40e68/source/framework/core/src/TRestCut.cxx#L69 only clears the fCuts member and not the fCutStrings and fParamCuts, which are the ones used in TRestDataSet::MakeCut(TRestCut*)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.