73 {
74 bool updated = false;
75 const TObjArray* fromBranches = fromTree->GetListOfBranches();
76 const TObjArray* toBranches = toTree->GetListOfBranches();
77 int nBranches = fromBranches->GetEntriesFast();
79 for (
int k = 0;
k < nBranches; ++
k) {
80 TBranch* branch = static_cast<TBranch*>(fromBranches->UncheckedAt(k));
81 if (toBranches->FindObject(branch->GetName()) == nullptr) {
82 TBranch* newBranch = nullptr;
83 TClass*
cl = TClass::GetClass(branch->GetClassName());
84 if (cl != nullptr) {
85 newBranch = toTree->Branch(branch->GetName(), branch->GetClassName(), nullptr, branch->GetBasketSize(), branch->GetSplitLevel());
87 newBranch->SetAddress(objectAddress);
88 } else {
89 TObjArray* outLeaves = branch->GetListOfLeaves();
90 TLeaf* leaf = static_cast<TLeaf*>(outLeaves->UncheckedAt(0));
91 std::string_view attr = leaf->GetName();
92 std::string_view
type = leaf->GetTypeName();
93 std::string branchSpec(attr);
94 branchSpec += '/';
95 if (type == "Int_t") branchSpec += 'I';
96 else if (type == "Short_t") branchSpec += 'S';
97 else if (type == "Long_t") branchSpec += 'L';
98 else if (type == "UInt_t") branchSpec +='i';
99 else if (type == "UShort_t") branchSpec+='s';
100 else if (type == "ULong_t") branchSpec +='l';
101 else if (type == "Float_t") branchSpec +='F';
102 else if (type == "Double_t") branchSpec+='D';
103 else if (type == "Char_t") branchSpec +='B';
104 else if (type == "UChar_t") branchSpec +='b';
105 else if (type == "Bool_t") branchSpec +='O';
106 else { branchSpec +=
type; }
107 newBranch = toTree->Branch(branch->GetName(), static_cast<void*>(nullptr), branchSpec.c_str(), 2048);
108 }
110 newBranch->BackFill();
111 }
112 updated = true;
113 }
114 }
115 return updated;
116 }
void * getCachedObjectAddress(TClass *cl, std::unordered_map< TClass *, void * > &cache)