ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
TTreeCloner Class Reference

Class implementing or helping the various TTree cloning method.

Definition at line 39 of file TTreeCloner.h.

Classes

class  CompareEntry
 
class  CompareSeek
 

Public Types

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

Public Member Functions

 TTreeCloner (TTree *from, TTree *to, Option_t *method, UInt_t options=kNone)
 Constructor. More...
 
virtual ~TTreeCloner ()
 TTreeCloner destructor. More...
 
void CloseOutWriteBaskets ()
 Before we can start adding new basket, we need to flush to disk the partially filled baskets (the WriteBasket) 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...
 
void CollectBaskets ()
 Collect the information about the on-file basket that need to be copied. More...
 
void CopyMemoryBaskets ()
 Transfer the basket from the input file to the output file. More...
 
void CopyStreamerInfos ()
 Make sure that all the needed TStreamerInfo are present in the output file. More...
 
void CopyProcessIds ()
 Make sure that all the needed TStreamerInfo are present in the output file. More...
 
const char * GetWarning () const
 
Bool_t Exec ()
 Execute the cloning. More...
 
Bool_t IsValid ()
 
Bool_t NeedConversion ()
 
void SortBaskets ()
 Sort the basket according to the user request. More...
 
void WriteBaskets ()
 Transfer the basket from the input file to the output file. More...
 
 ClassDef (TTreeCloner, 0)
 

Private Types

enum  ECloneMethod { kDefault = 0, kSortBasketsByBranch = 1, kSortBasketsByOffset = 2, kSortBasketsByEntry = 3 }
 

Private Member Functions

void ImportClusterRanges ()
 Set the entries and import the cluster range of the. More...
 
 TTreeCloner (const TTreeCloner &)
 
TTreeCloneroperator= (const TTreeCloner &)
 

Private Attributes

TString fWarningMsg
 
Bool_t fIsValid
 
Bool_t fNeedConversion
 
UInt_t fOptions
 
TTreefFromTree
 
TTreefToTree
 
Option_tfMethod
 
TObjArray fFromBranches
 
TObjArray fToBranches
 
UInt_t fMaxBaskets
 
UInt_tfBasketBranchNum
 
UInt_tfBasketNum
 
Long64_tfBasketSeek
 
Long64_tfBasketEntry
 
UInt_tfBasketIndex
 
UShort_t fPidOffset
 
UInt_t fCloneMethod
 
Long64_t fToStartEntries
 

Friends

class CompareSeek
 
class CompareEntry
 

#include <TTreeCloner.h>

Member Enumeration Documentation

Enumerator
kDefault 
kSortBasketsByBranch 
kSortBasketsByOffset 
kSortBasketsByEntry 

Definition at line 64 of file TTreeCloner.h.

Enumerator
kNone 
kNoWarnings 
kIgnoreMissingTopLevel 

Definition at line 95 of file TTreeCloner.h.

Constructor & Destructor Documentation

TTreeCloner::TTreeCloner ( const TTreeCloner )
private
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)
SortBasketsByBranch
SortBasketsByEntry

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 100 of file TTreeCloner.cxx.

TTreeCloner::~TTreeCloner ( )
virtual

TTreeCloner destructor.

Definition at line 193 of file TTreeCloner.cxx.

Member Function Documentation

TTreeCloner::ClassDef ( TTreeCloner  ,
 
)
void TTreeCloner::CloseOutWriteBaskets ( )

Before we can start adding new basket, we need to flush to disk the partially filled baskets (the WriteBasket)

Definition at line 206 of file TTreeCloner.cxx.

Referenced by Exec().

void TTreeCloner::CollectBaskets ( )

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

Definition at line 436 of file TTreeCloner.cxx.

Referenced by Exec().

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 220 of file TTreeCloner.cxx.

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 350 of file TTreeCloner.cxx.

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 415 of file TTreeCloner.cxx.

Referenced by CollectBranches().

void TTreeCloner::CopyMemoryBaskets ( )

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

Definition at line 499 of file TTreeCloner.cxx.

Referenced by Exec().

void TTreeCloner::CopyProcessIds ( )

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

Definition at line 526 of file TTreeCloner.cxx.

Referenced by Exec().

