482 case kchar:
return 0;
487 case kBits:
return 0;
523 fMethodBit(tfl.fMethodBit),
524 fPrevious(tfl.fPrevious)
548 fTree->fFriendLockStatus &= ~(fMethodBit &
kBitMask);
575 entryInRange = firstEntry;
578 entryInRange = firstEntry - pedestal;
586 if (autoflush <= 0) {
589 fStartEntry = pedestal + entryInRange - entryInRange%autoflush;
614 auto autoFlush = fTree->GetAutoFlush();
615 if (autoFlush > 0)
return autoFlush;
616 if (fEstimatedSize > 0)
return fEstimatedSize;
618 Long64_t zipBytes = fTree->GetZipBytes();
620 fEstimatedSize = fTree->GetEntries() - 1;
621 if (fEstimatedSize <= 0)
625 Long64_t cacheSize = fTree->GetCacheSize();
626 if (cacheSize == 0) {
637 if (cacheSize <= 0) {
638 cacheSize = 30000000;
640 clusterEstimate = fTree->GetEntries() * cacheSize / zipBytes;
642 fEstimatedSize = clusterEstimate ? clusterEstimate : 1;
644 return fEstimatedSize;
653 fStartEntry = fNextEntry;
654 if (fTree->fNClusterRange || fTree->GetAutoFlush() > 0) {
655 if (fClusterRange == fTree->fNClusterRange) {
658 fNextEntry += GetEstimatedClusterSize();
660 if (fStartEntry > fTree->fClusterRangeEnd[fClusterRange]) {
663 if (fClusterRange == fTree->fNClusterRange) {
666 fNextEntry += GetEstimatedClusterSize();
668 Long64_t clusterSize = fTree->fClusterSize[fClusterRange];
669 if (clusterSize == 0) {
670 clusterSize = GetEstimatedClusterSize();
672 fNextEntry += clusterSize;
673 if (fNextEntry > fTree->fClusterRangeEnd[fClusterRange]) {
677 fNextEntry = fTree->fClusterRangeEnd[fClusterRange] + 1;
683 fNextEntry = fStartEntry + GetEstimatedClusterSize();
685 if (fNextEntry > fTree->GetEntries()) {
686 fNextEntry = fTree->GetEntries();
697 fNextEntry = fStartEntry;
698 if (fTree->fNClusterRange || fTree->GetAutoFlush() > 0) {
699 if (fClusterRange == 0 || fTree->fNClusterRange == 0) {
702 fStartEntry -= GetEstimatedClusterSize();
707 if (fClusterRange == 0) {
711 Long64_t clusterSize = fTree->fClusterSize[fClusterRange];
712 if (clusterSize == 0) {
713 clusterSize = GetEstimatedClusterSize();
715 fStartEntry -= clusterSize;
720 fStartEntry = fNextEntry - GetEstimatedClusterSize();
722 if (fStartEntry < 0) {
833, fDefaultEntryOffsetLen(1000)
839, fAutoSave( -300000000)
840, fAutoFlush(-30000000)
872, fFriendLockStatus(0)
874, fCacheDoAutoInit(
kTRUE)
875, fCacheDoClusterPrefetch(
kFALSE)
877, fIMTEnabled(
ROOT::IsImplicitMTEnabled())
878, fNEntriesSinceSorting(0)
911 if (strlen(title) > 2) {
912 if (title[0] ==
'/') {
913 Branch(title+1,32000,splitlevel);
928#ifdef R__TRACK_BASKET_ALLOC_TIME
929 Info(
"TTree::~TTree",
"For tree %s, allocation time is %lluus.",
GetName(), fAllocationTime.load());
1064 Error(
"AddBranchToCache",
"Could not load a tree");
1073 Error(
"AddBranchToCache",
"No tree is available. Branch was not added to the cache");
1079 Error(
"AddBranchToCache",
"No file is available. Branch was not added to the cache");
1084 Error(
"AddBranchToCache",
"No cache is available, branch not added");
1087 return tc->
AddBranch(bname,subbranches);
1103 Error(
"AddBranchToCache",
"Could not load a tree");
1111 Error(
"AddBranchToCache",
"Error adding branch");
1116 Error(
"AddBranchToCache",
"No tree is available. Branch was not added to the cache");
1122 Error(
"AddBranchToCache",
"No file is available. Branch was not added to the cache");
1127 Error(
"AddBranchToCache",
"No cache is available, branch not added");
1147 Error(
"DropBranchFromCache",
"Could not load a tree");
1156 Error(
"DropBranchFromCache",
"No tree is available. Branch was not dropped from the cache");
1162 Error(
"DropBranchFromCache",
"No file is available. Branch was not dropped from the cache");
1167 Error(
"DropBranchFromCache",
"No cache is available, branch not dropped");
1186 Error(
"DropBranchFromCache",
"Could not load a tree");
1194 Error(
"DropBranchFromCache",
"Error dropping branch");
1199 Error(
"DropBranchFromCache",
"No tree is available. Branch was not dropped from the cache");
1205 Error(
"DropBranchFromCache",
"No file is available. Branch was not dropped from the cache");
1210 Error(
"DropBranchFromCache",
"No cache is available, branch not dropped");
1245 const auto friendHasValidIndex = [&] {
1250 if ((isMainReshuffled || isFriendReshuffled) && !friendHasValidIndex) {
1251 const auto reshuffledTreeName = isMainReshuffled ? mainTree.
GetName() : friendTree.
GetName();
1252 const auto msg =
"Tree '%s' has the kEntriesReshuffled bit set, and cannot be used as friend nor can be added as "
1253 "a friend unless the main tree has a TTreeIndex on the friend tree '%s'. You can also unset the "
1254 "bit manually if you know what you are doing.";
1255 Error(
"AddFriend", msg, reshuffledTreeName, friendTree.
GetName());
1340 bool canAddFriend =
true;
1344 Warning(
"AddFriend",
"FriendElement %s in file %s has less entries %lld than its parent Tree: %lld", treename,
1348 Error(
"AddFriend",
"Cannot find tree '%s' in file '%s', friend not added", treename,
filename);
1349 canAddFriend =
false;
1374 bool canAddFriend =
true;
1378 Warning(
"AddFriend",
"FriendElement %s in file %s has less entries %lld than its parent tree: %lld", treename,
1382 Error(
"AddFriend",
"Cannot find tree '%s' in file '%s', friend not added", treename,
file->GetName());
1383 canAddFriend =
false;
1409 Warning(
"AddFriend",
"FriendElement '%s' in file '%s' has less entries %lld than its parent tree: %lld",
1416 tree->RemoveExternalFriend(fe);
1509 if (opt.
Contains(
"flushbaskets")) {
1510 if (
gDebug > 0)
Info(
"AutoSave",
"calling FlushBaskets \n");
1529 if (
file)
file->WriteStreamerInfo();
1543 const char* writeStlWithoutProxyMsg =
"The class requested (%s) for the branch \"%s\""
1544 " is an instance of an stl collection and does not have a compiled CollectionProxy."
1545 " Please generate the dictionary for this collection (%s) to avoid to write corrupted data.";
1559 Error(
"Branch", writeStlWithoutProxyMsg,
1563 return Branch(branchname, classname, (
void*) addobj, bufsize, splitlevel);
1566 void** addr = (
void**) addobj;
1570 if (ptrClass && claim) {
1577 Error(
"Branch",
"The class requested (%s) for \"%s\" is different from the type of the pointer passed (%s)",
1580 }
else if (actualClass && (claim != actualClass) && !actualClass->
InheritsFrom(claim)) {
1585 Error(
"Branch",
"The actual class (%s) of the object provided for the definition of the branch \"%s\" does not inherit from %s",
1591 Error(
"Branch", writeStlWithoutProxyMsg,
1595 return Branch(branchname, classname, (
void*) addobj, bufsize, splitlevel);
1605 Error(
"Branch",
"The pointer specified for %s is not of a class known to ROOT", branchname);
1609 void** addr = (
void**) addobj;
1610 if (addr && *addr) {
1613 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",
1614 branchname, ptrClass->
GetName());
1615 actualClass = ptrClass;
1616 }
else if ((ptrClass != actualClass) && !actualClass->
InheritsFrom(ptrClass)) {
1617 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());
1621 actualClass = ptrClass;
1624 Error(
"Branch", writeStlWithoutProxyMsg,
1628 return Branch(branchname, actualClass->
GetName(), (
void*) addobj, bufsize, splitlevel);
1640 Error(
"Branch", writeStlWithoutProxyMsg,
1643 }
else if (claim == 0) {
1644 Error(
"Branch",
"The pointer specified for %s is not of a class known to ROOT and %s is not a known class", branchname, classname);
1651 Error(
"Branch",
"Reference interface requires a valid object (for branch: %s)!", branchname);
1655 if (ptrClass && claim) {
1662 Error(
"Branch",
"The class requested (%s) for \"%s\" is different from the type of the object passed (%s)",
1665 }
else if (actualClass && (claim != actualClass) && !actualClass->
InheritsFrom(claim)) {
1670 Error(
"Branch",
"The actual class (%s) of the object provided for the definition of the branch \"%s\" does not inherit from %s",
1676 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",
1677 branchname, ptrClass->
GetName());
1678 actualClass = ptrClass;
1679 }
else if ((ptrClass != actualClass) && !actualClass->
InheritsFrom(ptrClass)) {
1680 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());
1684 Error(
"Branch", writeStlWithoutProxyMsg,
1699 Error(
"Branch",
"The pointer specified for %s is not of a class or type known to ROOT", branchname);
1702 return Branch(branchname,addobj,varname.
Data(),bufsize);
1708 Error(
"Branch",
"Reference interface requires a valid object (for branch: %s)!", branchname);
1713 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",
1714 branchname, ptrClass->
GetName());
1715 actualClass = ptrClass;
1716 }
else if ((ptrClass != actualClass) && !actualClass->
InheritsFrom(ptrClass)) {
1717 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());
1721 Error(
"Branch", writeStlWithoutProxyMsg,
1736 "The inner type of the std::array passed specified for %s is not of a class or type known to ROOT",
1741 return Branch(branchname, addobj, varname.
Data(), bufsize);
1842 Error(
"Branch",
"Cannot call this constructor for a TClonesArray");
1848 while ((obj = next())) {
1856 Branch(col, bufsize, splitlevel - 1, branchname);
1858 if (nch && (
name[nch-1] ==
'_')) {
1867 if (splitlevel > 99) {
1893 char* curname =
new char[1000];
1895 while ((obj = next())) {
1898 Branch(curname, bufsize, splitlevel - 1);
1901 for (
Int_t i = 0; i < 1000; ++i) {
1902 if (curname[i] == 0) {
1905 if (curname[i] ==
'/') {
1912 strlcat(curname, occur,1000);
2024 return Bronch(
name, classname, addobj, bufsize, splitlevel);
2026 if (splitlevel < 0) {
2029 return BranchOld(
name, classname, addobj, bufsize, splitlevel);
2078 Error(
"BranchOld",
"Cannot find class: '%s'", classname);
2083 Fatal(
"BranchOld",
"The requested class ('%s') does not inherit from TObject.\n"
2084 "\tfgBranchStyle is set to zero requesting by default to use BranchOld.\n"
2085 "\tIf this is intentional use Bronch instead of Branch or BranchOld.", classname);
2087 Fatal(
"BranchOld",
"The requested class ('%s') does not inherit from TObject.\n"
2088 "\tYou can not use BranchOld to store objects of this type.",classname);
2099 const char* rdname = 0;
2100 const char* dname = 0;
2102 char** apointer = (
char**) addobj;
2114 if (
name[lenName-1] ==
'.') {
2153 if (!strcmp(dname,
"fBits")) {
2156 if (!strcmp(dname,
"fUniqueID")) {
2166 branchname = rdname;
2170 branchname.
Form(
"%s%s",
name, &rdname[1]);
2172 branchname.
Form(
"%s%s",
name, &rdname[0]);
2178 char* pointer = ((
char*) obj) +
offset;
2187 char* cpointer = (
char*) pointer;
2188 char** ppointer = (
char**) cpointer;
2190 if (splitlevel != 2) {
2192 branch1 =
new TBranchClones(branch,branchname, pointer, bufsize);
2197 blist->
Add(branch1);
2205 blist->
Add(branch1);
2222 blist->
Add(branch1);
2246 if (!strcmp(rdi->
GetName(), aindex)) {
2258 leaflist.
Form(
"%s[%s]/%c", &rdname[0],
index, vcode);
2260 Error(
"BranchOld",
"Cannot create branch for rdname: %s code: %d", branchname.
Data(), code);
2267 leaflist.
Form(
"%s/%s", dname,
"C");
2280 branch1 =
new TBranch(branch, bname, *((
void**) pointer), leaflist, bufsize);
2284 blist->
Add(branch1);
2291 leaflist.
Form(
"%s/%c", rdname, vcode);
2293 Error(
"BranchOld",
"Cannot create branch for rdname: %s code: %d", branchname.
Data(), code);
2296 branch1 =
new TBranch(branch, branchname, pointer, leaflist, bufsize);
2298 blist->
Add(branch1);
2307 Warning(
"BranchOld",
"Cannot process member: '%s'", rdname);
2416 Error(
"Bronch",
"Cannot find class:%s", classname);
2427 objptr = (
char*)addr;
2429 objptr = *((
char**) addr);
2435 Error(
"Bronch",
"Pointer to TClonesArray is null");
2439 Error(
"Bronch",
"TClonesArray with no class defined in branch: %s",
name);
2443 Error(
"Bronch",
"TClonesArray with no dictionary defined in branch: %s",
name);
2447 if (splitlevel > 0) {
2448 if (hasCustomStreamer)
2449 Warning(
"Bronch",
"Using split mode on a class: %s with a custom Streamer", clones->
GetClass()->
GetName());
2464 if (!inklass && (collProxy->
GetType() == 0)) {
2465 Error(
"Bronch",
"%s with no class defined in branch: %s", classname,
name);
2472 Error(
"Bronch",
"Container with no dictionary defined in branch: %s",
name);
2476 Warning(
"Bronch",
"Using split mode on a class: %s with a custom Streamer", inklass->
GetName());
2487 branch =
new TBranchSTL(
this,
name, collProxy, bufsize, splitlevel );
2501 Error(
"Bronch",
"Cannot find dictionary for class: %s", classname);
2507 hasCustomStreamer =
kTRUE;
2510 if (splitlevel < 0 || ((splitlevel == 0) && hasCustomStreamer && cl->
IsTObject())) {
2541 objptr = (
char*) cl->
New();
2549 if ((splitlevel > 0) && !cl->
CanSplit()) {
2550 if (splitlevel != 99) {
2551 Warning(
"Bronch",
"%s cannot be split, resetting splitlevel to 0", cl->
GetName());
2565 Error(
"Bronch",
"Cannot build the StreamerInfo for class: %s", cl->
GetName());
2574 if (splitlevel > 0) {
2585 branch->
Unroll(
name, cl, sinfo, objptr, bufsize, splitlevel);
2754 constexpr auto kBufSize = 2000;
2755 char* fname =
new char[kBufSize];
2758 for (
Int_t i = 0; i < 10; ++i) {
2766 strlcpy(fname,
file->GetName(), kBufSize);
2769 char* cunder = strrchr(fname,
'_');
2772 const char* cdot = strrchr(
file->GetName(),
'.');
2774 strlcat(fname, cdot, kBufSize);
2779 strlcat(fname, fcount, kBufSize);
2782 char* cdot = strrchr(fname,
'.');
2785 strlcat(fname, strrchr(
file->GetName(),
'.'), kBufSize);
2789 strlcat(fname, fcount, kBufSize);
2796 Warning(
"ChangeFile",
"file %s already exist, trying with %d underscores", fname, nus+1);
2798 Int_t compress =
file->GetCompressionSettings();
2801 Error(
"Fill",
"Failed to open new file %s, continuing as a memory tree.",fname);
2803 Printf(
"Fill: Switching to new file: %s", fname);
2809 while ((obj =
file->GetList()->First())) {
2826 while ((branch = (
TBranch*)nextb())) {
2835 if (newfile) newfile->
Append(obj);
2838 file->TObject::Delete();
2875 TClass* expectedClass = 0;
2882 if (expectedClass && datatype ==
kOther_t && ptrClass == 0) {
2883 if (isBranchElement) {
2888 Error(
"SetBranchAddress",
"Unable to determine the type given for the address for \"%s\". "
2889 "The class expected (%s) refers to an stl collection and do not have a compiled CollectionProxy. "
2890 "Please generate the dictionary for this class (%s)",
2897 Error(
"SetBranchAddress",
"Unable to determine the type given for the address for \"%s\". "
2898 "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."
2899 "Please generate the dictionary for this class (%s)",
2902 Error(
"SetBranchAddress",
"Unable to determine the type given for the address for \"%s\". "
2903 "This is probably due to a missing dictionary, the original data class for this branch is %s.", branch->
GetName(), expectedClass->
GetName());
2907 if (expectedClass && ptrClass && (branch->
GetMother() == branch)) {
2910 Error(
"SetBranchAddress",
"The address for \"%s\" should be the address of a pointer!", branch->
GetName());
2930 if( expectedClass && ptrClass &&
2931 expectedClass != ptrClass &&
2939 Info(
"SetBranchAddress",
"Matching STL collection (at least according to the SchemaRuleSet when "
2940 "reading a %s into a %s",expectedClass->
GetName(),ptrClass->
GetName());
2947 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());
2958 }
else if (expectedClass && ptrClass && !expectedClass->
InheritsFrom(ptrClass)) {
2980 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());
2981 if (isBranchElement) {
2990 Error(
"SetBranchAddress",
"The pointer type given \"%s\" (%d) does not correspond to the type needed \"%s\" (%d) by the branch: %s",
2997 if (expectedClass) {
2998 Error(
"SetBranchAddress",
"The pointer type given \"%s\" (%d) does not correspond to the type needed \"%s\" by the branch: %s",
3000 if (isBranchElement) {
3016 if (etype == expectedType) {
3031 if (etype == expectedType) {
3043 if (len <= ptrClass->Size()) {
3047 Error(
"SetBranchAddress",
"The pointer type given \"%s\" does not correspond to the type needed \"%s\" (%d) by the branch: %s",
3053 Error(
"SetBranchAddress", writeStlWithoutProxyMsg,
3055 if (isBranchElement) {
3061 if (isBranchElement) {
3062 if (expectedClass) {
3171 for (
Int_t i = 0; i < nb; ++i) {
3181 if (thistree !=
this) {
3206 for (
Int_t lndx = 0; lndx < nleaves; ++lndx) {
3212 if (branch && (newcomp > -1)) {
3221 for (
Long64_t i = 0; i < nb; ++i) {
3232 for (
Int_t j = 0; j < nb1; ++j) {
3246 for (
Int_t k = 0; k < nb2; ++k) {
3278 Error(
"CloneTTree",
"TTree has not been cloned\n");
3301 for (
Int_t i = 0; i < nbranches; ++i) {
3308 tree->ResetBranchAddress(br);
3337 Warning(
"CopyAddresses",
"Could not find branch named '%s' in tree named '%s'", branch->
GetName(),
tree->GetName());
3345 std::set<TLeaf*> updatedLeafCount;
3346 for (
Int_t i = 0; i < ntleaves; ++i) {
3362 tree->ResetBranchAddress(tbranch);
3365 bool needAddressReset =
false;
3373 needAddressReset =
true;
3375 needAddressReset = (updatedLeafCount.find(leaf->
GetLeafCount()) != updatedLeafCount.end());
3398 if (br->
IsA() != branch->
IsA()) {
3401 "Branch kind mismatch between input tree '%s' and output tree '%s' for branch '%s': '%s' vs '%s'",
3411 Warning(
"CopyAddresses",
"Could not find branch named '%s' in tree named '%s'", branch->
GetName(),
tree->GetName());
3420 (
tree->IsA()->InheritsFrom(
"TNtuple") ||
tree->IsA()->InheritsFrom(
"TNtupleD") )
3422 tree->ResetBranchAddresses();
3428 enum EOnIndexError { kDrop, kKeep, kBuild };
3430 static Bool_t R__HandleIndex(EOnIndexError onIndexError,
TTree *newtree,
TTree *oldtree)
3438 switch (onIndexError) {
3462 switch (onIndexError) {
3468 index->SetTree(newtree);
3476 index->SetTree(newtree);
3486 }
else if ( onIndexError == kDrop ) {
3541 EOnIndexError onIndexError;
3543 onIndexError = kKeep;
3544 }
else if (opt.
Contains(
"buildindex")) {
3545 onIndexError = kBuild;
3546 }
else if (opt.
Contains(
"dropindex")) {
3547 onIndexError = kDrop;
3549 onIndexError = kBuild;
3552 Int_t cacheSize = -1;
3555 Ssiz_t cacheSizeEnd = opt.
Index(
" ",cacheSizeLoc+10) - (cacheSizeLoc+10);
3556 TSubString cacheSizeStr( opt(cacheSizeLoc+10,cacheSizeEnd) );
3559 Warning(
"CopyEntries",
"The cachesize option can not be parsed: %s. The default size will be used.",cacheSizeStr.
String().
Data());
3562 const char *munit =
nullptr;
3565 Warning(
"CopyEntries",
"The cachesize option is too large: %s (%g%s max). The default size will be used.",cacheSizeStr.
String().
Data(),
m,munit);
3568 if (
gDebug > 0 && cacheSize != -1)
Info(
"CopyEntries",
"Using Cache size: %d\n",cacheSize);
3574 }
else if (
nentries > treeEntries) {
3578 if (fastClone && (nentries < 0 || nentries == tree->
GetEntriesFast())) {
3582 if (
tree->LoadTree(i) < 0) {
3586 withIndex = R__HandleIndex( onIndexError,
this,
tree );
3611 if (needCopyAddresses) {
3617 for (
Long64_t ii = 0; ii < tentries; ii++) {
3618 if (localtree->
GetEntry(ii) <= 0) {
3623 if (needCopyAddresses)
3624 tree->ResetBranchAddresses();
3630 if (
tree->GetDirectory() &&
tree->GetDirectory()->GetFile()) {
3631 Warning(
"CopyEntries",
"Skipped file %s\n",
tree->GetDirectory()->GetFile()->GetName());
3633 Warning(
"CopyEntries",
"Skipped file number %d\n",
tree->GetTreeNumber());
3647 }
else if (
nentries > treeEntries) {
3650 if (needCopyAddresses) {
3656 Int_t treenumber = -1;
3658 if (
tree->LoadTree(i) < 0) {
3661 if (treenumber !=
tree->GetTreeNumber()) {
3663 withIndex = R__HandleIndex( onIndexError,
this,
tree );
3665 treenumber =
tree->GetTreeNumber();
3667 if (
tree->GetEntry(i) <= 0) {
3670 nbytes += this->
Fill();
3672 if (needCopyAddresses)
3673 tree->ResetBranchAddresses();
3750 if (!
file->IsWritable()) {
3751 Error(
"Delete",
"File : %s is not writable, cannot delete Tree:%s",
file->GetName(),
GetName());
3768 Int_t nbytes,objlen,keylen;
3769 while ((leaf = (
TLeaf*)next())) {
3772 for (
Int_t i=0;i<nbaskets;i++) {
3776 if (!branchFile)
continue;
3778 if (nbytes <= 0)
continue;
3779 branchFile->
MakeFree(pos,pos+nbytes-1);
3793 if (dirsav) dirsav->
cd();
3794 if (
gDebug)
Info(
"TTree::Delete",
"Deleting Tree: %s: %d baskets deleted. Total space freed = %d bytes\n",
GetName(),nbask,ntot);
4519 for (
Int_t i = 0; i < nb; ++i) {
4532 for (
Int_t i = 0; i < nleaves; ++i) {
4536 for (
Int_t j = 0; j < nbaskets - 1; ++j) {
4625 for (
Int_t i = 0; i < nbranches; ++i) {
4633 nwrite = branch->
FillImpl(
nullptr);
4635 nwrite = branch->
FillImpl(useIMT ? &imtHelper :
nullptr);
4639 Error(
"Fill",
"Failed filling branch:%s.%s, nbytes=%d, entry=%lld\n"
4640 " This error is symptomatic of a Tree created as a memory-resident Tree\n"
4641 " Instead of doing:\n"
4642 " TTree *T = new TTree(...)\n"
4643 " TFile *f = new TFile(...)\n"
4645 " TFile *f = new TFile(...)\n"
4646 " TTree *T = new TTree(...)\n\n",
4649 Error(
"Fill",
"Failed filling branch:%s.%s, nbytes=%d, entry=%lld",
GetName(), branch->
GetName(), nwrite,
4681 bool autoFlush =
false;
4682 bool autoSave =
false;
4700 if (autoFlush || autoSave) {
4711 Info(
"TTree::Fill",
"OptimizeBaskets called at entry %lld, fZipBytes=%lld, fFlushedBytes=%lld\n",
4723 if (zipBytes != 0) {
4725 }
else if (totBytes != 0) {
4760 Info(
"TTree::Fill",
"FlushBaskets() called at entry %lld, fZipBytes=%lld, fFlushedBytes=%lld\n",
fEntries,
4768 Info(
"TTree::Fill",
"AutoSave called at entry %lld, fZipBytes=%lld, fSavedBytes=%lld\n",
fEntries,
4783 return nerror == 0 ? nbytes : -1;
4791 if (list==0 || branchname == 0 || branchname[0] ==
'\0')
return 0;
4795 UInt_t brlen = strlen(branchname);
4803 const char *dim = strchr(
name,
'[');
4808 if (brlen ==
len && strncmp(branchname,
name,
len)==0) {
4812 if ((brlen >=
len) && (branchname[
len] ==
'.')
4813 && strncmp(
name, branchname,
len) == 0) {
4820 if (next)
return next;
4822 const char *dot = strchr((
char*)branchname,
'.');
4824 if (
len==(
size_t)(dot-branchname) &&
4825 strncmp(branchname,
name,dot-branchname)==0 ) {
4856 if (branch)
return branch;
4860 if (branch)
return branch;
4864 while ((branch = (
TBranch*) next())) {
4867 return nestedbranch;
4884 const char *subbranch = strstr(branchname, fe->
GetName());
4885 if (subbranch != branchname) {
4886 subbranch =
nullptr;
4889 subbranch += strlen(fe->
GetName());
4890 if (*subbranch !=
'.') {
4891 subbranch =
nullptr;
4896 std::ostringstream
name;
4926 const char* subsearchname = strstr(searchname,
GetName());
4927 if (subsearchname != searchname) {
4928 subsearchname =
nullptr;
4930 if (subsearchname) {
4931 subsearchname += strlen(
GetName());
4932 if (*subsearchname !=
'.') {
4933 subsearchname =
nullptr;
4936 if (subsearchname[0] == 0) {
4937 subsearchname =
nullptr;
4947 const bool searchnameHasDot = strchr(searchname,
'.') !=
nullptr;
4951 TLeaf* leaf =
nullptr;
4952 while ((leaf = (
TLeaf*) next())) {
4955 if (dim >= 0) leafname.
Remove(dim);
4957 if (leafname == searchname) {
4960 if (subsearchname && leafname == subsearchname) {
4966 dim = leaftitle.
First(
'[');
4967 if (dim >= 0) leaftitle.
Remove(dim);
4969 if (leaftitle == searchname) {
4972 if (subsearchname && leaftitle == subsearchname) {
4975 if (!searchnameHasDot)
4980 dim = longname.
First(
'[');
4981 if (dim>=0) longname.
Remove(dim);
4982 if (longname == searchname) {
4985 if (subsearchname && longname == subsearchname) {
4989 dim = longtitle.
First(
'[');
4990 if (dim>=0) longtitle.
Remove(dim);
4991 if (longtitle == searchname) {
4994 if (subsearchname && longtitle == subsearchname) {
5002 if (strstr(searchname,
".") && !strcmp(searchname, branch->
GetName())) {
5005 if (subsearchname && strstr(subsearchname,
".") && !strcmp(subsearchname, branch->
GetName())) {
5023 subsearchname = strstr(searchname, fe->
GetName());
5024 if (subsearchname != searchname) {
5025 subsearchname =
nullptr;
5027 if (subsearchname) {
5028 subsearchname += strlen(fe->
GetName());
5029 if (*subsearchname !=
'.') {
5030 subsearchname =
nullptr;
5035 if (subsearchname) {
5036 leafname.
Form(
"%s.%s",t->
GetName(),subsearchname);
5038 leafname = searchname;
5086struct BoolRAIIToggle {
5089 BoolRAIIToggle(
Bool_t &val) : m_val(val) { m_val =
true; }
5090 ~BoolRAIIToggle() { m_val =
false; }
5129 if (retval == -1)
return retval;
5164 std::atomic<Int_t> nerrpar(0);
5165 std::atomic<Int_t> nbpar(0);
5166 std::atomic<Int_t> pos(0);
5168 auto mapFunction = [&]() {
5174 Int_t j = pos.fetch_add(1);
5180 std::stringstream ss;
5181 ss << std::this_thread::get_id();
5182 Info(
"FlushBaskets",
"[IMT] Thread %s", ss.str().c_str());
5183 Info(
"FlushBaskets",
"[IMT] Running task for branch #%d: %s", j, branch->GetName());
5186 Int_t nbtask = branch->FlushBaskets();
5188 if (nbtask < 0) { nerrpar++; }
5189 else { nbpar += nbtask; }
5193 pool.
Foreach(mapFunction, nb);
5199 return nerrpar ? -1 : nbpar.load();
5202 for (
Int_t j = 0; j < nb; j++) {
5245 const char* alias = t->
GetAlias(aliasName);
5249 const char* subAliasName = strstr(aliasName, fe->
GetName());
5250 if (subAliasName && (subAliasName[strlen(fe->
GetName())] ==
'.')) {
5270 for (
Int_t i = 0; i < nb; i++) {
5274 if (!strcmp(
b->GetName(),
name)) {
5277 if (!strcmp(
b->GetFullName(),
name)) {
5281 result = R__GetBranch(*(
b->GetListOfBranches()),
name);
5316 for (
Int_t i = 0; i < nleaves; i++) {