202,
fBasketSize((basketsize < 100) ? 100 : basketsize)
256,
fBasketSize((basketsize < 100) ? 100 : basketsize)
304 if ((compress == -1) &&
fTree->GetDirectory()) {
305 TFile* bfile =
fTree->GetDirectory()->GetFile();
325 char* nameBegin =
const_cast<char*
>(leaflist);
327 auto len = strlen(leaflist);
329 char* leafname =
new char[len + 1];
330 char* leaftype =
new char[320];
332 strlcpy(leaftype,
"F",320);
333 char* pos =
const_cast<char*
>(leaflist);
334 const char* leaflistEnd = leaflist + len;
335 for (; pos <= leaflistEnd; ++pos) {
337 if ((*pos ==
':') || (*pos == 0)) {
339 Int_t lenName = pos - nameBegin;
340 char* ctype =
nullptr;
342 strncpy(leafname, nameBegin, lenName);
343 leafname[lenName] = 0;
344 ctype = strstr(leafname,
"/");
347 strlcpy(leaftype, ctype + 1,320);
350 if (lenName == 0 || ctype == leafname) {
351 Warning(
"TBranch",
"No name was given to the leaf number '%d' in the leaflist of the branch '%s'.",
fNleaves,
name);
354 TLeaf* leaf =
nullptr;
355 if (leaftype[1] ==
'[' && !strchr(leaftype,
',')) {
356 Warning(
"TBranch",
"Array size for branch '%s' must be specified after leaf name, not after the type name!",
name);
358 }
else if (leaftype[1] && !strchr(leaftype,
',')) {
359 Warning(
"TBranch",
"Extra characters after type tag '%s' for branch '%s'; must be one character.", leaftype,
name);
362 if (*leaftype ==
'C') {
363 leaf =
new TLeafC(
this, leafname, leaftype);
364 }
else if (*leaftype ==
'O') {
365 leaf =
new TLeafO(
this, leafname, leaftype);
366 }
else if (*leaftype ==
'B') {
367 leaf =
new TLeafB(
this, leafname, leaftype);
368 }
else if (*leaftype ==
'b') {
369 leaf =
new TLeafB(
this, leafname, leaftype);
371 }
else if (*leaftype ==
'S') {
372 leaf =
new TLeafS(
this, leafname, leaftype);
373 }
else if (*leaftype ==
's') {
374 leaf =
new TLeafS(
this, leafname, leaftype);
376 }
else if (*leaftype ==
'I') {
377 leaf =
new TLeafI(
this, leafname, leaftype);
378 }
else if (*leaftype ==
'i') {
379 leaf =
new TLeafI(
this, leafname, leaftype);
381 }
else if (*leaftype ==
'F') {
382 leaf =
new TLeafF(
this, leafname, leaftype);
383 }
else if (*leaftype ==
'f') {
384 leaf =
new TLeafF16(
this, leafname, leaftype);
385 }
else if (*leaftype ==
'L') {
386 leaf =
new TLeafL(
this, leafname, leaftype);
387 }
else if (*leaftype ==
'l') {
388 leaf =
new TLeafL(
this, leafname, leaftype);
390 }
else if (*leaftype ==
'D') {
391 leaf =
new TLeafD(
this, leafname, leaftype);
392 }
else if (*leaftype ==
'd') {
393 leaf =
new TLeafD32(
this, leafname, leaftype);
394 }
else if (*leaftype ==
'G') {
395 leaf =
new TLeafG(
this, leafname, leaftype);
396 }
else if (*leaftype ==
'g') {
397 leaf =
new TLeafG(
this, leafname, leaftype);
401 Error(
"TLeaf",
"Illegal data type for %s/%s",
name, leaflist);
410 auto msg =
"Illegal leaf: %s/%s. If this is a variable size C array it's possible that the branch holding the size is not available.";
430 fTree->GetListOfLeaves()->Add(leaf);
477 if (lst && lst->
GetLast()!=-1) {
559 Warning(
"AddBasket",
"The assumption that out-of-order basket only comes from disk based ntuple is false.");
570 Error(
"AddBasket",
"An out-of-order basket matches the entry number of an existing basket.");
588 Fatal(
"AddBasket",
"Dropping non-empty 'write' basket in %s %s",
627 Fatal(
"AddBasket",
"The last basket must have the highest entry number (%s/%lld/%d).",
GetName(),startEntry,
fWriteBasket);
684 auto endCluster = cluster.GetNextEntry();
741 for (
Int_t j = 0; j < nb; j++) {
759 if (options && options[0]) {
762 if (opt.
Contains(
"all")) all =
true;
770 for (
Int_t i=0;i<nbaskets;i++) {
772 if (!basket)
continue;
792 for (
Int_t j = 0; j < nb; j++) {
794 if (!branch)
continue;
863 basket =
fTree->CreateBasket(
this);
864 if (!basket)
return 0;
898 nbytes = lnew - lold;
904 nsize = nevbuf *
sizeof(
Int_t);
925 if (nout < 0)
Error(
"TBranch::Fill",
"Failed to write out basket.\n");
926 return (nout >= 0) ? nbytes : -1;
937 Int_t objectStart = 0;
982 char* s =
new char[maxsize];
985 while (strlen(s) == (maxsize - 1)) {
990 s =
new char[maxsize];
1005 if (startpos >
UInt_t(objectStart)) {
1025 nbytes = lnew - lold;
1038 longnm.reserve(
fName.Length()+strlen(
name)+3);
1039 longnm =
fName.Data();
1040 if (longnm[longnm.length()-1]==
']') {
1041 std::size_t dim = longnm.find_first_of(
'[');
1042 if (dim != std::string::npos) {
1046 if (longnm[longnm.length()-1] !=
'.') {
1054 for(
Int_t i = 0; i < nbranches; ++i) {
1057 const char *brname = branch->
fName.
Data();
1059 if (brname[brlen-1]==
']') {
1060 const char *dim = strchr(brname,
'[');
1062 brlen = dim - brname;
1065 if (namelen == brlen
1066 && strncmp(
name,brname,brlen) == 0) {
1069 if (brlen == (
size_t)longnm.length()
1070 && strncmp(longnm.c_str(),brname,brlen) == 0) {
1089 TLeaf* leaf =
nullptr;
1090 while ((leaf = (
TLeaf*) next())) {
1093 if (dim >= 0) leafname.
Remove(dim);
1095 if (leafname == searchname)
return leaf;
1099 dim = leaftitle.
First(
'[');
1100 if (dim >= 0) leaftitle.
Remove(dim);
1102 if (leaftitle == searchname)
return leaf;
1107 dim = longname.
First(
'[');
1108 if (dim>=0) longname.
Remove(dim);
1109 if (longname == searchname)
return leaf;
1112 longname.
Form(
"%s.%s",branch->
GetName(),searchname);
1113 if (longname==leafname)
return leaf;
1116 dim = longtitle.
First(
'[');
1117 if (dim>=0) longtitle.
Remove(dim);
1118 if (longtitle == searchname)
return leaf;
1125 if (strstr(searchname,
".") && !strcmp(searchname, branch->
GetName()))
return leaf;
1146 for(
Int_t i=0; i != maxbasket; ++i) {
1157 for (
Int_t i = 0; i < len; ++i) {
1231 static std::atomic<Int_t> nerrors(0);
1234 if (basketnumber <0 || basketnumber >
fWriteBasket)
return nullptr;
1236 if (basket)
return basket;
1241 if (file ==
nullptr) {
1246 if (
fTree->GetMaxVirtualSize() < 0 ||
fTree->GetClusterPrefetch())
1270 if (nerrors > 10)
return nullptr;
1271 if (nerrors == 10) {
1272 printf(
" file probably overwritten: stopping reporting error messages\n");
1274 printf(
"===>File is more than 2 Gigabytes\n");
1278 printf(
"===>Your file is may be bigger than the maximum file size allowed on your system\n");
1279 printf(
" Check your AFS maximum file size limit for example\n");
1283 Error(
"GetBasket",
"File: %s at byte:%lld, branch:%s, entry:%lld, badread=%d, nerrors=%d, basketnumber=%d",file->
GetName(),basket->
GetSeekKey(),
GetName(),
fReadEntry,badread,nerrors.load(),basketnumber);
1292 perfStats->
SetUsed(
this, basketnumber);
1294 fBaskets.AddAt(basket,basketnumber);
1303 if (basketnumber <0 || basketnumber >
fWriteBasket)
return 0;
1334 return "TBranchElement-folder";
1336 return "TBranchElement-leaf";
1370 if ((entry < first) || (entry > last)) {
1374 Error(
"GetBasketAndFirst",
"In the branch %s, no basket contains the entry %lld\n",
GetName(), entry);
1396 if (
fTree->GetClusterPrefetch()) {
1398 clusterIterator.
Next();
1500 Error(
"GetBulkEntries",
"Failed to get a new buffer.\n");
1505 Error(
"GetBulkEntries",
"Basket has displacement.\n");
1509 if (&user_buf != buf) {
1534 Error(
"GetBulkEntries",
"Leaf failed to read.\n");
1540 R__ASSERT(
fExtraBasket ==
nullptr &&
"fExtraBasket should have been set to nullptr by GetFreshBasket");
1594 Error(
"GetEntriesSerialized",
"Encountered a branch with destructive deserialization; failing.");
1609 Error(
"GetEntriesSerialized",
"Failed to read from full cluster; first entry is %lld; requested entry is %lld.\n", first, entry);
1618 Error(
"GetEntriesSerialized",
"Failed to get a new buffer.\n");
1623 Error(
"GetEntriesSerialized",
"Basket has displacement.\n");
1627 if (&user_buf != buf) {
1660 Error(
"GetEntriesSerialized",
"Failed to read count leaf.\n");
1666 Int_t entry_count_serialized;
1667 char *tmp_ptr =
reinterpret_cast<char*
>(&entry_count_serialized);
1670 for (
int idx=0; idx<
N; idx++) {
1671 *count_buf << entry_count_serialized;
1678 R__ASSERT(
fExtraBasket ==
nullptr &&
"fExtraBasket should have been set to nullptr by GetFreshBasket");
1716 if (
R__unlikely(result < 0)) {
return result + 1; }
1724 if (!file)
return -1;
1740 bufbegin = entryOffset[entry-first];
1753 return buf->
Length() - bufbegin;
1776 if ((entry < first) || (entry > last)) {
1780 Error(
"In the branch %s, no basket contains the entry %d\n",
GetName(), entry);
1811 bufbegin = entryOffset[entry-first];
1823 nbytes = buf->
Length() - bufbegin;
1835 expectedClass =
nullptr;
1839 expectedType = (
EDataType)
gROOT->GetType(
l->GetTypeName())->GetType();
1842 Error(
"GetExpectedType",
"Did not find any leaves in %s",
GetName());
1857 TFile *file =
nullptr;
1867 if (
fFileName.Length() == 0)
return nullptr;
1874 if (mode) file =
TFile::Open(bFileName,
"recreate");
1877 if (!file)
return nullptr;
1878 if (file->
IsZombie()) {
delete file;
return nullptr;}
1901 if (
GetTree()->MemoryFull(0)) {
1909 if (oldindex !=
fBaskets.LowerBound()-1) {
1923#ifdef R__TRACK_BASKET_ALLOC_TIME
1924 fTree->AddAllocationTime(basket->GetResetAllocationTime());
1928 basket =
fTree->CreateBasket(
this);
1932 basket =
fTree->CreateBasket(
this);
1937 basket =
fTree->CreateBasket(
this);
1940 basket =
fTree->CreateBasket(
this);
1956 auto CreateOrReuseBasket = [
this, user_buffer]() ->
TBasket* {
1962 newbasket =
fTree->CreateBasket(
this);
1974 return CreateOrReuseBasket();
1979 for (
Int_t j = 0; j < -
fTree->GetMaxVirtualSize(); j++) {
1981 return CreateOrReuseBasket();
1990 while (
fBasketEntry[basketToUnload] != entryToUnload) {
1992 if (basketToUnload < 0) {
1993 return CreateOrReuseBasket();
2001 fBaskets.AddAt(
nullptr, basketToUnload);
2004 basket = CreateOrReuseBasket();
2018 fBaskets.AddAt(
nullptr, basketToUnload);
2033 if (!mother || mother==
this) {
2037 const auto motherName = mother->
GetName();
2038 const auto len = strlen(motherName);
2039 if (len > 0 && (motherName[len-1] ==
'.')) {
2045 result = motherName;
2076 if (!
gSystem->IsAbsoluteFileName(bname) && !strstr(bname,
":/") &&
fTree &&
fTree->GetCurrentFile()) {
2079 const char *tfn =
fTree->GetCurrentFile()->GetName();
2085 bFileName = arc.
GetUrl();
2089 char *tname =
gSystem->ExpandPathName(tfn);
2090 if (
gSystem->IsAbsoluteFileName(tname) || strstr(tname,
":/")) {
2091 bFileName =
gSystem->GetDirName(tname);
2148 for (
Int_t i = 0; i <
n; ++i) {
2166 if (
this == child) {
2176 for (
Int_t i = 0; i < len; ++i) {
2181 if (branch == child) {
2212 return totbytes +
b.Length();
2222 if (!option)
return totbytes;
2223 if (option[0] !=
'*')
return totbytes;
2226 for (
Int_t i = 0; i < len; ++i) {
2228 if (branch) totbytes += branch->
GetTotBytes(option);
2240 if (!option)
return zipbytes;
2241 if (option[0] !=
'*')
return zipbytes;
2244 for (
Int_t i = 0; i < len; ++i) {
2246 if (branch) zipbytes += branch->
GetZipBytes(option);
2276 return browsables && browsables->
GetSize();
2291 for (
Int_t i = 0; i < nb; ++i) {
2310 Int_t nimported = 0;
2313 if (!file)
return 0;
2315 for (
Int_t i=0;i<nbaskets;i++) {
2317 if (basket)
continue;
2324 Error(
"Loadbaskets",
"Error while reading basket buffer %d of branch %s",i,
GetName());
2342 const int kLINEND = 77;
2346 if ( titleContent ==
GetName() ) {
2347 titleContent.
Clear();
2350 if (
fLeaves.GetEntries() == 1) {
2351 if (titleContent.
Length()>=2 && titleContent[titleContent.
Length()-2]==
'/' && isalpha(titleContent[titleContent.
Length()-1])) {
2355 if (titleContent.
Length()) {
2365 aLength += (aLength / 54 + 1) * 80 + 100;
2366 if (aLength < 200) aLength = 200;
2367 char *bline =
new char[aLength];
2373 if (strlen(bline) >
UInt_t(kLINEND)) {
2374 char *tmp =
new char[strlen(bline)+1];
2375 if (titleLength) strlcpy(tmp, titleContent.
Data(),strlen(bline)+1);
2377 int pos = strlen (bline);
2380 while (beg < titleLength) {
2381 for (end=beg+1; end < titleLength-1; end ++)
2382 if (tmp[end] ==
':')
break;
2383 if (npos + end-beg+1 >= 78) {
2384 while (npos < kLINEND) {
2385 bline[pos ++] =
' ';
2388 bline[pos ++] =
'*';
2389 bline[pos ++] =
'\n';
2390 bline[pos ++] =
'*';
2392 for (; npos < 12; npos ++)
2393 bline[pos ++] =
' ';
2396 for (
int n = beg;
n <= end;
n ++)
2397 bline[pos+
n-beg] = tmp[
n];
2402 while (npos < kLINEND) {
2403 bline[pos ++] =
' ';
2406 bline[pos ++] =
'*';
2419 Printf(
"*Entries :%9lld : Total Size=%11lld bytes All baskets in memory *",
fEntries,totBytes);
2421 Printf(
"*Entries :%9lld : Total Size=%11lld bytes One basket in memory *",
fEntries,totBytes);
2427 if (strncmp(option,
"basketsInfo",std::char_traits<char>::length(
"basketsInfo"))==0) {
2429 for (
Int_t i=0;i<nbaskets;i++) {
2430 Printf(
"*Basket #%4d entry=%6lld pos=%6lld size=%5d",
2435 Printf(
"*............................................................................*");
2509 if (
b==
nullptr)
return;
2536 Int_t nbaskets =
b->fBaskets.GetSize();
2663 for (
Int_t i = 0; i < nbranches; ++i) {
2761 || (strcmp(
"TLeafObject",
fLeaves.UncheckedAt(0)->ClassName())!=0) ) {
2762 Error(
"TBranch::SetAddress",
"Filling from a TBuffer can only be done with a not split object branch. Request ignored.");
2786 for (
Int_t i=0;i<nb;i++) {
2797 if (level < 0) level = 0;
2798 if (level > 99) level = 99;
2808 for (
Int_t i=0;i<nb;i++) {
2822 for (
Int_t i=0;i<nb;i++) {
2838 if (updateExisting) {
2841 while ( (
b = (
TBranch*)next() ) ) {
2842 b->SetEntryOffsetLen( newdefault,
true );
2877 if (file ==
nullptr) file =
fTree->GetCurrentFile();
2889 while ((basket = (
TBasket*)nextb())) {
2896 while ((branch = (
TBranch*)next())) {
2928 while ((branch = (
TBranch*)next())) {
2953 Warning(
"SetObject",
"is not supported in TBranch objects");
2970 if (
b.IsReading()) {
2974 gROOT->SetReadingObject(
true);
2995 auto nbranches =
fBranches.GetEntriesFast();
2996 for (
Int_t i=0;i<nbranches;i++) {
3019 gROOT->SetReadingObject(
false);
3094 gROOT->SetReadingObject(
false);
3167 gROOT->SetReadingObject(
false);
3188 for (
Int_t i = 0; i < lastBasket; ++i) {
3201 for (
Int_t i = 0; i < lastBasket; ++i) {
3202 if (stash[i])
fBaskets[i] = stash[i];
3228 auto doUpdates = [
this, basket, where]() {
3231 Error(
"WriteBasketImpl",
"basket's WriteBuffer failed.");
3235 TBasket *reusebasket =
nullptr;
3240 reusebasket = basket;
3245 fTree->AddTotBytes(addbytes);
3246 fTree->AddZipBytes(nout);
3247#ifdef R__TRACK_BASKET_ALLOC_TIME
3248 fTree->AddAllocationTime(reusebasket->GetResetAllocationTime());
3281 imtHelper->
Run(doUpdates);
3325 while ((basket = (
TBasket*)nextb())) {
3333 while ((branch = (
TBranch*)next())) {
void tobuf(char *&buf, Bool_t x)
#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).
int Ssiz_t
String size (currently int).
char Char_t
Character 1 byte (char).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
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.
float Float_t
Float 4 bytes (float).
const char Option_t
Option string (const char).
const UInt_t kNewClassTag
const UInt_t kByteCountMask
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
externTVirtualMutex * gROOTMutex
void Printf(const char *fmt,...)
Formats a string in a circular formatting buffer and prints the string.
#define R__LOCKGUARD_IMT(mutex)
#define R__LOCKGUARD(mutex)
A helper class for managing IMT work during TTree:Fill operations.
void Run(const FN &lambda)
TIOFeatures provides the end-user with the ability to change the IO behavior of data written via a TT...
virtual void Streamer(TBuffer &)
Manages buffers for branches of a Tree.
bool GetResetAllocationCount() const
void AdoptBuffer(TBuffer *user_buffer)
Adopt a buffer from an external entity.
Int_t GetNevBufSize() const
Int_t * GetDisplacement() const
void DisownBuffer()
Disown all references to the internal buffer - some other object likely now owns it.
void SetBranch(TBranch *branch)
Int_t ReadBasketBuffers(Long64_t pos, Int_t len, TFile *file)
Read basket buffers in memory and cleanup.
virtual Int_t DropBuffers()
Drop buffers of this basket if it is not the current basket.
virtual void PrepareBasket(Long64_t)
virtual void MoveEntries(Int_t dentries)
Remove the first dentries of this basket, moving entries at dentries to the start of the buffer.
void SetNevBufSize(Int_t n)
Int_t GetBufferSize() const
virtual void AdjustSize(Int_t newsize)
Increase the size of the current fBuffer up to newsize.
virtual void SetReadMode()
Set read mode of basket.
virtual void SetWriteMode()
Set write mode of basket.
Int_t ReadBasketBytes(Long64_t pos, TFile *file)
Read basket buffers in memory and cleanup.
virtual void ReadResetBuffer(Int_t basketnumber)
Reset the read basket TBuffer memory allocation if needed.
virtual Int_t WriteBuffer()
Write buffer of this basket on the current file.
void Streamer(TBuffer &) override
Stream a class object.
void Update(Int_t newlast)
virtual void WriteReset()
Reset the write basket to the starting state.
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.
TString fFileName
Name of file where buffers are stored ("" if in same file as Tree header).
virtual const char * GetClassName() const
Return the name of the user class whose content is stored in this branch, if any.
TBasket * GetFreshBasket(Int_t basketnumber, TBuffer *user_buffer)
Return a fresh basket by either reusing an existing basket that needs to be drop (according to TTree:...
TBasket * GetBasketImpl(Int_t basket, TBuffer *user_buffer)
Return pointer to basket basketnumber in this Branch.
Int_t fEntryOffsetLen
Initial Length of fEntryOffset table in the basket buffers.
virtual void DeleteBaskets(Option_t *option="")
Loop on all branch baskets.
virtual Long64_t GetBasketSeek(Int_t basket) const
Return address of basket in the file.
TBranch()
Default constructor. Used for I/O by default.
void SetCompressionSettings(Int_t settings=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault)
Set compression settings.
const char * GetIconName() const override
Return icon name depending on type of branch.
Int_t BackFill()
Loop on all leaves of this branch to back fill Basket buffer.
~TBranch() override
Destructor.
Int_t fMaxBaskets
Maximum number of Baskets so far.
Long64_t fTotBytes
Total number of bytes in all leaves before compression.
TBuffer * fTransientBuffer
! Pointer to the current transient buffer.
virtual void ReadBasket(TBuffer &b)
Loop on all leaves of this branch to read Basket buffer.
FillLeaves_t fFillLeaves
! Pointer to the FillLeaves implementation to use.
virtual TString GetFullName() const
Return the 'full' name of the branch.
@ kDoNotUseBufferMap
If set, at least one of the entry in the branch will use the buffer's map of classname and objects.
@ kIsClone
To indicate a TBranchClones.
@ kDoNotProcess
Active bit for branches.
TObjArray fLeaves
-> List of leaves of this branch
Int_t GetBasketAndFirst(TBasket *&basket, Long64_t &first, TBuffer *user_buffer)
A helper function to locate the correct basket - and its first entry.
char * fAddress
! Address of 1st leaf (variable or object)
virtual void DropBaskets(Option_t *option="")
Loop on all branch baskets.
TObjArray * GetListOfBranches()
virtual TList * GetBrowsables()
Returns (and, if 0, creates) browsable objects for this branch See TVirtualBranchBrowsable::FillListO...
TList * fBrowsables
! List of TVirtualBranchBrowsables used for Browse()
void ReadLeavesImpl(TBuffer &b)
Loop on all leaves of this branch to read Basket buffer.
Int_t fOffset
Offset of this branch.
Long64_t * fBasketEntry
[fMaxBaskets] Table of first entry in each basket
Int_t GetEntriesSerialized(Long64_t N, TBuffer &user_buf)
void ExpandBasketArrays()
Increase BasketEntry buffer of a minimum of 10 locations and a maximum of 50 per cent of current size...
void Init(const char *name, const char *leaflist, Int_t compress)
virtual Int_t GetEntry(Long64_t entry=0, Int_t getall=0)
Read all leaves of entry and return total number of bytes read.
TIOFeatures GetIOFeatures() const
Returns the IO settings currently in use for this branch.
TClass * IsA() const override
void FillLeavesImpl(TBuffer &b)
Loop on all leaves of this branch to fill Basket buffer.
Long64_t fReadEntry
! Current entry number when reading
void Print(Option_t *option="") const override
Print TBranch parameters.
static void ResetCount()
Static function resetting fgCount.
TBranch * GetSubBranch(const TBranch *br) const
Find the parent branch of child.
ReadLeaves_t fReadLeaves
! Pointer to the ReadLeaves implementation to use.
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.
void ReadLeaves2Impl(TBuffer &b)
Read two leaves without the overhead of a loop.
virtual void AddBasket(TBasket &b, bool ondisk, Long64_t startEntry)
Add the basket to this branch.
virtual void SetAddress(void *add)
Set address of this branch.
static Int_t fgCount
! branch counter
virtual void AddLastBasket(Long64_t startEntry)
Add the start entry of the write basket (not yet created).
TBasket * GetBasket(Int_t basket)
Int_t fNBaskets
! Number of baskets in memory
void ReadLeaves1Impl(TBuffer &b)
Read one leaf without the overhead of a loop.
Int_t GetBulkEntries(Long64_t, TBuffer &)
Read a basket of events into the given buffer with byte swapping.
virtual void SetFile(TFile *file=nullptr)
Set file where this branch writes/reads its buffers.
virtual Int_t GetEntryExport(Long64_t entry, Int_t getall, TClonesArray *list, Int_t n)
Read all leaves of an entry and export buffers to real objects in a TClonesArray list.
virtual void SetAutoDelete(bool autodel=true)
Set the automatic delete bit.
Long64_t fZipBytes
Total number of bytes in all leaves after compression.
TIOFeatures fIOFeatures
IO features for newly-created baskets.
void Browse(TBrowser *b) override
Browser interface.
void SetCompressionAlgorithm(Int_t algorithm=ROOT::RCompressionSetting::EAlgorithm::kUseGlobal)
Set compression algorithm.
virtual void SetEntryOffsetLen(Int_t len, bool updateSubBranches=false)
Update the default value for the branch's fEntryOffsetLen if and only if it was already non zero (and...
virtual TLeaf * FindLeaf(const char *name)
Find the leaf corresponding to the name 'searchname'.
BulkObj fBulk
! Helper for performing bulk IO
CacheInfo_t fCacheInfo
! Hold info about which basket are in the cache and if they have been retrieved from the cache.
TObjArray * GetListOfBaskets()
virtual void SetBufferAddress(TBuffer *entryBuffer)
Set address of this branch directly from a TBuffer to avoid streaming.
Long64_t GetEntries() const
Int_t fNleaves
! Number of leaves
Int_t fSplitLevel
Branch split level.
Int_t WriteBasketImpl(TBasket *basket, Int_t where, ROOT::Internal::TBranchIMTHelper *)
Write the current basket to disk and return the number of bytes written to the file.
virtual void UpdateFile()
Refresh the value of fDirectory (i.e.
Int_t * fBasketBytes
[fMaxBaskets] Length of baskets on file
Long64_t fNextBasketEntry
! Next entry that will requires us to go to the next basket
bool IsAutoDelete() const
Return true if an existing object in a TBranchObject must be deleted.
Int_t FillEntryBuffer(TBasket *basket, TBuffer *buf, Int_t &lnew)
Copy the data from fEntryBuffer into the current basket.
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...
TObjArray fBranches
-> List of Branches of this branch
virtual void KeepCircular(Long64_t maxEntries)
keep a maximum of fMaxEntries in memory
virtual void SetStatus(bool status=true)
Set branch status to Process or DoNotProcess.
virtual void ResetAfterMerge(TFileMergeInfo *)
Reset a Branch.
void ReadLeaves0Impl(TBuffer &b)
Read zero leaves without the overhead of a loop.
bool SupportsBulkRead() const
Returns true if this branch supports bulk IO, false otherwise.
TString GetRealFileName() const
Get real file name.
virtual TBranch * FindBranch(const char *name)
Find the immediate sub-branch with passed name.
TBranch(const TBranch &)=delete
TDirectory * fDirectory
! Pointer to directory where this branch buffers are stored
void PrintCacheInfo() const
Print the information we have about which basket is currently cached and whether they have been 'used...
TObjArray fBaskets
-> List of baskets of this branch
virtual Int_t LoadBaskets()
Baskets associated to this branch are forced to be in memory.
TBranch * fMother
! Pointer to top-level parent branch in the tree.
Long64_t GetTotBytes(Option_t *option="") const
Return total number of bytes in the branch (excluding current buffer) if option ="*" includes all sub...
TBranch * fParent
! Pointer to parent branch.
Int_t WriteBasket(TBasket *basket, Int_t where)
Int_t FlushOneBasket(UInt_t which)
If we have a write basket in memory and it contains some entries and has not yet been written to disk...
bool fSkipZip
! After being read, the buffer will not be unzipped.
virtual Int_t GetExpectedType(TClass *&clptr, EDataType &type)
Fill expectedClass and expectedType with information on the data type of the object/values contained ...
bool IsFolder() const override
Return true if more than one leaf or browsables, false otherwise.
virtual void SetFirstEntry(Long64_t entry)
set the first entry number (case of TBranchSTL)
Long64_t GetTotalSize(Option_t *option="") const
Return total number of bytes in the branch (including current buffer).
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).
Int_t fWriteBasket
Last basket number written.
Long64_t * fBasketSeek
[fMaxBaskets] Addresses of baskets on file
TObjArray * GetListOfLeaves()
virtual void SetEntries(Long64_t entries)
Set the number of entries in this branch.
Int_t fReadBasket
! Current basket number when reading
TDirectory * GetDirectory() const
Long64_t fFirstEntry
Number of the first entry in this branch.
TBasket * fExtraBasket
! Allocated basket not currently holding any data.
virtual Int_t GetRow(Int_t row)
Return all elements of one row unpacked in internal array fValues [Actually just returns 1 (?...
Int_t fBasketSize
Initial Size of Basket Buffer.
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.
Long64_t fEntryNumber
Current entry number (last one filled in this branch).
TBranch * GetMother() const
Get our top-level parent branch in the tree.
Int_t fCompress
Compression level and algorithm.
TBuffer * GetTransientBuffer(Int_t size)
Returns the transient buffer currently used by this TBranch for reading/writing baskets.
virtual Int_t FillImpl(ROOT::Internal::TBranchIMTHelper *)
Loop on all leaves of this branch to fill Basket buffer.
TBuffer * fEntryBuffer
! Buffer used to directly pass the content without streaming
TBasket * fCurrentBasket
! Pointer to the current basket.
Long64_t fFirstBasketEntry
! First entry in the current basket.
void SetCompressionLevel(Int_t level=ROOT::RCompressionSetting::ELevel::kUseMin)
Set compression level.
void Streamer(TBuffer &) override
Stream a class object.
Long64_t fEntries
Number of entries.
TBasket * GetFreshCluster(TBuffer *user_buffer)
Drops the cluster two behind the current cluster and returns a fresh basket by either reusing or crea...
TTree * fTree
! Pointer to Tree header
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.
char * GetCurrent() const
void AutoExpand(Int_t size_needed)
Automatically calculate a new size and expand the buffer to fit at least size_needed.
void SetBuffer(void *buf, UInt_t bufsize=0, Bool_t adopt=kTRUE, ReAllocCharFun_t reallocfunc=nullptr)
Sets a new buffer in an existing TBuffer object.
virtual void ResetMap()=0
void SetBufferOffset(Int_t offset=0)
virtual Int_t GetMapCount() const =0
virtual void WriteBuf(const void *buf, Int_t max)=0
virtual void SetBufferDisplacement()=0
TClass instances represent classes, structs and namespaces in the ROOT type system.
virtual void RemoveAll(TCollection *col)
Remove all objects in collection col from this collection.
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
TDirectory::TContext keeps track and restore the current directory.
Describe directory structure in memory.
A cache when reading files over the network.
virtual void SetSkipZip(Bool_t=kTRUE)
virtual Bool_t IsLearning() const
virtual Int_t LearnBranch(TBranch *, Bool_t=kFALSE)
A class to pass information from the TFileMerger to the objects being merged.
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
Int_t GetCompressionSettings() const
Int_t GetCompressionLevel() const
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.
void Close(Option_t *option="") override
Close a file.
virtual Long64_t GetSeekKey() const
virtual void SetParent(const TObject *parent)
Set parent in key buffer.
TBuffer * GetBufferRef() const
A TLeaf for an 8 bit Integer data type.
A TLeaf for a variable length string.
A TLeaf for a 24 bit truncated floating point data type.
A TLeaf for a 64 bit floating point data type.
A TLeaf for a 24 bit truncated floating point data type.
A TLeaf for a 32 bit floating point data type.
A TLeaf for a long integer data type (Long_t, non-portable size).
A TLeaf for an Integer data type.
A TLeaf for a 64 bit Integer data type.
A TLeaf for a bool data type.
A TLeaf for a 16 bit Integer data type.
A TLeaf describes individual elements of a TBranch See TBranch structure in TTree.
virtual Int_t GetLenType() const
virtual const char * GetTypeName() 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...
virtual DeserializeType GetDeserializeType() const
virtual void ReadBasketExport(TBuffer &, TClonesArray *, Int_t)
virtual void SetAddress(void *add=nullptr)
virtual Int_t GetNdata() const
virtual void FillBasket(TBuffer &b)
Pack leaf elements in Basket output buffer.
TBranch * GetBranch() const
virtual void SetOffset(Int_t offset=0)
virtual bool ReadBasketFast(TBuffer &, Long64_t)
virtual void SetBranch(TBranch *branch)
virtual void SetUnsigned()
virtual Int_t GetOffset() const
virtual void ReadBasket(TBuffer &)
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.
Int_t GetEntriesFast() const
TObject * At(Int_t idx) const override
TObject * UncheckedAt(Int_t i) const
Int_t GetLast() const override
Return index of last object in array.
friend class TClonesArray
Bool_t TestBit(UInt_t f) const
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
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.
static Int_t * ReAllocInt(Int_t *vp, size_t size, size_t oldsize)
Reallocate (i.e.
static void * ReAlloc(void *vp, size_t size, size_t oldsize)
Reallocate (i.e.
void ToLower()
Change string to lower-case.
void Clear()
Clear string without changing its capacity.
Ssiz_t First(char c) const
Find first occurrence of a character c.
const char * Data() const
TString & Prepend(const char *cs)
TString & Remove(Ssiz_t pos)
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Helper class to iterate over cluster of baskets.
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.
virtual TVirtualPerfStats * GetPerfStats() const
virtual TClusterIterator GetClusterIterator(Long64_t firstentry)
Return an iterator over the cluster of baskets starting at firstentry.
void Draw(Option_t *opt) override
Default Draw method for all objects.
@ kOnlyFlushAtCluster
If set, the branch's buffers will grow until an event cluster boundary is hit, guaranteeing a basket ...
This class represents a WWW compatible URL.
const char * GetAnchor() const
const char * GetUrl(Bool_t withDeflt=kFALSE) const
Return full URL.
void SetAnchor(const char *anchor)
static Int_t FillListOfBrowsables(TList &list, const TBranch *branch, const TVirtualBranchBrowsable *parent=nullptr)
Askes all registered generators to fill their browsables into the list.
virtual void SetUsed(TBranch *b, size_t basketNumber)=0
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Long64_t BinarySearch(Long64_t n, const T *array, T value)
Binary search in an array of n values to locate value.
@ kUndefined
Undefined compression algorithm (must be kept the last of the list in case a new algorithm is added).
@ kUseMin
Compression level reserved when we are not sure what to use (1 is for the fastest compression).