ROOT   master Reference Guide
TTreeCloner Class Reference

Class implementing or helping the various TTree cloning method.

Definition at line 29 of file TTreeCloner.h.

## Classes

class  CompareEntry

class  CompareSeek

## Public Types

enum  EClonerOptions { kNone = 0, kNoWarnings = BIT(1), kIgnoreMissingTopLevel = BIT(2), kNoFileCache = BIT(3) }

## Public Member Functions

TTreeCloner (TTree *from, TTree *to, Option_t *method, UInt_t options=kNone)
Constructor. More...

virtual ~TTreeCloner ()
TTreeCloner destructor. More...

Collect the information about the on-file basket that need to be copied. More...

UInt_t CollectBranches (TBranch *from, TBranch *to)
Fill the array of branches, adding the branch 'from' and 'to', and matching the sub-branches of the 'from' and 'to' branches. More...

UInt_t CollectBranches (TObjArray *from, TObjArray *to)
Fill the array of branches, matching the branches of the 'from' and 'to' arrays. More...

UInt_t CollectBranches ()
Fill the array of branches, matching the branches of the 'from' and 'to' TTrees Returns the total number of baskets in all the branches. More...

Transfer the basket from the input file to the output file. More...

void CopyProcessIds ()
Make sure that all the needed TStreamerInfo are present in the output file. More...

void CopyStreamerInfos ()
Make sure that all the needed TStreamerInfo are present in the output file. More...

Bool_t Exec ()
Execute the cloning. More...

const char * GetWarning () const

Bool_t IsValid ()

Bool_t NeedConversion ()

void SetCacheSize (Int_t size)
Set the TFile cache size to be used. More...

Sort the basket according to the user request. More...

Transfer the basket from the input file to the output file. More...

## Private Member Functions

TTreeCloner (const TTreeCloner &)=delete

void CreateCache ()
Create a TFileCacheRead if it was requested. More...

UInt_t FillCache (UInt_t from)
Fill the file cache with the next set of basket. More...

void ImportClusterRanges ()
Set the entries and import the cluster range of the. More...

TTreeCloneroperator= (const TTreeCloner &)=delete

void RestoreCache ()
Restore the TFileCacheRead to its previous value. More...

## Private Attributes

Int_t fCacheSize
Requested size of the file cache. More...

UInt_t fCloneMethod
Indicates which cloning method was selected. More...

File Cache used to reduce the number of individual reads. More...

TObjArray fFromBranches

TTreefFromTree

Bool_t fIsValid

Option_tfMethod

Bool_t fNeedConversion
True if the fast merge is not possible but a slow merge might possible. More...

UInt_t fOptions

UShort_t fPidOffset

Cache that set before the TTreeCloner ctor for the 'from' TTree if any. More...

TObjArray fToBranches

Long64_t fToStartEntries
Number of entries in the target tree before any addition. More...

TTreefToTree

TString fWarningMsg
Text of the error message lead to an 'invalid' state. More...

## Friends

class CompareEntry

class CompareSeek

#include <TTreeCloner.h>

## ◆ ECloneMethod

 private
Enumerator
kDefault

Definition at line 58 of file TTreeCloner.h.

## ◆ EClonerOptions

Enumerator
kNone
kNoWarnings
kIgnoreMissingTopLevel
kNoFileCache

Definition at line 92 of file TTreeCloner.h.

## ◆ TTreeCloner() [1/2]

 TTreeCloner::TTreeCloner ( const TTreeCloner & )
privatedelete

## ◆ TTreeCloner() [2/2]

 TTreeCloner::TTreeCloner ( TTree * from, TTree * to, Option_t * method, UInt_t options = kNone )

Constructor.

This object would transfer the data from 'from' to 'to' using the method indicated in method.

The value of the parameter 'method' determines in which order the branches' baskets are written to the output file.

When a TTree is filled the data is stored in the individual branches' basket. Each basket is written individually to the disk as soon as it is full. In consequence the baskets of branches that contain 'large' data chunk are written to the disk more often.

There is currently 3 supported sorting order:

SortBasketsByOffset (the default)


When using SortBasketsByOffset the baskets are written in the output file in the same order as in the original file (i.e. the basket are sorted on their offset in the original file; Usually this also means that the baskets are sorted on the index/number of the last entry they contain)

When using SortBasketsByBranch all the baskets of each individual branches are stored contiguously. This tends to optimize reading speed when reading a small number (1->5) of branches, since all their baskets will be clustered together instead of being spread across the file. However it might decrease the performance when reading more branches (or the full entry).

When using SortBasketsByEntry the baskets with the lowest starting entry are written first. (i.e. the baskets are sorted on the index/number of the first entry they contain). This means that on the file the baskets will be in the order in which they will be needed when reading the whole tree sequentially.

Definition at line 103 of file TTreeCloner.cxx.

## ◆ ~TTreeCloner()

 TTreeCloner::~TTreeCloner ( )
virtual

TTreeCloner destructor.

Definition at line 216 of file TTreeCloner.cxx.

## Member Function Documentation

Definition at line 232 of file TTreeCloner.cxx.

Collect the information about the on-file basket that need to be copied.

Definition at line 418 of file TTreeCloner.cxx.

## ◆ CollectBranches() [1/3]

 UInt_t TTreeCloner::CollectBranches ( TBranch * from, TBranch * to )

Fill the array of branches, adding the branch 'from' and 'to', and matching the sub-branches of the 'from' and 'to' branches.

Returns the total number of baskets in all the from branch and it sub-branches.

Definition at line 246 of file TTreeCloner.cxx.

## ◆ CollectBranches() [2/3]

 UInt_t TTreeCloner::CollectBranches ( TObjArray * from, TObjArray * to )

Fill the array of branches, matching the branches of the 'from' and 'to' arrays.

Returns the total number of baskets in all the branches.

Definition at line 332 of file TTreeCloner.cxx.

## ◆ CollectBranches() [3/3]

 UInt_t TTreeCloner::CollectBranches ( )

Fill the array of branches, matching the branches of the 'from' and 'to' TTrees Returns the total number of baskets in all the branches.

Definition at line 397 of file TTreeCloner.cxx.

Transfer the basket from the input file to the output file.

Definition at line 480 of file TTreeCloner.cxx.

## ◆ CopyProcessIds()

 void TTreeCloner::CopyProcessIds ( )

Make sure that all the needed TStreamerInfo are present in the output file.

Definition at line 507 of file TTreeCloner.cxx.

## ◆ CopyStreamerInfos()

 void TTreeCloner::CopyStreamerInfos ( )

Make sure that all the needed TStreamerInfo are present in the output file.

Definition at line 439 of file TTreeCloner.cxx.

## ◆ CreateCache()

 void TTreeCloner::CreateCache ( )
private

Create a TFileCacheRead if it was requested.

Definition at line 560 of file TTreeCloner.cxx.

## ◆ Exec()

 Bool_t TTreeCloner::Exec ( )

Execute the cloning.

Definition at line 194 of file TTreeCloner.cxx.

## ◆ FillCache()

 UInt_t TTreeCloner::FillCache ( UInt_t from )
private

Fill the file cache with the next set of basket.

Parameters
 from index of the first lement of fFromBranches to start caching
Returns
The index of first element of fFromBranches that is not in the cache

Definition at line 659 of file TTreeCloner.cxx.

## ◆ GetWarning()

 const char* TTreeCloner::GetWarning ( ) const
inline

Definition at line 110 of file TTreeCloner.h.

## ◆ ImportClusterRanges()

 void TTreeCloner::ImportClusterRanges ( )
private

Set the entries and import the cluster range of the.

Definition at line 590 of file TTreeCloner.cxx.

## ◆ IsValid()

 Bool_t TTreeCloner::IsValid ( )
inline

Definition at line 112 of file TTreeCloner.h.

