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();
1253 "Tree '%s' has the kEntriesReshuffled bit set and cannot have friends nor can be added as a friend unless the "
1254 "main tree has a TTreeIndex on the friend tree '%s'. You can also unset the bit manually if you know what you "
1255 "are doing; note that you risk associating wrong TTree entries of the friend with those of the main TTree!";
1256 Error(
"AddFriend", msg, reshuffledTreeName, friendTree.
GetName());
1341 bool canAddFriend =
true;
1345 Warning(
"AddFriend",
"FriendElement %s in file %s has less entries %lld than its parent Tree: %lld", treename,
1349 Error(
"AddFriend",
"Cannot find tree '%s' in file '%s', friend not added", treename,
filename);
1350 canAddFriend =
false;
1375 bool canAddFriend =
true;
1379 Warning(
"AddFriend",
"FriendElement %s in file %s has less entries %lld than its parent tree: %lld", treename,
1383 Error(
"AddFriend",
"Cannot find tree '%s' in file '%s', friend not added", treename,
file->GetName());
1384 canAddFriend =
false;
1410 Warning(
"AddFriend",
"FriendElement '%s' in file '%s' has less entries %lld than its parent tree: %lld",
1417 tree->RemoveExternalFriend(fe);
1510 if (opt.
Contains(
"flushbaskets")) {
1511 if (
gDebug > 0)
Info(
"AutoSave",
"calling FlushBaskets \n");
1530 if (
file)
file->WriteStreamerInfo();
1544 const char* writeStlWithoutProxyMsg =
"The class requested (%s) for the branch \"%s\""
1545 " is an instance of an stl collection and does not have a compiled CollectionProxy."
1546 " Please generate the dictionary for this collection (%s) to avoid to write corrupted data.";
1560 Error(
"Branch", writeStlWithoutProxyMsg,
1564 return Branch(branchname, classname, (
void*) addobj, bufsize, splitlevel);
1567 void** addr = (
void**) addobj;
1571 if (ptrClass && claim) {
1578 Error(
"Branch",
"The class requested (%s) for \"%s\" is different from the type of the pointer passed (%s)",
1581 }
else if (actualClass && (claim != actualClass) && !actualClass->
InheritsFrom(claim)) {
1586 Error(
"Branch",
"The actual class (%s) of the object provided for the definition of the branch \"%s\" does not inherit from %s",
1592 Error(
"Branch", writeStlWithoutProxyMsg,
1596 return Branch(branchname, classname, (
void*) addobj, bufsize, splitlevel);
1606 Error(
"Branch",
"The pointer specified for %s is not of a class known to ROOT", branchname);
1610 void** addr = (
void**) addobj;
1611 if (addr && *addr) {
1614 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",
1615 branchname, ptrClass->
GetName());
1616 actualClass = ptrClass;
1617 }
else if ((ptrClass != actualClass) && !actualClass->
InheritsFrom(ptrClass)) {
1618 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());
1622 actualClass = ptrClass;
1625 Error(
"Branch", writeStlWithoutProxyMsg,
1629 return Branch(branchname, actualClass->
GetName(), (
void*) addobj, bufsize, splitlevel);
1641 Error(
"Branch", writeStlWithoutProxyMsg,
1644 }
else if (claim == 0) {
1645 Error(
"Branch",
"The pointer specified for %s is not of a class known to ROOT and %s is not a known class", branchname, classname);
1652 Error(
"Branch",
"Reference interface requires a valid object (for branch: %s)!", branchname);
1656 if (ptrClass && claim) {
1663 Error(
"Branch",
"The class requested (%s) for \"%s\" is different from the type of the object passed (%s)",
1666 }
else if (actualClass && (claim != actualClass) && !actualClass->
InheritsFrom(claim)) {
1671 Error(
"Branch",
"The actual class (%s) of the object provided for the definition of the branch \"%s\" does not inherit from %s",
1677 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",
1678 branchname, ptrClass->
GetName());
1679 actualClass = ptrClass;
1680 }
else if ((ptrClass != actualClass) && !actualClass->
InheritsFrom(ptrClass)) {
1681 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());
1685 Error(
"Branch", writeStlWithoutProxyMsg,
1700 Error(
"Branch",
"The pointer specified for %s is not of a class or type known to ROOT", branchname);
1703 return Branch(branchname,addobj,varname.
Data(),bufsize);
1709 Error(
"Branch",
"Reference interface requires a valid object (for branch: %s)!", branchname);
1714 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",
1715 branchname, ptrClass->
GetName());
1716 actualClass = ptrClass;
1717 }
else if ((ptrClass != actualClass) && !actualClass->
InheritsFrom(ptrClass)) {
1718 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());
1722 Error(
"Branch", writeStlWithoutProxyMsg,
1737 "The inner type of the std::array passed specified for %s is not of a class or type known to ROOT",
1742 return Branch(branchname, addobj, varname.
Data(), bufsize);
1843 Error(
"Branch",
"Cannot call this constructor for a TClonesArray");
1849 while ((obj = next())) {
1857 Branch(col, bufsize, splitlevel - 1, branchname);
1859 if (nch && (
name[nch-1] ==
'_')) {
1868 if (splitlevel > 99) {
1894 char* curname =
new char[1000];
1896 while ((obj = next())) {
1899 Branch(curname, bufsize, splitlevel - 1);
1902 for (
Int_t i = 0; i < 1000; ++i) {
1903 if (curname[i] == 0) {
1906 if (curname[i] ==
'/') {
1913 strlcat(curname, occur,1000);
2025 return Bronch(
name, classname, addobj, bufsize, splitlevel);
2027 if (splitlevel < 0) {
2030 return BranchOld(
name, classname, addobj, bufsize, splitlevel);
2079 Error(
"BranchOld",
"Cannot find class: '%s'", classname);
2084 Fatal(
"BranchOld",
"The requested class ('%s') does not inherit from TObject.\n"
2085 "\tfgBranchStyle is set to zero requesting by default to use BranchOld.\n"
2086 "\tIf this is intentional use Bronch instead of Branch or BranchOld.", classname);
2088 Fatal(
"BranchOld",
"The requested class ('%s') does not inherit from TObject.\n"
2089 "\tYou can not use BranchOld to store objects of this type.",classname);
2100 const char* rdname = 0;
2101 const char* dname = 0;
2103 char** apointer = (
char**) addobj;
2115 if (
name[lenName-1] ==
'.') {
2154 if (!strcmp(dname,
"fBits")) {
2157 if (!strcmp(dname,
"fUniqueID")) {
2167 branchname = rdname;
2171 branchname.
Form(
"%s%s",
name, &rdname[1]);
2173 branchname.
Form(
"%s%s",
name, &rdname[0]);
2179 char* pointer = ((
char*) obj) +
offset;
2188 char* cpointer = (
char*) pointer;
2189 char** ppointer = (
char**) cpointer;
2191 if (splitlevel != 2) {
2193 branch1 =
new TBranchClones(branch,branchname, pointer, bufsize);
2198 blist->
Add(branch1);
2206 blist->
Add(branch1);
2223 blist->
Add(branch1);
2247 if (!strcmp(rdi->
GetName(), aindex)) {
2259 leaflist.
Form(
"%s[%s]/%c", &rdname[0],
index, vcode);
2261 Error(
"BranchOld",
"Cannot create branch for rdname: %s code: %d", branchname.
Data(), code);
2268 leaflist.
Form(
"%s/%s", dname,
"C");
2281 branch1 =
new TBranch(branch, bname, *((
void**) pointer), leaflist, bufsize);
2285 blist->
Add(branch1);
2292 leaflist.
Form(
"%s/%c", rdname, vcode);
2294 Error(
"BranchOld",
"Cannot create branch for rdname: %s code: %d", branchname.
Data(), code);
2297 branch1 =
new TBranch(branch, branchname, pointer, leaflist, bufsize);
2299 blist->
Add(branch1);
2308 Warning(
"BranchOld",
"Cannot process member: '%s'", rdname);
2417 Error(
"Bronch",
"Cannot find class:%s", classname);
2428 objptr = (
char*)addr;
2430 objptr = *((
char**) addr);
2436 Error(
"Bronch",
"Pointer to TClonesArray is null");
2440 Error(
"Bronch",
"TClonesArray with no class defined in branch: %s",
name);
2444 Error(
"Bronch",
"TClonesArray with no dictionary defined in branch: %s",
name);
2448 if (splitlevel > 0) {
2449 if (hasCustomStreamer)
2450 Warning(
"Bronch",
"Using split mode on a class: %s with a custom Streamer", clones->
GetClass()->
GetName());
2465 if (!inklass && (collProxy->
GetType() == 0)) {
2466 Error(
"Bronch",
"%s with no class defined in branch: %s", classname,
name);
2473 Error(
"Bronch",
"Container with no dictionary defined in branch: %s",
name);
2477 Warning(
"Bronch",
"Using split mode on a class: %s with a custom Streamer", inklass->
GetName());
2488 branch =
new TBranchSTL(
this,
name, collProxy, bufsize, splitlevel );
2502 Error(
"Bronch",
"Cannot find dictionary for class: %s", classname);
2508 hasCustomStreamer =
kTRUE;
2511 if (splitlevel < 0 || ((splitlevel == 0) && hasCustomStreamer && cl->
IsTObject())) {
2542 objptr = (
char*) cl->
New();
2550 if ((splitlevel > 0) && !cl->
CanSplit()) {
2551 if (splitlevel != 99) {
2552 Warning(
"Bronch",
"%s cannot be split, resetting splitlevel to 0", cl->
GetName());
2566 Error(
"Bronch",
"Cannot build the StreamerInfo for class: %s", cl->
GetName());
2575 if (splitlevel > 0) {
2586 branch->
Unroll(
name, cl, sinfo, objptr, bufsize, splitlevel);
2755 constexpr auto kBufSize = 2000;
2756 char* fname =
new char[kBufSize];
2759 for (
Int_t i = 0; i < 10; ++i) {
2767 strlcpy(fname,
file->GetName(), kBufSize);
2770 char* cunder = strrchr(fname,
'_');
2773 const char* cdot = strrchr(
file->GetName(),
'.');
2775 strlcat(fname, cdot, kBufSize);
2780 strlcat(fname, fcount, kBufSize);
2783 char* cdot = strrchr(fname,
'.');
2786 strlcat(fname, strrchr(
file->GetName(),
'.'), kBufSize);
2790 strlcat(fname, fcount, kBufSize);
2797 Warning(
"ChangeFile",
"file %s already exist, trying with %d underscores", fname, nus+1);
2799 Int_t compress =
file->GetCompressionSettings();
2802 Error(
"Fill",
"Failed to open new file %s, continuing as a memory tree.",fname);
2804 Printf(
"Fill: Switching to new file: %s", fname);
2810 while ((obj =
file->GetList()->First())) {
2827 while ((branch = (
TBranch*)nextb())) {
2836 if (newfile) newfile->
Append(obj);
2839 file->TObject::Delete();
2876 TClass* expectedClass = 0;
2883 if (expectedClass && datatype ==
kOther_t && ptrClass == 0) {
2884 if (isBranchElement) {
2889 Error(
"SetBranchAddress",
"Unable to determine the type given for the address for \"%s\". "
2890 "The class expected (%s) refers to an stl collection and do not have a compiled CollectionProxy. "
2891 "Please generate the dictionary for this class (%s)",
2898 Error(
"SetBranchAddress",
"Unable to determine the type given for the address for \"%s\". "
2899 "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."
2900 "Please generate the dictionary for this class (%s)",
2903 Error(
"SetBranchAddress",
"Unable to determine the type given for the address for \"%s\". "
2904 "This is probably due to a missing dictionary, the original data class for this branch is %s.", branch->
GetName(), expectedClass->
GetName());
2908 if (expectedClass && ptrClass && (branch->
GetMother() == branch)) {
2911 Error(
"SetBranchAddress",
"The address for \"%s\" should be the address of a pointer!", branch->
GetName());
2931 if( expectedClass && ptrClass &&
2932 expectedClass != ptrClass &&
2940 Info(
"SetBranchAddress",
"Matching STL collection (at least according to the SchemaRuleSet when "
2941 "reading a %s into a %s",expectedClass->
GetName(),ptrClass->
GetName());
2948 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());
2959 }
else if (expectedClass && ptrClass && !expectedClass->
InheritsFrom(ptrClass)) {
2981 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());
2982 if (isBranchElement) {
2991 Error(
"SetBranchAddress",
"The pointer type given \"%s\" (%d) does not correspond to the type needed \"%s\" (%d) by the branch: %s",
2998 if (expectedClass) {
2999 Error(
"SetBranchAddress",
"The pointer type given \"%s\" (%d) does not correspond to the type needed \"%s\" by the branch: %s",
3001 if (isBranchElement) {
3017 if (etype == expectedType) {
3032 if (etype == expectedType) {
3044 if (len <= ptrClass->Size()) {
3048 Error(
"SetBranchAddress",
"The pointer type given \"%s\" does not correspond to the type needed \"%s\" (%d) by the branch: %s",
3054 Error(
"SetBranchAddress", writeStlWithoutProxyMsg,
3056 if (isBranchElement) {
3062 if (isBranchElement) {
3063 if (expectedClass) {
3172 for (
Int_t i = 0; i < nb; ++i) {
3182 if (thistree !=
this) {
3207 for (
Int_t lndx = 0; lndx < nleaves; ++lndx) {
3213 if (branch && (newcomp > -1)) {
3222 for (
Long64_t i = 0; i < nb; ++i) {
3233 for (
Int_t j = 0; j < nb1; ++j) {
3247 for (
Int_t k = 0; k < nb2; ++k) {
3279 Error(
"CloneTTree",
"TTree has not been cloned\n");
3302 for (
Int_t i = 0; i < nbranches; ++i) {
3309 tree->ResetBranchAddress(br);
3338 Warning(
"CopyAddresses",
"Could not find branch named '%s' in tree named '%s'", branch->
GetName(),
tree->GetName());
3346 std::set<TLeaf*> updatedLeafCount;
3347 for (
Int_t i = 0; i < ntleaves; ++i) {
3363 tree->ResetBranchAddress(tbranch);
3366 bool needAddressReset =
false;
3374 needAddressReset =
true;
3376 needAddressReset = (updatedLeafCount.find(leaf->
GetLeafCount()) != updatedLeafCount.end());
3399 if (br->
IsA() != branch->
IsA()) {
3402 "Branch kind mismatch between input tree '%s' and output tree '%s' for branch '%s': '%s' vs '%s'",
3412 Warning(
"CopyAddresses",
"Could not find branch named '%s' in tree named '%s'", branch->
GetName(),
tree->GetName());
3421 (
tree->IsA()->InheritsFrom(
"TNtuple") ||
tree->IsA()->InheritsFrom(
"TNtupleD") )
3423 tree->ResetBranchAddresses();
3429 enum EOnIndexError { kDrop, kKeep, kBuild };
3431 static Bool_t R__HandleIndex(EOnIndexError onIndexError,
TTree *newtree,
TTree *oldtree)
3439 switch (onIndexError) {
3463 switch (onIndexError) {
3469 index->SetTree(newtree);
3477 index->SetTree(newtree);
3487 }
else if ( onIndexError == kDrop ) {
3542 EOnIndexError onIndexError;
3544 onIndexError = kKeep;
3545 }
else if (opt.
Contains(
"buildindex")) {
3546 onIndexError = kBuild;
3547 }
else if (opt.
Contains(
"dropindex")) {
3548 onIndexError = kDrop;
3550 onIndexError = kBuild;
3553 Int_t cacheSize = -1;
3556 Ssiz_t cacheSizeEnd = opt.
Index(
" ",cacheSizeLoc+10) - (cacheSizeLoc+10);
3557 TSubString cacheSizeStr( opt(cacheSizeLoc+10,cacheSizeEnd) );
3560 Warning(
"CopyEntries",
"The cachesize option can not be parsed: %s. The default size will be used.",cacheSizeStr.
String().
Data());
3563 const char *munit =
nullptr;
3566 Warning(
"CopyEntries",
"The cachesize option is too large: %s (%g%s max). The default size will be used.",cacheSizeStr.
String().
Data(),
m,munit);
3569 if (
gDebug > 0 && cacheSize != -1)
Info(
"CopyEntries",
"Using Cache size: %d\n",cacheSize);
3575 }
else if (
nentries > treeEntries) {
3579 if (fastClone && (nentries < 0 || nentries == tree->
GetEntriesFast())) {
3583 if (
tree->LoadTree(i) < 0) {
3587 withIndex = R__HandleIndex( onIndexError,
this,
tree );
3612 if (needCopyAddresses) {
3618 for (
Long64_t ii = 0; ii < tentries; ii++) {
3619 if (localtree->
GetEntry(ii) <= 0) {
3624 if (needCopyAddresses)
3625 tree->ResetBranchAddresses();
3631 if (
tree->GetDirectory() &&
tree->GetDirectory()->GetFile()) {
3632 Warning(
"CopyEntries",
"Skipped file %s\n",
tree->GetDirectory()->GetFile()->GetName());
3634 Warning(
"CopyEntries",
"Skipped file number %d\n",
tree->GetTreeNumber());
3648 }
else if (
nentries > treeEntries) {
3651 if (needCopyAddresses) {
3657 Int_t treenumber = -1;
3659 if (
tree->LoadTree(i) < 0) {
3662 if (treenumber !=
tree->GetTreeNumber()) {
3664 withIndex = R__HandleIndex( onIndexError,
this,
tree );
3666 treenumber =
tree->GetTreeNumber();
3668 if (
tree->GetEntry(i) <= 0) {
3671 nbytes += this->
Fill();
3673 if (needCopyAddresses)
3674 tree->ResetBranchAddresses();
3751 if (!
file->IsWritable()) {
3752 Error(
"Delete",
"File : %s is not writable, cannot delete Tree:%s",
file->GetName(),
GetName());
3769 Int_t nbytes,objlen,keylen;
3770 while ((leaf = (
TLeaf*)next())) {
3773 for (
Int_t i=0;i<nbaskets;i++) {
3777 if (!branchFile)
continue;
3779 if (nbytes <= 0)
continue;
3780 branchFile->
MakeFree(pos,pos+nbytes-1);
3794 if (dirsav) dirsav->
cd();
3795 if (
gDebug)
Info(
"TTree::Delete",
"Deleting Tree: %s: %d baskets deleted. Total space freed = %d bytes\n",
GetName(),nbask,ntot);
4520 for (
Int_t i = 0; i < nb; ++i) {
4533 for (
Int_t i = 0; i < nleaves; ++i) {
4537 for (
Int_t j = 0; j < nbaskets - 1; ++j) {
4626 for (
Int_t i = 0; i < nbranches; ++i) {
4634 nwrite = branch->
FillImpl(
nullptr);
4636 nwrite = branch->
FillImpl(useIMT ? &imtHelper :
nullptr);
4640 Error(
"Fill",
"Failed filling branch:%s.%s, nbytes=%d, entry=%lld\n"
4641 " This error is symptomatic of a Tree created as a memory-resident Tree\n"
4642 " Instead of doing:\n"
4643 " TTree *T = new TTree(...)\n"
4644 " TFile *f = new TFile(...)\n"
4646 " TFile *f = new TFile(...)\n"
4647 " TTree *T = new TTree(...)\n\n",
4650 Error(
"Fill",
"Failed filling branch:%s.%s, nbytes=%d, entry=%lld",
GetName(), branch->
GetName(), nwrite,
4682 bool autoFlush =
false;
4683 bool autoSave =
false;
4701 if (autoFlush || autoSave) {
4712 Info(
"TTree::Fill",
"OptimizeBaskets called at entry %lld, fZipBytes=%lld, fFlushedBytes=%lld\n",
4724 if (zipBytes != 0) {
4726 }
else if (totBytes != 0) {
4761 Info(
"TTree::Fill",
"FlushBaskets() called at entry %lld, fZipBytes=%lld, fFlushedBytes=%lld\n",
fEntries,
4769 Info(
"TTree::Fill",
"AutoSave called at entry %lld, fZipBytes=%lld, fSavedBytes=%lld\n",
fEntries,
4784 return nerror == 0 ? nbytes : -1;
4792 if (list==0 || branchname == 0 || branchname[0] ==
'\0')
return 0;
4796 UInt_t brlen = strlen(branchname);
4804 const char *dim = strchr(
name,
'[');
4809 if (brlen ==
len && strncmp(branchname,
name,
len)==0) {
4813 if ((brlen >=
len) && (branchname[
len] ==
'.')
4814 && strncmp(
name, branchname,
len) == 0) {
4821 if (next)
return next;
4823 const char *dot = strchr((
char*)branchname,
'.');
4825 if (
len==(
size_t)(dot-branchname) &&
4826 strncmp(branchname,
name,dot-branchname)==0 ) {
4857 if (branch)
return branch;
4861 if (branch)
return branch;
4865 while ((branch = (
TBranch*) next())) {
4868 return nestedbranch;
4885 const char *subbranch = strstr(branchname, fe->
GetName());
4886 if (subbranch != branchname) {
4887 subbranch =
nullptr;
4890 subbranch += strlen(fe->
GetName());
4891 if (*subbranch !=
'.') {
4892 subbranch =
nullptr;
4897 std::ostringstream
name;
4927 const char* subsearchname = strstr(searchname,
GetName());
4928 if (subsearchname != searchname) {
4929 subsearchname =
nullptr;
4931 if (subsearchname) {
4932 subsearchname += strlen(
GetName());
4933 if (*subsearchname !=
'.') {
4934 subsearchname =
nullptr;
4937 if (subsearchname[0] == 0) {
4938 subsearchname =
nullptr;
4948 const bool searchnameHasDot = strchr(searchname,
'.') !=
nullptr;
4952 TLeaf* leaf =
nullptr;
4953 while ((leaf = (
TLeaf*) next())) {
4956 if (dim >= 0) leafname.
Remove(dim);
4958 if (leafname == searchname) {
4961 if (subsearchname && leafname == subsearchname) {
4967 dim = leaftitle.
First(
'[');
4968 if (dim >= 0) leaftitle.
Remove(dim);
4970 if (leaftitle == searchname) {
4973 if (subsearchname && leaftitle == subsearchname) {
4976 if (!searchnameHasDot)
4981 dim = longname.
First(
'[');
4982 if (dim>=0) longname.
Remove(dim);
4983 if (longname == searchname) {
4986 if (subsearchname && longname == subsearchname) {
4990 dim = longtitle.
First(
'[');
4991 if (dim>=0) longtitle.
Remove(dim);
4992 if (longtitle == searchname) {
4995 if (subsearchname && longtitle == subsearchname) {
5003 if (strstr(searchname,
".") && !strcmp(searchname, branch->
GetName())) {
5006 if (subsearchname && strstr(subsearchname,
".") && !strcmp(subsearchname, branch->
GetName())) {
5024 subsearchname = strstr(searchname, fe->
GetName());
5025 if (subsearchname != searchname) {
5026 subsearchname =
nullptr;
5028 if (subsearchname) {
5029 subsearchname += strlen(fe->
GetName());
5030 if (*subsearchname !=
'.') {
5031 subsearchname =
nullptr;
5036 if (subsearchname) {
5037 leafname.
Form(
"%s.%s",t->
GetName(),subsearchname);
5039 leafname = searchname;
5087struct BoolRAIIToggle {
5090 BoolRAIIToggle(
Bool_t &val) : m_val(val) { m_val =
true; }
5091 ~BoolRAIIToggle() { m_val =
false; }
5130 if (retval == -1)
return retval;
5165 std::atomic<Int_t> nerrpar(0);
5166 std::atomic<Int_t> nbpar(0);
5167 std::atomic<Int_t> pos(0);
5169 auto mapFunction = [&]() {
5175 Int_t j = pos.fetch_add(1);
5181 std::stringstream ss;
5182 ss << std::this_thread::get_id();
5183 Info(
"FlushBaskets",
"[IMT] Thread %s", ss.str().c_str());
5184 Info(
"FlushBaskets",
"[IMT] Running task for branch #%d: %s", j, branch->GetName());
5187 Int_t nbtask = branch->FlushBaskets();
5189 if (nbtask < 0) { nerrpar++; }
5190 else { nbpar += nbtask; }
5194 pool.
Foreach(mapFunction, nb);
5200 return nerrpar ? -1 : nbpar.load();
5203 for (
Int_t j = 0; j < nb; j++) {
5246 const char* alias = t->
GetAlias(aliasName);
5250 const char* subAliasName = strstr(aliasName, fe->
GetName());
5251 if (subAliasName && (subAliasName[strlen(fe->
GetName())] ==
'.')) {
5271 for (
Int_t i = 0; i < nb; i++) {
5275 if (!strcmp(
b->GetName(),
name)) {
5278 if (!strcmp(
b->GetFullName(),
name)) {
5282 result = R__GetBranch(*(
b->GetListOfBranches()),
name);
5317 for (
Int_t i = 0; i < nleaves; i++) {
5320 if (!strcmp(branch->