void TTreeCloner::CopyStreamerInfos ( )

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

Definition at line 457 of file TTreeCloner.cxx.

Referenced by Exec().

Bool_t TTreeCloner::Exec ( )

Execute the cloning.

Definition at line 173 of file TTreeCloner.cxx.

const char* TTreeCloner::GetWarning ( ) const
inline

Definition at line 112 of file TTreeCloner.h.

void TTreeCloner::ImportClusterRanges ( )
private

Set the entries and import the cluster range of the.

Definition at line 579 of file TTreeCloner.cxx.

Referenced by Exec().

Bool_t TTreeCloner::IsValid ( )
inline

Definition at line 114 of file TTreeCloner.h.

Referenced by Exec().

Bool_t TTreeCloner::NeedConversion ( )
inline

Definition at line 115 of file TTreeCloner.h.

TTreeCloner& TTreeCloner::operator= ( const TTreeCloner )
private
void TTreeCloner::SortBaskets ( )

Sort the basket according to the user request.

Definition at line 594 of file TTreeCloner.cxx.

Referenced by Exec().

void TTreeCloner::WriteBaskets ( )

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

Definition at line 620 of file TTreeCloner.cxx.

Referenced by Exec().

Friends And Related Function Documentation

friend class CompareEntry
friend

Definition at line 86 of file TTreeCloner.h.

Referenced by SortBaskets().

friend class CompareSeek
friend

Definition at line 85 of file TTreeCloner.h.

Referenced by SortBaskets().

Member Data Documentation

UInt_t* TTreeCloner::fBasketBranchNum
private

Definition at line 52 of file TTreeCloner.h.

Referenced by CollectBaskets(), WriteBaskets(), and ~TTreeCloner().

Long64_t* TTreeCloner::fBasketEntry
private
UInt_t* TTreeCloner::fBasketIndex
private

Definition at line 57 of file TTreeCloner.h.

Referenced by CollectBaskets(), SortBaskets(), WriteBaskets(), and ~TTreeCloner().

UInt_t* TTreeCloner::fBasketNum
private

Definition at line 53 of file TTreeCloner.h.

Referenced by CollectBaskets(), WriteBaskets(), and ~TTreeCloner().

Long64_t* TTreeCloner::fBasketSeek
private
UInt_t TTreeCloner::fCloneMethod
private

Definition at line 61 of file TTreeCloner.h.

Referenced by SortBaskets(), and TTreeCloner().

TObjArray TTreeCloner::fFromBranches
private

Definition at line 48 of file TTreeCloner.h.

Referenced by CollectBaskets(), CollectBranches(), CopyMemoryBaskets(), and WriteBaskets().

TTree* TTreeCloner::fFromTree
private
Bool_t TTreeCloner::fIsValid
private

Definition at line 42 of file TTreeCloner.h.

Referenced by CollectBranches(), IsValid(), and TTreeCloner().

UInt_t TTreeCloner::fMaxBaskets
private

Definition at line 51 of file TTreeCloner.h.

Referenced by SortBaskets(), and WriteBaskets().

Option_t* TTreeCloner::fMethod
private

Definition at line 47 of file TTreeCloner.h.

Bool_t TTreeCloner::fNeedConversion
private

Definition at line 43 of file TTreeCloner.h.

Referenced by CollectBranches(), and NeedConversion().

UInt_t TTreeCloner::fOptions
private

Definition at line 44 of file TTreeCloner.h.

Referenced by CollectBranches(), and TTreeCloner().

UShort_t TTreeCloner::fPidOffset
private

Definition at line 59 of file TTreeCloner.h.

Referenced by CopyProcessIds(), and WriteBaskets().

TObjArray TTreeCloner::fToBranches
private
Long64_t TTreeCloner::fToStartEntries
private

Definition at line 62 of file TTreeCloner.h.

Referenced by CopyMemoryBaskets(), TTreeCloner(), and WriteBaskets().

TTree* TTreeCloner::fToTree
private
TString TTreeCloner::fWarningMsg
private

Definition at line 40 of file TTreeCloner.h.

Referenced by CollectBranches(), GetWarning(), and TTreeCloner().

Collaboration diagram for TTreeCloner:
[legend]

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