14 #include "Compression.h"
49 #if (__GNUC__ >= 3) || defined(__INTEL_COMPILER)
50 #if !defined(R__unlikely)
51 #define R__unlikely(expr) __builtin_expect(!!(expr), 0)
53 #if !defined(R__likely)
54 #define R__likely(expr) __builtin_expect(!!(expr), 1)
57 #define R__unlikely(expr) expr
58 #define R__likely(expr) expr
85 , fEntryOffsetLen(1000)
95 , fFirstBasketEntry(-1)
96 , fNextBasketEntry(-1)
104 , fBaskets(fMaxBaskets)
117 , fReadLeaves(&
TBranch::ReadLeavesImpl)
118 , fFillLeaves(&
TBranch::FillLeavesImpl)
185 , fCompress(compress)
186 , fBasketSize((basketsize < 100) ? 100 : basketsize)
197 , fFirstBasketEntry(-1)
198 , fNextBasketEntry(-1)
206 , fBaskets(fMaxBaskets)
213 , fAddress((char*) address)
214 , fDirectory(fTree->GetDirectory())
219 , fReadLeaves(&
TBranch::ReadLeavesImpl)
220 , fFillLeaves(&
TBranch::FillLeavesImpl)
222 Init(name,leaflist,compress);
234 , fCompress(compress)
235 , fBasketSize((basketsize < 100) ? 100 : basketsize)
246 , fFirstBasketEntry(-1)
247 , fNextBasketEntry(-1)
255 , fBaskets(fMaxBaskets)
259 , fTree(parent ? parent->GetTree() : 0)
260 , fMother(parent ? parent->GetMother() : 0)
262 , fAddress((char*) address)
263 , fDirectory(fTree ? fTree->GetDirectory() : 0)
268 , fReadLeaves(&
TBranch::ReadLeavesImpl)
269 , fFillLeaves(&
TBranch::FillLeavesImpl)
271 Init(name,leaflist,compress);
300 char* nameBegin =
const_cast<char*
>(leaflist);
303 char* leafname =
new char[640];
304 char* leaftype =
new char[320];
306 strlcpy(leaftype,
"F",320);
307 char* pos =
const_cast<char*
>(leaflist);
308 const char* leaflistEnd = leaflist + strlen(leaflist);
309 for (; pos <= leaflistEnd; ++pos) {
311 if ((*pos ==
':') || (*pos == 0)) {
313 Int_t lenName = pos - nameBegin;
316 strncpy(leafname, nameBegin, lenName);
317 leafname[lenName] = 0;
318 ctype = strstr(leafname,
"/");
321 strlcpy(leaftype, ctype + 1,320);
324 if (lenName == 0 || ctype == leafname) {
325 Warning(
"TBranch",
"No name was given to the leaf number '%d' in the leaflist of the branch '%s'.",fNleaves,name);
326 snprintf(leafname,640,
"__noname%d",fNleaves);
329 if (*leaftype ==
'C') {
330 leaf =
new TLeafC(
this, leafname, leaftype);
331 }
else if (*leaftype ==
'O') {
332 leaf =
new TLeafO(
this, leafname, leaftype);
333 }
else if (*leaftype ==
'B') {
334 leaf =
new TLeafB(
this, leafname, leaftype);
335 }
else if (*leaftype ==
'b') {
336 leaf =
new TLeafB(
this, leafname, leaftype);
338 }
else if (*leaftype ==
'S') {
339 leaf =
new TLeafS(
this, leafname, leaftype);
340 }
else if (*leaftype ==
's') {
341 leaf =
new TLeafS(
this, leafname, leaftype);
343 }
else if (*leaftype ==
'I') {
344 leaf =
new TLeafI(
this, leafname, leaftype);
345 }
else if (*leaftype ==
'i') {
346 leaf =
new TLeafI(
this, leafname, leaftype);
348 }
else if (*leaftype ==
'F') {
349 leaf =
new TLeafF(
this, leafname, leaftype);
350 }
else if (*leaftype ==
'f') {
351 leaf =
new TLeafF(
this, leafname, leaftype);
352 }
else if (*leaftype ==
'L') {
353 leaf =
new TLeafL(
this, leafname, leaftype);
354 }
else if (*leaftype ==
'l') {
355 leaf =
new TLeafL(
this, leafname, leaftype);
357 }
else if (*leaftype ==
'D') {
358 leaf =
new TLeafD(
this, leafname, leaftype);
359 }
else if (*leaftype ==
'd') {
360 leaf =
new TLeafD(
this, leafname, leaftype);
363 Error(
"TLeaf",
"Illegal data type for %s/%s", name, leaflist);
372 Error(
"TBranch",
"Illegal leaf: %s/%s", name, leaflist);
383 fEntryOffsetLen = 1000;
387 fEntryOffsetLen = 1000;
436 if (lst && lst->
GetLast()!=-1) {
489 if (fWriteBasket >= fMaxBaskets) {
498 Warning(
"AddBasket",
"The assumption that out-of-order basket only comes from disk based ntuple is false.");
504 for(
Int_t i=fWriteBasket-1; i>=0; --i) {
509 Error(
"AddBasket",
"An out-of-order basket matches the entry number of an existing basket.");
514 if (where < fWriteBasket) {
516 for (
Int_t j=fWriteBasket; j > where; --j) {
551 if (fWriteBasket >= fMaxBaskets) {
559 Fatal(
"AddBasket",
"The last basket must have the highest entry number (%s/%lld/%d).",
GetName(),startEntry,fWriteBasket);
611 for (
Int_t j = 0; j < nb; j++) {
629 if (options && options[0]) {
638 if ( (fNBaskets>1) || all ) {
640 for (
Int_t i=0;i<nbaskets;i++) {
642 if (!basket)
continue;
643 if ((i ==
fReadBasket || i == fWriteBasket) && !all)
continue;
662 for (
Int_t j = 0; j < nb; j++) {
664 if (!branch)
continue;
703 fMaxBaskets = newsize;
732 if (!basket)
return 0;
764 nbytes = lnew - lold;
767 if (fEntryOffsetLen) {
770 nsize = nevbuf *
sizeof(
Int_t);
786 return (nout >= 0) ? nbytes : -1;
797 Int_t objectStart = 0;
837 if (tag & kByteCountMask) {
840 if (tag == kNewClassTag) {
845 while (strlen(s) == (maxsize - 1)) {
864 if (startpos >
UInt_t(objectStart)) {
884 nbytes = lnew - lold;
899 if (longnm[longnm.length()-1]==
']') {
901 if (dim != std::string::npos) {
905 if (longnm[longnm.length()-1] !=
'.') {
909 UInt_t namelen = strlen(name);
913 for(
Int_t i = 0; i < nbranches; ++i) {
916 const char *brname = branch->
fName.
Data();
918 if (brname[brlen-1]==
']') {
919 const char *dim = strchr(brname,
'[');
921 brlen = dim - brname;
925 && strncmp(name,brname,brlen) == 0) {
928 if (brlen == (
size_t)longnm.length()
929 && strncmp(longnm.c_str(),brname,brlen) == 0) {
952 if (dim >= 0) leafname.
Remove(dim);
954 if (leafname == searchname)
return leaf;
958 dim = leaftitle.
First(
'[');
959 if (dim >= 0) leaftitle.
Remove(dim);
961 if (leaftitle == searchname)
return leaf;
966 dim = longname.
First(
'[');
967 if (dim>=0) longname.
Remove(dim);
968 if (longname == searchname)
return leaf;
971 longname.
Form(
"%s.%s",branch->
GetName(),searchname);
972 if (longname==leafname)
return leaf;
975 dim = longtitle.
First(
'[');
976 if (dim>=0) longtitle.
Remove(dim);
977 if (longtitle == searchname)
return leaf;
984 if (strstr(searchname,
".") && !strcmp(searchname, branch->
GetName()))
return leaf;
999 Int_t maxbasket = fWriteBasket + 1;
1005 for(
Int_t i=0; i != maxbasket; ++i) {
1016 for (
Int_t i = 0; i < len; ++i) {
1059 if ((
Int_t)ibasket==fWriteBasket) {
1087 static std::atomic<Int_t> nerrors(0);
1090 if (basketnumber <0 || basketnumber > fWriteBasket)
return 0;
1092 if (basket)
return basket;
1093 if (basketnumber == fWriteBasket)
return 0;
1118 if (nerrors > 10)
return 0;
1119 if (nerrors == 10) {
1120 printf(
" file probably overwritten: stopping reporting error messages\n");
1122 printf(
"===>File is more than 2 Gigabytes\n");
1126 printf(
"===>Your file is may be bigger than the maximum file size allowed on your system\n");
1127 printf(
" Check your AFS maximum file size limit for example\n");
1131 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);
1145 if (basketnumber <0 || basketnumber > fWriteBasket)
return 0;
1176 return "TBranchElement-folder";
1178 return "TBranchElement-leaf";
1221 if ((entry < first) || (entry > last)) {
1225 Error(
"In the branch %s, no basket contains the entry %d\n",
GetName(), entry);
1255 if (!file)
return -1;
1269 bufbegin = entryOffset[entry-first];
1282 return buf->
Length() - bufbegin;
1305 if ((entry < first) || (entry > last)) {
1309 Error(
"In the branch %s, no basket contains the entry %d\n",
GetName(), entry);
1340 bufbegin = entryOffset[entry-first];
1352 nbytes = buf->
Length() - bufbegin;
1371 Error(
"GetExpectedType",
"Did not find any leaves in %s",
GetName());
1403 if (mode) file =
TFile::Open(bFileName,
"recreate");
1406 if (!file)
return 0;
1407 if (file->
IsZombie()) {
delete file;
return 0;}
1419 if (
GetTree()->MemoryFull(0)) {
1441 }
else if (fNBaskets == 0) {
1491 bFileName = arc.
GetUrl();
1538 for (
Int_t i = 0; i <
n; ++i) {
1556 if (
this == child) {
1566 for (
Int_t i = 0; i < len; ++i) {
1571 if (branch == child) {
1595 if (fNBaskets == 1) {
1597 if (writebasket && writebasket->
GetNevBuf()==0) {
1610 return totbytes + b.
Length();
1620 if (!option)
return totbytes;
1621 if (option[0] !=
'*')
return totbytes;
1624 for (
Int_t i = 0; i < len; ++i) {
1638 if (!option)
return zipbytes;
1639 if (option[0] !=
'*')
return zipbytes;
1642 for (
Int_t i = 0; i < len; ++i) {
1666 return browsables && browsables->
GetSize();
1681 for (
Int_t i = 0; i < nb; ++i) {
1699 Int_t nimported = 0;
1702 if (!file)
return 0;
1704 for (
Int_t i=0;i<nbaskets;i++) {
1706 if (basket)
continue;
1713 Error(
"Loadbaskets",
"Error while reading basket buffer %d of branch %s",i,
GetName());
1728 const int kLINEND = 77;
1732 if ( titleContent ==
GetName() ) {
1733 titleContent.
Clear();
1737 if (titleContent.
Length()>=2 && titleContent[titleContent.
Length()-2]==
'/' && isalpha(titleContent[titleContent.
Length()-1])) {
1741 if (titleContent.
Length()) {
1751 aLength += (aLength / 54 + 1) * 80 + 100;
1752 if (aLength < 200) aLength = 200;
1753 char *bline =
new char[aLength];
1757 if (titleLength) snprintf(bline,aLength,
"*Br%5d :%-9s : %-54s *",
fgCount,
GetName(),titleContent.
Data());
1758 else snprintf(bline,aLength,
"*Br%5d :%-9s : %-54s *",
fgCount,
GetName(),
" ");
1759 if (strlen(bline) >
UInt_t(kLINEND)) {
1760 char *tmp =
new char[strlen(bline)+1];
1761 if (titleLength) strlcpy(tmp, titleContent.
Data(),strlen(bline)+1);
1763 int pos = strlen (bline);
1766 while (beg < titleLength) {
1767 for (end=beg+1; end < titleLength-1; end ++)
1768 if (tmp[end] ==
':')
break;
1769 if (npos + end-beg+1 >= 78) {
1770 while (npos < kLINEND) {
1771 bline[pos ++] =
' ';
1774 bline[pos ++] =
'*';
1775 bline[pos ++] =
'\n';
1776 bline[pos ++] =
'*';
1778 for (; npos < 12; npos ++)
1779 bline[pos ++] =
' ';
1782 for (
int n = beg; n <= end; n ++)
1783 bline[pos+n-beg] = tmp[n];
1788 while (npos < kLINEND) {
1789 bline[pos ++] =
' ';
1792 bline[pos ++] =
'*';
1803 if (fWriteBasket > 0) {
1804 Printf(
"*Entries :%9lld : Total Size=%11lld bytes All baskets in memory *",
fEntries,totBytes);
1806 Printf(
"*Entries :%9lld : Total Size=%11lld bytes One basket in memory *",
fEntries,totBytes);
1810 Printf(
"*Baskets :%9d : Basket Size=%11d bytes Compression= %6.2f *",fWriteBasket,fBasketSize,cx);
1811 Printf(
"*............................................................................*");
2007 reusebasket->
Reset();
2030 for (
Int_t i = 0; i < nbranches; ++i) {
2098 if (buffsize < minsize+fEntryOffsetLen) buffsize = minsize+
fEntryOffsetLen;
2099 fBasketSize = buffsize;
2114 if ( (fNleaves != 1)
2116 Error(
"TBranch::SetAddress",
"Filling from a TBuffer can only be done with a not split object branch. Request ignored.");
2131 if (algorithm < 0 || algorithm >= ROOT::kUndefinedCompressionAlgorithm) algorithm = 0;
2132 if (fCompress < 0) {
2133 fCompress = 100 * algorithm + 1;
2135 int level = fCompress % 100;
2136 fCompress = 100 * algorithm + level;
2140 for (
Int_t i=0;i<nb;i++) {
2151 if (level < 0) level = 0;
2152 if (level > 99) level = 99;
2153 if (fCompress < 0) {
2156 int algorithm = fCompress / 100;
2157 if (algorithm >= ROOT::kUndefinedCompressionAlgorithm) algorithm = 0;
2158 fCompress = 100 * algorithm + level;
2162 for (
Int_t i=0;i<nb;i++) {
2173 fCompress = settings;
2176 for (
Int_t i=0;i<nb;i++) {
2189 if (fEntryOffsetLen && newdefault) {
2190 fEntryOffsetLen = newdefault;
2192 if (updateExisting) {
2236 if (file && fCompress == -1) {
2243 while ((basket = (
TBasket*)nextb())) {
2307 Warning(
"SetObject",
"is not supported in TBranch objects");
2322 void TBranch::Streamer(
TBuffer& b)
2359 if (fWriteBasket >= fMaxBaskets) {
2370 if (fNleaves == 0) {
2372 }
else if (fNleaves == 1) {
2374 }
else if (fNleaves == 2) {
2386 TNamed::Streamer(b);
2387 if (v > 7) TAttFill::Streamer(b);
2425 for (j=fWriteBasket,n=0;j>=0 && n<
fNBaskets;--j) {
2433 if (fWriteBasket >= fMaxBaskets) {
2446 if (fNleaves == 0) {
2448 }
else if (fNleaves == 1) {
2450 }
else if (fNleaves == 2) {
2460 TNamed::Streamer(b);
2480 for (j=fWriteBasket,n=0;j>0 && n<nbaskets;--j) {
2522 if (fNleaves == 0) {
2524 }
else if (fNleaves == 1) {
2526 }
else if (fNleaves == 2) {
2534 fMaxBaskets = fWriteBasket+1;
2535 if (fMaxBaskets < 10) fMaxBaskets=10;
2537 if (fNBaskets == 1) {
2539 if (writebasket && writebasket->
GetNevBuf()==0) {
2549 fMaxBaskets = maxBaskets;
2560 if (fEntryOffsetLen > 10 && (4*nevbuf) < fEntryOffsetLen ) {
2562 fEntryOffsetLen = nevbuf < 3 ? 10 : 4*nevbuf;
2563 }
else if (fEntryOffsetLen && nevbuf > fEntryOffsetLen) {
2565 fEntryOffsetLen = 2*nevbuf;
2577 reusebasket = basket;
2578 reusebasket->
Reset();
2586 if (where==fWriteBasket) {
2588 if (fWriteBasket >= fMaxBaskets) {
2652 while ((basket = (
TBasket*)nextb())) {
virtual Bool_t GetMakeClass() const
Return whether this branch is in a mode where the object are decomposed or not (Also known as MakeCla...
virtual Int_t GetLen() const
Return the number of effective elements of this leaf.
void Init(const char *name, const char *leaflist, Int_t compress)
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
Int_t ReadBasketBytes(Long64_t pos, TFile *file)
Read basket buffers in memory and cleanup.
virtual const char * GetTitle() const
Returns title of object.
void SetBufferOffset(Int_t offset=0)
A TLeaf describes individual elements of a TBranch See TBranch structure in TTree.
virtual void AddTotBytes(Int_t tot)
A TLeaf for an 8 bit Integer data type.
virtual Bool_t IsAbsoluteFileName(const char *dir)
Return true if dir is an absolute pathname.
virtual void SetBufferAddress(TBuffer *entryBuffer)
Set address of this branch directly from a TBuffer to avoid streaming.
virtual void SetReadMode()
Set read mode of basket.
A TLeaf for a 64 bit floating point data type.
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
void Update(Int_t newlast)
Int_t * GetEntryOffset() const
virtual void UpdateFile()
Refresh the value of fDirectory (i.e.
The concrete implementation of TBuffer for writing/reading to/from a ROOT file or socket...
virtual void SetAddress(void *add)
Set address of this branch.
Int_t ReadBasketBuffers(Long64_t pos, Int_t len, TFile *file)
Read basket buffers in memory and cleanup.
virtual TLeaf * GetLeaf(const char *name) const
Return pointer to the 1st Leaf named name in thisBranch.
Option_t * GetDrawOption() const
Get option used by the graphics system to draw this object.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual void IncrementTotalBuffers(Int_t nbytes)
ClassImp(TSeqCollection) Int_t TSeqCollection TIter next(this)
Return index of object in collection.
TObjArray * GetListOfBaskets()
virtual ~TBranch()
Destructor.
virtual void AddZipBytes(Int_t zip)
Long64_t fEntries
Pointer to the current basket.
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...
virtual Int_t GetExpectedType(TClass *&clptr, EDataType &type)
Fill expectedClass and expectedType with information on the data type of the object/values contained ...
Int_t GetLast() const
Return index of last object in array.
A cache when reading files over the network.
virtual void Delete(Option_t *option="")
Remove all objects from the array AND delete all heap based objects.
This class represents a WWW compatible URL.
const UInt_t kByteCountMask
Int_t FillEntryBuffer(TBasket *basket, TBuffer *buf, Int_t &lnew)
Copy the data from fEntryBuffer into the current basket.
void SetCompressionAlgorithm(Int_t algorithm=0)
Set compression algorithm.
virtual void DropBaskets(Option_t *option="")
Loop on all branch baskets.
virtual void SetStatus(Bool_t status=1)
Set branch status to Process or DoNotProcess.
void ReadLeaves2Impl(TBuffer &b)
Read two leaves without the overhead of a loop.
virtual void SetFirstEntry(Long64_t entry)
set the first entry number (case of TBranchSTL)
virtual Int_t AddBranch(TBranch *, Bool_t=kFALSE)
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
void SetCompressionLevel(Int_t level=1)
Set compression level.
Long64_t GetTotBytes(Option_t *option="") const
Return total number of bytes in the branch (excluding current buffer) if option ="*" includes all sub...
virtual TLeaf * FindLeaf(const char *name)
Find the leaf corresponding to the name 'searchname'.
virtual void Print(Option_t *option="") const
Print TBranch parameters.
Buffer base class used for serializing objects.
TBasket * fCurrentBasket
Next entry that will requires us to go to the next basket.
virtual TBasket * CreateBasket(TBranch *)
Create a basket for this tree and given branch.
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
virtual Bool_t IsLearning() const
void ToLower()
Change string to lower-case.
virtual const char * DirName(const char *pathname)
Return the directory name in pathname.
A TLeaf for a bool data type.
R__EXTERN TVirtualMutex * gROOTMutex
TBranch * GetBranch() const
virtual Long64_t GetBasketSeek(Int_t basket) const
Return address of basket in the file.
const UInt_t kNewClassTag
Type GetType(const std::string &Name)
Int_t GetEntriesFast() const
TString & Prepend(const char *cs)
virtual void DeleteBaskets(Option_t *option="")
Loop on all branch baskets.
TFile * GetCurrentFile() const
Return pointer to the current file.
A TLeaf for a variable length string.
virtual Int_t GetRow(Int_t row)
Return all elements of one row unpacked in internal array fValues [Actually just returns 1 (...
virtual Long64_t GetSeekKey() const
TBasket * GetFreshBasket()
Return a fresh basket by either resusing an existing basket that needs to be drop (according to TTree...
TString GetRealFileName() const
Get real file name.
virtual void SetupAddresses()
If the branch address is not set, we set all addresses starting with the top level parent branch...
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Long64_t fFirstBasketEntry
Current entry number when reading.
void SetBranch(TBranch *branch)
virtual TList * GetBrowsables()
Returns (and, if 0, creates) browsable objects for this branch See TVirtualBranchBrowsable::FillListO...
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=1, Int_t netopt=0)
Create / open a file.
const char * Data() const
TFileCacheRead * GetCacheRead(TObject *tree=0) const
Return a pointer to the current read cache.
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
static Int_t FillListOfBrowsables(TList &list, const TBranch *branch, const TVirtualBranchBrowsable *parent=0)
Askes all registered generators to fill their browsables into the list.
virtual TObjArray * GetListOfBranches()
Fill Area Attributes class.
Int_t GetCompressionLevel() const
void SetLast(Int_t last)
Set index of last object in array, effectively truncating the array.
The TNamed class is the base class for all named ROOT classes.
virtual void Browse(TBrowser *b)
Browser interface.
UChar_t mod R__LOCKGUARD2(gSrvAuthenticateMutex)
void ReadLeavesImpl(TBuffer &b)
Pointer to the FillLeaves implementation to use.
virtual Bool_t SetMakeClass(Bool_t decomposeObj=kTRUE)
Set the branch in a mode where the object are decomposed (Also known as MakeClass mode)...
void Clear()
Clear string without changing its capacity.
virtual TBranch * FindBranch(const char *name)
Find the immediate sub-branch with passed name.
virtual void Reset()
Reset the basket to the starting state.
virtual Int_t WriteBuffer()
Write buffer of this basket on the current file.
const Int_t kDoNotProcess
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...
TObjArray * GetListOfBranches()
virtual void SetBranch(TBranch *branch)
TBasket * GetBasket(Int_t basket)
Return pointer to basket basketnumber in this Branch.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void SetAddress(void *add=0)
virtual void FillBasket(TBuffer &b)
Pack leaf elements in Basket output buffer.
Int_t fSplitLevel
Number of baskets in memory.
virtual void ResetAfterMerge(TFileMergeInfo *)
Reset a Branch.
virtual TFile * GetFile() const
virtual Int_t Fill()
Loop on all leaves of this branch to fill Basket buffer.
TBuffer * GetBufferRef() const
TObject * UncheckedAt(Int_t i) const
Int_t GetBufferSize() const
Using a TBrowser one can browse all ROOT objects.
virtual void AddLastBasket(Long64_t startEntry)
Add the start entry of the write basket (not yet created)
Int_t WriteBasket(TBasket *basket, Int_t where)
Write the current basket to disk and return the number of bytes written to the file.
virtual char * ReadString(char *s, Int_t max)=0
void FillLeavesImpl(TBuffer &b)
Loop on all leaves of this branch to fill Basket buffer.
virtual const char * GetTypeName() const
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 AddAtAndExpand(TObject *obj, Int_t idx)
Add object at position idx.
void SetCompressionSettings(Int_t settings=1)
Set compression settings.
R__EXTERN TSystem * gSystem
virtual void SetEntries(Long64_t entries)
Set the number of entries in this branch.
TList * fBrowsables
Buffer used to directly pass the content without streaming.
virtual void AdjustSize(Int_t newsize)
Increase the size of the current fBuffer up to newsize.
virtual TObject * RemoveAt(Int_t idx)
Remove object at index idx.
TDirectory * GetDirectory() const
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Long64_t GetTotalSize(Option_t *option="") const
Return total number of bytes in the branch (including current buffer)
TBranch * GetMother() const
Get our top-level parent branch in the tree.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Bool_t TestBit(UInt_t f) const
virtual void MakeFree(Long64_t first, Long64_t last)
Mark unused bytes on the file.
Long64_t fNextBasketEntry
First entry in the current basket.
Manages buffers for branches of a Tree.
void SetReadMode()
Set buffer in read mode.
virtual Int_t GetEntry(Long64_t entry=0, Int_t getall=0)
Read all leaves of entry and return total number of bytes read.
virtual const char * GetName() const
Returns name of object.
The ROOT global object gROOT contains a list of all defined classes.
A TLeaf for a 32 bit floating point data type.
const char * GetAnchor() const
TBranch * GetSubBranch(const TBranch *br) const
Find the parent branch of child.
virtual void ReadFastArray(Bool_t *b, Int_t n)=0
virtual void AddAt(TObject *obj, Int_t idx)
Add object at position ids.
virtual void KeepCircular(Long64_t maxEntries)
keep a maximum of fMaxEntries in memory
virtual TLeaf * GetLeafCount() const
Int_t * GetDisplacement() const
Int_t GetCompressionSettings() const
virtual void SetParent(const TObject *parent)
Set parent in key buffer.
virtual void SetOffset(Int_t offset=0)
const char * GetUrl(Bool_t withDeflt=kFALSE) const
Return full URL.
virtual void SetBasketSize(Int_t buffsize)
Set the basket size The function makes sure that the basket size is greater than fEntryOffsetlen.
TString & Remove(Ssiz_t pos)
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
void SetAnchor(const char *anchor)
virtual Int_t GetSize() const
Bool_t fSkipZip
List of TVirtualBranchBrowsables used for Browse()
Int_t fReadBasket
Number of leaves.
virtual void ResetAddress()
Reset the address of the branch.
virtual Int_t GetLenType() const
Describe directory structure in memory.
ClassImp(TMCParticle) void TMCParticle printf(": p=(%7.3f,%7.3f,%9.3f) ;", fPx, fPy, fPz)
virtual void Draw(Option_t *opt)
Default Draw method for all objects.
Bool_t IsAutoDelete() const
Return kTRUE if an existing object in a TBranchObject must be deleted.
virtual void Expand(Int_t newSize)
Expand or shrink the array to newSize elements.
void Browse(TBrowser *b)
Browse this collection (called by TBrowser).
TObjArray * GetListOfLeaves()
Int_t GetEntries() const
Return the number of objects in array (i.e.
TDirectory * fDirectory
Address of 1st leaf (variable or object)
virtual void ReadBasket(TBuffer &)
virtual void SetUnsigned()
virtual Int_t GetOffset() const
virtual void ReadBasketExport(TBuffer &, TClonesArray *, Int_t)
static void * ReAlloc(void *vp, size_t size)
Reallocate (i.e.
virtual void SetEntryOffsetLen(Int_t len, Bool_t updateSubBranches=kFALSE)
Update the default value for the branch's fEntryOffsetLen if and only if it was already non zero (and...
virtual void SetFile(TFile *file=0)
Set file where this branch writes/reads its buffers.
A TLeaf for a 16 bit Integer data type.
virtual void Refresh(TBranch *b)
Refresh this branch using new information in b This function is called by TTree::Refresh.
An array of clone (identical) objects.
void ReadLeaves0Impl(TBuffer &b)
Read zero leaves without the overhead of a loop.
virtual Int_t DropBuffers()
Drop buffers of this basket if it is not the current basket.
virtual void SetSkipZip(Bool_t=kTRUE)
virtual void PrepareBasket(Long64_t)
virtual void RemoveAll(TCollection *col)
Remove all objects in collection col from this collection.
Short_t Max(Short_t a, Short_t b)
virtual void Reset(Option_t *option="")
Reset a Branch.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
virtual Bool_t IsWritable() const
Int_t GetNevBufSize() const
Long64_t fReadEntry
Current basket number when reading.
virtual void AddBasket(TBasket &b, Bool_t ondisk, Long64_t startEntry)
Add the basket to this branch.
TBranch * fMother
Pointer to Tree header.
virtual Int_t LoadBaskets()
Baskets associated to this branch are forced to be in memory.
virtual void WriteBuf(const void *buf, Int_t max)=0
A TLeaf for a 64 bit Integer data type.
virtual Int_t GetMapCount() const =0
const char * GetIconName() const
Return icon name depending on type of branch.
A TTree object has a header with a name and a title.
virtual void ResetMap()=0
#define R__unlikely(expr)
Bool_t IsFolder() const
Return kTRUE if more than one leaf or browsables, kFALSE otherwise.
virtual void ReadBasket(TBuffer &b)
Loop on all leaves of this branch to read Basket buffer.
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
Int_t FlushBaskets()
Flush to disk all the baskets of this branch and any of subbranches.
void SetNevBufSize(Int_t n)
TObject * At(Int_t idx) 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 SetBufferDisplacement()=0
A TTree is a list of TBranches.
virtual const char * GetClassName() const
Return the name of the user class whose content is stored in this branch, if any. ...
Int_t fCompress
branch counter
TString fFileName
Pointer to directory where this branch buffers are stored.
virtual Int_t GetBufferDisplacement() const =0
TBranch * fParent
Pointer to top-level parent branch in the tree.
Long64_t BinarySearch(Long64_t n, const T *array, T value)
virtual void SetWriteMode()
Set write mode of basket.
void ExpandBasketArrays()
Increase BasketEntry buffer of a minimum of 10 locations and a maximum of 50 per cent of current size...
Ssiz_t First(char c) const
Find first occurrence of a character c.
A TLeaf for an Integer data type.
virtual void SetObject(void *objadd)
Set object this branch is pointing to.
ClassImp(TBranch) TBranch
Default constructor. Used for I/O by default.
static Int_t * ReAllocInt(Int_t *vp, size_t size, size_t oldsize)
Reallocate (i.e.
void SetWriteMode()
Set buffer in write mode.
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
virtual Int_t ReadArray(Bool_t *&b)=0
virtual TObjArray * GetListOfLeaves()
void ReadLeaves1Impl(TBuffer &b)
Read one leaf without the overhead of a loop.
virtual void Close(Option_t *option="")
Close a file.
static void ResetCount()
Static function resetting fgCount.
virtual void MoveEntries(Int_t dentries)
Remove the first dentries of this basket, moving entries at dentries to the start of the buffer...
virtual void SetAutoDelete(Bool_t autodel=kTRUE)
Set the automatic delete bit.
char * fAddress
Pointer to parent branch.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.