TRestMetadata::InstantiateChildMetadata resets metadata after loading parameters
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*)