## ◆ NeedConversion()

 Bool_t TTreeCloner::NeedConversion ( )
inline

Definition at line 113 of file TTreeCloner.h.

## ◆ operator=()

 TTreeCloner& TTreeCloner::operator= ( const TTreeCloner & )
privatedelete

## ◆ RestoreCache()

 void TTreeCloner::RestoreCache ( )
private

Restore the TFileCacheRead to its previous value.

Definition at line 579 of file TTreeCloner.cxx.

## ◆ SetCacheSize()

 void TTreeCloner::SetCacheSize ( Int_t size )

Set the TFile cache size to be used.

Note that the default is to use the same size as the default TTreeCache for the input tree.

Parameters
 size Size of the cache. Zero disable the use of the cache.

Definition at line 613 of file TTreeCloner.cxx.

Sort the basket according to the user request.

Definition at line 631 of file TTreeCloner.cxx.

Transfer the basket from the input file to the output file.

Definition at line 686 of file TTreeCloner.cxx.

## ◆ CompareEntry

 friend class CompareEntry
friend

Definition at line 80 of file TTreeCloner.h.

## ◆ CompareSeek

 friend class CompareSeek
friend

Definition at line 79 of file TTreeCloner.h.

## Member Data Documentation

private

Definition at line 42 of file TTreeCloner.h.

private

Definition at line 46 of file TTreeCloner.h.

private

Definition at line 47 of file TTreeCloner.h.

private

Definition at line 43 of file TTreeCloner.h.

private

Definition at line 45 of file TTreeCloner.h.

## ◆ fCacheSize

 Int_t TTreeCloner::fCacheSize
private

Requested size of the file cache.

Definition at line 54 of file TTreeCloner.h.

## ◆ fCloneMethod

 UInt_t TTreeCloner::fCloneMethod
private

Indicates which cloning method was selected.

Definition at line 51 of file TTreeCloner.h.

## ◆ fFileCache

private

File Cache used to reduce the number of individual reads.

Definition at line 55 of file TTreeCloner.h.

## ◆ fFromBranches

 TObjArray TTreeCloner::fFromBranches
private

Definition at line 38 of file TTreeCloner.h.

## ◆ fFromTree

 TTree* TTreeCloner::fFromTree
private

Definition at line 35 of file TTreeCloner.h.

## ◆ fIsValid

 Bool_t TTreeCloner::fIsValid
private

Definition at line 32 of file TTreeCloner.h.

private

Definition at line 41 of file TTreeCloner.h.

## ◆ fMethod

 Option_t* TTreeCloner::fMethod
private

Definition at line 37 of file TTreeCloner.h.

## ◆ fNeedConversion

 Bool_t TTreeCloner::fNeedConversion
private

True if the fast merge is not possible but a slow merge might possible.

Definition at line 33 of file TTreeCloner.h.

## ◆ fOptions

 UInt_t TTreeCloner::fOptions
private

Definition at line 34 of file TTreeCloner.h.

## ◆ fPidOffset

 UShort_t TTreeCloner::fPidOffset
private

Definition at line 49 of file TTreeCloner.h.

## ◆ fPrevCache

private

Cache that set before the TTreeCloner ctor for the 'from' TTree if any.

Definition at line 56 of file TTreeCloner.h.

## ◆ fToBranches

 TObjArray TTreeCloner::fToBranches
private

Definition at line 39 of file TTreeCloner.h.

## ◆ fToStartEntries

 Long64_t TTreeCloner::fToStartEntries
private

Number of entries in the target tree before any addition.

Definition at line 52 of file TTreeCloner.h.

## ◆ fToTree

 TTree* TTreeCloner::fToTree
private

Definition at line 36 of file TTreeCloner.h.

## ◆ fWarningMsg

 TString TTreeCloner::fWarningMsg
private

Text of the error message lead to an 'invalid' state.

Definition at line 30 of file TTreeCloner.h.

Libraries for TTreeCloner:
[legend]

The documentation for this class was generated from the following files: