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.
|
md->LoadConfigFromElement(paraele, Global, {}); |
|
md->Initialize(); |
This was added in commit 5d8cb71 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
|
cut->AddCut((TRestCut*)InstantiateChildMetadata("TRestCut", cutName)); |
It also appears for loading the TRestCut in TRestDataSet
|
fCut = (TRestCut*)InstantiateChildMetadata("TRestCut"); |
and was recently added in TRestDataSetGainMap
|
fCut = (TRestCut*)InstantiateChildMetadata("TRestCut"); |
They still work as expected because the TRestCut::Initialize() method
|
void TRestCut::Initialize() { fCuts.clear(); } |
only clears the fCuts member and not the fCutStrings and fParamCuts, which are the ones used in TRestDataSet::MakeCut(TRestCut*)
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.
framework/source/framework/core/src/TRestMetadata.cxx
Lines 801 to 802 in df3eb05
This was added in commit 5d8cb71 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
framework/source/framework/core/src/TRestDataSetPlot.cxx
Line 324 in df3eb05
It also appears for loading the TRestCut in TRestDataSet
framework/source/framework/core/src/TRestDataSet.cxx
Line 768 in df3eb05
and was recently added in TRestDataSetGainMap
framework/source/framework/analysis/src/TRestDataSetGainMap.cxx
Line 189 in df3eb05
They still work as expected because the TRestCut::Initialize() method
framework/source/framework/core/src/TRestCut.cxx
Line 69 in df3eb05