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

ROOTReader doesn't handle meta data properly when reading from multiple files #132

Closed
tmadlener opened this issue Sep 3, 2020 · 1 comment · Fixed by #133
Closed

ROOTReader doesn't handle meta data properly when reading from multiple files #132

tmadlener opened this issue Sep 3, 2020 · 1 comment · Fixed by #133

Comments

@tmadlener
Copy link
Collaborator

When reading from more than one file the reading of the meta data breaks after the first file has been read. The read-multiple test doesn't actually cover this so it has gone undetected until now.

The reason seems to be that in

podio/src/ROOTReader.cc

Lines 18 to 20 in 6a1e506

auto evt_metadatatree = static_cast<TTree*>(m_chain->GetFile()->Get("evt_metadata"));
evt_metadatatree->SetBranchAddress("evtMD",&emd);
evt_metadatatree->GetEntry(m_eventNumber);

the call to m_chain->GetFile() possibly still returns the "old" file and has not necessarily switched to the "new" file yet. For this to happen a call to m_chain->LoadTree(m_eventNumber) needs to happen, which is happening only in readCollection:

Long64_t localEntry = m_chain->LoadTree(m_eventNumber);

This issue is easily solved for meta data that is expected to change with every event / run. However, it is a bit harder, also from a conceptual point of view, for meta data that are read at the beginning of the file which is done in openFiles, but only for the first file. It is possible that the stored meta data in the next file are different, but currently this is not taken into account when switching files.

@hegner
Copy link
Collaborator

hegner commented Sep 18, 2020

There are two problems:

  1. the (memory) bookkeeping of this data is left to the magics of ROOT.
  2. It seems there is no record of the validity of metadata, but only implicit assumptions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants