468 case kchar:
return 0;
473 case kBits:
return 0;
509 fMethodBit(tfl.fMethodBit),
510 fPrevious(tfl.fPrevious)
534 fTree->fFriendLockStatus &= ~(fMethodBit &
kBitMask);
561 entryInRange = firstEntry;
564 entryInRange = firstEntry - pedestal;
572 if (autoflush <= 0) {
575 fStartEntry = pedestal + entryInRange - entryInRange%autoflush;
600 auto autoFlush = fTree->GetAutoFlush();
601 if (autoFlush > 0)
return autoFlush;
602 if (fEstimatedSize > 0)
return fEstimatedSize;
604 Long64_t zipBytes = fTree->GetZipBytes();
606 fEstimatedSize = fTree->GetEntries() - 1;
607 if (fEstimatedSize <= 0)
611 Long64_t cacheSize = fTree->GetCacheSize();
612 if (cacheSize == 0) {
623 if (cacheSize <= 0) {
624 cacheSize = 30000000;
626 clusterEstimate = fTree->GetEntries() * cacheSize / zipBytes;
628 fEstimatedSize = clusterEstimate ? clusterEstimate : 1;
630 return fEstimatedSize;
639 fStartEntry = fNextEntry;
640 if (fTree->fNClusterRange || fTree->GetAutoFlush() > 0) {
641 if (fClusterRange == fTree->fNClusterRange) {
644 fNextEntry += GetEstimatedClusterSize();
646 if (fStartEntry > fTree->fClusterRangeEnd[fClusterRange]) {
649 if (fClusterRange == fTree->fNClusterRange) {
652 fNextEntry += GetEstimatedClusterSize();
654 Long64_t clusterSize = fTree->fClusterSize[fClusterRange];
655 if (clusterSize == 0) {
656 clusterSize = GetEstimatedClusterSize();
658 fNextEntry += clusterSize;
659 if (fNextEntry > fTree->fClusterRangeEnd[fClusterRange]) {
663 fNextEntry = fTree->fClusterRangeEnd[fClusterRange] + 1;
669 fNextEntry = fStartEntry + GetEstimatedClusterSize();
671 if (fNextEntry > fTree->GetEntries()) {
672 fNextEntry = fTree->GetEntries();
683 fNextEntry = fStartEntry;
684 if (fTree->fNClusterRange || fTree->GetAutoFlush() > 0) {
685 if (fClusterRange == 0 || fTree->fNClusterRange == 0) {
688 fStartEntry -= GetEstimatedClusterSize();
693 if (fClusterRange == 0) {
697 Long64_t clusterSize = fTree->fClusterSize[fClusterRange];
698 if (clusterSize == 0) {
699 clusterSize = GetEstimatedClusterSize();
701 fStartEntry -= clusterSize;
706 fStartEntry = fNextEntry - GetEstimatedClusterSize();
708 if (fStartEntry < 0) {
818, fDefaultEntryOffsetLen(1000)
824, fAutoSave( -300000000)
825, fAutoFlush(-30000000)
856, fFriendLockStatus(0)
858, fCacheDoAutoInit(
kTRUE)
859, fCacheDoClusterPrefetch(
kFALSE)
862, fNEntriesSinceSorting(0)
895 if (strlen(title) > 2) {
896 if (title[0] ==
'/') {
897 Branch(title+1,32000,splitlevel);
912#ifdef R__TRACK_BASKET_ALLOC_TIME
913 Info(
"TTree::~TTree",
"For tree %s, allocation time is %lluus.",
GetName(), fAllocationTime.load());
1033 Error(
"AddBranchToCache",
"Could not load a tree");
1042 Error(
"AddBranchToCache",
"No tree is available. Branch was not added to the cache");
1048 Error(
"AddBranchToCache",
"No file is available. Branch was not added to the cache");
1053 Error(
"AddBranchToCache",
"No cache is available, branch not added");
1056 return tc->
AddBranch(bname,subbranches);
1072 Error(
"AddBranchToCache",
"Could not load a tree");
1080 Error(
"AddBranchToCache",
"Error adding branch");
1085 Error(
"AddBranchToCache",
"No tree is available. Branch was not added to the cache");
1091 Error(
"AddBranchToCache",
"No file is available. Branch was not added to the cache");
1096 Error(
"AddBranchToCache",
"No cache is available, branch not added");
1116 Error(
"DropBranchFromCache",
"Could not load a tree");
1125 Error(
"DropBranchFromCache",
"No tree is available. Branch was not dropped from the cache");
1131 Error(
"DropBranchFromCache",
"No file is available. Branch was not dropped from the cache");
1136 Error(
"DropBranchFromCache",
"No cache is available, branch not dropped");
1155 Error(
"DropBranchFromCache",
"Could not load a tree");
1163 Error(
"DropBranchFromCache",
"Error dropping branch");
1168 Error(
"DropBranchFromCache",
"No tree is available. Branch was not dropped from the cache");
1174 Error(
"DropBranchFromCache",
"No file is available. Branch was not dropped from the cache");
1179 Error(
"DropBranchFromCache",
"No cache is available, branch not dropped");
1214 const auto friendHasValidIndex = [&] {
1219 if ((isMainReshuffled || isFriendReshuffled) && !friendHasValidIndex) {
1220 const auto reshuffledTreeName = isMainReshuffled ? mainTree.
GetName() : friendTree.
GetName();
1221 const auto msg =
"Tree '%s' has the kEntriesReshuffled bit set, and cannot be used as friend nor can be added as "
1222 "a friend unless the main tree has a TTreeIndex on the friend tree '%s'. You can also unset the "
1223 "bit manually if you know what you are doing.";
1224 Error(
"AddFriend", msg, reshuffledTreeName, friendTree.
GetName());
1309 bool canAddFriend =
true;
1313 Warning(
"AddFriend",
"FriendElement %s in file %s has less entries %lld than its parent Tree: %lld", treename,
1317 Error(
"AddFriend",
"Cannot find tree '%s' in file '%s', friend not added", treename, filename);
1318 canAddFriend =
false;
1343 bool canAddFriend =
true;
1347 Warning(
"AddFriend",
"FriendElement %s in file %s has less entries %lld than its parent tree: %lld", treename,
1351 Error(
"AddFriend",
"Cannot find tree '%s' in file '%s', friend not added", treename,
file->GetName());
1352 canAddFriend =
false;
1378 Warning(
"AddFriend",
"FriendElement '%s' in file '%s' has less entries %lld than its parent tree: %lld",
1477 if (opt.
Contains(
"flushbaskets")) {
1478 if (
gDebug > 0)
Info(
"AutoSave",
"calling FlushBaskets \n");
1490 if (nbytes && key) {
1497 if (
file)
file->WriteStreamerInfo();
1511 const char* writeStlWithoutProxyMsg =
"The class requested (%s) for the branch \"%s\""
1512 " is an instance of an stl collection and does not have a compiled CollectionProxy."
1513 " Please generate the dictionary for this collection (%s) to avoid to write corrupted data.";
1527 Error(
"Branch", writeStlWithoutProxyMsg,
1531 return Branch(branchname, classname, (
void*) addobj, bufsize, splitlevel);
1534 void** addr = (
void**) addobj;
1538 if (ptrClass && claim) {
1545 Error(
"Branch",
"The class requested (%s) for \"%s\" is different from the type of the pointer passed (%s)",
1548 }
else if (actualClass && (claim != actualClass) && !actualClass->
InheritsFrom(claim)) {
1553 Error(
"Branch",
"The actual class (%s) of the object provided for the definition of the branch \"%s\" does not inherit from %s",
1559 Error(
"Branch", writeStlWithoutProxyMsg,
1563 return Branch(branchname, classname, (
void*) addobj, bufsize, splitlevel);
1573 Error(
"Branch",
"The pointer specified for %s is not of a class known to ROOT", branchname);
1577 void** addr = (
void**) addobj;
1578 if (addr && *addr) {
1581 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",
1582 branchname, ptrClass->
GetName());
1583 actualClass = ptrClass;
1584 }
else if ((ptrClass != actualClass) && !actualClass->
InheritsFrom(ptrClass)) {
1585 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());
1589 actualClass = ptrClass;
1592 Error(
"Branch", writeStlWithoutProxyMsg,
1596 return Branch(branchname, actualClass->
GetName(), (
void*) addobj, bufsize, splitlevel);
1608 Error(
"Branch", writeStlWithoutProxyMsg,
1611 }
else if (claim == 0) {
1612 Error(
"Branch",
"The pointer specified for %s is not of a class known to ROOT and %s is not a known class", branchname, classname);
1619 Error(
"Branch",
"Reference interface requires a valid object (for branch: %s)!", branchname);
1623 if (ptrClass && claim) {
1630 Error(
"Branch",
"The class requested (%s) for \"%s\" is different from the type of the object passed (%s)",
1633 }
else if (actualClass && (claim != actualClass) && !actualClass->
InheritsFrom(claim)) {
1638 Error(
"Branch",
"The actual class (%s) of the object provided for the definition of the branch \"%s\" does not inherit from %s",
1644 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",
1645 branchname, ptrClass->
GetName());
1646 actualClass = ptrClass;
1647 }
else if ((ptrClass != actualClass) && !actualClass->
InheritsFrom(ptrClass)) {
1648 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());
1652 Error(
"Branch", writeStlWithoutProxyMsg,
1667 Error(
"Branch",
"The pointer specified for %s is not of a class or type known to ROOT", branchname);
1670 return Branch(branchname,addobj,varname.
Data(),bufsize);
1676 Error(
"Branch",
"Reference interface requires a valid object (for branch: %s)!", branchname);
1681 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",
1682 branchname, ptrClass->
GetName());
1683 actualClass = ptrClass;
1684 }
else if ((ptrClass != actualClass) && !actualClass->
InheritsFrom(ptrClass)) {
1685 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());
1689 Error(
"Branch", writeStlWithoutProxyMsg,
1704 "The inner type of the std::array passed specified for %s is not of a class or type known to ROOT",
1709 return Branch(branchname, addobj, varname.
Data(), bufsize);
1810 Error(
"Branch",
"Cannot call this constructor for a TClonesArray");
1816 while ((obj = next())) {
1824 Branch(col, bufsize, splitlevel - 1, branchname);
1826 if (nch && (
name[nch-1] ==
'_')) {
1835 if (splitlevel > 99) {
1861 char* curname =
new char[1000];
1863 while ((obj = next())) {
1866 Branch(curname, bufsize, splitlevel - 1);
1869 for (
Int_t i = 0; i < 1000; ++i) {
1870 if (curname[i] == 0) {
1873 if (curname[i] ==
'/') {
1880 strlcat(curname, occur,1000);
1989 return Bronch(
name, classname, addobj, bufsize, splitlevel);
1991 if (splitlevel < 0) {
1994 return BranchOld(
name, classname, addobj, bufsize, splitlevel);
2043 Error(
"BranchOld",
"Cannot find class: '%s'", classname);
2048 Fatal(
"BranchOld",
"The requested class ('%s') does not inherit from TObject.\n"
2049 "\tfgBranchStyle is set to zero requesting by default to use BranchOld.\n"
2050 "\tIf this is intentional use Bronch instead of Branch or BranchOld.", classname);
2052 Fatal(
"BranchOld",
"The requested class ('%s') does not inherit from TObject.\n"
2053 "\tYou can not use BranchOld to store objects of this type.",classname);
2064 const char* rdname = 0;
2065 const char* dname = 0;
2067 char** apointer = (
char**) addobj;
2079 if (
name[lenName-1] ==
'.') {
2118 if (!strcmp(dname,
"fBits")) {
2121 if (!strcmp(dname,
"fUniqueID")) {
2131 branchname = rdname;
2135 branchname.
Form(
"%s%s",
name, &rdname[1]);
2137 branchname.
Form(
"%s%s",
name, &rdname[0]);
2143 char* pointer = ((
char*) obj) + offset;
2152 char* cpointer = (
char*) pointer;
2153 char** ppointer = (
char**) cpointer;
2155 if (splitlevel != 2) {
2157 branch1 =
new TBranchClones(branch,branchname, pointer, bufsize);
2162 blist->
Add(branch1);
2170 blist->
Add(branch1);
2187 blist->
Add(branch1);
2208 if (!strcmp(rdi->
GetName(), index)) {
2211 if (!strcmp(rdi->
GetName(), aindex)) {
2223 leaflist.
Form(
"%s[%s]/%c", &rdname[0], index, vcode);
2225 Error(
"BranchOld",
"Cannot create branch for rdname: %s code: %d", branchname.
Data(), code);
2232 leaflist.
Form(
"%s/%s", dname,
"C");
2245 branch1 =
new TBranch(branch, bname, *((
void**) pointer), leaflist, bufsize);
2249 blist->
Add(branch1);
2256 leaflist.
Form(
"%s/%c", rdname, vcode);
2258 Error(
"BranchOld",
"Cannot create branch for rdname: %s code: %d", branchname.
Data(), code);
2261 branch1 =
new TBranch(branch, branchname, pointer, leaflist, bufsize);
2263 blist->
Add(branch1);
2272 Warning(
"BranchOld",
"Cannot process member: '%s'", rdname);
2381 Error(
"Bronch",
"Cannot find class:%s", classname);
2392 objptr = (
char*)addr;
2394 objptr = *((
char**) addr);
2400 Error(
"Bronch",
"Pointer to TClonesArray is null");
2404 Error(
"Bronch",
"TClonesArray with no class defined in branch: %s",
name);
2408 Error(
"Bronch",
"TClonesArray with no dictionary defined in branch: %s",
name);
2412 if (splitlevel > 0) {
2413 if (hasCustomStreamer)
2414 Warning(
"Bronch",
"Using split mode on a class: %s with a custom Streamer", clones->
GetClass()->
GetName());
2429 if (!inklass && (collProxy->
GetType() == 0)) {
2430 Error(
"Bronch",
"%s with no class defined in branch: %s", classname,
name);
2437 Error(
"Bronch",
"Container with no dictionary defined in branch: %s",
name);
2441 Warning(
"Bronch",
"Using split mode on a class: %s with a custom Streamer", inklass->
GetName());
2452 branch =
new TBranchSTL(
this,
name, collProxy, bufsize, splitlevel );
2466 Error(
"Bronch",
"Cannot find dictionary for class: %s", classname);
2472 hasCustomStreamer =
kTRUE;
2475 if (splitlevel < 0 || ((splitlevel == 0) && hasCustomStreamer && cl->
IsTObject())) {
2506 objptr = (
char*) cl->
New();
2514 if ((splitlevel > 0) && !cl->
CanSplit()) {
2515 if (splitlevel != 99) {
2516 Warning(
"Bronch",
"%s cannot be split, resetting splitlevel to 0", cl->
GetName());
2530 Error(
"Bronch",
"Cannot build the StreamerInfo for class: %s", cl->
GetName());
2539 if (splitlevel > 0) {
2550 branch->
Unroll(
name, cl, sinfo, objptr, bufsize, splitlevel);
2697 constexpr auto kBufSize = 2000;
2698 char* fname =
new char[kBufSize];
2701 for (
Int_t i = 0; i < 10; ++i) {
2709 strlcpy(fname,
file->GetName(), kBufSize);
2712 char* cunder = strrchr(fname,
'_');
2715 const char* cdot = strrchr(
file->GetName(),
'.');
2717 strlcat(fname, cdot, kBufSize);
2722 strlcat(fname, fcount, kBufSize);
2725 char* cdot = strrchr(fname,
'.');
2728 strlcat(fname, strrchr(
file->GetName(),
'.'), kBufSize);
2732 strlcat(fname, fcount, kBufSize);
2739 Warning(
"ChangeFile",
"file %s already exist, trying with %d underscores", fname, nus+1);
2741 Int_t compress =
file->GetCompressionSettings();
2744 Error(
"Fill",
"Failed to open new file %s, continuing as a memory tree.",fname);
2746 Printf(
"Fill: Switching to new file: %s", fname);
2752 while ((obj =
file->GetList()->First())) {
2769 while ((branch = (
TBranch*)nextb())) {
2778 if (newfile) newfile->
Append(obj);
2818 TClass* expectedClass = 0;
2825 if (expectedClass && datatype ==
kOther_t && ptrClass == 0) {
2826 if (isBranchElement) {
2831 Error(
"SetBranchAddress",
"Unable to determine the type given for the address for \"%s\". "
2832 "The class expected (%s) refers to an stl collection and do not have a compiled CollectionProxy. "
2833 "Please generate the dictionary for this class (%s)",
2840 Error(
"SetBranchAddress",
"Unable to determine the type given for the address for \"%s\". "
2841 "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."
2842 "Please generate the dictionary for this class (%s)",
2845 Error(
"SetBranchAddress",
"Unable to determine the type given for the address for \"%s\". "
2846 "This is probably due to a missing dictionary, the original data class for this branch is %s.", branch->
GetName(), expectedClass->
GetName());
2850 if (expectedClass && ptrClass && (branch->
GetMother() == branch)) {
2853 Error(
"SetBranchAddress",
"The address for \"%s\" should be the address of a pointer!", branch->
GetName());
2873 if( expectedClass && ptrClass &&
2874 expectedClass != ptrClass &&
2882 Info(
"SetBranchAddress",
"Matching STL collection (at least according to the SchemaRuleSet when "
2883 "reading a %s into a %s",expectedClass->
GetName(),ptrClass->
GetName());
2890 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());
2901 }
else if (expectedClass && ptrClass && !expectedClass->
InheritsFrom(ptrClass)) {
2923 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());
2924 if (isBranchElement) {
2933 Error(
"SetBranchAddress",
"The pointer type given \"%s\" (%d) does not correspond to the type needed \"%s\" (%d) by the branch: %s",
2940 if (expectedClass) {
2941 Error(
"SetBranchAddress",
"The pointer type given \"%s\" (%d) does not correspond to the type needed \"%s\" by the branch: %s",
2943 if (isBranchElement) {
2959 if (etype == expectedType) {
2974 if (etype == expectedType) {
2986 if (len <= ptrClass->
Size()) {
2990 Error(
"SetBranchAddress",
"The pointer type given \"%s\" does not correspond to the type needed \"%s\" (%d) by the branch: %s",
2996 Error(
"SetBranchAddress", writeStlWithoutProxyMsg,
2998 if (isBranchElement) {
3004 if (isBranchElement) {
3005 if (expectedClass) {
3114 for (
Int_t i = 0; i < nb; ++i) {
3124 if (thistree !=
this) {
3149 for (
Int_t lndx = 0; lndx < nleaves; ++lndx) {
3155 if (branch && (newcomp > -1)) {
3164 for (
Long64_t i = 0; i < nb; ++i) {
3175 for (
Int_t j = 0; j < nb1; ++j) {
3189 for (
Int_t k = 0; k < nb2; ++k) {
3219 if ( newtree->
CopyEntries(
this, -1, option ) < 0 ) {
3221 Error(
"CloneTTree",
"TTree has not been cloned\n");
3244 for (
Int_t i = 0; i < nbranches; ++i) {
3251 tree->ResetBranchAddress(br);
3280 Warning(
"CopyAddresses",
"Could not find branch named '%s' in tree named '%s'", branch->
GetName(),
tree->GetName());
3288 std::set<TLeaf*> updatedLeafCount;
3289 for (
Int_t i = 0; i < ntleaves; ++i) {
3305 tree->ResetBranchAddress(tbranch);
3308 bool needAddressReset =
false;
3316 needAddressReset =
true;
3318 needAddressReset = (updatedLeafCount.find(leaf->
GetLeafCount()) != updatedLeafCount.end());
3347 Warning(
"CopyAddresses",
"Could not find branch named '%s' in tree named '%s'", branch->
GetName(),
tree->GetName());
3356 (
tree->IsA()->InheritsFrom(
"TNtuple") ||
tree->IsA()->InheritsFrom(
"TNtupleD") )
3358 tree->ResetBranchAddresses();
3364 enum EOnIndexError { kDrop, kKeep, kBuild };
3366 static Bool_t R__HandleIndex(EOnIndexError onIndexError,
TTree *newtree,
TTree *oldtree)
3374 switch (onIndexError) {
3398 switch (onIndexError) {
3422 }
else if ( onIndexError == kDrop ) {
3477 EOnIndexError onIndexError;
3479 onIndexError = kKeep;
3480 }
else if (opt.
Contains(
"buildindex")) {
3481 onIndexError = kBuild;
3482 }
else if (opt.
Contains(
"dropindex")) {
3483 onIndexError = kDrop;
3485 onIndexError = kBuild;
3488 Int_t cacheSize = -1;
3491 Ssiz_t cacheSizeEnd = opt.
Index(
" ",cacheSizeLoc+10) - (cacheSizeLoc+10);
3492 TSubString cacheSizeStr( opt(cacheSizeLoc+10,cacheSizeEnd) );
3495 Warning(
"CopyEntries",
"The cachesize option can not be parsed: %s. The default size will be used.",cacheSizeStr.
String().
Data());
3498 const char *munit =
nullptr;
3501 Warning(
"CopyEntries",
"The cachesize option is too large: %s (%g%s max). The default size will be used.",cacheSizeStr.
String().
Data(),
m,munit);
3504 if (
gDebug > 0 && cacheSize != -1)
Info(
"CopyEntries",
"Using Cache size: %d\n",cacheSize);
3510 }
else if (
nentries > treeEntries) {
3514 if (fastClone && (nentries < 0 || nentries == tree->
GetEntriesFast())) {
3518 if (
tree->LoadTree(i) < 0) {
3522 withIndex = R__HandleIndex( onIndexError,
this,
tree );
3547 for (
Long64_t ii = 0; ii < tentries; ii++) {
3548 if (localtree->
GetEntry(ii) <= 0) {
3558 if (
tree->GetDirectory() &&
tree->GetDirectory()->GetFile()) {
3559 Warning(
"CopyEntries",
"Skipped file %s\n",
tree->GetDirectory()->GetFile()->GetName());
3561 Warning(
"CopyEntries",
"Skipped file number %d\n",
tree->GetTreeNumber());
3575 }
else if (
nentries > treeEntries) {
3578 Int_t treenumber = -1;
3580 if (
tree->LoadTree(i) < 0) {
3583 if (treenumber !=
tree->GetTreeNumber()) {
3585 withIndex = R__HandleIndex( onIndexError,
this,
tree );
3587 treenumber =
tree->GetTreeNumber();
3589 if (
tree->GetEntry(i) <= 0) {
3592 nbytes += this->
Fill();
3669 if (
file && !strcmp(option,
"all")) {
3670 if (!
file->IsWritable()) {
3671 Error(
"Delete",
"File : %s is not writable, cannot delete Tree:%s",
file->GetName(),
GetName());
3688 Int_t nbytes,objlen,keylen;
3689 while ((leaf = (
TLeaf*)next())) {
3692 for (
Int_t i=0;i<nbaskets;i++) {
3696 if (!branchFile)
continue;
3698 if (nbytes <= 0)
continue;
3699 branchFile->
MakeFree(pos,pos+nbytes-1);
3713 if (dirsav) dirsav->
cd();
3714 if (
gDebug)
Info(
"TTree::Delete",
"Deleting Tree: %s: %d baskets deleted. Total space freed = %d bytes\n",
GetName(),nbask,ntot);
4411 for (
Int_t i = 0; i < nb; ++i) {
4425 for (
Int_t i = 0; i < nleaves; ++i) {
4429 for (
Int_t j = 0; j < nbaskets - 1; ++j) {
4513 for (
Int_t i = 0; i < nbranches; ++i) {
4521 nwrite = branch->
FillImpl(
nullptr);
4523 nwrite = branch->
FillImpl(useIMT ? &imtHelper :
nullptr);
4527 Error(
"Fill",
"Failed filling branch:%s.%s, nbytes=%d, entry=%lld\n"
4528 " This error is symptomatic of a Tree created as a memory-resident Tree\n"
4529 " Instead of doing:\n"
4530 " TTree *T = new TTree(...)\n"
4531 " TFile *f = new TFile(...)\n"
4533 " TFile *f = new TFile(...)\n"
4534 " TTree *T = new TTree(...)\n\n",
4537 Error(
"Fill",
"Failed filling branch:%s.%s, nbytes=%d, entry=%lld",
GetName(), branch->
GetName(), nwrite,
4569 bool autoFlush =
false;
4570 bool autoSave =
false;
4588 if (autoFlush || autoSave) {
4599 Info(
"TTree::Fill",
"OptimizeBaskets called at entry %lld, fZipBytes=%lld, fFlushedBytes=%lld\n",
4611 if (zipBytes != 0) {
4613 }
else if (totBytes != 0) {
4648 Info(
"TTree::Fill",
"FlushBaskets() called at entry %lld, fZipBytes=%lld, fFlushedBytes=%lld\n",
fEntries,
4656 Info(
"TTree::Fill",
"AutoSave called at entry %lld, fZipBytes=%lld, fSavedBytes=%lld\n",
fEntries,
4669 return nerror == 0 ? nbytes : -1;
4677 if (list==0 || branchname == 0 || branchname[0] ==
'\0')
return 0;
4681 UInt_t brlen = strlen(branchname);
4683 for(
Int_t index = 0; index < nbranches; ++index) {
4688 if (len &&
name[len-1]==
']') {
4689 const char *dim = strchr(
name,
'[');
4694 if (brlen == len && strncmp(branchname,
name,len)==0) {
4698 if ((brlen >= len) && (branchname[len] ==
'.')
4699 && strncmp(
name, branchname, len) == 0) {
4706 if (next)
return next;
4708 const char *dot = strchr((
char*)branchname,
'.');
4710 if (len==(
size_t)(dot-branchname) &&
4711 strncmp(branchname,
name,dot-branchname)==0 ) {
4739 if (branch)
return branch;
4743 if (branch)
return branch;
4747 while ((branch = (
TBranch*) next())) {
4750 return nestedbranch;
4767 const char *subbranch = strstr(branchname, fe->
GetName());
4768 if (subbranch != branchname) {
4772 subbranch += strlen(fe->
GetName());
4773 if (*subbranch !=
'.') {
4779 std::ostringstream
name;
4806 char* subsearchname = (
char*) strstr(searchname,
GetName());
4807 if (subsearchname != searchname) {
4810 if (subsearchname) {
4811 subsearchname += strlen(
GetName());
4812 if (*subsearchname !=
'.') {
4816 if (subsearchname[0]==0) {
4827 const bool searchnameHasDot = strchr(searchname,
'.') !=
nullptr;
4832 while ((leaf = (
TLeaf*) next())) {
4835 if (dim >= 0) leafname.
Remove(dim);
4837 if (leafname == searchname) {
4840 if (subsearchname && leafname == subsearchname) {
4846 dim = leaftitle.
First(
'[');
4847 if (dim >= 0) leaftitle.
Remove(dim);
4849 if (leaftitle == searchname) {
4852 if (subsearchname && leaftitle == subsearchname) {
4855 if (!searchnameHasDot)
4860 dim = longname.
First(
'[');
4861 if (dim>=0) longname.
Remove(dim);
4862 if (longname == searchname) {
4865 if (subsearchname && longname == subsearchname) {
4869 dim = longtitle.
First(
'[');
4870 if (dim>=0) longtitle.
Remove(dim);
4871 if (longtitle == searchname) {
4874 if (subsearchname && longtitle == subsearchname) {
4882 if (strstr(searchname,
".") && !strcmp(searchname, branch->
GetName())) {
4885 if (subsearchname && strstr(subsearchname,
".") && !strcmp(subsearchname, branch->
GetName())) {
4903 subsearchname = (
char*) strstr(searchname, fe->
GetName());
4904 if (subsearchname != searchname) {
4907 if (subsearchname) {
4908 subsearchname += strlen(fe->
GetName());
4909 if (*subsearchname !=
'.') {
4915 if (subsearchname) {
4916 leafname.
Form(
"%s.%s",t->
GetName(),subsearchname);
4918 leafname = searchname;
4960 return fPlayer->
Fit(funcname, varexp, selection, option, goption,
nentries, firstentry);
4966struct BoolRAIIToggle {
4969 BoolRAIIToggle(
Bool_t &val) : m_val(val) { m_val =
true; }
4970 ~BoolRAIIToggle() { m_val =
false; }
5009 if (retval == -1)
return retval;
5044 std::atomic<Int_t> nerrpar(0);
5045 std::atomic<Int_t> nbpar(0);
5046 std::atomic<Int_t> pos(0);
5048 auto mapFunction = [&]() {
5054 Int_t j = pos.fetch_add(1);
5060 std::stringstream ss;
5061 ss << std::this_thread::get_id();
5062 Info(
"FlushBaskets",
"[IMT] Thread %s", ss.str().c_str());
5063 Info(
"FlushBaskets",
"[IMT] Running task for branch #%d: %s", j, branch->GetName());
5066 Int_t nbtask = branch->FlushBaskets();
5068 if (nbtask < 0) { nerrpar++; }
5069 else { nbpar += nbtask; }
5073 pool.
Foreach(mapFunction, nb);
5079 return nerrpar ? -1 : nbpar.load();
5082 for (
Int_t j = 0; j < nb; j++) {
5125 const char* alias = t->
GetAlias(aliasName);
5129 const char* subAliasName = strstr(aliasName, fe->
GetName());
5130 if (subAliasName && (subAliasName[strlen(fe->
GetName())] ==
'.')) {
5150 for (
Int_t i = 0; i < nb; i++) {
5154 if (!strcmp(
b->GetName(),
name)) {
5157 if (!strcmp(
b->GetFullName(),
name)) {
5161 result = R__GetBranch(*(
b->GetListOfBranches()),
name);
5173 if (
name == 0)
return 0;
5189 for (
Int_t i = 0; i < nleaves; i++) {
5226 char* subname = (
char*) strstr(
name, fe->
GetName());
5227 if (subname !=
name) {
5232 if (*subname !=
'.') {
5281 if (!(stcs =
gSystem->
Getenv(
"ROOT_TTREECACHE_SIZE")) || !*stcs) {
5287 if (cacheFactor < 0.0) {
5298 if (cacheSize >= (INT_MAX / 4)) {
5299 cacheSize = INT_MAX / 4;
5302 if (cacheSize < 0) {
5306 if (cacheSize == 0 && withDefault) {