Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TRestMetadata::InstantiateChildMetadata resets metadata after loading parameters #515

Open
AlvaroEzq opened this issue Apr 11, 2024 · 0 comments
Assignees
Labels
invalid This doesn't seem right

Comments

@AlvaroEzq
Copy link
Contributor

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*)

@AlvaroEzq AlvaroEzq added bug Something isn't working invalid This doesn't seem right and removed bug Something isn't working labels Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants