81 {
82 bool updated = false;
83 const TObjArray* fromBranches = fromTree->GetListOfBranches();
84 const TObjArray* toBranches = toTree->GetListOfBranches();
85 int nBranches = fromBranches->GetEntriesFast();
86 for (
int k = 0;
k < nBranches; ++
k) {
87 TBranch* branch = static_cast<TBranch*>(fromBranches->UncheckedAt(k));
88 if (toBranches->FindObject(branch->GetName()) == nullptr) {
89 TBranch* newBranch = nullptr;
90 TClass*
cl = TClass::GetClass(branch->GetClassName());
93 if (strlen(branch->GetClassName()) > 0) {
94 newBranch = toTree->Branch(branch->GetName(), branch->GetClassName(), nullptr, branch->GetBasketSize(), branch->GetSplitLevel());
95 newBranch->SetAddress(
empty);
96 } else {
97 TObjArray* outLeaves = branch->GetListOfLeaves();
98 TLeaf* leaf = static_cast<TLeaf*>(outLeaves->UncheckedAt(0));
99 std::string
type = leaf->GetTypeName();
100 std::string attr = leaf->GetName();
101 if (type ==
"Int_t")
type = attr +
"/I";
102 else if (type ==
"Short_t")
type = attr +
"/S";
103 else if (type ==
"Long_t")
type = attr +
"/L";
104 else if (type ==
"UInt_t")
type = attr +
"/i";
105 else if (type ==
"UShort_t")
type = attr +
"/s";
106 else if (type ==
"ULong_t")
type = attr +
"/l";
107 else if (type ==
"Float_t")
type = attr +
"/F";
108 else if (type ==
"Double_t")
type = attr +
"/D";
109 else if (type ==
"Char_t")
type = attr +
"/B";
110 else if (type ==
"UChar_t")
type = attr +
"/b";
111 else if (type ==
"Bool_t")
type = attr +
"/O";
112 newBranch = toTree->Branch(branch->GetName(),
static_cast<void*
>(
nullptr),
type.c_str(), 2048);
113 }
114 int nEntries = toTree->GetEntries();
116 newBranch->BackFill();
117 }
118 updated = true;
119 }
120 }
121 return updated;
122 }
static const Attributes_t empty