56 void RemovePrefix(
TString& str,
const char* prefix) {
58 if (str.
Length() && prefix && strlen(prefix)) {
59 if (!str.
Index(prefix)) {
60 str.
Remove(0, strlen(prefix));
85 for (
Int_t i = 0; i < nbranches; ++i) {
88 case 31: br->
SetType(41);
break;
110 return CanSelfReference(inside);
115 const static TClassRef stringClass(
"std::string");
159 , fReadActionSequence(0)
160 , fFillActionSequence(0)
209 Init(tree, 0, bname,sinfo,
id,pointer,basketsize,splitlevel,btype);
251 Init(parent ? parent->
GetTree() : 0, parent, bname,sinfo,
id,pointer,basketsize,splitlevel,btype);
270 if (
fTree == 0)
return;
362 if (hasCustomStreamer) {
415 if (splitlevel > 0) {
436 if (!strcmp(name, clOfElement->
GetName())) {
463 Unroll(name, clOfElement, clOfElement, pointer, basketsize, splitlevel+splitSTLP, 0);
464 if (strchr(bname,
'.')) {
497 char **ppointer = (
char**)(pointer);
538 Unroll(name, clOfClones, clOfClones, pointer, basketsize, splitlevel+splitSTLP, 31);
545 TClass* contCl = elementClass;
590 Unroll(name, valueClass, valueClass, pointer, basketsize, splitlevel+splitSTLP, 41);
603 TClass* clm = elementClass;
604 Int_t err =
Unroll(name, clm, clm, pointer, basketsize, splitlevel+splitSTLP, 0);
660 Init(tree, 0, bname, clones, basketsize, splitlevel, compress);
684 Init(parent ? parent->
GetTree() : 0, parent, bname, clones, basketsize, splitlevel, compress);
727 if (basketsize < 100) basketsize = 100;
747 Error(
"Init",
"Missing class object of the TClonesArray %s\n",clones->
GetName());
759 std::string branchname = name + std::string(
"_");
761 leaf->
SetName(branchname.c_str());
763 Unroll(name, clonesClass, clonesClass, 0, basketsize, splitlevel, 31);
803 Init(tree, 0, bname, cont, basketsize, splitlevel, compress);
826 Init(parent ? parent->
GetTree() : 0, parent, bname, cont, basketsize, splitlevel, compress);
838 if (name[name.
Length()-1]==
'.') {
880 if (basketsize < 100) {
921 Unroll(name, valueClass, valueClass, 0, basketsize, splitlevel, 41);
1000 if (nbranches > 0) {
1001 TList persistentBranches;
1004 while((branch=(
TBranch*)iB())) {
1005 if (branch->
IsFolder()) persistentBranches.
Add(branch);
1031 mempos=strMember.
First(
'[');
1036 }
else persistentBranches.
Add(branch);
1039 persistentBranches.
Browse(b);
1060 pos = mothername.
First(
'[');
1066 if (mothername(len-1) !=
'.') {
1071 TString doublename = mothername;
1073 Int_t isthere = (name.
Index(doublename) == 0);
1078 doublename.
Append(mothername);
1079 isthere = (name.
Index(doublename) == 0);
1115 for (
Int_t i = 0; i < nbranches; ++i) {
1119 }
else if (
fType == 4) {
1122 Error(
"BuildTitle",
"This cannot happen, fType of parent is not 3 or 4!");
1126 const char* fin = strrchr(bre->
GetTitle(),
'.');
1159 if ((stype > 40) && (stype < 61)) {
1201 Error(
"Fill",
"attempt to fill branch %s while addresss is not set",
GetName());
1224 Error(
"Fill",
"Failed filling branch:%s, nbytes=%d",
GetName(), nwrite);
1236 Error(
"Fill",
"Failed filling branch:%s, nbytes=%d",
GetName(), nwrite);
1244 for (
Int_t i = 0; i < nbranches; ++i) {
1247 nwrite = branch->
Fill();
1249 Error(
"Fill",
"Failed filling branch:%s.%s, nbytes=%d",
GetName(), branch->
GetName(), nwrite);
1262 printf(
"Fill: %lld, branch=%s, nbytes=%d\n", entry,
GetName(), nbytes);
1300 }
else if (
fType == 31) {
1321 Error(
"FillLeaves",
"The branch counter address was zero!");
1327 Error(
"FillLeaves",
"Clonesa: %s, n=%d, sorry not supported yet",
GetName(), n);
1350 for (
Int_t ii = 0; ii <
n; ++ii) {
1360 for (
Int_t ii = 0; ii <
n; ++ii) {
1443 Error(
"FillLeaves",
"Cannot get streamer info for branch '%s'",
GetName());
1474 Error(
"FillLeaves",
"Cannot get streamer info for branch '%s'",
GetName());
1504 Error(
"FillLeaves",
"Cannot get streamer info for branch '%s'",
GetName());
1535 Error(
"FillLeaves",
"Cannot get streamer info for branch '%s'",
GetName());
1590 Error(
"FillLeaves",
"Cannot get streamer info for branch '%s'",
GetName());
1595 char **end = arr +
n;
1672 Error(
"FillLeaves",
"Cannot get streamer info for branch '%s'",
GetName());
1716 Error(
"FillLeaves",
"Cannot get streamer info for branch '%s'",
GetName());
1730 if (name[name.length()-1]==
']') {
1731 std::size_t dim = name.find_first_of(
"[");
1732 if (dim != std::string::npos) {
1736 if (name[name.size()-1] !=
'.') {
1755 if (se && se->
IsBase()) {
1757 UInt_t len = strlen(name);
1763 std::string longnm_parent;
1767 longnm_parent +=
name;
1769 UInt_t namelen = strlen(name);
1773 for(
Int_t i = 0; i < nbranches; ++i) {
1776 const char *brname = branch->
GetName();
1777 UInt_t brlen = strlen(brname);
1778 if (brname[brlen-1]==
']') {
1779 const char *dim = strchr(brname,
'[');
1781 brlen = dim - brname;
1784 if (namelen == brlen
1785 && strncmp(name,brname,brlen) == 0) {
1788 if (brlen == longnm.length()
1789 && strncmp(longnm.c_str(),brname,brlen) == 0) {
1793 if (brlen == longnm_parent.length()
1794 && strncmp(longnm_parent.c_str(),brname,brlen) == 0) {
1798 if (namelen>brlen && name[brlen]==
'.' && strncmp(name,brname,brlen)==0) {
1809 for(
Int_t i = 0; i < nbranches; ++i) {
1815 if (si && br->
GetID() >= 0) {
1817 if (se && se->
IsBase()) {
1839 if (parent==
this || parent->
GetID()<0 )
return 0;
1844 if (! se->
IsBase() )
return 0;
1852 std::string longname( grand_parent->
GetName() );
1858 if ( longname == leafname ) {
1910 if ( !targetClass ) {
1911 Error(
"InitInfo",
"The target class dictionary is not present!" );
1929 target +=
"@@emulated";
1938 if( targetClass != cl ) {
1955 if( targetClass != cl )
1985 Error(
"InitInfo",
"StreamerInfo is not compiled.");
1996 size_t pos = s.rfind(
'.');
1997 if (pos != std::string::npos) {
1998 s = s.substr(pos+1);
2000 while ((pos = s.rfind(
'[')) != std::string::npos) {
2001 s = s.substr(0, pos);
2008 for (
size_t i = 0; i <
ndata; ++i) {
2060 for (
size_t i = 0; i <
ndata; ++i) {
2087 for (
Int_t i = 0; i < nbranches; ++i) {
2091 lastbranch = subbranch;
2123 const char* className = 0;
2160 Fatal(
"GetCollectionProxy",
2161 "Can not create a Collection Proxy of any kind for the class \"%s\" needed by the branch \"%s\" of the TTree \"%s\"!",
2165 "Fixing the collection proxy of the class \"%s\" \n" 2166 "\tneeded by the branch \"%s\" of the TTree \"%s\" to be similar to \"%s\".",
2172 }
else if (
fType == 41) {
2215 if (newInfo != brInfo) {
2224 if (newType.
Length()==0) {
2307 for (
Int_t i = 0; i < nbranches; ++i) {
2335 Info(
"GetEntry",
"%lld, branch=%s, nbytes=%d", entry,
GetName(), nbytes);
2353 if ((type == -1) || (
fID == -1)) {
2362 if (!expectedClass) {
2372 Error(
"GetExpectedType",
"Did not find the type for %s",
GetName());
2385 return "TBranchElement-folder";
2387 return "TBranchElement-leaf";
2448 const char *types[20] = {
2471 return types[itype];
2480 template <
typename T>
2500 }
else if (fOnfileObject) {
2531 }
else if (
fType <= 2) {
2556 }
else if (
fType == 41) {
2592 }
else if (fOnfileObject) {
2609 }
else if (
fType == 4) {
2612 }
else if (
fType == 31) {
2617 }
else if (
fType == 41) {
2622 }
else if (
fType <= 2) {
2637 }
else if (
fType == 41) {
2639 }
else if (prID < 0) {
2644 char **val = (
char**)(
object+
GetInfoImp()->TStreamerInfo::GetElementOffset(prID));
2687 Warning(
"InitializeOffsets",
"No branch class set for branch: %s",
GetName());
2704 Int_t localOffset = 0;
2717 Warning(
"InitializeOffsets",
"Streamer info for branch: %s has no elements array!",
GetName());
2724 Warning(
"InitializeOffsets",
"Cannot get streamer element for branch: %s!",
GetName());
2745 Error(
"InitializeOffsets",
"Could not find class for branch: %s",
GetName());
2759 stlParentName = br->
GetName();
2768 for (
Int_t subBranchIdx = 0; subBranchIdx < nbranches; ++subBranchIdx) {
2769 bool alternateElement =
false;
2773 if (subBranch == 0) {
2787 Warning(
"InitializeOffsets",
"No streamer info for branch: %s subbranch: %s",
GetName(), subBranch->
GetName());
2792 Warning(
"InitializeOffsets",
"No elements array for branch: %s subbranch: %s",
GetName(), subBranch->
GetName());
2798 if (!subBranchElement) {
2799 Warning(
"InitializeOffsets",
"No streamer element for branch: %s subbranch: %s",
GetName(), subBranch->
GetName());
2813 typedef TStreamerInfoActions::ActionContainer_t::iterator iterator;
2816 iter != end; ++iter) {
2821 subBranchElement =
e;
2822 alternateElement =
true;
2829 localOffset = subBranchElement->
GetOffset();
2838 && CanSelfReference(subBranchElement->
GetClass()))
2854 Warning(
"InitializeOffsets",
"Branch '%s' has no mother!",
GetName());
2860 if (motherName.Length() && strchr(motherName.Data(),
'.')) {
2864 if (motherName.Length() && (motherName[motherName.Length()-1] ==
'.')) {
2865 motherDotAtEnd =
kTRUE;
2869 if ((subBranch->
fType == 1) || (subBranchElement && subBranchElement->
IsBase())) {
2877 isBaseSubBranch =
kTRUE;
2881 if ((subBranch->
fType == 31) || (subBranch->
fType == 41)) {
2883 isContDataMember =
kTRUE;
2908 if (motherDotAtEnd) {
2910 dataName.
Remove(0, motherName.Length());
2912 if (!stlParentNameUpdated && stlParentName.
Length()) {
2913 stlParentName.
Remove(0, motherName.Length());
2914 stlParentNameUpdated =
kTRUE;
2916 }
else if (motherDot) {
2930 if (dataName.Length() == motherName.Length()) {
2931 dataName.Remove(0, motherName.Length());
2933 if (!stlParentNameUpdated && stlParentName.
Length()) {
2934 stlParentName.
Remove(0, motherName.Length());
2939 if (dataName.Length() > motherName.Length()) {
2940 dataName.
Remove(0, motherName.Length() + 1);
2941 if (!stlParentNameUpdated && stlParentName.
Length()) {
2942 stlParentName.
Remove(0, motherName.Length());
2947 stlParentNameUpdated =
kTRUE;
2948 if (isBaseSubBranch) {
2952 if (
pattern.Length() <= dataName.Length()) {
2953 if (!strcmp(dataName.Data() + (dataName.Length() -
pattern.Length()),
pattern.Data())) {
2957 dataName.Remove(dataName.Length() -
pattern.Length());
2961 if (dataName.Length()) {
2962 if (dataName[0] ==
'.') {
2963 dataName.Remove(0, 1);
2972 if (motherDotAtEnd) {
2974 parentName.
Remove(0, motherName.Length());
2975 }
else if (motherDot) {
2989 if (parentName.
Length() == motherName.Length()) {
2990 parentName.
Remove(0, motherName.Length());
2994 if (parentName.
Length() > motherName.Length()) {
2995 parentName.
Remove(0, motherName.Length() + 1);
3025 RemovePrefix(dataName, parentName);
3029 if (dataName.Length()) {
3030 if (dataName[0] ==
'.') {
3031 dataName.Remove(0, 1);
3036 if (dataName.Length()) {
3037 if (dataName[dataName.Length()-1] ==
'.') {
3038 dataName.Remove(dataName.Length() - 1, 1);
3054 if (dataName.Length()) {
3079 target +=
"@@emulated";
3097 Warning(
"InitializeOffsets",
"subBranch: '%s' has no parent class, and cannot get class for clones class: '%s'!", subBranch->
GetName(),
GetClonesName());
3101 Warning(
"InitializeOffsets",
"subBranch: '%s' has no parent class! Assuming parent class is: '%s'.", subBranch->
GetName(), pClass->
GetName());
3105 Warning(
"InitializeOffsets",
"subBranch: '%s' has no parent class! Assuming parent class is: '%s'.", subBranch->
GetName(), pClass ? pClass->
GetName() :
"unknowned class");
3110 pClass = branchClass;
3115 if (renamed && pClass) {
3116 if (pClass == branchClass) {
3128 if( dynamic_cast<TBranchSTL*>(
fParent) && stlParentName.
Length() )
3130 if( !strncmp( stlParentName.
Data(), dataName.Data(), stlParentName.
Length()-1 )
3131 && dataName[ stlParentName.
Length() ] ==
'.' )
3132 dataName.Remove( 0, stlParentName.
Length()+1 );
3139 if (alternateElement) {
3140 Ssiz_t dotpos = dataName.Last(
'.');
3141 Ssiz_t endpos = dataName.Length();
3142 if (dotpos !=
kNPOS) ++dotpos;
else dotpos = 0;
3143 dataName.Replace(dotpos,endpos-dotpos,subBranchElement->
GetFullName());
3164 Error(
"InitializeOffsets",
3165 "Could not find the real data member '%s' when constructing the branch '%s' [Likely missing ShowMember].",
3170 Info(
"InitializeOffsets",
3171 "TTree created with an older schema, some data might not be copied in 'slow-cloning' mode; fast-cloning should have the correct result. '%s' is missing when constructing the branch '%s'. ",
3175 Fatal(
"InitializeOffsets",
3176 "Could not find the real data member '%s' when constructing the branch '%s' [Likely an internal error, please report to the developers].",
3184 if (isBaseSubBranch) {
3187 Warning(
"InitializeOffsets",
"Could not find the data member name for branch '%s' with parent branch '%s', assuming offset is zero!", subBranch->
GetName(),
GetName());
3195 if (isContDataMember) {
3209 if (isBaseSubBranch) {
3216 subBranch->
SetOffset(offset - localOffset);
3226 }
else if (isSplit) {
3227 if (isBaseSubBranch) {
3238 if (isBaseSubBranch) {
3269 if (nbranches >= 1) {
3273 return browsables && browsables->
GetSize();
3288 if (basket &&
fTree) {
3301 bufbegin = entryOffset[entry-first];
3304 bufnext = entryOffset[entry+1-first];
3308 if (bufnext == bufbegin) {
3327 if (strncmp(option,
"debugAddress",strlen(
"debugAddress"))==0) {
3328 if (strlen(option)==strlen(
"debugAddress")) {
3329 Printf(
"%-24s %-16s %2s %4s %-16s %-16s %8s %8s %s\n",
3330 "Branch Name",
"Streamer Class",
"ID",
"Type",
"Class",
"Parent",
"pOffset",
"fOffset",
"fObject");
3339 Printf(
"%-16s %2d %4d %-16s %-16s %8x %8x %s\n",
3344 for (
Int_t i = 0; i < nbranches; ++i) {
3346 subbranch->
Print(
"debugAddressSub");
3350 if (strncmp(option,
"debugInfo",strlen(
"debugInfo"))==0) {
3357 Printf(
" with read actions:");
3359 Printf(
" with write actions:");
3362 TString suboption =
"debugInfoSub";
3363 suboption += (option+strlen(
"debugInfo"));
3364 for (
Int_t i = 0; i < nbranches; ++i) {
3366 subbranch->
Print(suboption);
3379 Printf(
"*............................................................................*");
3384 for (
Int_t i=0;i<nbranches;i++) {
3386 branch->
Print(option);
3406 }
else if (fOnfileObject) {
3443 }
else if (
fType <= 2) {
3460 }
else if (
fType == 3) {
3462 }
else if (
fType == 31) {
3467 }
else if (
fType == 41) {
3484 Fatal(
"ReadLeaves",
"The ReadLeaves function has not been configured for %s",
GetName());
3499 if ((n[0] < 0) || (n[0] >
fMaximum)) {
3504 Error(
"ReadLeaves",
"Incorrect size read for the container in %s\nThe size read is %d when the maximum is %d\nThe size is reset to 0 for this entry (%lld)",
GetName(), n[0],
fMaximum,
GetReadEntry());
3516 for (
Int_t i=0; i<nbranches; i++) {
3533 if (atype > 54)
return;
3542 if (!len_where)
return;
3547 for( k=0; k<
n; k++) {
3548 char **where = &(((
char**)
fAddress)[k]);
3552 case 1: {length = ((
Char_t*) len_where)[k];
break;}
3553 case 2: {length = ((
Short_t*) len_where)[k];
break;}
3554 case 3: {length = ((
Int_t*) len_where)[k];
break;}
3555 case 4: {length = ((
Long_t*) len_where)[k];
break;}
3557 case 6: {length = ((
Int_t*) len_where)[k];
break;}
3559 case 11: {length = ((
UChar_t*) len_where)[k];
break;}
3560 case 12: {length = ((
UShort_t*) len_where)[k];
break;}
3561 case 13: {length = ((
UInt_t*) len_where)[k];
break;}
3562 case 14: {length = ((
ULong_t*) len_where)[k];
break;}
3563 case 15: {length = ((
UInt_t*) len_where)[k];
break;}
3564 case 16: {length = ((
Long64_t*) len_where)[k];
break;}
3565 case 17: {length = ((
ULong64_t*)len_where)[k];
break;}
3566 case 18: {length = ((
Bool_t*) len_where)[k];
break;}
3570 if (length <= 0)
continue;
3571 if (isArray == 0)
continue;
3617 for (
Int_t ii=0;ii<
n;ii++) {
3626 for (
Int_t ii=0;ii<
n;ii++) {
3633 }
else if (
fType <= 2) {
3653 loc = counter.
Last(
']');
3657 countname += counter;
3663 Warning(
"ReadLeaves",
"Missing fBranchCount for %s. Data will not be read correctly by the MakeClass mode.",
GetName());
3689 for (
Int_t ii=0;ii<
n;ii++) {
3698 for (
Int_t ii=0;ii<
n;ii++) {
3753 Error(
"ReadLeaves",
"Incorrect size read for the container in %s\n\tThe size read is %d while the maximum is %d\n\tThe size is reset to 0 for this entry (%lld)",
GetName(), n,
fMaximum,
GetReadEntry());
3759 R__PushCache onfileObject(((
TBufferFile&)b),fOnfileObject,n);
3787 for (
Int_t i = 0; i < nbranches; ++i) {
3815 if( !
fNdata || *(
void**)proxy->
At( 0 ) != 0 )
3820 void **el = (
void**)proxy->
At( i );
3822 *el = elClass->
New();
3826 proxy->
Commit(alternate);
3852 if (info == 0)
return;
3893 if (info == 0)
return;
3924 if (info == 0)
return;
3957 Error(
"ReadLeaves",
"Incorrect size read for the container in %s\n\tThe size read is %d while the maximum is %d\n\tThe size is reset to 0 for this entry (%lld)",
GetName(), n,
fMaximum,
GetReadEntry());
3996 if (info==0)
return;
4004 char **end = arr +
fNdata;
4026 R__PushCache onfileObject(((
TBufferFile&)b),fOnfileObject,1);
4078 R__PushCache onfileObject(((
TBufferFile&)b),fOnfileObject,1);
4113 R__PushCache onfileObject(((
TBufferFile&)b),fOnfileObject,1);
4134 R__PushCache onfileObject(((
TBufferFile&)b),fOnfileObject,1);
4143 Fatal(
"FillLeaves",
"The FillLeaves function has not been configured for %s",
GetName());
4166 }
else if (
fType == 4) {
4171 Warning(
"ReleaseObject",
"Cannot delete allocated STL container because I do not have a proxy! branch: %s",
GetName());
4175 if (needDelete &&
fID >= 0) {
4182 proxy->
Clear(
"force");
4207 proxy->
Clear(
"force");
4211 proxy->
Clear(
"force");
4232 for (
Int_t i = 0; i < nbranches; ++i) {
4234 branch->
Reset(option);
4247 for (
Int_t i = 0; i < nbranches; ++i) {
4269 for (
Int_t i = 0; i < nbranches; ++i) {
4295 for (
Int_t i = 0; i < nb; ++i) {
4436 if (
Long_t(addr) == -1) {
4528 if (clm == content) {
4534 Warning(
"SetAddress",
"The type of the %s was changed from TClonesArray to %s but we do not have a TVirtualCollectionProxy for that container type!",
GetName(), newType->
GetName());
4560 }
else if (
fType == 4) {
4572 for (
Int_t i = 0; i < nbranches; ++i) {
4605 for (
Int_t i = 0; i < nbranches; ++i) {
4633 Error(
"SetAddress",
"For %s, we can not convert %s into %s\n",
4766 Error(
"SetAddress",
"Embedded TClonesArray given a zero address for branch '%s'",
GetName());
4782 Error(
"SetAddress",
"Embedded pointer to a TClonesArray given a zero address for branch '%s'",
GetName());
4786 }
else if (
fType == 4) {
4813 Error(
"SetAddress",
"Failed to allocate STL container for branch '%s'",
GetName());
4830 Error(
"SetAddress",
"Failed to allocate STL container for branch '%s'",
GetName());
4849 Error(
"SetAddress",
"Embedded STL container given a zero address for branch '%s'",
GetName());
4862 Error(
"SetAddress",
"Failed to allocate STL container for branch '%s'",
GetName());
4870 Error(
"SetAddress",
"Embedded pointer to an STL container given a zero address for branch '%s'",
GetName());
4874 }
else if (
fType == 41) {
4880 }
else if (
fID < 0) {
4900 Error(
"SetAddress",
"I have no TClass for branch %s, so I cannot allocate an I/O buffer!",
GetName());
4927 for (
Int_t i = 0; i < nbranches; ++i) {
4950 for (
Int_t i = 0; i < nbranches; ++i) {
4966 if (leafOfCounter && leaf) {
4969 if (!leafOfCounter) {
4970 Warning(
"SetBranchCount",
"Counter branch %s for branch %s has no leaves!", brOfCounter->
GetName(),
GetName());
4973 Warning(
"SetBranchCount",
"Branch %s has no leaves!",
GetName());
4992 for (
Int_t i = 0; i < nbranches; ++i) {
5060 original =
transient;
5063 }
else if (
fType == 31) {