467 case kchar:
return 0;
472 case kBits:
return 0;
508 fMethodBit(tfl.fMethodBit),
509 fPrevious(tfl.fPrevious)
533 fTree->fFriendLockStatus &= ~(fMethodBit &
kBitMask);
560 entryInRange = firstEntry;
563 entryInRange = firstEntry - pedestal;
571 if (autoflush <= 0) {
574 fStartEntry = pedestal + entryInRange - entryInRange%autoflush;
599 auto autoFlush = fTree->GetAutoFlush();
600 if (autoFlush > 0)
return autoFlush;
601 if (fEstimatedSize > 0)
return fEstimatedSize;
603 Long64_t zipBytes = fTree->GetZipBytes();
605 fEstimatedSize = fTree->GetEntries() - 1;
606 if (fEstimatedSize <= 0)
610 Long64_t cacheSize = fTree->GetCacheSize();
611 if (cacheSize == 0) {
622 if (cacheSize <= 0) {
623 cacheSize = 30000000;
625 clusterEstimate = fTree->GetEntries() * cacheSize / zipBytes;
627 fEstimatedSize = clusterEstimate ? clusterEstimate : 1;
629 return fEstimatedSize;
638 fStartEntry = fNextEntry;
639 if (fTree->fNClusterRange || fTree->GetAutoFlush() > 0) {
640 if (fClusterRange == fTree->fNClusterRange) {
643 fNextEntry += GetEstimatedClusterSize();
645 if (fStartEntry > fTree->fClusterRangeEnd[fClusterRange]) {
648 if (fClusterRange == fTree->fNClusterRange) {
651 fNextEntry += GetEstimatedClusterSize();
653 Long64_t clusterSize = fTree->fClusterSize[fClusterRange];
654 if (clusterSize == 0) {
655 clusterSize = GetEstimatedClusterSize();
657 fNextEntry += clusterSize;
658 if (fNextEntry > fTree->fClusterRangeEnd[fClusterRange]) {
662 fNextEntry = fTree->fClusterRangeEnd[fClusterRange] + 1;
668 fNextEntry = fStartEntry + GetEstimatedClusterSize();
670 if (fNextEntry > fTree->GetEntries()) {
671 fNextEntry = fTree->GetEntries();
682 fNextEntry = fStartEntry;
683 if (fTree->fNClusterRange || fTree->GetAutoFlush() > 0) {
684 if (fClusterRange == 0 || fTree->fNClusterRange == 0) {
687 fStartEntry -= GetEstimatedClusterSize();
692 if (fClusterRange == 0) {
696 Long64_t clusterSize = fTree->fClusterSize[fClusterRange];
697 if (clusterSize == 0) {
698 clusterSize = GetEstimatedClusterSize();
700 fStartEntry -= clusterSize;
705 fStartEntry = fNextEntry - GetEstimatedClusterSize();
707 if (fStartEntry < 0) {
818, fDefaultEntryOffsetLen(1000)
824, fAutoSave( -300000000)
825, fAutoFlush(-30000000)
857, fFriendLockStatus(0)
859, fCacheDoAutoInit(
kTRUE)
860, fCacheDoClusterPrefetch(
kFALSE)
863, fNEntriesSinceSorting(0)
896 if (strlen(title) > 2) {
897 if (title[0] ==
'/') {
898 Branch(title+1,32000,splitlevel);
913#ifdef R__TRACK_BASKET_ALLOC_TIME
914 Info(
"TTree::~TTree",
"For tree %s, allocation time is %lluus.",
GetName(), fAllocationTime.load());
1049 Error(
"AddBranchToCache",
"Could not load a tree");
1058 Error(
"AddBranchToCache",
"No tree is available. Branch was not added to the cache");
1064 Error(
"AddBranchToCache",
"No file is available. Branch was not added to the cache");
1069 Error(
"AddBranchToCache",
"No cache is available, branch not added");
1072 return tc->
AddBranch(bname,subbranches);
1088 Error(
"AddBranchToCache",
"Could not load a tree");
1096 Error(
"AddBranchToCache",
"Error adding branch");
1101 Error(
"AddBranchToCache",
"No tree is available. Branch was not added to the cache");
1107 Error(
"AddBranchToCache",
"No file is available. Branch was not added to the cache");
1112 Error(
"AddBranchToCache",
"No cache is available, branch not added");
1132 Error(
"DropBranchFromCache",
"Could not load a tree");
1141 Error(
"DropBranchFromCache",
"No tree is available. Branch was not dropped from the cache");
1147 Error(
"DropBranchFromCache",
"No file is available. Branch was not dropped from the cache");
1152 Error(
"DropBranchFromCache",
"No cache is available, branch not dropped");
1171 Error(
"DropBranchFromCache",
"Could not load a tree");
1179 Error(
"DropBranchFromCache",
"Error dropping branch");
1184 Error(
"DropBranchFromCache",
"No tree is available. Branch was not dropped from the cache");
1190 Error(
"DropBranchFromCache",
"No file is available. Branch was not dropped from the cache");
1195 Error(
"DropBranchFromCache",
"No cache is available, branch not dropped");
1230 const auto friendHasValidIndex = [&] {
1235 if ((isMainReshuffled || isFriendReshuffled) && !friendHasValidIndex) {
1236 const auto reshuffledTreeName = isMainReshuffled ? mainTree.
GetName() : friendTree.
GetName();
1237 const auto msg =
"Tree '%s' has the kEntriesReshuffled bit set, and cannot be used as friend nor can be added as "
1238 "a friend unless the main tree has a TTreeIndex on the friend tree '%s'. You can also unset the "
1239 "bit manually if you know what you are doing.";
1240 Error(
"AddFriend", msg, reshuffledTreeName, friendTree.
GetName());
1325 bool canAddFriend =
true;
1329 Warning(
"AddFriend",
"FriendElement %s in file %s has less entries %lld than its parent Tree: %lld", treename,
1333 Error(
"AddFriend",
"Cannot find tree '%s' in file '%s', friend not added", treename, filename);
1334 canAddFriend =
false;
1359 bool canAddFriend =
true;
1363 Warning(
"AddFriend",
"FriendElement %s in file %s has less entries %lld than its parent tree: %lld", treename,
1367 Error(
"AddFriend",
"Cannot find tree '%s' in file '%s', friend not added", treename,
file->GetName());
1368 canAddFriend =
false;
1394 Warning(
"AddFriend",
"FriendElement '%s' in file '%s' has less entries %lld than its parent tree: %lld",
1401 tree->RemoveExternalFriend(fe);
1494 if (opt.
Contains(
"flushbaskets")) {
1495 if (
gDebug > 0)
Info(
"AutoSave",
"calling FlushBaskets \n");
1514 if (
file)
file->WriteStreamerInfo();
1528 const char* writeStlWithoutProxyMsg =
"The class requested (%s) for the branch \"%s\""
1529 " is an instance of an stl collection and does not have a compiled CollectionProxy."
1530 " Please generate the dictionary for this collection (%s) to avoid to write corrupted data.";
1544 Error(
"Branch", writeStlWithoutProxyMsg,
1548 return Branch(branchname, classname, (
void*) addobj, bufsize, splitlevel);
1551 void** addr = (
void**) addobj;
1555 if (ptrClass && claim) {
1562 Error(
"Branch",
"The class requested (%s) for \"%s\" is different from the type of the pointer passed (%s)",
1565 }
else if (actualClass && (claim != actualClass) && !actualClass->
InheritsFrom(claim)) {
1570 Error(
"Branch",
"The actual class (%s) of the object provided for the definition of the branch \"%s\" does not inherit from %s",
1576 Error(
"Branch", writeStlWithoutProxyMsg,
1580 return Branch(branchname, classname, (
void*) addobj, bufsize, splitlevel);
1590 Error(
"Branch",
"The pointer specified for %s is not of a class known to ROOT", branchname);
1594 void** addr = (
void**) addobj;
1595 if (addr && *addr) {
1598 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",
1599 branchname, ptrClass->
GetName());
1600 actualClass = ptrClass;
1601 }
else if ((ptrClass != actualClass) && !actualClass->
InheritsFrom(ptrClass)) {
1602 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());
1606 actualClass = ptrClass;
1609 Error(
"Branch", writeStlWithoutProxyMsg,
1613 return Branch(branchname, actualClass->
GetName(), (
void*) addobj, bufsize, splitlevel);
1625 Error(
"Branch", writeStlWithoutProxyMsg,
1628 }
else if (claim == 0) {
1629 Error(
"Branch",
"The pointer specified for %s is not of a class known to ROOT and %s is not a known class", branchname, classname);
1636 Error(
"Branch",
"Reference interface requires a valid object (for branch: %s)!", branchname);
1640 if (ptrClass && claim) {
1647 Error(
"Branch",
"The class requested (%s) for \"%s\" is different from the type of the object passed (%s)",
1650 }
else if (actualClass && (claim != actualClass) && !actualClass->
InheritsFrom(claim)) {
1655 Error(
"Branch",
"The actual class (%s) of the object provided for the definition of the branch \"%s\" does not inherit from %s",
1661 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",
1662 branchname, ptrClass->
GetName());
1663 actualClass = ptrClass;
1664 }
else if ((ptrClass != actualClass) && !actualClass->
InheritsFrom(ptrClass)) {
1665 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());
1669 Error(
"Branch", writeStlWithoutProxyMsg,
1684 Error(
"Branch",
"The pointer specified for %s is not of a class or type known to ROOT", branchname);
1687 return Branch(branchname,addobj,varname.
Data(),bufsize);
1693 Error(
"Branch",
"Reference interface requires a valid object (for branch: %s)!", branchname);
1698 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",
1699 branchname, ptrClass->
GetName());
1700 actualClass = ptrClass;
1701 }
else if ((ptrClass != actualClass) && !actualClass->
InheritsFrom(ptrClass)) {
1702 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());
1706 Error(
"Branch", writeStlWithoutProxyMsg,
1721 "The inner type of the std::array passed specified for %s is not of a class or type known to ROOT",
1726 return Branch(branchname, addobj, varname.
Data(), bufsize);
1827 Error(
"Branch",
"Cannot call this constructor for a TClonesArray");
1833 while ((obj = next())) {
1841 Branch(col, bufsize, splitlevel - 1, branchname);
1843 if (nch && (
name[nch-1] ==
'_')) {
1852 if (splitlevel > 99) {
1878 char* curname =
new char[1000];
1880 while ((obj = next())) {
1883 Branch(curname, bufsize, splitlevel - 1);
1886 for (
Int_t i = 0; i < 1000; ++i) {
1887 if (curname[i] == 0) {
1890 if (curname[i] ==
'/') {
1897 strlcat(curname, occur,1000);
2006 return Bronch(
name, classname, addobj, bufsize, splitlevel);
2008 if (splitlevel < 0) {
2011 return BranchOld(
name, classname, addobj, bufsize, splitlevel);
2060 Error(
"BranchOld",
"Cannot find class: '%s'", classname);
2065 Fatal(
"BranchOld",
"The requested class ('%s') does not inherit from TObject.\n"
2066 "\tfgBranchStyle is set to zero requesting by default to use BranchOld.\n"
2067 "\tIf this is intentional use Bronch instead of Branch or BranchOld.", classname);
2069 Fatal(
"BranchOld",
"The requested class ('%s') does not inherit from TObject.\n"
2070 "\tYou can not use BranchOld to store objects of this type.",classname);
2081 const char* rdname = 0;
2082 const char* dname = 0;
2084 char** apointer = (
char**) addobj;
2096 if (
name[lenName-1] ==
'.') {
2135 if (!strcmp(dname,
"fBits")) {
2138 if (!strcmp(dname,
"fUniqueID")) {
2148 branchname = rdname;
2152 branchname.
Form(
"%s%s",
name, &rdname[1]);
2154 branchname.
Form(
"%s%s",
name, &rdname[0]);
2160 char* pointer = ((
char*) obj) + offset;
2169 char* cpointer = (
char*) pointer;
2170 char** ppointer = (
char**) cpointer;
2172 if (splitlevel != 2) {
2174 branch1 =
new TBranchClones(branch,branchname, pointer, bufsize);
2179 blist->
Add(branch1);
2187 blist->
Add(branch1);
2204 blist->
Add(branch1);
2225 if (!strcmp(rdi->
GetName(), index)) {
2228 if (!strcmp(rdi->
GetName(), aindex)) {
2240 leaflist.
Form(
"%s[%s]/%c", &rdname[0], index, vcode);
2242 Error(
"BranchOld",
"Cannot create branch for rdname: %s code: %d", branchname.
Data(), code);
2249 leaflist.
Form(
"%s/%s", dname,
"C");
2262 branch1 =
new TBranch(branch, bname, *((
void**) pointer), leaflist, bufsize);
2266 blist->
Add(branch1);
2273 leaflist.
Form(
"%s/%c", rdname, vcode);
2275 Error(
"BranchOld",
"Cannot create branch for rdname: %s code: %d", branchname.
Data(), code);
2278 branch1 =
new TBranch(branch, branchname, pointer, leaflist, bufsize);
2280 blist->
Add(branch1);
2289 Warning(
"BranchOld",
"Cannot process member: '%s'", rdname);
2398 Error(
"Bronch",
"Cannot find class:%s", classname);
2409 objptr = (
char*)addr;
2411 objptr = *((
char**) addr);
2417 Error(
"Bronch",
"Pointer to TClonesArray is null");
2421 Error(
"Bronch",
"TClonesArray with no class defined in branch: %s",
name);
2425 Error(
"Bronch",
"TClonesArray with no dictionary defined in branch: %s",
name);
2429 if (splitlevel > 0) {
2430 if (hasCustomStreamer)
2431 Warning(
"Bronch",
"Using split mode on a class: %s with a custom Streamer", clones->
GetClass()->
GetName());
2446 if (!inklass && (collProxy->
GetType() == 0)) {
2447 Error(
"Bronch",
"%s with no class defined in branch: %s", classname,
name);
2454 Error(
"Bronch",
"Container with no dictionary defined in branch: %s",
name);
2458 Warning(
"Bronch",
"Using split mode on a class: %s with a custom Streamer", inklass->
GetName());
2469 branch =
new TBranchSTL(
this,
name, collProxy, bufsize, splitlevel );
2483 Error(
"Bronch",
"Cannot find dictionary for class: %s", classname);
2489 hasCustomStreamer =
kTRUE;
2492 if (splitlevel < 0 || ((splitlevel == 0) && hasCustomStreamer && cl->
IsTObject())) {
2523 objptr = (
char*) cl->
New();
2531 if ((splitlevel > 0) && !cl->
CanSplit()) {
2532 if (splitlevel != 99) {
2533 Warning(
"Bronch",
"%s cannot be split, resetting splitlevel to 0", cl->
GetName());
2547 Error(
"Bronch",
"Cannot build the StreamerInfo for class: %s", cl->
GetName());
2556 if (splitlevel > 0) {
2567 branch->
Unroll(
name, cl, sinfo, objptr, bufsize, splitlevel);
2713 constexpr auto kBufSize = 2000;
2714 char* fname =
new char[kBufSize];
2717 for (
Int_t i = 0; i < 10; ++i) {
2725 strlcpy(fname,
file->GetName(), kBufSize);
2728 char* cunder = strrchr(fname,
'_');
2731 const char* cdot = strrchr(
file->GetName(),
'.');
2733 strlcat(fname, cdot, kBufSize);
2738 strlcat(fname, fcount, kBufSize);
2741 char* cdot = strrchr(fname,
'.');
2744 strlcat(fname, strrchr(
file->GetName(),
'.'), kBufSize);
2748 strlcat(fname, fcount, kBufSize);
2755 Warning(
"ChangeFile",
"file %s already exist, trying with %d underscores", fname, nus+1);
2757 Int_t compress =
file->GetCompressionSettings();
2760 Error(
"Fill",
"Failed to open new file %s, continuing as a memory tree.",fname);
2762 Printf(
"Fill: Switching to new file: %s", fname);
2768 while ((obj =
file->GetList()->First())) {
2785 while ((branch = (
TBranch*)nextb())) {
2794 if (newfile) newfile->
Append(obj);
2834 TClass* expectedClass = 0;
2841 if (expectedClass && datatype ==
kOther_t && ptrClass == 0) {
2842 if (isBranchElement) {
2847 Error(
"SetBranchAddress",
"Unable to determine the type given for the address for \"%s\". "
2848 "The class expected (%s) refers to an stl collection and do not have a compiled CollectionProxy. "
2849 "Please generate the dictionary for this class (%s)",
2856 Error(
"SetBranchAddress",
"Unable to determine the type given for the address for \"%s\". "
2857 "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."
2858 "Please generate the dictionary for this class (%s)",
2861 Error(
"SetBranchAddress",
"Unable to determine the type given for the address for \"%s\". "
2862 "This is probably due to a missing dictionary, the original data class for this branch is %s.", branch->
GetName(), expectedClass->
GetName());
2866 if (expectedClass && ptrClass && (branch->
GetMother() == branch)) {
2869 Error(
"SetBranchAddress",
"The address for \"%s\" should be the address of a pointer!", branch->
GetName());
2889 if( expectedClass && ptrClass &&
2890 expectedClass != ptrClass &&
2898 Info(
"SetBranchAddress",
"Matching STL collection (at least according to the SchemaRuleSet when "
2899 "reading a %s into a %s",expectedClass->
GetName(),ptrClass->
GetName());
2906 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());
2917 }
else if (expectedClass && ptrClass && !expectedClass->
InheritsFrom(ptrClass)) {
2939 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());
2940 if (isBranchElement) {
2949 Error(
"SetBranchAddress",
"The pointer type given \"%s\" (%d) does not correspond to the type needed \"%s\" (%d) by the branch: %s",
2956 if (expectedClass) {
2957 Error(
"SetBranchAddress",
"The pointer type given \"%s\" (%d) does not correspond to the type needed \"%s\" by the branch: %s",
2959 if (isBranchElement) {
2975 if (etype == expectedType) {
2990 if (etype == expectedType) {
3002 if (len <= ptrClass->
Size()) {
3006 Error(
"SetBranchAddress",
"The pointer type given \"%s\" does not correspond to the type needed \"%s\" (%d) by the branch: %s",
3012 Error(
"SetBranchAddress", writeStlWithoutProxyMsg,
3014 if (isBranchElement) {
3020 if (isBranchElement) {
3021 if (expectedClass) {
3130 for (
Int_t i = 0; i < nb; ++i) {
3140 if (thistree !=
this) {
3165 for (
Int_t lndx = 0; lndx < nleaves; ++lndx) {
3171 if (branch && (newcomp > -1)) {
3180 for (
Long64_t i = 0; i < nb; ++i) {
3191 for (
Int_t j = 0; j < nb1; ++j) {
3205 for (
Int_t k = 0; k < nb2; ++k) {
3237 Error(
"CloneTTree",
"TTree has not been cloned\n");
3260 for (
Int_t i = 0; i < nbranches; ++i) {
3267 tree->ResetBranchAddress(br);
3296 Warning(
"CopyAddresses",
"Could not find branch named '%s' in tree named '%s'", branch->
GetName(),
tree->GetName());
3304 std::set<TLeaf*> updatedLeafCount;
3305 for (
Int_t i = 0; i < ntleaves; ++i) {
3321 tree->ResetBranchAddress(tbranch);
3324 bool needAddressReset =
false;
3332 needAddressReset =
true;
3334 needAddressReset = (updatedLeafCount.find(leaf->
GetLeafCount()) != updatedLeafCount.end());
3363 Warning(
"CopyAddresses",
"Could not find branch named '%s' in tree named '%s'", branch->
GetName(),
tree->GetName());
3372 (
tree->IsA()->InheritsFrom(
"TNtuple") ||
tree->IsA()->InheritsFrom(
"TNtupleD") )
3374 tree->ResetBranchAddresses();
3380 enum EOnIndexError { kDrop, kKeep, kBuild };
3382 static Bool_t R__HandleIndex(EOnIndexError onIndexError,
TTree *newtree,
TTree *oldtree)
3390 switch (onIndexError) {
3414 switch (onIndexError) {
3438 }
else if ( onIndexError == kDrop ) {
3493 EOnIndexError onIndexError;
3495 onIndexError = kKeep;
3496 }
else if (opt.
Contains(
"buildindex")) {
3497 onIndexError = kBuild;
3498 }
else if (opt.
Contains(
"dropindex")) {
3499 onIndexError = kDrop;
3501 onIndexError = kBuild;
3504 Int_t cacheSize = -1;
3507 Ssiz_t cacheSizeEnd = opt.
Index(
" ",cacheSizeLoc+10) - (cacheSizeLoc+10);
3508 TSubString cacheSizeStr( opt(cacheSizeLoc+10,cacheSizeEnd) );
3511 Warning(
"CopyEntries",
"The cachesize option can not be parsed: %s. The default size will be used.",cacheSizeStr.
String().
Data());
3514 const char *munit =
nullptr;
3517 Warning(
"CopyEntries",
"The cachesize option is too large: %s (%g%s max). The default size will be used.",cacheSizeStr.
String().
Data(),
m,munit);
3520 if (
gDebug > 0 && cacheSize != -1)
Info(
"CopyEntries",
"Using Cache size: %d\n",cacheSize);
3526 }
else if (
nentries > treeEntries) {
3530 if (fastClone && (nentries < 0 || nentries == tree->
GetEntriesFast())) {
3534 if (
tree->LoadTree(i) < 0) {
3538 withIndex = R__HandleIndex( onIndexError,
this,
tree );
3563 if (needCopyAddresses) {
3569 for (
Long64_t ii = 0; ii < tentries; ii++) {
3570 if (localtree->
GetEntry(ii) <= 0) {
3575 if (needCopyAddresses)
3576 tree->ResetBranchAddresses();
3582 if (
tree->GetDirectory() &&
tree->GetDirectory()->GetFile()) {
3583 Warning(
"CopyEntries",
"Skipped file %s\n",
tree->GetDirectory()->GetFile()->GetName());
3585 Warning(
"CopyEntries",
"Skipped file number %d\n",
tree->GetTreeNumber());
3599 }
else if (
nentries > treeEntries) {
3602 if (needCopyAddresses) {
3608 Int_t treenumber = -1;
3610 if (
tree->LoadTree(i) < 0) {
3613 if (treenumber !=
tree->GetTreeNumber()) {
3615 withIndex = R__HandleIndex( onIndexError,
this,
tree );
3617 treenumber =
tree->GetTreeNumber();
3619 if (
tree->GetEntry(i) <= 0) {
3622 nbytes += this->
Fill();
3624 if (needCopyAddresses)
3625 tree->ResetBranchAddresses();
3701 if (
file && !strcmp(option,
"all")) {
3702 if (!
file->IsWritable()) {
3703 Error(
"Delete",
"File : %s is not writable, cannot delete Tree:%s",
file->GetName(),
GetName());
3720 Int_t nbytes,objlen,keylen;
3721 while ((leaf = (
TLeaf*)next())) {
3724 for (
Int_t i=0;i<nbaskets;i++) {
3728 if (!branchFile)
continue;
3730 if (nbytes <= 0)
continue;
3731 branchFile->
MakeFree(pos,pos+nbytes-1);
3745 if (dirsav) dirsav->
cd();
3746 if (
gDebug)
Info(
"TTree::Delete",
"Deleting Tree: %s: %d baskets deleted. Total space freed = %d bytes\n",
GetName(),nbask,ntot);
4443 for (
Int_t i = 0; i < nb; ++i) {
4457 for (
Int_t i = 0; i < nleaves; ++i) {
4461 for (
Int_t j = 0; j < nbaskets - 1; ++j) {
4550 for (
Int_t i = 0; i < nbranches; ++i) {
4558 nwrite = branch->
FillImpl(
nullptr);
4560 nwrite = branch->
FillImpl(useIMT ? &imtHelper :
nullptr);
4564 Error(
"Fill",
"Failed filling branch:%s.%s, nbytes=%d, entry=%lld\n"
4565 " This error is symptomatic of a Tree created as a memory-resident Tree\n"
4566 " Instead of doing:\n"
4567 " TTree *T = new TTree(...)\n"
4568 " TFile *f = new TFile(...)\n"
4570 " TFile *f = new TFile(...)\n"
4571 " TTree *T = new TTree(...)\n\n",
4574 Error(
"Fill",
"Failed filling branch:%s.%s, nbytes=%d, entry=%lld",
GetName(), branch->
GetName(), nwrite,
4606 bool autoFlush =
false;
4607 bool autoSave =
false;
4625 if (autoFlush || autoSave) {
4636 Info(
"TTree::Fill",
"OptimizeBaskets called at entry %lld, fZipBytes=%lld, fFlushedBytes=%lld\n",
4648 if (zipBytes != 0) {
4650 }
else if (totBytes != 0) {
4685 Info(
"TTree::Fill",
"FlushBaskets() called at entry %lld, fZipBytes=%lld, fFlushedBytes=%lld\n",
fEntries,
4693 Info(
"TTree::Fill",
"AutoSave called at entry %lld, fZipBytes=%lld, fSavedBytes=%lld\n",
fEntries,
4708 return nerror == 0 ? nbytes : -1;
4716 if (list==0 || branchname == 0 || branchname[0] ==
'\0')
return 0;
4720 UInt_t brlen = strlen(branchname);
4722 for(
Int_t index = 0; index < nbranches; ++index) {
4727 if (len &&
name[len-1]==
']') {
4728 const char *dim = strchr(
name,
'[');
4733 if (brlen == len && strncmp(branchname,
name,len)==0) {
4737 if ((brlen >= len) && (branchname[len] ==
'.')
4738 && strncmp(
name, branchname, len) == 0) {
4745 if (next)
return next;
4747 const char *dot = strchr((
char*)branchname,
'.');
4749 if (len==(
size_t)(dot-branchname) &&
4750 strncmp(branchname,
name,dot-branchname)==0 ) {
4778 if (branch)
return branch;
4782 if (branch)
return branch;
4786 while ((branch = (
TBranch*) next())) {
4789 return nestedbranch;
4806 const char *subbranch = strstr(branchname, fe->
GetName());
4807 if (subbranch != branchname) {
4811 subbranch += strlen(fe->
GetName());
4812 if (*subbranch !=
'.') {
4818 std::ostringstream
name;
4845 char* subsearchname = (
char*) strstr(searchname,
GetName());
4846 if (subsearchname != searchname) {
4849 if (subsearchname) {
4850 subsearchname += strlen(
GetName());
4851 if (*subsearchname !=
'.') {
4855 if (subsearchname[0]==0) {
4866 const bool searchnameHasDot = strchr(searchname,
'.') !=
nullptr;
4871 while ((leaf = (
TLeaf*) next())) {
4874 if (dim >= 0) leafname.
Remove(dim);
4876 if (leafname == searchname) {
4879 if (subsearchname && leafname == subsearchname) {
4885 dim = leaftitle.
First(
'[');
4886 if (dim >= 0) leaftitle.
Remove(dim);
4888 if (leaftitle == searchname) {
4891 if (subsearchname && leaftitle == subsearchname) {
4894 if (!searchnameHasDot)
4899 dim = longname.
First(
'[');
4900 if (dim>=0) longname.
Remove(dim);
4901 if (longname == searchname) {
4904 if (subsearchname && longname == subsearchname) {
4908 dim = longtitle.
First(
'[');
4909 if (dim>=0) longtitle.
Remove(dim);
4910 if (longtitle == searchname) {
4913 if (subsearchname && longtitle == subsearchname) {
4921 if (strstr(searchname,
".") && !strcmp(searchname, branch->
GetName())) {
4924 if (subsearchname && strstr(subsearchname,
".") && !strcmp(subsearchname, branch->
GetName())) {
4942 subsearchname = (
char*) strstr(searchname, fe->
GetName());
4943 if (subsearchname != searchname) {
4946 if (subsearchname) {
4947 subsearchname += strlen(fe->
GetName());
4948 if (*subsearchname !=
'.') {
4954 if (subsearchname) {
4955 leafname.
Form(
"%s.%s",t->
GetName(),subsearchname);
4957 leafname = searchname;
4999 return fPlayer->
Fit(funcname, varexp, selection, option, goption,
nentries, firstentry);
5005struct BoolRAIIToggle {
5008 BoolRAIIToggle(
Bool_t &val) : m_val(val) { m_val =
true; }
5009 ~BoolRAIIToggle() { m_val =
false; }
5048 if (retval == -1)
return retval;
5083 std::atomic<Int_t> nerrpar(0);
5084 std::atomic<Int_t> nbpar(0);
5085 std::atomic<Int_t> pos(0);
5087 auto mapFunction = [&]() {
5093 Int_t j = pos.fetch_add(1);
5099 std::stringstream ss;
5100 ss << std::this_thread::get_id();
5101 Info(
"FlushBaskets",
"[IMT] Thread %s", ss.str().c_str());
5102 Info(
"FlushBaskets",
"[IMT] Running task for branch #%d: %s", j, branch->GetName());
5105 Int_t nbtask = branch->FlushBaskets();
5107 if (nbtask < 0) { nerrpar++; }
5108 else { nbpar += nbtask; }
5112 pool.
Foreach(mapFunction, nb);
5118 return nerrpar ? -1 : nbpar.load();
5121 for (
Int_t j = 0; j < nb; j++) {
5164 const char* alias = t->
GetAlias(aliasName);
5168 const char* subAliasName = strstr(aliasName, fe->
GetName());
5169 if (subAliasName && (subAliasName[strlen(fe->
GetName())] ==
'.')) {
5189 for (
Int_t i = 0; i < nb; i++) {
5193 if (!strcmp(
b->GetName(),
name)) {
5196 if (!strcmp(
b->GetFullName(),
name)) {
5200 result = R__GetBranch(*(
b->GetListOfBranches()),
name);
5212 if (
name == 0)
return 0;
5234 for (
Int_t i = 0; i < nleaves; i++) {
5271 char* subname = (
char*) strstr(
name, fe->
GetName());
5272 if (subname !=
name) {
5277 if (*subname !=
'.') {
5326 if (!(stcs =
gSystem->
Getenv(
"ROOT_TTREECACHE_SIZE")) || !*stcs) {
5332 if (cacheFactor < 0.0) {
5343 if (cacheSize >= (INT_MAX / 4)) {
5344 cacheSize = INT_MAX / 4;
5347 if (cacheSize < 0) {
5351 if (cacheSize == 0 && withDefault) {