481 case kchar:
return 0;
486 case kBits:
return 0;
522 fMethodBit(tfl.fMethodBit),
523 fPrevious(tfl.fPrevious)
547 fTree->fFriendLockStatus &= ~(fMethodBit &
kBitMask);
574 entryInRange = firstEntry;
577 entryInRange = firstEntry - pedestal;
585 if (autoflush <= 0) {
588 fStartEntry = pedestal + entryInRange - entryInRange%autoflush;
613 auto autoFlush = fTree->GetAutoFlush();
614 if (autoFlush > 0)
return autoFlush;
615 if (fEstimatedSize > 0)
return fEstimatedSize;
617 Long64_t zipBytes = fTree->GetZipBytes();
619 fEstimatedSize = fTree->GetEntries() - 1;
620 if (fEstimatedSize <= 0)
624 Long64_t cacheSize = fTree->GetCacheSize();
625 if (cacheSize == 0) {
636 if (cacheSize <= 0) {
637 cacheSize = 30000000;
639 clusterEstimate = fTree->GetEntries() * cacheSize / zipBytes;
641 fEstimatedSize = clusterEstimate ? clusterEstimate : 1;
643 return fEstimatedSize;
652 fStartEntry = fNextEntry;
653 if (fTree->fNClusterRange || fTree->GetAutoFlush() > 0) {
654 if (fClusterRange == fTree->fNClusterRange) {
657 fNextEntry += GetEstimatedClusterSize();
659 if (fStartEntry > fTree->fClusterRangeEnd[fClusterRange]) {
662 if (fClusterRange == fTree->fNClusterRange) {
665 fNextEntry += GetEstimatedClusterSize();
667 Long64_t clusterSize = fTree->fClusterSize[fClusterRange];
668 if (clusterSize == 0) {
669 clusterSize = GetEstimatedClusterSize();
671 fNextEntry += clusterSize;
672 if (fNextEntry > fTree->fClusterRangeEnd[fClusterRange]) {
676 fNextEntry = fTree->fClusterRangeEnd[fClusterRange] + 1;
682 fNextEntry = fStartEntry + GetEstimatedClusterSize();
684 if (fNextEntry > fTree->GetEntries()) {
685 fNextEntry = fTree->GetEntries();
696 fNextEntry = fStartEntry;
697 if (fTree->fNClusterRange || fTree->GetAutoFlush() > 0) {
698 if (fClusterRange == 0 || fTree->fNClusterRange == 0) {
701 fStartEntry -= GetEstimatedClusterSize();
706 if (fClusterRange == 0) {
710 Long64_t clusterSize = fTree->fClusterSize[fClusterRange];
711 if (clusterSize == 0) {
712 clusterSize = GetEstimatedClusterSize();
714 fStartEntry -= clusterSize;
719 fStartEntry = fNextEntry - GetEstimatedClusterSize();
721 if (fStartEntry < 0) {
832, fDefaultEntryOffsetLen(1000)
838, fAutoSave( -300000000)
839, fAutoFlush(-30000000)
871, fFriendLockStatus(0)
873, fCacheDoAutoInit(
kTRUE)
874, fCacheDoClusterPrefetch(
kFALSE)
876, fIMTEnabled(
ROOT::IsImplicitMTEnabled())
877, fNEntriesSinceSorting(0)
910 if (strlen(title) > 2) {
911 if (title[0] ==
'/') {
912 Branch(title+1,32000,splitlevel);
927#ifdef R__TRACK_BASKET_ALLOC_TIME
928 Info(
"TTree::~TTree",
"For tree %s, allocation time is %lluus.",
GetName(), fAllocationTime.load());
1063 Error(
"AddBranchToCache",
"Could not load a tree");
1072 Error(
"AddBranchToCache",
"No tree is available. Branch was not added to the cache");
1078 Error(
"AddBranchToCache",
"No file is available. Branch was not added to the cache");
1083 Error(
"AddBranchToCache",
"No cache is available, branch not added");
1086 return tc->
AddBranch(bname,subbranches);
1102 Error(
"AddBranchToCache",
"Could not load a tree");
1110 Error(
"AddBranchToCache",
"Error adding branch");
1115 Error(
"AddBranchToCache",
"No tree is available. Branch was not added to the cache");
1121 Error(
"AddBranchToCache",
"No file is available. Branch was not added to the cache");
1126 Error(
"AddBranchToCache",
"No cache is available, branch not added");
1146 Error(
"DropBranchFromCache",
"Could not load a tree");
1155 Error(
"DropBranchFromCache",
"No tree is available. Branch was not dropped from the cache");
1161 Error(
"DropBranchFromCache",
"No file is available. Branch was not dropped from the cache");
1166 Error(
"DropBranchFromCache",
"No cache is available, branch not dropped");
1185 Error(
"DropBranchFromCache",
"Could not load a tree");
1193 Error(
"DropBranchFromCache",
"Error dropping branch");
1198 Error(
"DropBranchFromCache",
"No tree is available. Branch was not dropped from the cache");
1204 Error(
"DropBranchFromCache",
"No file is available. Branch was not dropped from the cache");
1209 Error(
"DropBranchFromCache",
"No cache is available, branch not dropped");
1244 const auto friendHasValidIndex = [&] {
1249 if ((isMainReshuffled || isFriendReshuffled) && !friendHasValidIndex) {
1250 const auto reshuffledTreeName = isMainReshuffled ? mainTree.
GetName() : friendTree.
GetName();
1251 const auto msg =
"Tree '%s' has the kEntriesReshuffled bit set, and cannot be used as friend nor can be added as "
1252 "a friend unless the main tree has a TTreeIndex on the friend tree '%s'. You can also unset the "
1253 "bit manually if you know what you are doing.";
1254 Error(
"AddFriend", msg, reshuffledTreeName, friendTree.
GetName());
1339 bool canAddFriend =
true;
1343 Warning(
"AddFriend",
"FriendElement %s in file %s has less entries %lld than its parent Tree: %lld", treename,
1347 Error(
"AddFriend",
"Cannot find tree '%s' in file '%s', friend not added", treename,
filename);
1348 canAddFriend =
false;
1373 bool canAddFriend =
true;
1377 Warning(
"AddFriend",
"FriendElement %s in file %s has less entries %lld than its parent tree: %lld", treename,
1381 Error(
"AddFriend",
"Cannot find tree '%s' in file '%s', friend not added", treename,
file->GetName());
1382 canAddFriend =
false;
1408 Warning(
"AddFriend",
"FriendElement '%s' in file '%s' has less entries %lld than its parent tree: %lld",
1415 tree->RemoveExternalFriend(fe);
1508 if (opt.
Contains(
"flushbaskets")) {
1509 if (
gDebug > 0)
Info(
"AutoSave",
"calling FlushBaskets \n");
1528 if (
file)
file->WriteStreamerInfo();
1542 const char* writeStlWithoutProxyMsg =
"The class requested (%s) for the branch \"%s\""
1543 " is an instance of an stl collection and does not have a compiled CollectionProxy."
1544 " Please generate the dictionary for this collection (%s) to avoid to write corrupted data.";
1558 Error(
"Branch", writeStlWithoutProxyMsg,
1562 return Branch(branchname, classname, (
void*) addobj, bufsize, splitlevel);
1565 void** addr = (
void**) addobj;
1569 if (ptrClass && claim) {
1576 Error(
"Branch",
"The class requested (%s) for \"%s\" is different from the type of the pointer passed (%s)",
1579 }
else if (actualClass && (claim != actualClass) && !actualClass->
InheritsFrom(claim)) {
1584 Error(
"Branch",
"The actual class (%s) of the object provided for the definition of the branch \"%s\" does not inherit from %s",
1590 Error(
"Branch", writeStlWithoutProxyMsg,
1594 return Branch(branchname, classname, (
void*) addobj, bufsize, splitlevel);
1604 Error(
"Branch",
"The pointer specified for %s is not of a class known to ROOT", branchname);
1608 void** addr = (
void**) addobj;
1609 if (addr && *addr) {
1612 Warning(
"Branch",
"The actual TClass corresponding to the object provided for the definition of the branch \"%s\" is missing.\n\tThe object will be truncated down to its %s part",
1613 branchname, ptrClass->
GetName());
1614 actualClass = ptrClass;
1615 }
else if ((ptrClass != actualClass) && !actualClass->
InheritsFrom(ptrClass)) {
1616 Error(
"Branch",
"The actual class (%s) of the object provided for the definition of the branch \"%s\" does not inherit from %s", actualClass->
GetName(), branchname, ptrClass->
GetName());
1620 actualClass = ptrClass;
1623 Error(
"Branch", writeStlWithoutProxyMsg,
1627 return Branch(branchname, actualClass->
GetName(), (
void*) addobj, bufsize, splitlevel);
1639 Error(
"Branch", writeStlWithoutProxyMsg,
1642 }
else if (claim == 0) {
1643 Error(
"Branch",
"The pointer specified for %s is not of a class known to ROOT and %s is not a known class", branchname, classname);
1650 Error(
"Branch",
"Reference interface requires a valid object (for branch: %s)!", branchname);
1654 if (ptrClass && claim) {
1661 Error(
"Branch",
"The class requested (%s) for \"%s\" is different from the type of the object passed (%s)",
1664 }
else if (actualClass && (claim != actualClass) && !actualClass->
InheritsFrom(claim)) {
1669 Error(
"Branch",
"The actual class (%s) of the object provided for the definition of the branch \"%s\" does not inherit from %s",
1675 Warning(
"Branch",
"The actual TClass corresponding to the object provided for the definition of the branch \"%s\" is missing.\n\tThe object will be truncated down to its %s part",
1676 branchname, ptrClass->
GetName());
1677 actualClass = ptrClass;
1678 }
else if ((ptrClass != actualClass) && !actualClass->
InheritsFrom(ptrClass)) {
1679 Error(
"Branch",
"The actual class (%s) of the object provided for the definition of the branch \"%s\" does not inherit from %s", actualClass->
GetName(), branchname, ptrClass->
GetName());
1683 Error(
"Branch", writeStlWithoutProxyMsg,
1698 Error(
"Branch",
"The pointer specified for %s is not of a class or type known to ROOT", branchname);
1701 return Branch(branchname,addobj,varname.
Data(),bufsize);
1707 Error(
"Branch",
"Reference interface requires a valid object (for branch: %s)!", branchname);
1712 Warning(
"Branch",
"The actual TClass corresponding to the object provided for the definition of the branch \"%s\" is missing.\n\tThe object will be truncated down to its %s part",
1713 branchname, ptrClass->
GetName());
1714 actualClass = ptrClass;
1715 }
else if ((ptrClass != actualClass) && !actualClass->
InheritsFrom(ptrClass)) {
1716 Error(
"Branch",
"The actual class (%s) of the object provided for the definition of the branch \"%s\" does not inherit from %s", actualClass->
GetName(), branchname, ptrClass->
GetName());
1720 Error(
"Branch", writeStlWithoutProxyMsg,
1735 "The inner type of the std::array passed specified for %s is not of a class or type known to ROOT",
1740 return Branch(branchname, addobj, varname.
Data(), bufsize);
1841 Error(
"Branch",
"Cannot call this constructor for a TClonesArray");
1847 while ((obj = next())) {
1855 Branch(col, bufsize, splitlevel - 1, branchname);
1857 if (nch && (
name[nch-1] ==
'_')) {
1866 if (splitlevel > 99) {
1892 char* curname =
new char[1000];
1894 while ((obj = next())) {
1897 Branch(curname, bufsize, splitlevel - 1);
1900 for (
Int_t i = 0; i < 1000; ++i) {
1901 if (curname[i] == 0) {
1904 if (curname[i] ==
'/') {
1911 strlcat(curname, occur,1000);
2022 return Bronch(
name, classname, addobj, bufsize, splitlevel);
2024 if (splitlevel < 0) {
2027 return BranchOld(
name, classname, addobj, bufsize, splitlevel);
2076 Error(
"BranchOld",
"Cannot find class: '%s'", classname);
2081 Fatal(
"BranchOld",
"The requested class ('%s') does not inherit from TObject.\n"
2082 "\tfgBranchStyle is set to zero requesting by default to use BranchOld.\n"
2083 "\tIf this is intentional use Bronch instead of Branch or BranchOld.", classname);
2085 Fatal(
"BranchOld",
"The requested class ('%s') does not inherit from TObject.\n"
2086 "\tYou can not use BranchOld to store objects of this type.",classname);
2097 const char* rdname = 0;
2098 const char* dname = 0;
2100 char** apointer = (
char**) addobj;
2112 if (
name[lenName-1] ==
'.') {
2151 if (!strcmp(dname,
"fBits")) {
2154 if (!strcmp(dname,
"fUniqueID")) {
2164 branchname = rdname;
2168 branchname.
Form(
"%s%s",
name, &rdname[1]);
2170 branchname.
Form(
"%s%s",
name, &rdname[0]);
2176 char* pointer = ((
char*) obj) +
offset;
2185 char* cpointer = (
char*) pointer;
2186 char** ppointer = (
char**) cpointer;
2188 if (splitlevel != 2) {
2190 branch1 =
new TBranchClones(branch,branchname, pointer, bufsize);
2195 blist->
Add(branch1);
2203 blist->
Add(branch1);
2220 blist->
Add(branch1);
2244 if (!strcmp(rdi->
GetName(), aindex)) {
2256 leaflist.
Form(
"%s[%s]/%c", &rdname[0],
index, vcode);
2258 Error(
"BranchOld",
"Cannot create branch for rdname: %s code: %d", branchname.
Data(), code);
2265 leaflist.
Form(
"%s/%s", dname,
"C");
2278 branch1 =
new TBranch(branch, bname, *((
void**) pointer), leaflist, bufsize);
2282 blist->
Add(branch1);
2289 leaflist.
Form(
"%s/%c", rdname, vcode);
2291 Error(
"BranchOld",
"Cannot create branch for rdname: %s code: %d", branchname.
Data(), code);
2294 branch1 =
new TBranch(branch, branchname, pointer, leaflist, bufsize);
2296 blist->
Add(branch1);
2305 Warning(
"BranchOld",
"Cannot process member: '%s'", rdname);
2414 Error(
"Bronch",
"Cannot find class:%s", classname);
2425 objptr = (
char*)addr;
2427 objptr = *((
char**) addr);
2433 Error(
"Bronch",
"Pointer to TClonesArray is null");
2437 Error(
"Bronch",
"TClonesArray with no class defined in branch: %s",
name);
2441 Error(
"Bronch",
"TClonesArray with no dictionary defined in branch: %s",
name);
2445 if (splitlevel > 0) {
2446 if (hasCustomStreamer)
2447 Warning(
"Bronch",
"Using split mode on a class: %s with a custom Streamer", clones->
GetClass()->
GetName());
2462 if (!inklass && (collProxy->
GetType() == 0)) {
2463 Error(
"Bronch",
"%s with no class defined in branch: %s", classname,
name);
2470 Error(
"Bronch",
"Container with no dictionary defined in branch: %s",
name);
2474 Warning(
"Bronch",
"Using split mode on a class: %s with a custom Streamer", inklass->
GetName());
2485 branch =
new TBranchSTL(
this,
name, collProxy, bufsize, splitlevel );
2499 Error(
"Bronch",
"Cannot find dictionary for class: %s", classname);
2505 hasCustomStreamer =
kTRUE;
2508 if (splitlevel < 0 || ((splitlevel == 0) && hasCustomStreamer && cl->
IsTObject())) {
2539 objptr = (
char*) cl->
New();
2547 if ((splitlevel > 0) && !cl->
CanSplit()) {
2548 if (splitlevel != 99) {
2549 Warning(
"Bronch",
"%s cannot be split, resetting splitlevel to 0", cl->
GetName());
2563 Error(
"Bronch",
"Cannot build the StreamerInfo for class: %s", cl->
GetName());
2572 if (splitlevel > 0) {
2583 branch->
Unroll(
name, cl, sinfo, objptr, bufsize, splitlevel);
2752 constexpr auto kBufSize = 2000;
2753 char* fname =
new char[kBufSize];
2756 for (
Int_t i = 0; i < 10; ++i) {
2764 strlcpy(fname,
file->GetName(), kBufSize);
2767 char* cunder = strrchr(fname,
'_');
2770 const char* cdot = strrchr(
file->GetName(),
'.');
2772 strlcat(fname, cdot, kBufSize);
2777 strlcat(fname, fcount, kBufSize);
2780 char* cdot = strrchr(fname,
'.');
2783 strlcat(fname, strrchr(
file->GetName(),
'.'), kBufSize);
2787 strlcat(fname, fcount, kBufSize);
2794 Warning(
"ChangeFile",
"file %s already exist, trying with %d underscores", fname, nus+1);
2796 Int_t compress =
file->GetCompressionSettings();
2799 Error(
"Fill",
"Failed to open new file %s, continuing as a memory tree.",fname);
2801 Printf(
"Fill: Switching to new file: %s", fname);
2807 while ((obj =
file->GetList()->First())) {
2824 while ((branch = (
TBranch*)nextb())) {
2833 if (newfile) newfile->
Append(obj);
2836 file->TObject::Delete();
2873 TClass* expectedClass = 0;
2880 if (expectedClass && datatype ==
kOther_t && ptrClass == 0) {
2881 if (isBranchElement) {
2886 Error(
"SetBranchAddress",
"Unable to determine the type given for the address for \"%s\". "
2887 "The class expected (%s) refers to an stl collection and do not have a compiled CollectionProxy. "
2888 "Please generate the dictionary for this class (%s)",
2895 Error(
"SetBranchAddress",
"Unable to determine the type given for the address for \"%s\". "
2896 "The class expected (%s) does not have a dictionary and needs to be emulated for I/O purposes but is being passed a compiled object."
2897 "Please generate the dictionary for this class (%s)",
2900 Error(
"SetBranchAddress",
"Unable to determine the type given for the address for \"%s\". "
2901 "This is probably due to a missing dictionary, the original data class for this branch is %s.", branch->
GetName(), expectedClass->
GetName());
2905 if (expectedClass && ptrClass && (branch->
GetMother() == branch)) {
2908 Error(
"SetBranchAddress",
"The address for \"%s\" should be the address of a pointer!", branch->
GetName());
2928 if( expectedClass && ptrClass &&
2929 expectedClass != ptrClass &&
2937 Info(
"SetBranchAddress",
"Matching STL collection (at least according to the SchemaRuleSet when "
2938 "reading a %s into a %s",expectedClass->
GetName(),ptrClass->
GetName());
2945 Error(
"SetBranchAddress",
"The pointer type given \"%s\" does not correspond to the type needed \"%s\" by the branch: %s", ptrClass->
GetName(), bEl->
GetClassName(), branch->
GetName());
2956 }
else if (expectedClass && ptrClass && !expectedClass->
InheritsFrom(ptrClass)) {
2978 Error(
"SetBranchAddress",
"The pointer type given (%s) does not correspond to the class needed (%s) by the branch: %s", ptrClass->
GetName(), expectedClass->
GetName(), branch->
GetName());
2979 if (isBranchElement) {
2988 Error(
"SetBranchAddress",
"The pointer type given \"%s\" (%d) does not correspond to the type needed \"%s\" (%d) by the branch: %s",
2995 if (expectedClass) {
2996 Error(
"SetBranchAddress",
"The pointer type given \"%s\" (%d) does not correspond to the type needed \"%s\" by the branch: %s",
2998 if (isBranchElement) {
3014 if (etype == expectedType) {
3029 if (etype == expectedType) {
3041 if (len <= ptrClass->Size()) {
3045 Error(
"SetBranchAddress",
"The pointer type given \"%s\" does not correspond to the type needed \"%s\" (%d) by the branch: %s",
3051 Error(
"SetBranchAddress", writeStlWithoutProxyMsg,
3053 if (isBranchElement) {
3059 if (isBranchElement) {
3060 if (expectedClass) {
3169 for (
Int_t i = 0; i < nb; ++i) {
3179 if (thistree !=
this) {
3204 for (
Int_t lndx = 0; lndx < nleaves; ++lndx) {
3210 if (branch && (newcomp > -1)) {
3219 for (
Long64_t i = 0; i < nb; ++i) {
3230 for (
Int_t j = 0; j < nb1; ++j) {
3244 for (
Int_t k = 0; k < nb2; ++k) {
3276 Error(
"CloneTTree",
"TTree has not been cloned\n");
3299 for (
Int_t i = 0; i < nbranches; ++i) {
3306 tree->ResetBranchAddress(br);
3335 Warning(
"CopyAddresses",
"Could not find branch named '%s' in tree named '%s'", branch->
GetName(),
tree->GetName());
3343 std::set<TLeaf*> updatedLeafCount;
3344 for (
Int_t i = 0; i < ntleaves; ++i) {
3360 tree->ResetBranchAddress(tbranch);
3363 bool needAddressReset =
false;
3371 needAddressReset =
true;
3373 needAddressReset = (updatedLeafCount.find(leaf->
GetLeafCount()) != updatedLeafCount.end());
3396 if (br->
IsA() != branch->
IsA()) {
3399 "Branch kind mismatch between input tree '%s' and output tree '%s' for branch '%s': '%s' vs '%s'",
3409 Warning(
"CopyAddresses",
"Could not find branch named '%s' in tree named '%s'", branch->
GetName(),
tree->GetName());
3418 (
tree->IsA()->InheritsFrom(
"TNtuple") ||
tree->IsA()->InheritsFrom(
"TNtupleD") )
3420 tree->ResetBranchAddresses();
3426 enum EOnIndexError { kDrop, kKeep, kBuild };
3428 static Bool_t R__HandleIndex(EOnIndexError onIndexError,
TTree *newtree,
TTree *oldtree)
3436 switch (onIndexError) {
3460 switch (onIndexError) {
3466 index->SetTree(newtree);
3474 index->SetTree(newtree);
3484 }
else if ( onIndexError == kDrop ) {
3539 EOnIndexError onIndexError;
3541 onIndexError = kKeep;
3542 }
else if (opt.
Contains(
"buildindex")) {
3543 onIndexError = kBuild;
3544 }
else if (opt.
Contains(
"dropindex")) {
3545 onIndexError = kDrop;
3547 onIndexError = kBuild;
3550 Int_t cacheSize = -1;
3553 Ssiz_t cacheSizeEnd = opt.
Index(
" ",cacheSizeLoc+10) - (cacheSizeLoc+10);
3554 TSubString cacheSizeStr( opt(cacheSizeLoc+10,cacheSizeEnd) );
3557 Warning(
"CopyEntries",
"The cachesize option can not be parsed: %s. The default size will be used.",cacheSizeStr.
String().
Data());
3560 const char *munit =
nullptr;
3563 Warning(
"CopyEntries",
"The cachesize option is too large: %s (%g%s max). The default size will be used.",cacheSizeStr.
String().
Data(),
m,munit);
3566 if (
gDebug > 0 && cacheSize != -1)
Info(
"CopyEntries",
"Using Cache size: %d\n",cacheSize);
3572 }
else if (
nentries > treeEntries) {
3576 if (fastClone && (nentries < 0 || nentries == tree->
GetEntriesFast())) {
3580 if (
tree->LoadTree(i) < 0) {
3584 withIndex = R__HandleIndex( onIndexError,
this,
tree );
3609 if (needCopyAddresses) {
3615 for (
Long64_t ii = 0; ii < tentries; ii++) {
3616 if (localtree->
GetEntry(ii) <= 0) {
3621 if (needCopyAddresses)
3622 tree->ResetBranchAddresses();
3628 if (
tree->GetDirectory() &&
tree->GetDirectory()->GetFile()) {
3629 Warning(
"CopyEntries",
"Skipped file %s\n",
tree->GetDirectory()->GetFile()->GetName());
3631 Warning(
"CopyEntries",
"Skipped file number %d\n",
tree->GetTreeNumber());
3645 }
else if (
nentries > treeEntries) {
3648 if (needCopyAddresses) {
3654 Int_t treenumber = -1;
3656 if (
tree->LoadTree(i) < 0) {
3659 if (treenumber !=
tree->GetTreeNumber()) {
3661 withIndex = R__HandleIndex( onIndexError,
this,
tree );
3663 treenumber =
tree->GetTreeNumber();
3665 if (
tree->GetEntry(i) <= 0) {
3668 nbytes += this->
Fill();
3670 if (needCopyAddresses)
3671 tree->ResetBranchAddresses();
3748 if (!
file->IsWritable()) {
3749 Error(
"Delete",
"File : %s is not writable, cannot delete Tree:%s",
file->GetName(),
GetName());
3766 Int_t nbytes,objlen,keylen;
3767 while ((leaf = (
TLeaf*)next())) {
3770 for (
Int_t i=0;i<nbaskets;i++) {
3774 if (!branchFile)
continue;
3776 if (nbytes <= 0)
continue;
3777 branchFile->
MakeFree(pos,pos+nbytes-1);
3791 if (dirsav) dirsav->
cd();
3792 if (
gDebug)
Info(
"TTree::Delete",
"Deleting Tree: %s: %d baskets deleted. Total space freed = %d bytes\n",
GetName(),nbask,ntot);
4514 for (
Int_t i = 0; i < nb; ++i) {
4527 for (
Int_t i = 0; i < nleaves; ++i) {
4531 for (
Int_t j = 0; j < nbaskets - 1; ++j) {
4620 for (
Int_t i = 0; i < nbranches; ++i) {
4628 nwrite = branch->
FillImpl(
nullptr);
4630 nwrite = branch->
FillImpl(useIMT ? &imtHelper :
nullptr);
4634 Error(
"Fill",
"Failed filling branch:%s.%s, nbytes=%d, entry=%lld\n"
4635 " This error is symptomatic of a Tree created as a memory-resident Tree\n"
4636 " Instead of doing:\n"
4637 " TTree *T = new TTree(...)\n"
4638 " TFile *f = new TFile(...)\n"
4640 " TFile *f = new TFile(...)\n"
4641 " TTree *T = new TTree(...)\n\n",
4644 Error(
"Fill",
"Failed filling branch:%s.%s, nbytes=%d, entry=%lld",
GetName(), branch->
GetName(), nwrite,
4676 bool autoFlush =
false;
4677 bool autoSave =
false;
4695 if (autoFlush || autoSave) {
4706 Info(
"TTree::Fill",
"OptimizeBaskets called at entry %lld, fZipBytes=%lld, fFlushedBytes=%lld\n",
4718 if (zipBytes != 0) {
4720 }
else if (totBytes != 0) {
4755 Info(
"TTree::Fill",
"FlushBaskets() called at entry %lld, fZipBytes=%lld, fFlushedBytes=%lld\n",
fEntries,
4763 Info(
"TTree::Fill",
"AutoSave called at entry %lld, fZipBytes=%lld, fSavedBytes=%lld\n",
fEntries,
4778 return nerror == 0 ? nbytes : -1;
4786 if (list==0 || branchname == 0 || branchname[0] ==
'\0')
return 0;
4790 UInt_t brlen = strlen(branchname);
4798 const char *dim = strchr(
name,
'[');
4803 if (brlen ==
len && strncmp(branchname,
name,
len)==0) {
4807 if ((brlen >=
len) && (branchname[
len] ==
'.')
4808 && strncmp(
name, branchname,
len) == 0) {
4815 if (next)
return next;
4817 const char *dot = strchr((
char*)branchname,
'.');
4819 if (
len==(
size_t)(dot-branchname) &&
4820 strncmp(branchname,
name,dot-branchname)==0 ) {
4851 if (branch)
return branch;
4855 if (branch)
return branch;
4859 while ((branch = (
TBranch*) next())) {
4862 return nestedbranch;
4879 const char *subbranch = strstr(branchname, fe->
GetName());
4880 if (subbranch != branchname) {
4881 subbranch =
nullptr;
4884 subbranch += strlen(fe->
GetName());
4885 if (*subbranch !=
'.') {
4886 subbranch =
nullptr;
4891 std::ostringstream
name;
4921 const char* subsearchname = strstr(searchname,
GetName());
4922 if (subsearchname != searchname) {
4923 subsearchname =
nullptr;
4925 if (subsearchname) {
4926 subsearchname += strlen(
GetName());
4927 if (*subsearchname !=
'.') {
4928 subsearchname =
nullptr;
4931 if (subsearchname[0] == 0) {
4932 subsearchname =
nullptr;
4942 const bool searchnameHasDot = strchr(searchname,
'.') !=
nullptr;
4946 TLeaf* leaf =
nullptr;
4947 while ((leaf = (
TLeaf*) next())) {
4950 if (dim >= 0) leafname.
Remove(dim);
4952 if (leafname == searchname) {
4955 if (subsearchname && leafname == subsearchname) {
4961 dim = leaftitle.
First(
'[');
4962 if (dim >= 0) leaftitle.
Remove(dim);
4964 if (leaftitle == searchname) {
4967 if (subsearchname && leaftitle == subsearchname) {
4970 if (!searchnameHasDot)
4975 dim = longname.
First(
'[');
4976 if (dim>=0) longname.
Remove(dim);
4977 if (longname == searchname) {
4980 if (subsearchname && longname == subsearchname) {
4984 dim = longtitle.
First(
'[');
4985 if (dim>=0) longtitle.
Remove(dim);
4986 if (longtitle == searchname) {
4989 if (subsearchname && longtitle == subsearchname) {
4997 if (strstr(searchname,
".") && !strcmp(searchname, branch->
GetName())) {
5000 if (subsearchname && strstr(subsearchname,
".") && !strcmp(subsearchname, branch->
GetName())) {
5018 subsearchname = strstr(searchname, fe->
GetName());
5019 if (subsearchname != searchname) {
5020 subsearchname =
nullptr;
5022 if (subsearchname) {
5023 subsearchname += strlen(fe->
GetName());
5024 if (*subsearchname !=
'.') {
5025 subsearchname =
nullptr;
5030 if (subsearchname) {
5031 leafname.
Form(
"%s.%s",t->
GetName(),subsearchname);
5033 leafname = searchname;
5081struct BoolRAIIToggle {
5084 BoolRAIIToggle(
Bool_t &val) : m_val(val) { m_val =
true; }
5085 ~BoolRAIIToggle() { m_val =
false; }
5124 if (retval == -1)
return retval;
5159 std::atomic<Int_t> nerrpar(0);
5160 std::atomic<Int_t> nbpar(0);
5161 std::atomic<Int_t> pos(0);
5163 auto mapFunction = [&]() {
5169 Int_t j = pos.fetch_add(1);
5175 std::stringstream ss;
5176 ss << std::this_thread::get_id();
5177 Info(
"FlushBaskets",
"[IMT] Thread %s", ss.str().c_str());
5178 Info(
"FlushBaskets",
"[IMT] Running task for branch #%d: %s", j, branch->GetName());
5181 Int_t nbtask = branch->FlushBaskets();
5183 if (nbtask < 0) { nerrpar++; }
5184 else { nbpar += nbtask; }
5188 pool.
Foreach(mapFunction, nb);
5194 return nerrpar ? -1 : nbpar.load();
5197 for (
Int_t j = 0; j < nb; j++) {
5240 const char* alias = t->
GetAlias(aliasName);
5244 const char* subAliasName = strstr(aliasName, fe->
GetName());
5245 if (subAliasName && (subAliasName[strlen(fe->
GetName())] ==
'.')) {
5265 for (
Int_t i = 0; i < nb; i++) {
5269 if (!strcmp(
b->GetName(),
name)) {
5272 if (!strcmp(
b->GetFullName(),
name)) {
5276 result = R__GetBranch(*(
b->GetListOfBranches()),
name);
5311 for (
Int_t i = 0; i < nleaves; i++) {
<