Skip to content

Commit

Permalink
TBranchElement: no drilling through new members.
Browse files Browse the repository at this point in the history
This resolved the problem seen at: cms-sw/cmssw#36908 (comment)
and fix root-project#9899.

The problem is the rules are applied to a data member nested inside an object nested inside
an STL collection that is a new data member of the class reco::HaloClusterCandidateHCAL,
since it is a new member compared to the layout on file, none of the objects; from the new
member down to the object on which the rules need to be run) are actually streamed and the
code gathering the information to run the rule got a bit lost ; it is likely (I am checking
as we speak) that in previous release the rule was not even attempted to be run ... which
might actually be the desired behavior in this specific case.

The solution is to have GatherArtificialElements stop drilling through data members which
are not stored in the existing TTree.
  • Loading branch information
pcanal committed Feb 16, 2022
1 parent 965ea2d commit 68e6725
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tree/tree/src/TBranchElement.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2068,18 +2068,26 @@ static void GatherArtificialElements(const TObjArray &branches, TStreamerInfoAct
subprefix = ename + ".";
}
auto nbranches = search->GetEntriesFast();
bool foundRelatedSplit = false;
for (Int_t bi = 0; bi < nbranches; ++bi) {
TBranchElement* subbe = (TBranchElement*)search->At(bi);
bool matchSubPrefix = strncmp(subbe->GetFullName(), subprefix.Data(), subprefix.Length()) == 0;
if (!foundRelatedSplit)
foundRelatedSplit = matchSubPrefix;
if (elementClass == subbe->GetInfo()->GetClass() // Use GetInfo to provoke its creation.
&& subbe->GetOnfileObject()
&& strncmp(subbe->GetFullName(), subprefix.Data(), subprefix.Length()) == 0)
&& matchSubPrefix)
{
nextinfo = subbe->GetInfo();
onfileObject = subbe->GetOnfileObject();
break;
}
}

if (!foundRelatedSplit) {
continue;
}

if (!nextinfo) {
nextinfo = (TStreamerInfo *)elementClass->GetStreamerInfo();
if (elementClass->GetCollectionProxy() && elementClass->GetCollectionProxy()->GetValueClass()) {
Expand Down

0 comments on commit 68e6725

Please sign in to comment.