Augmented file reading with TEvent
This MR implements the reading of augmented (DAOD) files with TEvent
as discussed during the following meeting (link 1 and link 2).
It supersedes the following (now closed) MR !63693 (closed)
Citing also the corresponding JIRA ticket: https://its.cern.ch/jira/browse/ATLASG-2539
During the meeting it was discussed that the alternative solution proposed by the ROOT team was a better solution so only the slides 11, 12, 15, 16 and 28 are relevant for the current MR.
To read the events that are common to two collection tree the user has to provide himself/herself the list of entries to be processed.
e.g. has done (here)
i.e. the TEvent
class is NOT taking care of finding/looping over those common events, it is up to the user to loop only over them.
The way the entries to be read in each tree are found is done through the call of the TTree::LoadTree(entry)
function in the TEvent
class.
And then are retrieved thanks to the TTree::GetReadEntry()
function
(as proposed by the ROOT team here)
This relies on the event index of each tree being built beforehand (in principle should be done when creating the DAOD).
NB: TTree::LoadTree(entry)
is NOT reading anything it just sets the entry to be read.
So e.g. if m_inTree->LoadTree(5)
is called in the TEvent
class
- For all branches belonging to the main tree
then
m_branch->GetTree()->GetReadEntry()
will return5
- For all branches belonging to a friend tree, the entry to be read will be found and set by the call of
m_inTree->LoadTree()
(m_inTree
being the main tree). TheTTree::LoadTree
is using the major and minor values of the event in the main tree and finds the corresponding entry in the friend tree with the same values.
In augmented DAOD files, the trees have an index that is built in order to be able to match common events accross trees i.e. with same major and minor values.
And so in that casem_branch->GetTree()->GetReadEntry()
will most likely be different from5
for those branches (see slide 28 of the presentation linked above)
So the entries to be read for each branch are retrieved in the branch manager classes with lines similar to:
::Long64_t entry = m_branch->GetTree()->GetReadEntry();
m_entry = entry ;
m_branch->GetEntry( m_entry, getall );
In case a user request reading an event for which there is no corresponding entry in a friend tree then the entry returned by
::Long64_t entry = m_branch->GetTree()->GetReadEntry();
for branches of that friend tree
would be negative (equal to -1
) hence the protection against such cases in the code with an error raised if entry < 0
- If more than one metadata tree is found in the event then the event format information stored in each tree is read
Tagging @akraszna, @krumnack, @hrussell, @gwatts and @ekourlit on this MR