505 case kchar:
return 0;
510 case kBits:
return 0;
590 if (
fTree->fNClusterRange) {
596 fClusterRange = TMath::BinarySearch(fTree->fNClusterRange, fTree->fClusterRangeEnd, firstEntry - 1) + 1;
598 Long64_t entryInRange;
600 if (fClusterRange == 0) {
602 entryInRange = firstEntry;
604 pedestal = fTree->fClusterRangeEnd[fClusterRange-1] + 1;
605 entryInRange = firstEntry - pedestal;
609 autoflush = fTree->fAutoFlush;
611 autoflush = fTree->fClusterSize[fClusterRange];
613 if (autoflush <= 0) {
616 fStartEntry = pedestal + entryInRange - entryInRange%autoflush;
617 }
else if ( fTree->GetAutoFlush() <= 0 ) {
619 fStartEntry = firstEntry;
621 fStartEntry = firstEntry - firstEntry%fTree->GetAutoFlush();
623 fNextEntry = fStartEntry;
641 auto autoFlush =
fTree->GetAutoFlush();
642 if (autoFlush > 0)
return autoFlush;
653 if (cacheSize == 0) {
664 if (cacheSize <= 0) {
665 cacheSize = 30000000;
667 clusterEstimate =
fTree->GetEntries() * cacheSize / zipBytes;
681 if (
fTree->fNClusterRange ||
fTree->GetAutoFlush() > 0) {
696 if (clusterSize == 0) {
725 if (
fTree->fNClusterRange ||
fTree->GetAutoFlush() > 0) {
739 if (clusterSize == 0) {
938 if (strlen(title) > 2) {
939 if (title[0] ==
'/') {
940 Branch(title+1,32000,splitlevel);
955#ifdef R__TRACK_BASKET_ALLOC_TIME
956 Info(
"TTree::~TTree",
"For tree %s, allocation time is %lluus.",
GetName(), fAllocationTime.load());
1091 Error(
"AddBranchToCache",
"Could not load a tree");
1100 Error(
"AddBranchToCache",
"No tree is available. Branch was not added to the cache");
1106 Error(
"AddBranchToCache",
"No file is available. Branch was not added to the cache");
1111 Error(
"AddBranchToCache",
"No cache is available, branch not added");
1114 return tc->
AddBranch(bname,subbranches);
1130 Error(
"AddBranchToCache",
"Could not load a tree");
1138 Error(
"AddBranchToCache",
"Error adding branch");
1143 Error(
"AddBranchToCache",
"No tree is available. Branch was not added to the cache");
1149 Error(
"AddBranchToCache",
"No file is available. Branch was not added to the cache");
1154 Error(
"AddBranchToCache",
"No cache is available, branch not added");
1174 Error(
"DropBranchFromCache",
"Could not load a tree");
1183 Error(
"DropBranchFromCache",
"No tree is available. Branch was not dropped from the cache");
1189 Error(
"DropBranchFromCache",
"No file is available. Branch was not dropped from the cache");
1194 Error(
"DropBranchFromCache",
"No cache is available, branch not dropped");
1213 Error(
"DropBranchFromCache",
"Could not load a tree");
1221 Error(
"DropBranchFromCache",
"Error dropping branch");
1226 Error(
"DropBranchFromCache",
"No tree is available. Branch was not dropped from the cache");
1232 Error(
"DropBranchFromCache",
"No file is available. Branch was not dropped from the cache");
1237 Error(
"DropBranchFromCache",
"No cache is available, branch not dropped");
1259 if (!
fClones->FindObject(clone)) {
1272 const auto friendHasValidIndex = [&] {
1274 return idx ? idx->
IsValidFor(&mainTree) :
false;
1277 if ((isMainReshuffled || isFriendReshuffled) && !friendHasValidIndex) {
1278 const auto reshuffledTreeName = isMainReshuffled ? mainTree.
GetName() : friendTree.
GetName();
1280 "Tree '%s' has the kEntriesReshuffled bit set and cannot have friends nor can be added as a friend unless the "
1281 "main tree has a TTreeIndex on the friend tree '%s'. You can also unset the bit manually if you know what you "
1282 "are doing; note that you risk associating wrong TTree entries of the friend with those of the main TTree!";
1283 Error(
"AddFriend", msg, reshuffledTreeName, friendTree.
GetName());
1368 bool canAddFriend =
true;
1372 Warning(
"AddFriend",
"FriendElement %s in file %s has less entries %lld than its parent Tree: %lld", treename,
1376 Error(
"AddFriend",
"Cannot find tree '%s' in file '%s', friend not added", treename, filename);
1377 canAddFriend =
false;
1402 bool canAddFriend =
true;
1406 Warning(
"AddFriend",
"FriendElement %s in file %s has less entries %lld than its parent tree: %lld", treename,
1410 Error(
"AddFriend",
"Cannot find tree '%s' in file '%s', friend not added", treename, file->
GetName());
1411 canAddFriend =
false;
1437 Warning(
"AddFriend",
"FriendElement '%s' in file '%s' has less entries %lld than its parent tree: %lld",
1537 if (opt.
Contains(
"flushbaskets")) {
1538 if (
gDebug > 0)
Info(
"AutoSave",
"calling FlushBaskets \n");
1547 nbytes =
fDirectory->WriteTObject(
this,
"",
"overwrite");
1571 const char* writeStlWithoutProxyMsg =
"The class requested (%s) for the branch \"%s\""
1572 " is an instance of an stl collection and does not have a compiled CollectionProxy."
1573 " Please generate the dictionary for this collection (%s) to avoid to write corrupted data.";
1587 Error(
"Branch", writeStlWithoutProxyMsg,
1591 return Branch(branchname, classname, (
void*) addobj, bufsize, splitlevel);
1593 TClass* actualClass =
nullptr;
1594 void** addr = (
void**) addobj;
1598 if (ptrClass && claim) {
1605 Error(
"Branch",
"The class requested (%s) for \"%s\" is different from the type of the pointer passed (%s)",
1608 }
else if (actualClass && (claim != actualClass) && !actualClass->
InheritsFrom(claim)) {
1613 Error(
"Branch",
"The actual class (%s) of the object provided for the definition of the branch \"%s\" does not inherit from %s",
1619 Error(
"Branch", writeStlWithoutProxyMsg,
1623 return Branch(branchname, classname, (
void*) addobj, bufsize, splitlevel);
1633 Error(
"Branch",
"The pointer specified for %s is not of a class known to ROOT", branchname);
1636 TClass* actualClass =
nullptr;
1637 void** addr = (
void**) addobj;
1638 if (addr && *addr) {
1641 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",
1642 branchname, ptrClass->
GetName());
1643 actualClass = ptrClass;
1644 }
else if ((ptrClass != actualClass) && !actualClass->
InheritsFrom(ptrClass)) {
1645 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());
1649 actualClass = ptrClass;
1652 Error(
"Branch", writeStlWithoutProxyMsg,
1656 return Branch(branchname, actualClass->
GetName(), (
void*) addobj, bufsize, splitlevel);
1668 Error(
"Branch", writeStlWithoutProxyMsg,
1671 }
else if (claim ==
nullptr) {
1672 Error(
"Branch",
"The pointer specified for %s is not of a class known to ROOT and %s is not a known class", branchname, classname);
1677 TClass* actualClass =
nullptr;
1679 Error(
"Branch",
"Reference interface requires a valid object (for branch: %s)!", branchname);
1683 if (ptrClass && claim) {
1690 Error(
"Branch",
"The class requested (%s) for \"%s\" is different from the type of the object passed (%s)",
1693 }
else if (actualClass && (claim != actualClass) && !actualClass->
InheritsFrom(claim)) {
1698 Error(
"Branch",
"The actual class (%s) of the object provided for the definition of the branch \"%s\" does not inherit from %s",
1704 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",
1705 branchname, ptrClass->
GetName());
1706 actualClass = ptrClass;
1707 }
else if ((ptrClass != actualClass) && !actualClass->
InheritsFrom(ptrClass)) {
1708 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());
1712 Error(
"Branch", writeStlWithoutProxyMsg,
1716 return BronchExec(branchname, actualClass->
GetName(), (
void*) addobj,
false, bufsize, splitlevel);
1727 Error(
"Branch",
"The pointer specified for %s is not of a class or type known to ROOT", branchname);
1730 return Branch(branchname,addobj,varname.
Data(),bufsize);
1734 TClass* actualClass =
nullptr;
1736 Error(
"Branch",
"Reference interface requires a valid object (for branch: %s)!", branchname);
1741 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",
1742 branchname, ptrClass->
GetName());
1743 actualClass = ptrClass;
1744 }
else if ((ptrClass != actualClass) && !actualClass->
InheritsFrom(ptrClass)) {
1745 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());
1749 Error(
"Branch", writeStlWithoutProxyMsg,
1753 return BronchExec(branchname, actualClass->
GetName(), (
void*) addobj,
false, bufsize, splitlevel);
1764 "The inner type of the std::array passed specified for %s is not of a class or type known to ROOT",
1769 return Branch(branchname, addobj, varname.
Data(), bufsize);
1873 Error(
"Branch",
"Cannot call this constructor for a TClonesArray");
1879 while ((obj = next())) {
1887 Branch(col, bufsize, splitlevel - 1, branchname);
1889 if (nch && (
name[nch-1] ==
'_')) {
1898 if (splitlevel > 99) {
1924 char* curname =
new char[1000];
1926 while ((obj = next())) {
1929 Branch(curname, bufsize, splitlevel - 1);
1932 for (
Int_t i = 0; i < 1000; ++i) {
1933 if (curname[i] == 0) {
1936 if (curname[i] ==
'/') {
1943 strlcat(curname, occur,1000);
2055 return Bronch(
name, classname, addobj, bufsize, splitlevel);
2057 if (splitlevel < 0) {
2060 return BranchOld(
name, classname, addobj, bufsize, splitlevel);
2109 Error(
"BranchOld",
"Cannot find class: '%s'", classname);
2114 Fatal(
"BranchOld",
"The requested class ('%s') does not inherit from TObject.\n"
2115 "\tfgBranchStyle is set to zero requesting by default to use BranchOld.\n"
2116 "\tIf this is intentional use Bronch instead of Branch or BranchOld.", classname);
2118 Fatal(
"BranchOld",
"The requested class ('%s') does not inherit from TObject.\n"
2119 "\tYou can not use BranchOld to store objects of this type.",classname);
2130 const char* rdname =
nullptr;
2131 const char* dname =
nullptr;
2133 char** apointer = (
char**) addobj;
2135 bool delobj =
false;
2145 if (
name[lenName-1] ==
'.') {
2184 if (!strcmp(dname,
"fBits")) {
2187 if (!strcmp(dname,
"fUniqueID")) {
2197 branchname = rdname;
2201 branchname.
Form(
"%s%s",
name, &rdname[1]);
2203 branchname.
Form(
"%s%s",
name, &rdname[0]);
2209 char* pointer = ((
char*) obj) + offset;
2218 char* cpointer = (
char*) pointer;
2219 char** ppointer = (
char**) cpointer;
2221 if (splitlevel != 2) {
2223 branch1 =
new TBranchClones(branch,branchname, pointer, bufsize);
2228 blist->
Add(branch1);
2236 blist->
Add(branch1);
2253 blist->
Add(branch1);
2274 if (!strcmp(rdi->
GetName(), index)) {
2277 if (!strcmp(rdi->
GetName(), aindex)) {
2289 leaflist.
Form(
"%s[%s]/%c", &rdname[0], index, vcode);
2291 Error(
"BranchOld",
"Cannot create branch for rdname: %s code: %d", branchname.
Data(), code);
2298 leaflist.
Form(
"%s/%s", dname,
"C");
2311 branch1 =
new TBranch(branch, bname, *((
void**) pointer), leaflist, bufsize);
2315 blist->
Add(branch1);
2322 leaflist.
Form(
"%s/%c", rdname, vcode);
2324 Error(
"BranchOld",
"Cannot create branch for rdname: %s code: %d", branchname.
Data(), code);
2327 branch1 =
new TBranch(branch, branchname, pointer, leaflist, bufsize);
2329 blist->
Add(branch1);
2338 Warning(
"BranchOld",
"Cannot process member: '%s'", rdname);
2437 return BronchExec(
name, classname, addr,
true, bufsize, splitlevel);
2447 Error(
"Bronch",
"Cannot find class:%s", classname);
2456 char* objptr =
nullptr;
2458 objptr = (
char*)addr;
2460 objptr = *((
char**) addr);
2466 Error(
"Bronch",
"Pointer to TClonesArray is null");
2470 Error(
"Bronch",
"TClonesArray with no class defined in branch: %s",
name);
2474 Error(
"Bronch",
"TClonesArray with no dictionary defined in branch: %s",
name);
2478 if (splitlevel > 0) {
2479 if (hasCustomStreamer)
2480 Warning(
"Bronch",
"Using split mode on a class: %s with a custom Streamer", clones->
GetClass()->
GetName());
2495 if (!inklass && (collProxy->
GetType() == 0)) {
2496 Error(
"Bronch",
"%s with no class defined in branch: %s", classname,
name);
2503 Error(
"Bronch",
"Container with no dictionary defined in branch: %s",
name);
2507 Warning(
"Bronch",
"Using split mode on a class: %s with a custom Streamer", inklass->
GetName());
2518 branch =
new TBranchSTL(
this,
name, collProxy, bufsize, splitlevel );
2530 bool hasCustomStreamer =
false;
2532 Error(
"Bronch",
"Cannot find dictionary for class: %s", classname);
2538 hasCustomStreamer =
true;
2541 if (splitlevel < 0 || ((splitlevel == 0) && hasCustomStreamer && cl->
IsTObject())) {
2569 bool delobj =
false;
2572 objptr = (
char*) cl->
New();
2580 if ((splitlevel > 0) && !cl->
CanSplit()) {
2581 if (splitlevel != 99) {
2582 Warning(
"Bronch",
"%s cannot be split, resetting splitlevel to 0", cl->
GetName());
2596 Error(
"Bronch",
"Cannot build the StreamerInfo for class: %s", cl->
GetName());
2605 if (splitlevel > 0) {
2616 branch->
Unroll(
name, cl, sinfo, objptr, bufsize, splitlevel);
2644 if (strcmp(
"TList",
fUserInfo->GetName())==0) {
2668Int_t TTree::BuildIndex(
const char* majorname,
const char* minorname ,
bool long64major,
bool long64minor)
2789 constexpr auto kBufSize = 2000;
2790 char* fname =
new char[kBufSize];
2793 for (
Int_t i = 0; i < 10; ++i) {
2801 strlcpy(fname, file->
GetName(), kBufSize);
2804 char* cunder = strrchr(fname,
'_');
2807 const char* cdot = strrchr(file->
GetName(),
'.');
2809 strlcat(fname, cdot, kBufSize);
2814 strlcat(fname, fcount, kBufSize);
2817 char* cdot = strrchr(fname,
'.');
2820 strlcat(fname, strrchr(file->
GetName(),
'.'), kBufSize);
2824 strlcat(fname, fcount, kBufSize);
2827 if (
gSystem->AccessPathName(fname)) {
2831 Warning(
"ChangeFile",
"file %s already exists, trying with %d underscores", fname, nus + 1);
2835 if (newfile ==
nullptr) {
2836 Error(
"Fill",
"Failed to open new file %s, continuing as a memory tree.",fname);
2838 Printf(
"Fill: Switching to new file: %s", fname);
2861 while ((branch = (
TBranch*)nextb())) {
2870 if (newfile) newfile->
Append(obj);
2873 file->TObject::Delete();
2910 TClass* expectedClass =
nullptr;
2917 if (expectedClass && datatype ==
kOther_t && ptrClass ==
nullptr) {
2918 if (isBranchElement) {
2923 Error(
"SetBranchAddress",
"Unable to determine the type given for the address for \"%s\". "
2924 "The class expected (%s) refers to an stl collection and do not have a compiled CollectionProxy. "
2925 "Please generate the dictionary for this class (%s)",
2932 Error(
"SetBranchAddress",
"Unable to determine the type given for the address for \"%s\". "
2933 "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."
2934 "Please generate the dictionary for this class (%s)",
2937 Error(
"SetBranchAddress",
"Unable to determine the type given for the address for \"%s\". "
2938 "This is probably due to a missing dictionary, the original data class for this branch is %s.", branch->
GetName(), expectedClass->
GetName());
2942 if (expectedClass && ptrClass && (branch->
GetMother() == branch)) {
2945 Error(
"SetBranchAddress",
"The address for \"%s\" should be the address of a pointer!", branch->
GetName());
2965 if( expectedClass && ptrClass &&
2966 expectedClass != ptrClass &&
2974 Info(
"SetBranchAddress",
"Matching STL collection (at least according to the SchemaRuleSet when "
2975 "reading a %s into a %s",expectedClass->
GetName(),ptrClass->
GetName());
2982 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());
2993 }
else if (expectedClass && ptrClass && !expectedClass->
InheritsFrom(ptrClass)) {
3015 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());
3016 if (isBranchElement) {
3025 Error(
"SetBranchAddress",
"The pointer type given \"%s\" (%d) does not correspond to the type needed \"%s\" (%d) by the branch: %s",
3032 if (expectedClass) {
3033 Error(
"SetBranchAddress",
"The pointer type given \"%s\" (%d) does not correspond to the type needed \"%s\" by the branch: %s",
3035 if (isBranchElement) {
3051 if (etype == expectedType) {
3066 if (etype == expectedType) {
3078 if (len <= ptrClass->Size()) {
3082 Error(
"SetBranchAddress",
"The pointer type given \"%s\" does not correspond to the type needed \"%s\" (%d) by the branch: %s",
3088 Error(
"SetBranchAddress", writeStlWithoutProxyMsg,
3090 if (isBranchElement) {
3096 if (isBranchElement) {
3097 if (expectedClass) {
3177 bool fastClone =
false;
3188 if (res < -2 || res == -1) {
3192 Error(
"CloneTree",
"returning nullptr since LoadTree failed with code %lld.", res);
3215 for (
Int_t i = 0; i < nb; ++i) {
3225 if (thistree !=
this) {
3234 TFile* nfile =
nullptr;
3250 for (
Int_t lndx = 0; lndx < nleaves; ++lndx) {
3256 if (branch && (newcomp > -1)) {
3265 for (
Long64_t i = 0; i < nb; ++i) {
3276 for (
Int_t j = 0; j < nb1; ++j) {
3290 for (
Int_t k = 0; k < nb2; ++k) {
3322 Error(
"CloneTTree",
"TTree has not been cloned\n");
3345 for (
Int_t i = 0; i < nbranches; ++i) {
3381 Warning(
"CopyAddresses",
"Could not find branch named '%s' in tree named '%s'", branch->
GetName(), tree->
GetName());
3389 std::set<TLeaf*> updatedLeafCount;
3390 for (
Int_t i = 0; i < ntleaves; ++i) {
3409 bool needAddressReset =
false;
3417 needAddressReset =
true;
3419 needAddressReset = (updatedLeafCount.find(leaf->
GetLeafCount()) != updatedLeafCount.end());
3442 if (br->
IsA() != branch->
IsA()) {
3445 "Branch kind mismatch between input tree '%s' and output tree '%s' for branch '%s': '%s' vs '%s'",
3455 Warning(
"CopyAddresses",
"Could not find branch named '%s' in tree named '%s'", branch->
GetName(), tree->
GetName());
3472 enum EOnIndexError { kDrop, kKeep, kBuild };
3474 bool R__HandleIndex(EOnIndexError onIndexError,
TTree *newtree,
TTree *oldtree)
3478 bool withIndex =
true;
3482 switch (onIndexError) {
3506 switch (onIndexError) {
3530 }
else if ( onIndexError == kDrop ) {
3583 bool fastClone = opt.
Contains(
"fast");
3584 bool withIndex = !opt.
Contains(
"noindex");
3585 EOnIndexError onIndexError;
3587 onIndexError = kKeep;
3588 }
else if (opt.
Contains(
"buildindex")) {
3589 onIndexError = kBuild;
3590 }
else if (opt.
Contains(
"dropindex")) {
3591 onIndexError = kDrop;
3593 onIndexError = kBuild;
3599 Ssiz_t cacheSizeEnd = opt.
Index(
" ",cacheSizeLoc+10) - (cacheSizeLoc+10);
3600 TSubString cacheSizeStr( opt(cacheSizeLoc+10,cacheSizeEnd) );
3603 Warning(
"CopyEntries",
"The cachesize option can not be parsed: %s. The default size will be used.",cacheSizeStr.
String().
Data());
3606 const char *munit =
nullptr;
3609 Warning(
"CopyEntries",
"The cachesize option is too large: %s (%g%s max). The default size will be used.",cacheSizeStr.
String().
Data(),
m,munit);
3612 if (
gDebug > 0 && cacheSize != -1)
Info(
"CopyEntries",
"Using Cache size: %lld\n",cacheSize);
3618 }
else if (
nentries > treeEntries) {
3630 withIndex = R__HandleIndex( onIndexError,
this, tree );
3655 if (needCopyAddresses) {
3661 for (
Long64_t ii = 0; ii < tentries; ii++) {
3662 if (localtree->
GetEntry(ii) <= 0) {
3667 if (needCopyAddresses)
3691 }
else if (
nentries > treeEntries) {
3694 if (needCopyAddresses) {
3700 Int_t treenumber = -1;
3707 withIndex = R__HandleIndex( onIndexError,
this, tree );
3714 nbytes += this->
Fill();
3716 if (needCopyAddresses)
3795 Error(
"Delete",
"File : %s is not writable, cannot delete Tree:%s", file->
GetName(),
GetName());
3812 Int_t nbytes,objlen,keylen;
3813 while ((leaf = (
TLeaf*)next())) {
3816 for (
Int_t i=0;i<nbaskets;i++) {
3820 if (!branchFile)
continue;
3822 if (nbytes <= 0)
continue;
3837 if (dirsav) dirsav->
cd();
3838 if (
gDebug)
Info(
"TTree::Delete",
"Deleting Tree: %s: %d baskets deleted. Total space freed = %d bytes\n",
GetName(),nbask,ntot);
3850 gCling->DeleteGlobal(
this);
4573 for (
Int_t i = 0; i < nb; ++i) {
4586 for (
Int_t i = 0; i < nleaves; ++i) {
4590 for (
Int_t j = 0; j < nbaskets - 1; ++j) {
4679 for (
Int_t i = 0; i < nbranches; ++i) {
4687 nwrite = branch->
FillImpl(
nullptr);
4689 nwrite = branch->
FillImpl(useIMT ? &imtHelper :
nullptr);
4693 Error(
"Fill",
"Failed filling branch:%s.%s, nbytes=%d, entry=%lld\n"
4694 " This error is symptomatic of a Tree created as a memory-resident Tree\n"
4695 " Instead of doing:\n"
4696 " TTree *T = new TTree(...)\n"
4697 " TFile *f = new TFile(...)\n"
4699 " TFile *f = new TFile(...)\n"
4700 " TTree *T = new TTree(...)\n\n",
4703 Error(
"Fill",
"Failed filling branch:%s.%s, nbytes=%d, entry=%lld",
GetName(), branch->
GetName(), nwrite,
4735 bool autoFlush =
false;
4736 bool autoSave =
false;
4754 if (autoFlush || autoSave) {
4765 Info(
"TTree::Fill",
"OptimizeBaskets called at entry %lld, fZipBytes=%lld, fFlushedBytes=%lld\n",
4777 if (zipBytes != 0) {
4779 }
else if (totBytes != 0) {
4814 Info(
"TTree::Fill",
"FlushBaskets() called at entry %lld, fZipBytes=%lld, fFlushedBytes=%lld\n",
fEntries,
4822 Info(
"TTree::Fill",
"AutoSave called at entry %lld, fZipBytes=%lld, fSavedBytes=%lld\n",
fEntries,
4835 return nerror == 0 ? nbytes : -1;
4843 if (list==
nullptr || branchname ==
nullptr || branchname[0] ==
'\0')
return nullptr;
4845 Int_t nbranches = list->GetEntries();
4847 UInt_t brlen = strlen(branchname);
4849 for(
Int_t index = 0; index < nbranches; ++index) {
4854 if (len &&
name[len - 1] ==
']' && (brlen == 0 || branchname[brlen - 1] !=
']')) {
4855 const char *
dim = strchr(
name,
'[');
4860 if (brlen == len && strncmp(branchname,
name,len)==0) {
4864 if ((brlen >= len) && (branchname[len] ==
'.')
4865 && strncmp(
name, branchname, len) == 0) {
4872 if (next)
return next;
4874 const char *dot = strchr((
char*)branchname,
'.');
4876 if (len==(
size_t)(dot-branchname) &&
4877 strncmp(branchname,
name,dot-branchname)==0 ) {
4907 if (strncmp(
fName.Data(),branchname,
fName.Length())==0 && branchname[
fName.Length()]==
'.') {
4909 if (branch)
return branch;
4913 if (branch)
return branch;
4917 while ((branch = (
TBranch*) next())) {
4920 return nestedbranch;
4937 const char *subbranch = strstr(branchname, fe->
GetName());
4938 if (subbranch != branchname) {
4939 subbranch =
nullptr;
4942 subbranch += strlen(fe->
GetName());
4943 if (*subbranch !=
'.') {
4944 subbranch =
nullptr;
4949 std::ostringstream
name;
4979 const char* subsearchname = strstr(searchname,
GetName());
4980 if (subsearchname != searchname) {
4981 subsearchname =
nullptr;
4983 if (subsearchname) {
4984 subsearchname += strlen(
GetName());
4985 if (*subsearchname !=
'.') {
4986 subsearchname =
nullptr;
4989 if (subsearchname[0] == 0) {
4990 subsearchname =
nullptr;
5000 const bool searchnameHasDot = strchr(searchname,
'.') !=
nullptr;
5004 TLeaf* leaf =
nullptr;
5005 while ((leaf = (
TLeaf*) next())) {
5010 if (leafname == searchname) {
5013 if (subsearchname && leafname == subsearchname) {
5022 if (leaftitle == searchname) {
5025 if (subsearchname && leaftitle == subsearchname) {
5028 if (!searchnameHasDot)
5035 if (longname == searchname) {
5038 if (subsearchname && longname == subsearchname) {
5044 if (longtitle == searchname) {
5047 if (subsearchname && longtitle == subsearchname) {
5055 if (strstr(searchname,
".") && !strcmp(searchname, branch->
GetName())) {
5058 if (subsearchname && strstr(subsearchname,
".") && !strcmp(subsearchname, branch->
GetName())) {
5076 subsearchname = strstr(searchname, fe->
GetName());
5077 if (subsearchname != searchname) {
5078 subsearchname =
nullptr;
5080 if (subsearchname) {
5081 subsearchname += strlen(fe->
GetName());
5082 if (*subsearchname !=
'.') {
5083 subsearchname =
nullptr;
5088 if (subsearchname) {
5089 leafname.
Form(
"%s.%s",t->
GetName(),subsearchname);
5091 leafname = searchname;
5139struct BoolRAIIToggle {
5142 BoolRAIIToggle(
bool &val) : m_val(val) { m_val =
true; }
5143 ~BoolRAIIToggle() { m_val =
false; }
5182 if (retval == -1)
return retval;
5217 std::atomic<Int_t> nerrpar(0);
5218 std::atomic<Int_t> nbpar(0);
5219 std::atomic<Int_t>
pos(0);
5221 auto mapFunction = [&]() {
5233 std::stringstream ss;
5234 ss << std::this_thread::get_id();
5235 Info(
"FlushBaskets",
"[IMT] Thread %s", ss.str().c_str());
5236 Info(
"FlushBaskets",
"[IMT] Running task for branch #%d: %s", j, branch->GetName());
5239 Int_t nbtask = branch->FlushBaskets();
5241 if (nbtask < 0) { nerrpar++; }
5242 else { nbpar += nbtask; }
5246 pool.
Foreach(mapFunction, nb);
5252 return nerrpar ? -1 : nbpar.load();
5255 for (
Int_t j = 0; j < nb; j++) {
5298 const char* alias = t->
GetAlias(aliasName);
5302 const char* subAliasName = strstr(aliasName, fe->
GetName());
5303 if (subAliasName && (subAliasName[strlen(fe->
GetName())] ==
'.')) {
5323 for (
Int_t i = 0; i < nb; i++) {
5327 if (!strcmp(
b->GetName(),
name)) {
5330 if (!strcmp(
b->GetFullName(),
name)) {
5334 result = R__GetBranch(*(
b->GetListOfBranches()),
name);
5362 for (
Int_t i = 0; i < nleaves; i++) {
5413 if (*subname !=
'.') {
5486 auto calculateCacheSize = [
this](
Double_t cacheFactor)
5493 if (medianClusterSize > 0)
5496 cacheSize =
Long64_t(cacheFactor * 1.5 * 30000000);
5500 if (cacheSize >= (INT_MAX / 4)) {
5501 cacheSize = INT_MAX / 4;
5508 if (!(stcs =
gSystem->Getenv(
"ROOT_TTREECACHE_SIZE")) || !*stcs) {
5509 cacheFactor =
gEnv->GetValue(
"TTreeCache.Size", 1.0);
5514 if (cacheFactor < 0.0) {
5519 Long64_t cacheSize = calculateCacheSize(cacheFactor);
5521 if (cacheSize < 0) {
5525 if (cacheSize == 0 && withDefault) {
5526 cacheSize = calculateCacheSize(1.0);
5580 return fPlayer->GetEntries(selection);
5598 if (t==
nullptr)
return 0;
5725 if (entry < 0 || entry >=
fEntries)
return 0;
5737 auto seqprocessing = [&]() {
5739 for (i=0;i<nbranches;i++) {
5741 nb = branch->
GetEntry(entry, getall);
5754 nb = branch->GetEntry(entry, getall);
5758 if (nb < 0)
return nb;
5764 std::atomic<Int_t>
pos(0);
5765 std::atomic<Int_t> nbpar(0);
5767 auto mapFunction = [&]() {
5779 std::stringstream ss;
5780 ss << std::this_thread::get_id();
5781 Info(
"GetEntry",
"[IMT] Thread %s", ss.str().c_str());
5782 Info(
"GetEntry",
"[IMT] Running task for branch #%d: %s", j, branch->GetName());
5785 std::chrono::time_point<std::chrono::system_clock>
start, end;
5787 start = std::chrono::system_clock::now();
5788 nbtask = branch->GetEntry(entry, getall);
5789 end = std::chrono::system_clock::now();
5791 Long64_t tasktime = (
Long64_t)std::chrono::duration_cast<std::chrono::microseconds>(end -
start).count();
5794 if (nbtask < 0) errnb = nbtask;
5795 else nbpar += nbtask;
5821 if (nb < 0)
return nb;
5838 if (nb < 0)
return nb;
5873 if (checkLeafCount) {
5874 for (
Int_t i = 0; i < nbranches; i++) {
5878 auto countBranch = leafCount->GetBranch();
5888 if (!checkLeafCount) {
5891 for (
Int_t i = 0; i < nbranches; i++) {
5903 [](std::pair<Long64_t,TBranch*>
a, std::pair<Long64_t,TBranch*>
b) {
5904 return a.first > b.first;
5923 [](std::pair<Long64_t,TBranch*>
a, std::pair<Long64_t,TBranch*>
b) {
5924 return a.first > b.first;
5976 return fTreeIndex->GetEntryNumberWithBestIndex(major, minor);
5996 return fTreeIndex->GetEntryNumberWithIndex(major, minor);
6030 for (i = 0; i < nbranches; ++i) {
6033 if (nb < 0)
return nb;
6045 if (serial <0)
return -nbytes;
6047 if (nb < 0)
return nb;
6072 if (strcmp(friendname,fe->
GetName())==0
6116 if ((tree ==
this) || (tree ==
GetTree())) {
6132 auto lookForFriendNameInListOfFriends = [tree](
const TList &friends) ->
const char * {
6134 auto *frElTree = frEl->GetTree();
6136 if (frElTree == tree)
6137 return frEl->GetName();
6139 if (frElTree && frElTree->GetTree() == tree)
6140 return frEl->GetName();
6147 const char *friendAlias = lookForFriendNameInListOfFriends(*
fFriends);
6157 innerListOfFriends && innerListOfFriends !=
fFriends) {
6158 const char *friendAlias = lookForFriendNameInListOfFriends(*innerListOfFriends);
6166 const char *friendAlias = frEl->GetTree()->GetFriendAlias(tree);
6174 innerListOfFriends && innerListOfFriends !=
fFriends) {
6176 const char *friendAlias = frEl->GetTree()->GetFriendAlias(tree);
6212 TLeaf *leaf =
nullptr;
6216 leaf = branch->
GetLeaf(leafname);
6223 while ((leaf = (
TLeaf*)nextl())) {
6224 if (strcmp(leaf->
GetFullName(), leafname) != 0 && strcmp(leaf->
GetName(), leafname) != 0)
6232 UInt_t nbch = strlen(branchname);
6233 const char* brname = br->
GetName();
6235 if (strncmp(brname,branchname,nbch)) {
6237 const char *mothername = mother->
GetName();
6238 UInt_t motherlen = strlen(mothername);
6239 if (!strcmp(mothername, branchname)) {
6241 }
else if (nbch > motherlen && strncmp(mothername,branchname,motherlen)==0 && (mothername[motherlen-1]==
'.' || branchname[motherlen]==
'.')) {
6243 if (strncmp(brname,branchname+motherlen+1,nbch-motherlen-1)) {
6259 if ((strlen(brname) > nbch) && (brname[nbch] !=
'.') && (brname[nbch] !=
'[')) {
6272 leaf = t->
GetLeaf(branchname, leafname);
6273 if (leaf)
return leaf;
6284 const char *subname = strstr(leafname,fe->
GetName());
6285 if (subname != leafname)
continue;
6288 if (*subname !=
'.')
continue;
6290 strippedArg += subname;
6291 leaf = t->
GetLeaf(branchname,subname);
6292 if (leaf)
return leaf;
6309 if (leafname ==
nullptr)
return nullptr;
6334 std::string path(
name);
6335 const auto sep = path.find_last_of(
'/');
6336 if (sep != std::string::npos)
6362 if (entryNumber < 0)
break;
6402 if (entryNumber < 0)
break;
6446 if (create && !pe) {
6519 if (autoflush > 0 && autosave > 0) {
6531 for (
Int_t i = 0; i < nb; ++i) {
6538 for(
Int_t i = 0, j = 0; j < oldsize; ++j) {
6569 Int_t nimported = 0;
6570 while ((leaf=(
TLeaf*)next())) {
6606 bool friendHasEntry =
false;
6612 bool needUpdate =
false;
6627 friendHasEntry =
true;
6639 fPlayer->UpdateFormulaLeaves();
6643 if(!
fNotify->Notify())
return -6;
6652 external_fe->MarkUpdated();
6762 Warning(
"MakeCode",
"MakeCode is obsolete. Use MakeClass or MakeSelector instead");
6766 return fPlayer->MakeCode(filename);
6892 return fPlayer->MakeProxy(proxyClassname,macrofilename,cutfilename,
option,maxUnrolling);
6975 if (!li)
return nullptr;
6977 TTree *newtree =
nullptr;
6980 while ((obj=next())) {
6985 tree->
Warning(
"MergeTrees",
"TTree %s has no branches, skipping.", tree->
GetName());
6994 if (!newtree)
continue;
7030 while ((tree = (
TTree *)next())) {
7033 Warning(
"Merge",
"TTree %s has no branches, skipping.", tree->
GetName());
7040 auto result = tree->
Merge(li, options);
7041 if (result != prevEntries) {
7065 while ((tree = (
TTree*)next())) {
7066 if (tree==
this)
continue;
7101 while ((tree = (
TTree *)next())) {
7104 Warning(
"Merge",
"TTree %s has no branches, skipping.", tree->
GetName());
7111 auto result = tree->
Merge(li, info);
7112 if (result != prevEntries) {
7125 const char *options = info ? info->
fOptions.
Data() :
"";
7160 while ((tree = (
TTree*)next())) {
7161 if (tree==
this)
continue;
7183 if (src == dst)
return;
7210 if (!newdirectory) {
7221 return cloner.
Exec();
7232 TLeaf* leaf =
nullptr;
7233 while ((leaf = (
TLeaf*) next())) {
7265 if (nleaves == 0 || treeSize == 0) {
7269 Double_t aveSize = treeSize/nleaves;
7273 Int_t i, oldMemsize,newMemsize,oldBaskets,newBaskets;
7274 i = oldMemsize = newMemsize = oldBaskets = newBaskets = 0;
7279 for (
Int_t pass =0;pass<2;pass++) {
7284 for (i=0;i<nleaves;i++) {
7288 Double_t idealFactor = totBytes/aveSize;
7292 sizeOfOneEntry = aveSize;
7297 oldMemsize += oldBsize;
7298 oldBaskets += 1+
Int_t(totBytes/oldBsize);
7301 newBaskets += 1+
Int_t(totBytes/oldBsize);
7304 Double_t bsize = oldBsize*idealFactor*memFactor;
7305 if (bsize < 0) bsize = bmax;
7306 if (bsize > bmax) bsize = bmax;
7315 newBsize = newBsize + (clusterSize *
sizeof(
Int_t) * 2);
7324 newBsize = newBsize - newBsize%512 + 512;
7326 if (newBsize < sizeOfOneEntry) newBsize = sizeOfOneEntry;
7327 if (newBsize < bmin) newBsize = bmin;
7328 if (newBsize > 10000000) newBsize = bmax;
7330 if (pDebug)
Info(
"OptimizeBaskets",
"Changing buffer size from %6d to %6d bytes for %s\n",oldBsize,newBsize,branch->
GetName());
7333 newMemsize += newBsize;
7337 newBaskets += 1+
Int_t(totBytes/newBsize);
7338 if (pass == 0)
continue;
7342 if (comp > 1 && comp < minComp) {
7343 if (pDebug)
Info(
"OptimizeBaskets",
"Disabling compression for branch : %s\n",branch->
GetName());
7349 if (memFactor > 100) memFactor = 100;
7350 Double_t bmin_new = bmin*memFactor;
7351 Double_t bmax_new = bmax*memFactor;
7352 static const UInt_t hardmax = 1*1024*1024*1024;
7359 static const UInt_t hardmin = 8;
7360 bmin = (bmin_new > hardmax) ? hardmax : ( bmin_new < hardmin ? hardmin : (
UInt_t)bmin_new );
7361 bmax = (bmax_new > hardmax) ? bmin : (
UInt_t)bmax_new;
7364 Info(
"OptimizeBaskets",
"oldMemsize = %d, newMemsize = %d\n",oldMemsize, newMemsize);
7365 Info(
"OptimizeBaskets",
"oldBaskets = %d, newBaskets = %d\n",oldBaskets, newBaskets);
7444 Printf(
"******************************************************************************");
7446 Printf(
"*Entries : %8lld : Total = %15lld bytes File Size = %10lld *",
fEntries,
total, file);
7447 Printf(
"* : : Tree compression factor = %6.2f *", cx);
7448 Printf(
"******************************************************************************");
7454 if (strncmp(
option,
"clusters",std::char_traits<char>::length(
"clusters"))==0) {
7455 Printf(
"%-16s %-16s %-16s %8s %20s",
7456 "Cluster Range #",
"Entry Start",
"Last Entry",
"Size",
"Number of clusters");
7460 bool estimated =
false;
7461 bool unknown =
false;
7464 if (recordedSize > 0) {
7465 nclusters =
TMath::Ceil(
static_cast<double>(1 + end -
start) / recordedSize);
7466 Printf(
"%-16d %-16lld %-16lld %8lld %10lld",
7467 ind,
start, end, recordedSize, nclusters);
7473 if (estimated_size > 0) {
7474 nclusters =
TMath::Ceil(
static_cast<double>(1 + end -
start) / estimated_size);
7475 Printf(
"%-16d %-16lld %-16lld %8lld %10lld (estimated)",
7476 ind,
start, end, recordedSize, nclusters);
7479 Printf(
"%-16d %-16lld %-16lld %8lld (unknown)",
7480 ind,
start, end, recordedSize);
7485 totalClusters += nclusters;
7495 Printf(
"Total number of clusters: (unknown)");
7497 Printf(
"Total number of clusters: %lld %s", totalClusters, estimated ?
"(estimated)" :
"");
7505 TLeaf* leaf =
nullptr;
7506 if (strstr(
option,
"toponly")) {
7509 for (
l=0;
l<nl;
l++) {
7510 leaf = (
TLeaf *)
const_cast<TTree*
>(
this)->GetListOfLeaves()->At(
l);
7521 for (
l=0;
l<nl;
l++) {
7522 if (count[
l] < 0)
continue;
7523 leaf = (
TLeaf *)
const_cast<TTree*
>(
this)->GetListOfLeaves()->At(
l);
7534 while ((br= (
TBranch*)next())) {
7694 var.
Form(
"%s>>%s", varexp, hname);
7760 if (!filename || !*filename) {
7761 Error(
"ReadFile",
"File name not specified");
7768 Error(
"ReadFile",
"Cannot open file: %s",filename);
7771 const char* ext = strrchr(filename,
'.');
7772 if(ext && ((strcmp(ext,
".csv") == 0) || (strcmp(ext,
".CSV") == 0)) && delimiter ==
' ') {
7775 return ReadStream(in, branchDescriptor, delimiter);
7784 Long_t inPos = inputStream.tellg();
7785 char newline =
'\n';
7789 if(!inputStream.good()) {
7790 Error(
"ReadStream",
"Error reading stream: no newline found.");
7793 if(
c == newline)
break;
7799 inputStream.clear();
7800 inputStream.seekg(inPos);
7812 std::stringstream ss;
7813 std::istream *inTemp;
7814 Long_t inPos = inputStream.tellg();
7815 if (!inputStream.good()) {
7816 Error(
"ReadStream",
"Error reading stream");
7820 ss << std::cin.rdbuf();
7825 inTemp = &inputStream;
7827 std::istream& in = *inTemp;
7832 if (nbranches == 0) {
7833 char *bdname =
new char[4000];
7834 char *bd =
new char[100000];
7836 if (branchDescriptor) nch = strlen(branchDescriptor);
7840 in.getline(bd, 100000, newline);
7844 Error(
"ReadStream",
"Error reading stream");
7848 while( isspace(*cursor) && *cursor !=
'\n' && *cursor !=
'\0') {
7851 if (*cursor !=
'#' && *cursor !=
'\n' && *cursor !=
'\0') {
7858 strlcpy(bd,branchDescriptor,100000);
7863 void *address = &bd[90000];
7867 if(delimiter !=
' ') {
7869 if (strchr(bdcur,bdelim)==
nullptr && strchr(bdcur,
':') !=
nullptr) {
7875 char *colon = strchr(bdcur,bdelim);
7876 if (colon) *colon = 0;
7877 strlcpy(bdname,bdcur,4000);
7878 char *
slash = strchr(bdname,
'/');
7884 desc.
Form(
"%s/%s",bdname,olddesc.Data());
7886 char *bracket = strchr(bdname,
'[');
7890 branch =
new TBranch(
this,bdname,address,desc.
Data(),32000);
7893 Warning(
"ReadStream",
"Illegal branch definition: %s",bdcur);
7908 Info(
"ReadStream",
"Will use branches:");
7909 for (
int i = 0 ; i < nbranches; ++i) {
7915 Info(
"ReadStream",
"Dumping read tokens, format:");
7916 Info(
"ReadStream",
"LLLLL:BBB:gfbe:GFBE:T");
7917 Info(
"ReadStream",
" L: line number");
7918 Info(
"ReadStream",
" B: branch number");
7919 Info(
"ReadStream",
" gfbe: good / fail / bad / eof of token");
7920 Info(
"ReadStream",
" GFBE: good / fail / bad / eof of file");
7921 Info(
"ReadStream",
" T: Token being read");
7928 const char sDelimBuf[2] = { delimiter, 0 };
7929 const char* sDelim = sDelimBuf;
7930 if (delimiter ==
' ') {
7935 if (newline ==
'\r' && in.peek() ==
'\n') {
7939 std::getline(in,
line, newline);
7946 Info(
"ReadStream",
"Skipping empty line number %lld", nlines);
7950 if (sLine[0] ==
'#') {
7952 Info(
"ReadStream",
"Skipping comment line number %lld: '%s'",
7953 nlines,
line.c_str());
7958 Info(
"ReadStream",
"Parsing line number %lld: '%s'",
7959 nlines,
line.c_str());
7966 std::stringstream sToken;
7969 bool goodLine =
true;
7970 Int_t remainingLeafLen = 0;
7971 while (goodLine && iBranch < nbranches
7974 if (tok.
IsNull() && delimiter ==
' ') {
7980 if (!remainingLeafLen) {
7985 if (!remainingLeafLen) {
7986 remainingLeafLen = leaf->
GetLen();
7990 remainingLeafLen = 1;
8000 if (remainingLeafLen) {
8008 sToken.seekp(0, std::ios_base::beg);
8009 sToken.str(leafData.
Data());
8010 sToken.seekg(0, std::ios_base::beg);
8013 Info(
"ReadStream",
"%5lld:%3d:%d%d%d%d:%d%d%d%d:%s",
8015 (
int)sToken.good(), (
int)sToken.fail(),
8016 (
int)sToken.bad(), (
int)sToken.eof(),
8017 (
int)in.good(), (
int)in.fail(),
8018 (
int)in.bad(), (
int)in.eof(),
8019 sToken.str().c_str());
8026 "Buffer error while reading data for branch %s on line %lld",
8028 }
else if (!sToken.eof()) {
8029 if (sToken.fail()) {
8031 "Couldn't read formatted data in \"%s\" for branch %s on line %lld; ignoring line",
8035 std::string remainder;
8036 std::getline(sToken, remainder, newline);
8037 if (!remainder.empty()) {
8039 "Ignoring trailing \"%s\" while reading data for branch %s on line %lld",
8040 remainder.c_str(), branch->
GetName(), nlines);
8046 if (iBranch < nbranches) {
8048 "Read too few columns (%d < %d) in line %lld; ignoring line",
8049 iBranch, nbranches, nlines);
8055 "Ignoring trailing \"%s\" while reading line %lld",
8135 for (
Int_t i = 0; i < nleaves; i++) {
8186 if (friend_t == oldFriend) {
8214 for (
Int_t i = 0; i < nb; ++i) {
8244 for (
Int_t i = 0; i < nb; ++i) {
8278 for (
Int_t i = 0; i < nbranches; ++i) {
8285 auto *frTree = frEl->GetTree();
8287 frTree->ResetBranchAddresses();
8351 if (!aliasName || !aliasFormula) {
8354 if (!aliasName[0] || !aliasFormula[0]) {
8507 std::vector<Long64_t> clusterSizesPerRange;
8515 std::vector<double> nClustersInRange;
8516 nClustersInRange.reserve(clusterSizesPerRange.size());
8518 auto clusterRangeStart = 0ll;
8525 nClustersInRange.emplace_back(nClusters);
8529 R__ASSERT(nClustersInRange.size() == clusterSizesPerRange.size());
8530 const auto medianClusterSize =
8531 TMath::Median(nClustersInRange.size(), clusterSizesPerRange.data(), nClustersInRange.data());
8532 return medianClusterSize;
8571 for (
Int_t i = 0; i < nleaves; i++) {
8582 Error(
"SetBasketSize",
"unknown branch -> '%s'", bname);
8597 if (ptr) *ptr =
nullptr;
8598 Error(
"SetBranchAddress",
"unknown branch -> %s", bname);
8626 branchFromSelf->SetMakeClass(
true);
8639 if (
auto *tree = fe->GetTree()) {
8640 status = tree->SetBranchAddress(bname, addr, ptr, ptrClass, datatype, isptr,
true);
8672 Error(
"SetBranchAddress",
"unknown branch -> %s", bname);
8699 TTree* clone =
nullptr;
8700 const char *bname = branch->
GetName();
8701 while ((clone = (
TTree*) next())) {
8703 if (cloneBr && (cloneBr->
GetAddress() == oldAddr)) {
8788 if (!bname || !*bname) {
8789 Error(
"SetBranchStatus",
"Input regexp is an empty string: no match against branch names will be attempted.");
8793 TBranch *branch, *bcount, *bson;
8794 TLeaf *leaf, *leafcount;
8803 for (i=0;i<nleaves;i++) {
8807 if (strcmp(bname,
"*")) {
8810 if (strcmp(bname,branch->
GetName())
8811 && longname != bname
8824 if (nb==0 && !strchr(bname,
'*')) {
8834 UInt_t foundInFriend = 0;
8845 const char *subbranch = strstr(bname,fe->
GetName());
8846 if (subbranch!=bname) subbranch =
nullptr;
8848 subbranch += strlen(fe->
GetName());
8849 if ( *subbranch !=
'.' ) subbranch =
nullptr;
8860 if (!nb && !foundInFriend) {
8863 if (strchr(bname,
'*') !=
nullptr)
8864 Error(
"SetBranchStatus",
"No branch name is matching wildcard -> %s", bname);
8866 Error(
"SetBranchStatus",
"unknown branch -> %s", bname);
8868 if (strchr(bname,
'*') !=
nullptr)
8869 Warning(
"SetBranchStatus",
"No branch name is matching wildcard -> %s", bname);
8871 Warning(
"SetBranchStatus",
"unknown branch -> %s", bname);
8876 if (found) *found = nb + foundInFriend;
8880 for (i = 0; i < nleaves; i++) {
8892 for (j=0;j<nbranches;j++) {
8894 if (!bson)
continue;
8975 if (cacheSize < 0) {
8979 if (cacheSize == 0) {
8981 }
else if (cacheSize < 0) {
8987 if (!file ||
GetTree() !=
this) {
8996 if (!autocache && cacheSize>0) {
8997 Warning(
"SetCacheSizeAux",
"A TTreeCache could not be created because the TTree has no file");
9032 if (cacheSize == 0) {
9055 Error(
"SetCacheSizeAux",
"Not setting up an automatically sized TTreeCache because of missing cache previously set");
9063 if (cacheSize == 0 || pf) {
9090 Error(
"SetCacheEntryRange",
"Could not load a tree");
9099 Error(
"SetCacheEntryRange",
"No tree is available. Could not set cache entry range");
9105 Error(
"SetCacheEntryRange",
"No file is available. Could not set cache entry range");
9110 Error(
"SetCacheEntryRange",
"No cache is available. Could not set entry range");
9149 if (maxEntries <= 0) {
9164 for (
Int_t i = 0; i < nb; i++) {
9197 if (newdefault < 10) {
9201 if (updateExisting) {
9204 while ( (
b = (
TBranch*)next() ) ) {
9205 b->SetEntryOffsetLen( newdefault,
true );
9208 fBranchRef->SetEntryOffsetLen( newdefault,
true );
9237 TFile* file =
nullptr;
9275 TBranch*
b(
nullptr), *bMin(
nullptr), *bMax(
nullptr);
9281 if (!bMin || n2 < nMin) {
9285 if (!bMax || n2 > nMax) {
9290 if (bMin && nMin != nMax) {
9291 Warning(
"SetEntries",
"Tree branches have different numbers of entries, eg %s has %lld entries while %s has %lld entries.",
9292 bMin->GetName(), nMin, bMax->
GetName(), nMax);
9344 char enlistname[100];
9351 for (
Int_t i=0; i<nsel; i++){
9392 UChar_t newFeatures = ~curFeatures & featuresRequested;
9393 curFeatures |= newFeatures;
9411 Warning(
"SetFileNumber",
"file number must be positive. Set to 0");
9448 for (
Int_t i = 0; i < nb; ++i) {
9478 TFile *file =
nullptr;
9504 "The tree or chain already has a fNotify registered and it is a TNotifyLink, while the new object is "
9505 "not a TNotifyLink. Setting fNotify to the new value will lead to an orphan linked list of "
9506 "TNotifyLinks and it is most likely not intended. If this is the intended goal, please call "
9507 "SetNotify(nullptr) first to silence this warning.");
9508 }
else if (newLink->GetNext() != oldLink && oldLink->GetNext() != newLink) {
9513 "The tree or chain already has a TNotifyLink registered, and the new TNotifyLink `obj` does not link "
9514 "to it. Setting fNotify to the new value will lead to an orphan linked list of TNotifyLinks and it is "
9515 "most likely not intended. If this is the intended goal, please call SetNotify(nullptr) first to "
9516 "silence this warning.");
9534 TFile *file =
nullptr;
9574 if (pf && !( opt ^ (
nullptr !=
dynamic_cast<TTreeCacheUnzip*
>(pf)))) {
9582 unzip->SetUnzipBufferSize(
Long64_t(cacheSize * RelSize) );
9656 Error(
"Show()",
"Cannot read entry %lld (entry does not exist)", entry);
9658 }
else if (
ret == -1) {
9659 Error(
"Show()",
"Cannot read entry %lld (I/O error)", entry);
9664 Error(
"Show()",
"Cannot read entry %lld (I/O error)", entry);
9666 }
else if (
ret == 0) {
9667 Error(
"Show()",
"Cannot read entry %lld (no data read)", entry);
9675 for (
Int_t i = 0; i < nleaves; i++) {
9704 printf(
" %-15s = ", leaf->
GetName());
9707 if (
l == (len - 1)) {
9712 if ((
l % ltype) == 0) {
9729 fPlayer->StartViewer(600, 400);
9744 Error(
"StopCacheLearningPhase",
"Could not load a tree");
9753 Error(
"StopCacheLearningPhase",
"No tree is available. Could not stop cache learning phase");
9759 Error(
"StopCacheLearningPhase",
"No file is available. Could not stop cache learning phase");
9764 Error(
"StopCacheLearningPhase",
"No cache is available. Could not stop learning phase");
9777 for (
Int_t i = 0; i < nb; ++i) {
9782 for (
Int_t j = writeBasket; j >= 0; --j) {
9815 if (
b.IsReading()) {
9827 Version_t R__v =
b.ReadVersion(&R__s, &R__c);
9841 Warning(
"Streamer",
"Old style index in this tree is deleted. Rebuild the index via TTree::BuildIndex");
9886 if (R__v > 2)
fIndex.Streamer(
b);
9985 if (
gStyle->IsReading()) {
10074 if (
this != &rhs) {
10085 if (!
fTree)
return nullptr;
10092 if (!list)
return nullptr;
10101 if (!list)
return next;
10109 if (!nextTree)
return Next();
10131 return tree.
BranchImpRef(branchname, ptrClass, datatype, addobj, bufsize, splitlevel);
10137 return tree.
BranchImp(branchname, ptrClass, addobj, bufsize, splitlevel);
#define R__unlikely(expr)
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
int Int_t
Signed integer 4 bytes (int).
short Version_t
Class version identifier (short).
unsigned char UChar_t
Unsigned Character 1 byte (unsigned char).
int Ssiz_t
String size (currently int).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
double Double_t
Double 8 bytes.
double Stat_t
Statistics type (double).
constexpr Ssiz_t kNPOS
The equivalent of std::string::npos for the ROOT class TString.
long long Long64_t
Portable signed long integer 8 bytes.
unsigned long long ULong64_t
Portable unsigned long integer 8 bytes.
float Float_t
Float 4 bytes (float).
const char Option_t
Option string (const char).
const Int_t kDoNotProcess
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Error("WriteTObject","The current directory (%s) is not associated with a file. The object (%s) has not been written.", GetName(), objname)
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
static unsigned int total
externTInterpreter * gCling
externTVirtualMutex * gROOTMutex
void Printf(const char *fmt,...)
Formats a string in a circular formatting buffer and prints the string.
constexpr Int_t kNEntriesResort
static TBranch * R__FindBranchHelper(TObjArray *list, const char *branchname)
Search in the array for a branch matching the branch name, with the branch possibly expressed as a 'f...
static char DataTypeToChar(EDataType datatype)
void TFriendElement__SetTree(TTree *tree, TList *frlist)
Set the fTree member for all friend elements.
bool CheckReshuffling(TTree &mainTree, TTree &friendTree)
constexpr Float_t kNEntriesResortInv
#define R__LOCKGUARD(mutex)
Bool_t HasRuleWithSourceClass(const TString &source) const
Return True if we have any rule whose source class is 'source'.
A helper class for managing IMT work during TTree:Fill operations.
TIOFeatures provides the end-user with the ability to change the IO behavior of data written via a TT...
UChar_t GetFeatures() const
This class provides a simple interface to execute the same task multiple times in parallel threads,...
void Foreach(F func, unsigned nTimes, unsigned nChunks=0)
Execute a function without arguments several times in parallel, dividing the execution in nChunks.
virtual void Streamer(TBuffer &)
virtual Color_t GetFillColor() const
Return the fill area color.
virtual Style_t GetFillStyle() const
Return the fill area style.
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
virtual void Streamer(TBuffer &)
virtual Color_t GetLineColor() const
Return the line color.
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
virtual Width_t GetLineWidth() const
Return the line width.
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual Style_t GetLineStyle() const
Return the line style.
virtual Style_t GetMarkerStyle() const
Return the marker style.
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
virtual Color_t GetMarkerColor() const
Return the marker color.
virtual Size_t GetMarkerSize() const
Return the marker size.
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
virtual void Streamer(TBuffer &)
virtual void SetMarkerSize(Size_t msize=1)
Set the marker size.
Each class (see TClass) has a linked list of its base class(es).
ROOT::ESTLType IsSTLContainer()
Return which type (if any) of STL container the data member is.
Manages buffers for branches of a Tree.
virtual Int_t DropBuffers()
Drop buffers of this basket if it is not the current basket.
Int_t GetBufferSize() const
A Branch for the case of an array of clone objects.
A Branch for the case of an object.
virtual bool IsObjectOwner() const
virtual void SetBranchFolder()
const char * GetClassName() const override
Return the name of the user class whose content is stored in this branch, if any.
void ResetAddress() override
Set branch address to zero and free all allocated memory.
Int_t Unroll(const char *name, TClass *cltop, TClass *cl, char *ptr, Int_t basketsize, Int_t splitlevel, Int_t btype)
Split class cl into sub-branches of this branch.
void SetAddress(void *addobj) override
Point this branch at an object.
virtual void SetTargetClass(const char *name)
Set the name of the class of the in-memory object into which the data will loaded.
void SetObject(void *objadd) override
Set object this branch is pointing to.
A Branch for the case of an object.
A branch containing and managing a TRefTable for TRef autoloading.
A Branch handling STL collection of pointers (vectors, lists, queues, sets and multisets) while stori...
A TTree is a list of TBranches.
virtual TLeaf * GetLeaf(const char *name) const
Return pointer to the 1st Leaf named name in thisBranch.
virtual bool GetMakeClass() const
Return whether this branch is in a mode where the object are decomposed or not (Also known as MakeCla...
virtual void SetupAddresses()
If the branch address is not set, we set all addresses starting with the top level parent branch.
virtual void ResetAddress()
Reset the address of the branch.
virtual Long64_t GetBasketSeek(Int_t basket) const
Return address of basket in the file.
virtual char * GetAddress() const
void SetCompressionSettings(Int_t settings=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault)
Set compression settings.
virtual TString GetFullName() const
Return the 'full' name of the branch.
Int_t GetWriteBasket() const
virtual void DropBaskets(Option_t *option="")
Loop on all branch baskets.
TObjArray * GetListOfBranches()
virtual void SetTree(TTree *tree)
virtual Int_t GetEntry(Long64_t entry=0, Int_t getall=0)
Read all leaves of entry and return total number of bytes read.
TClass * IsA() const override
void Print(Option_t *option="") const override
Print TBranch parameters.
static void ResetCount()
Static function resetting fgCount.
virtual void SetObject(void *objadd)
Set object this branch is pointing to.
Int_t FlushBaskets()
Flush to disk all the baskets of this branch and any of subbranches.
virtual void SetAddress(void *add)
Set address of this branch.
virtual void SetFile(TFile *file=nullptr)
Set file where this branch writes/reads its buffers.
TObjArray * GetListOfBaskets()
Long64_t GetEntries() const
Int_t GetReadBasket() const
Int_t GetMaxBaskets() const
virtual TFile * GetFile(Int_t mode=0)
Return pointer to the file where branch buffers reside, returns 0 in case branch buffers reside in th...
virtual void KeepCircular(Long64_t maxEntries)
keep a maximum of fMaxEntries in memory
virtual void ResetAfterMerge(TFileMergeInfo *)
Reset a Branch.
virtual TBranch * FindBranch(const char *name)
Find the immediate sub-branch with passed name.
virtual Int_t LoadBaskets()
Baskets associated to this branch are forced to be in memory.
void SetIOFeatures(TIOFeatures &features)
Long64_t GetTotBytes(Option_t *option="") const
Return total number of bytes in the branch (excluding current buffer) if option ="*" includes all sub...
virtual void SetOffset(Int_t offset=0)
virtual Int_t GetExpectedType(TClass *&clptr, EDataType &type)
Fill expectedClass and expectedType with information on the data type of the object/values contained ...
virtual Int_t GetBasketSize() const
Long64_t GetZipBytes(Option_t *option="") const
Return total number of zip bytes in the branch if option ="*" includes all sub-branches of this branc...
virtual void Refresh(TBranch *b)
Refresh this branch using new information in b This function is called by TTree::Refresh.
virtual bool SetMakeClass(bool decomposeObj=true)
Set the branch in a mode where the object are decomposed (Also known as MakeClass mode).
TObjArray * GetListOfLeaves()
virtual void Reset(Option_t *option="")
Reset a Branch.
virtual void SetBasketSize(Int_t bufsize)
Set the basket size The function makes sure that the basket size is greater than fEntryOffsetlen.
TBranch * GetMother() const
Get our top-level parent branch in the tree.
virtual Int_t FillImpl(ROOT::Internal::TBranchIMTHelper *)
Loop on all leaves of this branch to fill Basket buffer.
Int_t GetEntryOffsetLen() const
Using a TBrowser one can browse all ROOT objects.
The concrete implementation of TBuffer for writing/reading to/from a ROOT file or socket.
Buffer base class used for serializing objects.
TClass instances represent classes, structs and namespaces in the ROOT type system.
Bool_t CanSplit() const
Return true if the data member of this TClass can be saved separately.
ROOT::ESTLType GetCollectionType() const
Return the 'type' of the STL the TClass is representing.
void * New(ENewType defConstructor=kClassNew, Bool_t quiet=kFALSE) const
Return a pointer to a newly allocated object of this class.
Bool_t HasDataMemberInfo() const
Bool_t HasCustomStreamerMember() const
The class has a Streamer method and it is implemented by the user or an older (not StreamerInfo based...
void Destructor(void *obj, Bool_t dtorOnly=kFALSE)
Explicitly call destructor for object.
void BuildRealData(void *pointer=nullptr, Bool_t isTransient=kFALSE)
Build a full list of persistent data members.
const std::type_info * GetTypeInfo() const
TList * GetListOfDataMembers(Bool_t load=kTRUE)
Return list containing the TDataMembers of a class.
TList * GetListOfRealData() const
Bool_t CanIgnoreTObjectStreamer()
const ROOT::Detail::TSchemaRuleSet * GetSchemaRules() const
Return the set of the schema rules if any.
TList * GetListOfBases()
Return list containing the TBaseClass(es) of a class.
Bool_t IsLoaded() const
Return true if the shared library of this class is currently in the a process's memory.
Bool_t IsTObject() const
Return kTRUE is the class inherits from TObject.
TVirtualStreamerInfo * GetStreamerInfo(Int_t version=0, Bool_t isTransient=kFALSE) const
returns a pointer to the TVirtualStreamerInfo object for version If the object does not exist,...
Bool_t InheritsFrom(const char *cl) const override
Return kTRUE if this class inherits from a class with name "classname".
TVirtualCollectionProxy * GetCollectionProxy() const
Return the proxy describing the collection (if any).
TVirtualStreamerInfo * GetConversionStreamerInfo(const char *onfile_classname, Int_t version) const
Return a Conversion StreamerInfo from the class 'classname' for version number 'version' to this clas...
TVirtualStreamerInfo * FindConversionStreamerInfo(const char *onfile_classname, UInt_t checksum) const
Return a Conversion StreamerInfo from the class 'classname' for the layout represented by 'checksum' ...
Version_t GetClassVersion() const
TClass * GetActualClass(const void *object) const
Return a pointer to the real class of the object.
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Int_t WriteBuffer(TBuffer &b, void *pointer, const char *info="")
Function called by the Streamer functions to serialize object at p to buffer b.
void BypassStreamer(Bool_t bypass=kTRUE)
When the kBypassStreamer bit is set, the automatically generated Streamer can call directly TClass::W...
TClass * GetClass() const
Collection abstract base class.
virtual TObject ** GetObjectRef(const TObject *obj) const =0
const char * GetName() const override
Return name of this collection.
virtual Bool_t IsEmpty() const
A specialized string object used for TTree selections.
All ROOT classes may have RTTI (run time type identification) support added.
Bool_t IsPersistent() const
Bool_t IsBasic() const
Return true if data member is a basic type, e.g. char, int, long...
Bool_t IsaPointer() const
Return true if data member is a pointer.
TDataType * GetDataType() const
Longptr_t GetOffset() const
Get offset from "this".
const char * GetTypeName() const
Get the decayed type name of this data member, removing const and volatile qualifiers,...
const char * GetArrayIndex() const
If the data member is pointer and has a valid array size in its comments GetArrayIndex returns a stri...
const char * GetFullTypeName() const
Get the concrete type name of this data member, including const and volatile qualifiers.
Basic data type descriptor (datatype information is obtained from CINT).
TString GetTypeName()
Get basic type of typedef, e,g.: "class TDirectory*" -> "TDirectory".
Bool_t cd() override
Change current directory to "this" directory.
void Append(TObject *obj, Bool_t replace=kFALSE) override
Append object to this directory.
Bool_t IsWritable() const override
TDirectory::TContext keeps track and restore the current directory.
Describe directory structure in memory.
virtual TList * GetList() const
virtual TFile * GetFile() const
virtual Bool_t cd()
Change current directory to "this" directory.
virtual Int_t ReadTObject(TObject *, const char *)
virtual TObject * Remove(TObject *)
Remove an object from the in-memory list.
Streamer around an arbitrary STL like container, which implements basic container functionality.
<div class="legacybox"><h2>Legacy Code</h2> TEventList is a legacy interface: there will be no bug fi...
virtual Long64_t GetEntry(Int_t index) const
Return value of entry at index in the list.
virtual bool GetReapplyCut() const
virtual Int_t GetN() const
A cache when reading files over the network.
virtual void WaitFinishPrefetch()
virtual Int_t GetBufferSize() const
A class to pass information from the TFileMerger to the objects being merged.
TIOFeatures * fIOFeatures
Any ROOT IO features that should be explicitly enabled.
Bool_t fIsFirst
True if this is the first call to Merge for this series of object.
TString fOptions
Additional text based option being passed down to customize the merge.
TDirectory * fOutputDirectory
Target directory where the merged object will be written.
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
virtual void SetCacheRead(TFileCacheRead *cache, TObject *tree=nullptr, ECacheAction action=kDisconnect)
Set a pointer to the read cache.
Int_t GetCompressionSettings() const
Int_t GetCompressionLevel() const
virtual Long64_t GetEND() const
virtual void WriteStreamerInfo()
Write the list of TStreamerInfo as a single object in this file The class Streamer description for al...
virtual void Flush()
Synchronize a file's in-memory and on-disk states.
virtual void MakeFree(Long64_t first, Long64_t last)
Mark unused bytes on the file.
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
virtual void WriteHeader()
Write File Header.
@ kCancelTTreeChangeRequest
Int_t GetRecordHeader(char *buf, Long64_t first, Int_t maxbytes, Int_t &nbytes, Int_t &objlen, Int_t &keylen)
Read the logical record header starting at a certain postion.
TFileCacheRead * GetCacheRead(const TObject *tree=nullptr) const
Return a pointer to the current read cache.
<div class="legacybox"><h2>Legacy Code</h2> TFolder is a legacy interface: there will be no bug fixes...
TCollection * GetListOfFolders() const
virtual Int_t Occurence(const TObject *obj) const
Return occurrence number of object in the list of objects of this folder.
A TFriendElement TF describes a TTree object TF in a file.
virtual const char * GetTreeName() const
Get the actual TTree name of the friend.
virtual TTree * GetTree()
Return pointer to friend TTree.
virtual TFile * GetFile()
Return pointer to TFile containing this friend TTree.
TTree * fParentTree
! pointer to the parent TTree
TFriendElement(const TFriendElement &)=delete
Iterator abstract base class.
virtual TClass * IsA() const
Book space in a file, create I/O buffers, to fill them, (un)compress them.
void Delete(Option_t *option="") override
Delete an object from the file.
virtual const char * GetClassName() const
A TLeaf describes individual elements of a TBranch See TBranch structure in TTree.
virtual Double_t GetValue(Int_t i=0) const
virtual void * GetValuePointer() const
virtual Int_t GetLenType() const
virtual void ReadValue(std::istream &, Char_t=' ')
virtual Int_t GetMaximum() const
virtual Int_t GetLen() const
Return the number of effective elements of this leaf, for the current entry.
virtual TLeaf * GetLeafCount() const
If this leaf stores a variable-sized array or a multi-dimensional array whose last dimension has vari...
TClass * IsA() const override
virtual bool IncludeRange(TLeaf *)
virtual void SetAddress(void *add=nullptr)
TBranch * GetBranch() const
@ kNewValue
Set if we own the value buffer and so must delete it ourselves.
@ kIndirectAddress
Data member is a pointer to an array of basic types.
virtual TString GetFullName() const
Return the full name (including the parent's branch names) of the leaf.
virtual Int_t GetOffset() const
virtual void PrintValue(Int_t i=0) const
void Streamer(TBuffer &) override
Stream all objects in the collection to or from the I/O buffer.
TObject * Remove(TObject *obj) override
Remove object from the list.
TObject * First() const override
Return the first object in the list. Returns 0 when list is empty.
virtual TObjLink * FirstLink() const
void Delete(Option_t *option="") override
Remove all objects from the list AND delete all heap based objects.
A TMemFile is like a normal TFile except that it reads and writes only from memory.
TObject * Clone(const char *newname="") const override
Make a clone of an object using the Streamer facility.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
const char * GetName() const override
Returns name of object.
void Streamer(TBuffer &) override
Stream an object of class TObject.
const char * GetTitle() const override
Returns title of object.
virtual void SetName(const char *name)
Set the name of the TNamed.
Int_t GetEntriesFast() const
TObject * Last() const override
Return the object in the last filled slot. Returns 0 if no entries.
TIterator * MakeIterator(Bool_t dir=kIterForward) const override
Returns an array iterator.
virtual void Compress()
Remove empty slots from array.
Int_t GetEntries() const override
Return the number of objects in array (i.e.
TObject * At(Int_t idx) const override
TObject * UncheckedAt(Int_t i) const
Bool_t IsEmpty() const override
TObject * RemoveAt(Int_t idx) override
Remove object at index idx.
void Add(TObject *obj) override
Wrapper around a TObject so it can be stored in a TList.
TObject * GetObject() const
Mother of all ROOT objects.
friend class TClonesArray
virtual Bool_t Notify()
This method must be overridden to handle object notification (the base implementation is no-op).
Bool_t TestBit(UInt_t f) const
virtual const char * GetName() const
Returns name of object.
@ kOnlyPrepStep
Used to request that the class specific implementation of TObject::Write just prepare the objects to ...
virtual const char * ClassName() const
Returns name of class to which the object belongs.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
virtual const char * GetTitle() const
Returns title of object.
virtual TClass * IsA() const
TObject()
TObject constructor.
@ kCanDelete
if object in a list can be deleted
@ kMustCleanup
if object destructor must call RecursiveRemove()
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
The TRealData class manages the effective list of all data members for a given class.
const char * GetName() const override
Returns name of object.
TDataMember * GetDataMember() const
Long_t GetThisOffset() const
A TRefTable maintains the association between a referenced object and the parent object supporting th...
static void SetRefTable(TRefTable *table)
Static function setting the current TRefTable.
static TRefTable * GetRefTable()
Static function returning the current TRefTable.
Regular expression class.
A TSelector object is used by the TTree::Draw, TTree::Scan, TTree::Process to navigate in a TTree and...
static void * ReAlloc(void *vp, size_t size, size_t oldsize)
Reallocate (i.e.
Describes a persistent version of a class.
void ForceWriteInfo(TFile *file, Bool_t force=kFALSE) override
Recursively mark streamer infos for writing to a file.
void ToLower()
Change string to lower-case.
static constexpr Ssiz_t kNPOS
TSubString Strip(EStripType s=kTrailing, char c=' ') const
Return a substring of self stripped at beginning and/or end.
Double_t Atof() const
Return floating-point value contained in string.
Ssiz_t First(char c) const
Find first occurrence of a character c.
const char * Data() const
Bool_t EqualTo(const char *cs, ECaseCompare cmp=kExact) const
TString & ReplaceAll(const TString &s1, const TString &s2)
Ssiz_t Last(char c) const
Find last occurrence of a character c.
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
TString & Remove(Ssiz_t pos)
TString & Append(const char *cs)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
A zero length substring is legal.
A TTreeCache which exploits parallelized decompression of its own content.
static bool IsParallelUnzip()
Static function that tells wether the multithreading unzipping is activated.
A cache to speed-up the reading of ROOT datasets.
bool IsAutoCreated() const
Int_t SetBufferSize(Long64_t buffersize) override
Change the underlying buffer size of the cache.
static void SetLearnEntries(Int_t n=10)
Static function to set the number of entries to be used in learning mode The default value for n is 1...
virtual void SetEntryRange(Long64_t emin, Long64_t emax)
Set the minimum and maximum entry number to be processed this information helps to optimize the numbe...
virtual Int_t DropBranch(TBranch *b, bool subbranches=false)
Remove a branch to the list of branches to be stored in the cache this function is called by TBranch:...
void SetAutoCreated(bool val)
virtual void StopLearningPhase()
This is the counterpart of StartLearningPhase() and can be used to stop the learning phase.
void Print(Option_t *option="") const override
Print cache statistics.
Int_t AddBranch(TBranch *b, bool subgbranches=false) override
Add a branch to the list of branches to be stored in the cache this function is called by the user vi...
const char * GetWarning() const
bool Exec()
Execute the cloning.
void SetCacheSize(Long64_t size)
Set the cache size used by the matching TFile.
Iterator on all the leaves in a TTree and its friend.
TTree * fTree
tree being iterated
TIterator & operator=(const TIterator &rhs) override
Overridden assignment operator. Does NOT copy the 'cursor' location!
TObject * Next() override
Go the next friend element.
TIterator * fLeafIter
current leaf sub-iterator.
Option_t * GetOption() const override
Returns the object option stored in the list.
TIterator * fTreeIter
current tree sub-iterator.
bool fDirection
iteration direction
Helper class to iterate over cluster of baskets.
Long64_t GetEstimatedClusterSize()
Estimate the cluster size.
Long64_t Previous()
Move on to the previous cluster and return the starting entry of this previous cluster.
Long64_t Next()
Move on to the next cluster and return the starting entry of this next cluster.
TClusterIterator(TTree *tree, Long64_t firstEntry)
Regular constructor.
Helper class to prevent infinite recursion in the usage of TTree Friends.
TFriendLock & operator=(const TFriendLock &)
Assignment operator.
TFriendLock(const TFriendLock &)
Copy constructor.
~TFriendLock()
Restore the state of tree the same as before we set the lock.
A TTree represents a columnar dataset.
virtual Int_t Fill()
Fill all branches.
virtual TFriendElement * AddFriend(const char *treename, const char *filename="")
Add a TFriendElement to the list of friends.
TBranchRef * fBranchRef
Branch supporting the TRefTable (if any).
TStreamerInfo * BuildStreamerInfo(TClass *cl, void *pointer=nullptr, bool canOptimize=true)
Build StreamerInfo for class cl.
TBranch * GetBranchFromFriends(const char *branchName)
Returns a pointer to the branch with the given name, if it can be found in the list of friends of thi...
virtual Int_t SetBranchAddress(const char *bname, void *add, TBranch **ptr, TClass *realClass, EDataType datatype, bool isptr, bool suppressMissingBranchError)
virtual TBranch * FindBranch(const char *name)
Return the branch that correspond to the path 'branchname', which can include the name of the tree or...
virtual void SetBranchStatus(const char *bname, bool status=true, UInt_t *found=nullptr)
Set branch status to Process or DoNotProcess.
bool EnableCache()
Enable the TTreeCache unless explicitly disabled for this TTree by a prior call to SetCacheSize(0).
virtual TBranch * GetBranch(const char *name)
Return pointer to the branch with the given name in this tree or its friends.
static Int_t GetBranchStyle()
Static function returning the current branch style.
TList * fFriends
pointer to list of friend elements
bool fIMTEnabled
! true if implicit multi-threading is enabled for this tree
virtual bool GetBranchStatus(const char *branchname) const
Return status of branch with name branchname.
UInt_t fFriendLockStatus
! Record which method is locking the friend recursion
virtual TLeaf * GetLeafImpl(const char *branchname, const char *leafname)
Return pointer to the 1st Leaf named name in any Branch of this Tree or any branch in the list of fri...
Long64_t fTotBytes
Total number of bytes in all branches before compression.
virtual Int_t FlushBaskets(bool create_cluster=true) const
Write to disk all the basket that have not yet been individually written and create an event cluster ...
Int_t fMaxClusterRange
! Memory allocated for the cluster range.
virtual void Show(Long64_t entry=-1, Int_t lenmax=20)
Print values of all active leaves for entry.
TEventList * fEventList
! Pointer to event selection list (if one)
virtual Long64_t GetAutoSave() const
virtual Int_t StopCacheLearningPhase()
Stop the cache learning phase.
virtual Int_t GetEntry(Long64_t entry, Int_t getall=0)
Read all branches of entry and return total number of bytes read.
std::vector< std::pair< Long64_t, TBranch * > > fSortedBranches
! Branches to be processed in parallel when IMT is on, sorted by average task time
virtual void SetCircular(Long64_t maxEntries)
Enable/Disable circularity for this tree.
Long64_t fSavedBytes
Number of autosaved bytes.
virtual Int_t AddBranchToCache(const char *bname, bool subbranches=false)
Add branch with name bname to the Tree cache.
Long64_t GetMedianClusterSize()
Estimate the median cluster size for the TTree.
virtual TClusterIterator GetClusterIterator(Long64_t firstentry)
Return an iterator over the cluster of baskets starting at firstentry.
virtual void ResetBranchAddress(TBranch *)
Tell a branch to set its address to zero.
bool fCacheUserSet
! true if the cache setting was explicitly given by user
char GetNewlineValue(std::istream &inputStream)
Determine which newline this file is using.
TIOFeatures fIOFeatures
IO features to define for newly-written baskets and branches.
virtual Long64_t GetEntryNumberWithIndex(Long64_t major, Long64_t minor=0) const
Return entry number corresponding to major and minor number.
Long64_t fDebugMin
! First entry number to debug
virtual Long64_t SetEntries(Long64_t n=-1)
Change number of entries in the tree.
virtual TObjArray * GetListOfLeaves()
virtual TBranch * BranchOld(const char *name, const char *classname, void *addobj, Int_t bufsize=32000, Int_t splitlevel=1)
Create a new TTree BranchObject.
virtual Int_t GetEntryWithIndex(Long64_t major, Long64_t minor=0)
Read entry corresponding to major and minor number.
Long64_t GetCacheAutoSize(bool withDefault=false)
Used for automatic sizing of the cache.
virtual TBranch * BranchRef()
Build the optional branch supporting the TRefTable.
TFile * GetCurrentFile() const
Return pointer to the current file.
TList * fAliases
List of aliases for expressions based on the tree branches.
virtual TTree * CopyTree(const char *selection, Option_t *option="", Long64_t nentries=kMaxEntries, Long64_t firstentry=0)
Copy a tree with selection.
virtual Int_t DropBranchFromCache(const char *bname, bool subbranches=false)
Remove the branch with name 'bname' from the Tree cache.
virtual Int_t Fit(const char *funcname, const char *varexp, const char *selection="", Option_t *option="", Option_t *goption="", Long64_t nentries=kMaxEntries, Long64_t firstentry=0)
Fit a projected item(s) from a tree.
Long64_t * fClusterRangeEnd
[fNClusterRange] Last entry of a cluster range.
void Streamer(TBuffer &) override
Stream a class object.
std::atomic< Long64_t > fIMTZipBytes
! Zip bytes for the IMT flush baskets.
void RecursiveRemove(TObject *obj) override
Make sure that obj (which is being deleted or will soon be) is no longer referenced by this TTree.
TVirtualTreePlayer * GetPlayer()
Load the TTreePlayer (if not already done).
virtual Int_t MakeProxy(const char *classname, const char *macrofilename=nullptr, const char *cutfilename=nullptr, const char *option=nullptr, Int_t maxUnrolling=3)
Generate a skeleton analysis class for this Tree using TBranchProxy.
virtual Long64_t ReadStream(std::istream &inputStream, const char *branchDescriptor="", char delimiter=' ')
Create or simply read branches from an input stream.
virtual void SetDebug(Int_t level=1, Long64_t min=0, Long64_t max=9999999)
Set the debug level and the debug range.
Int_t fScanField
Number of runs before prompting in Scan.
void Draw(Option_t *opt) override
Default Draw method for all objects.
virtual TTree * GetFriend(const char *) const
Return a pointer to the TTree friend whose name or alias is friendname.
virtual void SetNotify(TObject *obj)
Sets the address of the object to be notified when the tree is loaded.
virtual Double_t GetMaximum(const char *columname)
Return maximum of column with name columname.
virtual Long64_t GetEntryNumberWithBestIndex(Long64_t major, Long64_t minor=0) const
Return entry number corresponding to major and minor number.
static void SetMaxTreeSize(Long64_t maxsize=100000000000LL)
Set the maximum size in bytes of a Tree file (static function).
void Print(Option_t *option="") const override
Print a summary of the tree contents.
virtual Int_t UnbinnedFit(const char *funcname, const char *varexp, const char *selection="", Option_t *option="", Long64_t nentries=kMaxEntries, Long64_t firstentry=0)
Unbinned fit of one or more variable(s) from a tree.
Int_t fNClusterRange
Number of Cluster range in addition to the one defined by 'AutoFlush'.
virtual void PrintCacheStats(Option_t *option="") const
Print statistics about the TreeCache for this tree.
TVirtualTreePlayer * fPlayer
! Pointer to current Tree player
virtual TIterator * GetIteratorOnAllLeaves(bool dir=kIterForward)
Creates a new iterator that will go through all the leaves on the tree itself and its friend.
virtual void SetMakeClass(Int_t make)
Set all the branches in this TTree to be in decomposed object mode (also known as MakeClass mode).
virtual bool InPlaceClone(TDirectory *newdirectory, const char *options="")
Copy the content to a new new file, update this TTree with the new location information and attach th...
virtual void IncrementTotalBuffers(Int_t nbytes)
TObjArray fBranches
List of Branches.
TDirectory * GetDirectory() const
bool fCacheDoAutoInit
! true if cache auto creation or resize check is needed
TTreeCache * GetReadCache(TFile *file) const
Find and return the TTreeCache registered with the file and which may contain branches for us.
Long64_t fEntries
Number of entries.
virtual TFile * ChangeFile(TFile *file)
Called by TTree::Fill() when file has reached its maximum fgMaxTreeSize.
virtual TEntryList * GetEntryList()
Returns the entry list assigned to this tree.
virtual void SetWeight(Double_t w=1, Option_t *option="")
Set tree weight.
void InitializeBranchLists(bool checkLeafCount)
Divides the top-level branches into two vectors: (i) branches to be processed sequentially and (ii) b...
Long64_t * fClusterSize
[fNClusterRange] Number of entries in each cluster for a given range.
Long64_t fFlushedBytes
Number of auto-flushed bytes.
virtual void SetPerfStats(TVirtualPerfStats *perf)
Set perf stats.
std::atomic< Long64_t > fIMTTotBytes
! Total bytes for the IMT flush baskets
virtual void SetCacheLearnEntries(Int_t n=10)
Interface to TTreeCache to set the number of entries for the learning phase.
TEntryList * fEntryList
! Pointer to event selection list (if one)
virtual TVirtualIndex * GetTreeIndex() const
TList * fExternalFriends
! List of TFriendsElement pointing to us and need to be notified of LoadTree. Content not owned.
virtual Long64_t Merge(TCollection *list, Option_t *option="")
Merge the trees in the TList into this tree.
virtual void SetMaxVirtualSize(Long64_t size=0)
virtual void DropBaskets()
Remove some baskets from memory.
virtual void SetAutoSave(Long64_t autos=-300000000)
In case of a program crash, it will be possible to recover the data in the tree up to the last AutoSa...
Long64_t fMaxEntryLoop
Maximum number of entries to process.
virtual void SetParallelUnzip(bool opt=true, Float_t RelSize=-1)
Enable or disable parallel unzipping of Tree buffers.
virtual void SetDirectory(TDirectory *dir)
Change the tree's directory.
void SortBranchesByTime()
Sorts top-level branches by the last average task time recorded per branch.
void Delete(Option_t *option="") override
Delete this tree from memory or/and disk.
virtual TBranchRef * GetBranchRef() const
virtual Long64_t Process(const char *filename, Option_t *option="", Long64_t nentries=kMaxEntries, Long64_t firstentry=0)
Process this tree executing the TSelector code in the specified filename.
virtual TBranch * BranchImpRef(const char *branchname, const char *classname, TClass *ptrClass, void *addobj, Int_t bufsize, Int_t splitlevel)
Same as TTree::Branch but automatic detection of the class name.
virtual void SetEventList(TEventList *list)
This function transfroms the given TEventList into a TEntryList The new TEntryList is owned by the TT...
void MoveReadCache(TFile *src, TDirectory *dir)
Move a cache from a file to the current file in dir.
Long64_t fAutoFlush
Auto-flush tree when fAutoFlush entries written or -fAutoFlush (compressed) bytes produced.
Int_t fUpdate
Update frequency for EntryLoop.
virtual void ResetAfterMerge(TFileMergeInfo *)
Resets the state of this TTree after a merge (keep the customization but forget the data).
ROOT::TIOFeatures TIOFeatures
virtual Long64_t GetEntries() const
virtual void SetEstimate(Long64_t nentries=1000000)
Set number of entries to estimate variable limits.
Int_t fTimerInterval
Timer interval in milliseconds.
Int_t fDebug
! Debug level
Int_t SetCacheSizeAux(bool autocache=true, Long64_t cacheSize=0)
Set the maximum size of the file cache (TTreeCache) in bytes and create it if possible.
virtual Long64_t AutoSave(Option_t *option="")
AutoSave tree header every fAutoSave bytes.
virtual Long64_t GetEntryNumber(Long64_t entry) const
Return entry number corresponding to entry.
virtual TTree * CloneTree(Long64_t nentries=-1, Option_t *option="")
Create a clone of this tree and copy nentries.
virtual TLeaf * GetLeaf(const char *branchname, const char *leafname)
Return pointer to the 1st Leaf named name in any Branch of this Tree or any branch in the list of fri...
virtual Long64_t GetZipBytes() const
TObjArray fLeaves
Direct pointers to individual branch leaves.
virtual void Reset(Option_t *option="")
Reset baskets, buffers and entries count in all branches and leaves.
@ kSplitCollectionOfPointers
virtual void KeepCircular()
Keep a maximum of fMaxEntries in memory.
virtual void SetDefaultEntryOffsetLen(Int_t newdefault, bool updateExisting=false)
Update the default value for the branch's fEntryOffsetLen.
virtual void DirectoryAutoAdd(TDirectory *)
Called by TKey and TObject::Clone to automatically add us to a directory when we are read from a file...
Long64_t fMaxVirtualSize
Maximum total size of buffers kept in memory.
virtual Long64_t GetTotBytes() const
virtual Int_t MakeSelector(const char *selector=nullptr, Option_t *option="")
Generate skeleton selector class for this tree.
virtual void SetObject(const char *name, const char *title)
Change the name and title of this tree.
TVirtualPerfStats * fPerfStats
! pointer to the current perf stats object
Double_t fWeight
Tree weight (see TTree::SetWeight).
std::vector< TBranch * > fSeqBranches
! Branches to be processed sequentially when IMT is on
Long64_t fDebugMax
! Last entry number to debug
Int_t fDefaultEntryOffsetLen
Initial Length of fEntryOffset table in the basket buffers.
TBranch * GetBranchFromSelf(const char *branchName)
Returns a pointer to the branch with the given name, if it can be found in this tree.
TTree()
Default constructor and I/O constructor.
Long64_t fAutoSave
Autosave tree when fAutoSave entries written or -fAutoSave (compressed) bytes produced.
TBranch * Branch(const char *name, T *obj, Int_t bufsize=32000, Int_t splitlevel=99)
Add a new branch, and infer the data type from the type of obj being passed.
std::atomic< UInt_t > fAllocationCount
memory churn.
static TTree * MergeTrees(TList *list, Option_t *option="")
Static function merging the trees in the TList into a new tree.
bool MemoryFull(Int_t nbytes)
Check if adding nbytes to memory we are still below MaxVirtualsize.
virtual Long64_t GetReadEntry() const
virtual TObjArray * GetListOfBranches()
Long64_t fZipBytes
Total number of bytes in all branches after compression.
virtual TTree * GetTree() const
TBuffer * fTransientBuffer
! Pointer to the current transient buffer.
virtual void SetEntryList(TEntryList *list, Option_t *opt="")
Set an EntryList.
bool Notify() override
Function called when loading a new class library.
virtual void AddZipBytes(Int_t zip)
virtual Long64_t LoadTree(Long64_t entry)
Set current entry.
virtual Long64_t ReadFile(const char *filename, const char *branchDescriptor="", char delimiter=' ')
Create or simply read branches from filename.
virtual const char * GetAlias(const char *aliasName) const
Returns the expanded value of the alias. Search in the friends if any.
ROOT::TIOFeatures SetIOFeatures(const ROOT::TIOFeatures &)
Provide the end-user with the ability to enable/disable various experimental IO features for this TTr...
virtual TBasket * CreateBasket(TBranch *)
Create a basket for this tree and given branch.
TList * fUserInfo
pointer to a list of user objects associated to this Tree
virtual Double_t GetMinimum(const char *columname)
Return minimum of column with name columname.
virtual void RemoveFriend(TTree *)
Remove a friend from the list of friends.
virtual Long64_t GetEntriesFast() const
Return a number greater or equal to the total number of entries in the dataset.
void Browse(TBrowser *) override
Browse content of the TTree.
virtual TList * GetUserInfo()
Return a pointer to the list containing user objects associated to this tree.
void RegisterBranchFullName(std::pair< std::string, TBranch * > &&kv)
Long64_t fChainOffset
! Offset of 1st entry of this Tree in a TChain
@ kOnlyFlushAtCluster
If set, the branch's buffers will grow until an event cluster boundary is hit, guaranteeing a basket ...
@ kEntriesReshuffled
If set, signals that this TTree is the output of the processing of another TTree, and the entries are...
virtual Long64_t GetEntriesFriend() const
Returns a number corresponding to:
virtual TSQLResult * Query(const char *varexp="", const char *selection="", Option_t *option="", Long64_t nentries=kMaxEntries, Long64_t firstentry=0)
Loop over entries and return a TSQLResult object containing entries following selection.
virtual TBranch * Bronch(const char *name, const char *classname, void *addobj, Int_t bufsize=32000, Int_t splitlevel=99)
Create a new TTree BranchElement.
virtual void SetBasketSize(const char *bname, Int_t buffsize=16000)
Set a branch's basket size.
static void SetBranchStyle(Int_t style=1)
Set the current branch style.
~TTree() override
Destructor.
void ImportClusterRanges(TTree *fromtree)
Appends the cluster range information stored in 'fromtree' to this tree, including the value of fAuto...
TClass * IsA() const override
Long64_t fEstimate
Number of entries to estimate histogram limits.
Int_t FlushBasketsImpl() const
Internal implementation of the FlushBaskets algorithm.
virtual Long64_t LoadTreeFriend(Long64_t entry, TTree *T)
Load entry on behalf of our master tree, we may use an index.
Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0) override
Write this object to the current directory.
TVirtualIndex * fTreeIndex
Pointer to the tree Index (if any).
void UseCurrentStyle() override
Replace current attributes by current style.
virtual Int_t GetTreeNumber() const
TObject * fNotify
Object to be notified when loading a Tree.
virtual TBranch * BranchImp(const char *branchname, const char *classname, TClass *ptrClass, void *addobj, Int_t bufsize, Int_t splitlevel)
Same as TTree::Branch() with added check that addobj matches className.
virtual TList * GetListOfClones()
Long64_t fCacheSize
! Maximum size of file buffers
TList * fClones
! List of cloned trees which share our addresses
std::atomic< Long64_t > fTotalBuffers
! Total number of bytes in branch buffers
virtual void SetTreeIndex(TVirtualIndex *index)
The current TreeIndex is replaced by the new index.
virtual void OptimizeBaskets(ULong64_t maxMemory=10000000, Float_t minComp=1.1, Option_t *option="")
This function may be called after having filled some entries in a Tree.
virtual Long64_t Project(const char *hname, const char *varexp, const char *selection="", Option_t *option="", Long64_t nentries=kMaxEntries, Long64_t firstentry=0)
Make a projection of a tree using selections.
virtual Int_t SetCacheEntryRange(Long64_t first, Long64_t last)
interface to TTreeCache to set the cache entry range
static Long64_t GetMaxTreeSize()
Static function which returns the tree file size limit in bytes.
bool fCacheDoClusterPrefetch
! true if cache is prefetching whole clusters
virtual bool SetAlias(const char *aliasName, const char *aliasFormula)
Set a tree variable alias.
virtual void CopyAddresses(TTree *, bool undo=false)
Set branch addresses of passed tree equal to ours.
virtual Int_t BuildIndex(const char *majorname, const char *minorname="0", bool long64major=false, bool long64minor=false)
Build a Tree Index (default is TTreeIndex).
Long64_t fMaxEntries
Maximum number of entries in case of circular buffers.
virtual void DropBuffers(Int_t nbytes)
Drop branch buffers to accommodate nbytes below MaxVirtualsize.
virtual TList * GetListOfFriends() const
virtual void Refresh()
Refresh contents of this tree and its branches from the current status on disk.
virtual void SetAutoFlush(Long64_t autof=-30000000)
This function may be called at the start of a program to change the default value for fAutoFlush.
static Long64_t fgMaxTreeSize
Maximum size of a file containing a Tree.
Long64_t fReadEntry
! Number of the entry being processed
TArrayD fIndexValues
Sorted index values.
void MarkEventCluster()
Mark the previous event as being at the end of the event cluster.
UInt_t fNEntriesSinceSorting
! Number of entries processed since the last re-sorting of branches
virtual void SetFileNumber(Int_t number=0)
Set fFileNumber to number.
virtual TLeaf * FindLeaf(const char *name)
Find first leaf containing searchname.
virtual void StartViewer()
Start the TTreeViewer on this tree.
Int_t GetMakeClass() const
virtual Int_t MakeCode(const char *filename=nullptr)
Generate a skeleton function for this tree.
bool fIMTFlush
! True if we are doing a multithreaded flush.
TDirectory * fDirectory
! Pointer to directory holding this tree
@ kNeedEnableDecomposedObj
@ kMatchConversionCollection
@ kMissingCompiledCollectionProxy
static Int_t fgBranchStyle
Old/New branch style.
virtual void ResetBranchAddresses()
Tell all of our branches to drop their current objects and allocate new ones.
Int_t fNfill
! Local for EntryLoop
void SetName(const char *name) override
Change the name of this tree.
virtual void RegisterExternalFriend(TFriendElement *)
Record a TFriendElement that we need to warn when the chain switches to a new file (typically this is...
TArrayI fIndex
Index of sorted values.
Int_t SetBranchAddressImp(const char *bname, void *add, TBranch **ptr, TClass *realClass, EDataType datatype, bool isptr)
virtual Int_t SetCacheSize(Long64_t cachesize=-1)
Set maximum size of the file cache (TTreeCache) in bytes.
void AddClone(TTree *)
Add a cloned tree to our list of trees to be notified whenever we change our branch addresses or when...
virtual Int_t CheckBranchAddressType(TBranch *branch, TClass *ptrClass, EDataType datatype, bool ptr)
Check whether or not the address described by the last 3 parameters matches the content of the branch...
TBuffer * GetTransientBuffer(Int_t size)
Returns the transient buffer currently used by this TTree for reading/writing baskets.
ROOT::TIOFeatures GetIOFeatures() const
Returns the current set of IO settings.
virtual Int_t MakeClass(const char *classname=nullptr, Option_t *option="")
Generate a skeleton analysis class for this tree.
virtual const char * GetFriendAlias(TTree *) const
If the 'tree' is a friend, this method returns its alias name.
virtual void RemoveExternalFriend(TFriendElement *)
Removes external friend.
Int_t fPacketSize
! Number of entries in one packet for parallel root
virtual TBranch * BranchImpArr(const char *branchname, EDataType datatype, std::size_t N, void *addobj, Int_t bufsize, Int_t splitlevel)
virtual Long64_t Scan(const char *varexp="", const char *selection="", Option_t *option="", Long64_t nentries=kMaxEntries, Long64_t firstentry=0)
Loop over tree entries and print entries passing selection.
virtual TBranch * BronchExec(const char *name, const char *classname, void *addobj, bool isptrptr, Int_t bufsize, Int_t splitlevel)
Helper function implementing TTree::Bronch and TTree::Branch(const char *name, T &obj);.
virtual void AddTotBytes(Int_t tot)
virtual Long64_t CopyEntries(TTree *tree, Long64_t nentries=-1, Option_t *option="", bool needCopyAddresses=false)
Copy nentries from given tree to this tree.
Int_t fMakeClass
! not zero when processing code generated by MakeClass
virtual Int_t LoadBaskets(Long64_t maxmemory=2000000000)
Read in memory all baskets from all branches up to the limit of maxmemory bytes.
static constexpr Long64_t kMaxEntries
Used as the max value for any TTree range operation.
TPrincipal * Principal(const char *varexp="", const char *selection="", Option_t *option="np", Long64_t nentries=kMaxEntries, Long64_t firstentry=0)
Interface to the Principal Components Analysis class.
std::unordered_map< std::string, TBranch * > fNamesToBranches
! maps names to their branches, useful when retrieving branches by name
virtual Long64_t GetAutoFlush() const
Defines a common interface to inspect/change the contents of an object that represents a collection.
virtual EDataType GetType() const =0
If the value type is a fundamental data type, return its type (see enumeration EDataType).
virtual TClass * GetValueClass() const =0
If the value type is a user-defined class, return a pointer to the TClass representing the value type...
virtual Bool_t HasPointers() const =0
Return true if the content is of type 'pointer to'.
Abstract interface for Tree Index.
virtual const char * GetMajorName() const =0
virtual void Append(const TVirtualIndex *, bool delaySort=false)=0
virtual const char * GetMinorName() const =0
virtual void SetTree(TTree *T)=0
virtual bool IsValidFor(const TTree *parent)=0
Provides the interface for the an internal performance measurement and event tracing.
Abstract base class defining the interface for the plugins that implement Draw, Scan,...
virtual TVirtualIndex * BuildIndex(const TTree *T, const char *majorname, const char *minorname, bool long64major=false, bool long64minor=false)=0
static TVirtualTreePlayer * TreePlayer(TTree *obj)
Static function returning a pointer to a Tree player.
Special implementation of ROOT::RRangeCast for TCollection, including a check that the cast target ty...
TRangeCast< T, false > TRangeStaticCast
TRangeStaticCast is an adapter class that allows the typed iteration through a TCollection.
TBranch * CallBranchImp(TTree &tree, const char *branchname, TClass *ptrClass, void *addobj, Int_t bufsize=32000, Int_t splitlevel=99)
TBranch * CallBranchImpRef(TTree &tree, const char *branchname, TClass *ptrClass, EDataType datatype, void *addobj, Int_t bufsize=32000, Int_t splitlevel=99)
void TBranch__SetTree(TTree *tree, TObjArray &branches)
Set the fTree member for all branches and sub branches.
The namespace of The Lean Mean C++ Option Parser.
Bool_t IsImplicitMTEnabled()
Returns true if the implicit multi-threading in ROOT is enabled.
void CallRecursiveRemoveIfNeeded(TObject &obj)
call RecursiveRemove for obj if gROOT is valid and obj.TestBit(kMustCleanup) is true.
void ToHumanReadableSize(value_type bytes, Bool_t si, Double_t *coeff, const char **units)
Return the size expressed in 'human readable' format.
EFromHumanReadableSize FromHumanReadableSize(std::string_view str, T &value)
Convert strings like the following into byte counts 5MB, 5 MB, 5M, 3.7GB, 123b, 456kB,...
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Double_t Median(Long64_t n, const T *a, const Double_t *w=nullptr, Long64_t *work=nullptr)
Same as RMS.
Double_t Ceil(Double_t x)
Rounds x upward, returning the smallest integral value that is not less than x.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
@ kUseGlobal
Use the global compression algorithm.
@ kInherit
Some objects use this value to denote that the compression algorithm should be inherited from the par...
@ kUseCompiledDefault
Use the compile-time default setting.