From d63f9774f444cf5503ae2b7a9154957119d5b659 Mon Sep 17 00:00:00 2001 From: Philippe Canal Date: Wed, 10 Nov 2021 15:58:09 -0600 Subject: [PATCH 1/3] Add missing init of TIsAProxy::fNextLastSlot. (thanks valgrind for pointing this out) --- core/meta/src/TIsAProxy.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/meta/src/TIsAProxy.cxx b/core/meta/src/TIsAProxy.cxx index 55b463452d929..57504c4a0372c 100644 --- a/core/meta/src/TIsAProxy.cxx +++ b/core/meta/src/TIsAProxy.cxx @@ -47,7 +47,7 @@ namespace { TIsAProxy::TIsAProxy(const std::type_info& typ) : fType(&typ), fClass(nullptr), - fSubTypesReaders(0), fSubTypesWriteLockTaken(kFALSE), + fSubTypesReaders(0), fSubTypesWriteLockTaken(kFALSE), fNextLastSlot(0), fInit(kFALSE), fVirtual(kFALSE) { static_assert(sizeof(ClassMap_t)<=sizeof(fSubTypes), "ClassMap size is to large for array"); From 7c6986d858356584c0d4fd2d4153000f1b1ce661 Mon Sep 17 00:00:00 2001 From: Philippe Canal Date: Tue, 25 Jan 2022 17:58:47 -0600 Subject: [PATCH 2/3] TBranchElement::InitInfo improve doc --- tree/tree/src/TBranchElement.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tree/tree/src/TBranchElement.cxx b/tree/tree/src/TBranchElement.cxx index 04fab60c23378..e725b4b5ce634 100644 --- a/tree/tree/src/TBranchElement.cxx +++ b/tree/tree/src/TBranchElement.cxx @@ -2236,7 +2236,7 @@ void TBranchElement::InitInfo() Bool_t seenExisting = kFALSE; fOnfileObject = new TVirtualArray( info->GetElement(0)->GetClassPointer(), arrlen ); - // Propagate this to all the other branch belonging to the same object. + // Propagate this to all the other branches belonging to the same object. TObjArray *branches = toplevel ? GetListOfBranches() : GetMother()->GetSubBranch(this)->GetListOfBranches(); Int_t nbranches = branches->GetEntriesFast(); TBranchElement *lastbranch = this; From 40ffef6cababb5b4207db77513b9ef09a3c1d80c Mon Sep 17 00:00:00 2001 From: Philippe Canal Date: Tue, 15 Feb 2022 17:31:26 -0600 Subject: [PATCH 3/3] TBranchElement: no drilling through new members. This resolved the problem seen at: https://github.com/cms-sw/cmssw/issues/36908#issuecomment-1036397481 and fix #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. --- tree/tree/src/TBranchElement.cxx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tree/tree/src/TBranchElement.cxx b/tree/tree/src/TBranchElement.cxx index e725b4b5ce634..76c096b154068 100644 --- a/tree/tree/src/TBranchElement.cxx +++ b/tree/tree/src/TBranchElement.cxx @@ -2068,11 +2068,15 @@ 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(); @@ -2080,6 +2084,10 @@ static void GatherArtificialElements(const TObjArray &branches, TStreamerInfoAct } } + if (!foundRelatedSplit) { + continue; + } + if (!nextinfo) { nextinfo = (TStreamerInfo *)elementClass->GetStreamerInfo(); if (elementClass->GetCollectionProxy() && elementClass->GetCollectionProxy()->GetValueClass()) {