Skip to content

TRestMetadata::InstantiateChildMetadata resets metadata after loading parameters #515

Description

@AlvaroEzq

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

Activity

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

Metadata

Metadata

Labels

invalidThis doesn't seem right

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions