58 if (fObject->fBasketEntry[i1] == fObject->fBasketEntry[i2]) {
61 return fObject->fBasketEntry[i1] < fObject->fBasketEntry[i2];
105 TTreeCloner(from, to, to ? to->GetDirectory() : nullptr, method, options)
120 TTreeCloner(from, from, newdirectory, method, options)
130 fNeedConversion(false),
134 fToDirectory(newdirectory),
135 fToFile(fToDirectory ? fToDirectory->GetFile() : nullptr),
137 fFromBranches( from ? from->GetListOfLeaves()->GetEntriesFast()+1 : 0),
138 fToBranches( to ? to->GetListOfLeaves()->GetEntriesFast()+1 : 0),
139 fMaxBaskets(CollectBranches()),
140 fBasketBranchNum(new
UInt_t[fMaxBaskets]),
141 fBasketNum(new
UInt_t[fMaxBaskets]),
142 fBasketSeek(new
Long64_t[fMaxBaskets]),
143 fBasketEntry(new
Long64_t[fMaxBaskets]),
144 fBasketIndex(new
UInt_t[fMaxBaskets]),
154 if (opt.
Contains(
"sortbasketsbybranch")) {
157 }
else if (opt.
Contains(
"sortbasketsbyentry")) {
179 from ? from->
GetName() :
"no tree");
185 fWarningMsg.
Form(
"The output TTree (%s) must be associated with a directory.",
191 }
else if (
fToFile ==
nullptr) {
192 fWarningMsg.
Form(
"The output TTree (%s) must be associated with a directory (%s) that is in a file.",
200 fWarningMsg.
Form(
"The output TTree (%s) must be associated with a writable file (%s).",
203 fWarningMsg.
Form(
"The output TTree (%s) must be associated with a writable directory (%s in %s).",
291 if (nb != fnb && (nb == 0 || fnb == 0)) {
294 fWarningMsg.
Form(
"The export branch and the import branch do not have the same split level. (The branch name is %s.)",
304 fWarningMsg.
Form(
"The export branch and the import branch do not have the same streamer type. (The branch name is %s.)",
320 fWarningMsg.
Form(
"The export branch and the import branch (%s) do not have the same number of leaves (%d vs %d)",
328 for (
Int_t i=0;i<nb;i++) {
332 if (toleaf->
IsA() != fromleaf->
IsA() ) {
334 fWarningMsg.
Form(
"The export leaf and the import leaf (%s.%s) do not have the same data type (%s vs %s)",
405 fWarningMsg.
Form(
"One of the export top level branches (%s) is not present in the import TTree.",
413 fWarningMsg.
Form(
"One of the export sub-branches (%s) is not present in the import TTree.",
555 while ((key = (
TKey*)next())) {
565 for (
Int_t i=0;i<npids;i++) {
566 if (pids->
At(i) == pid) {out = (
UShort_t)i; wasIn =
true;
break;}
582 if (dirsav) dirsav->
cd();
586 Error(
"CopyProcessIDs",
"Copied %s from %s might already exist!\n",
606 if (prev)
f->SetCacheRead(
nullptr,
fFromTree);
773 if (frombasket && frombasket->
GetNevBuf()>0) {
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
Manages buffers for branches of a Tree.
Long64_t CopyTo(TFile *to)
Copy the basket of this branch onto the file to.
void SetBranch(TBranch *branch)
Int_t ReadBasketBytes(Long64_t pos, TFile *file)
Read basket buffers in memory and cleanup.
Int_t LoadBasketBuffers(Long64_t pos, Int_t len, TFile *file, TTree *tree=nullptr)
Load basket buffers in memory without unziping.
A Branch for the case of an array of clone objects.
TBranch * fBranchCount
Branch with clones count.
A Branch for the case of an object.
Int_t fMaximum
Maximum entries for a TClonesArray or variable array.
A TTree is a list of TBranches.
virtual Long64_t GetBasketSeek(Int_t basket) const
Return address of basket in the file.
Int_t GetWriteBasket() const
@ kDoNotUseBufferMap
If set, at least one of the entry in the branch will use the buffer's map of classname and objects.
TObjArray * GetListOfBranches()
virtual void AddBasket(TBasket &b, bool ondisk, Long64_t startEntry)
Add the basket to this branch.
virtual void AddLastBasket(Long64_t startEntry)
Add the start entry of the write basket (not yet created)
TBasket * GetBasket(Int_t basket)
TObjArray * GetListOfBaskets()
Long64_t GetEntries() const
Int_t * GetBasketBytes() 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...
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...
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.
TBranch * GetMother() const
Get our top-level parent branch in the tree.
Long64_t * GetBasketEntry() const
TClass instances represent classes, structs and namespaces in the ROOT type system.
ROOT::NewFunc_t GetNew() const
Return the wrapper around new ThisClass().
Bool_t IsLoaded() const
Return true if the shared library of this class is currently in the a process's memory.
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,...
TVirtualStreamerInfo * FindStreamerInfo(TObjArray *arr, UInt_t checksum) const
Find the TVirtualStreamerInfo in the StreamerInfos corresponding to checksum.
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.
Bool_t cd() override
Change current directory to "this" directory.
TList * GetListOfKeys() const override
TDirectory::TContext keeps track and restore the current directory.
Describe directory structure in memory.
virtual TFile * GetFile() const
virtual Bool_t cd()
Change current directory to "this" directory.
virtual Bool_t IsWritable() const
A cache when reading files over the network.
virtual void Prefetch(Long64_t pos, Int_t len)
Add block of length len at position pos in the list of blocks to be prefetched.
virtual Int_t GetBufferSize() const
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
virtual void SetCacheRead(TFileCacheRead *cache, TObject *tree=nullptr, ECacheAction action=kDisconnect)
Set a pointer to the read cache.
virtual Int_t GetNProcessIDs() const
virtual void IncrementProcessIDs()
TObjArray * GetListOfProcessIDs() const
virtual TList * GetStreamerInfoList() final
Read the list of TStreamerInfo objects written to this file.
Book space in a file, create I/O buffers, to fill them, (un)compress them.
virtual Long64_t GetSeekKey() const
virtual void IncrementPidOffset(UShort_t offset)
Increment fPidOffset by 'offset'.
virtual const char * GetClassName() const
virtual void * ReadObjectAny(const TClass *expectedClass)
To read an object (non deriving from TObject) from the file.
A TLeaf describes individual elements of a TBranch See TBranch structure in TTree.
virtual const char * GetTypeName() const
TClass * IsA() const override
virtual bool IncludeRange(TLeaf *)
TObject * Clone(const char *newname="") const override
Make a clone of an object using the Streamer facility.
const char * GetName() const override
Returns name of object.
Int_t GetEntriesFast() const
virtual void AddAtAndExpand(TObject *obj, Int_t idx)
Add object at position idx.
TObject * At(Int_t idx) const override
void AddLast(TObject *obj) override
Add object in the next empty slot in the array.
TObject * UncheckedAt(Int_t i) const
Bool_t IsEmpty() const override
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
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".
A TProcessID identifies a ROOT job in a unique way in time and space.
Int_t IncrementCount()
Increase the reference count to this object.
Describes a persistent version of a class.
Int_t GetClassVersion() const override
TClass * IsA() const override
UInt_t GetCheckSum() const override
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.
const char * Data() const
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
bool operator()(UInt_t i1, UInt_t i2)
bool operator()(UInt_t i1, UInt_t i2)
Class implementing or helping the various TTree cloning method.
UInt_t * fBasketBranchNum
[fMaxBaskets] Index of the branch(es) of the basket.
void ImportClusterRanges()
Set the entries and import the cluster range of the.
UInt_t CollectBranches()
Fill the array of branches, matching the branches of the 'from' and 'to' TTrees Returns the total num...
void CollectBaskets()
Collect the information about the on-file basket that need to be copied.
UInt_t * fBasketIndex
[fMaxBaskets] ordered list of basket indices to be written.
UInt_t FillCache(UInt_t from)
Fill the file cache with the next set of basket.
void CopyStreamerInfos()
Make sure that all the needed TStreamerInfo are present in the output file.
void WriteBaskets()
Transfer the basket from the input file to the output file.
Long64_t fCacheSize
Requested size of the file cache.
bool Exec()
Execute the cloning.
Long64_t * fBasketSeek
[fMaxBaskets] list of basket position to be read.
void CopyMemoryBaskets()
Transfer the basket from the input file to the output file.
bool fNeedConversion
True if the fast merge is not possible but a slow merge might possible.
UShort_t fPidOffset
Offset to be added to the copied key/basket.
Long64_t * fBasketEntry
[fMaxBaskets] list of basket start entries.
void CreateCache()
Create a TFileCacheRead if it was requested.
TFileCacheRead * fFileCache
File Cache used to reduce the number of individual reads.
void CopyProcessIds()
Make sure that all the needed TStreamerInfo are present in the output file.
TTreeCloner(const TTreeCloner &)=delete
TFileCacheRead * fPrevCache
Cache that set before the TTreeCloner ctor for the 'from' TTree if any.
UInt_t fCloneMethod
Indicates which cloning method was selected.
void RestoreCache()
Restore the TFileCacheRead to its previous value.
TString fWarningMsg
Text of the error message lead to an 'invalid' state.
void CloseOutWriteBaskets()
Before we can start adding new basket, we need to flush to disk the partially filled baskets (the Wri...
Long64_t fToStartEntries
Number of entries in the target tree before any addition.
virtual ~TTreeCloner()
TTreeCloner destructor.
UInt_t * fBasketNum
[fMaxBaskets] index of the basket within the branch.
void SetCacheSize(Long64_t size)
Set the cache size used by the matching TFile.
TDirectory * fToDirectory
void SortBaskets()
Sort the basket according to the user request.
A TTree represents a columnar dataset.
virtual Long64_t SetEntries(Long64_t n=-1)
Change number of entries in the tree.
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.
TDirectory * GetDirectory() const
TTreeCache * GetReadCache(TFile *file) const
Find and return the TTreeCache registered with the file and which may contain branches for us.
Long64_t fFlushedBytes
Number of auto-flushed bytes.
virtual void SetDirectory(TDirectory *dir)
Change the tree's directory.
virtual TBranchRef * GetBranchRef() const
virtual Long64_t GetEntries() const
virtual TObjArray * GetListOfBranches()
virtual TTree * GetTree() const
void ImportClusterRanges(TTree *fromtree)
Appends the cluster range information stored in 'fromtree' to this tree, including the value of fAuto...