Class implementing or helping the various TTree cloning method.
Definition at line 31 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, TDirectory *newdirectory, Option_t *method, UInt_t options=kNone) | |
Constructor. In place cloning. | |
TTreeCloner (TTree *from, TTree *to, Option_t *method, UInt_t options=kNone) | |
Constructor. | |
virtual | ~TTreeCloner () |
TTreeCloner destructor. | |
ClassDef (TTreeCloner, 0) | |
void | CloseOutWriteBaskets () |
Before we can start adding new basket, we need to flush to disk the partially filled baskets (the WriteBasket) | |
void | CollectBaskets () |
Collect the information about the on-file basket that need to be copied. | |
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. | |
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. | |
UInt_t | CollectBranches (TObjArray *from, TObjArray *to) |
Fill the array of branches, matching the branches of the 'from' and 'to' arrays. | |
void | CopyMemoryBaskets () |
Transfer the basket from the input file to the output file. | |
void | CopyProcessIds () |
Make sure that all the needed TStreamerInfo are present in the output file. | |
void | CopyStreamerInfos () |
Make sure that all the needed TStreamerInfo are present in the output file. | |
bool | Exec () |
Execute the cloning. | |
const char * | GetWarning () const |
bool | IsInPlace () const |
bool | IsValid () |
bool | NeedConversion () |
void | SetCacheSize (Long64_t size) |
Set the cache size used by the matching TFile. | |
void | SortBaskets () |
Sort the basket according to the user request. | |
void | WriteBaskets () |
Transfer the basket from the input file to the output file. | |
Private Types | |
enum | ECloneMethod { kDefault = 0 , kSortBasketsByBranch = 1 , kSortBasketsByOffset = 2 , kSortBasketsByEntry = 3 } |
Private Member Functions | |
TTreeCloner (const TTreeCloner &)=delete | |
TTreeCloner (TTree *from, TTree *to, TDirectory *newdirectory, Option_t *method, UInt_t options=kNone) | |
Constructor implementation. | |
void | CreateCache () |
Create a TFileCacheRead if it was requested. | |
UInt_t | FillCache (UInt_t from) |
Fill the file cache with the next set of basket. | |
void | ImportClusterRanges () |
Set the entries and import the cluster range of the. | |
TTreeCloner & | operator= (const TTreeCloner &)=delete |
void | RestoreCache () |
Restore the TFileCacheRead to its previous value. | |
Private Attributes | |
UInt_t * | fBasketBranchNum |
[fMaxBaskets] Index of the branch(es) of the basket. | |
Long64_t * | fBasketEntry |
[fMaxBaskets] list of basket start entries. | |
UInt_t * | fBasketIndex |
[fMaxBaskets] ordered list of basket indices to be written. | |
UInt_t * | fBasketNum |
[fMaxBaskets] index of the basket within the branch. | |
Long64_t * | fBasketSeek |
[fMaxBaskets] list of basket position to be read. | |
Long64_t | fCacheSize |
Requested size of the file cache. | |
UInt_t | fCloneMethod |
Indicates which cloning method was selected. | |
TFileCacheRead * | fFileCache |
File Cache used to reduce the number of individual reads. | |
TObjArray | fFromBranches |
TTree * | fFromTree |
bool | fIsValid |
UInt_t | fMaxBaskets |
Option_t * | fMethod |
bool | fNeedConversion |
True if the fast merge is not possible but a slow merge might possible. | |
UInt_t | fOptions |
UShort_t | fPidOffset |
Offset to be added to the copied key/basket. | |
TFileCacheRead * | fPrevCache |
Cache that set before the TTreeCloner ctor for the 'from' TTree if any. | |
TObjArray | fToBranches |
TDirectory * | fToDirectory |
TFile * | fToFile |
Long64_t | fToStartEntries |
Number of entries in the target tree before any addition. | |
TTree * | fToTree |
TString | fWarningMsg |
Text of the error message lead to an 'invalid' state. | |
Friends | |
class | CompareEntry |
class | CompareSeek |
#include <TTreeCloner.h>
|
private |
Enumerator | |
---|---|
kDefault | |
kSortBasketsByBranch | |
kSortBasketsByOffset | |
kSortBasketsByEntry |
Definition at line 62 of file TTreeCloner.h.
Enumerator | |
---|---|
kNone | |
kNoWarnings | |
kIgnoreMissingTopLevel | |
kNoFileCache |
Definition at line 98 of file TTreeCloner.h.
|
privatedelete |
|
private |
Constructor implementation.
Definition at line 127 of file TTreeCloner.cxx.
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 104 of file TTreeCloner.cxx.
TTreeCloner::TTreeCloner | ( | TTree * | from, |
TDirectory * | newdirectory, | ||
Option_t * | method, | ||
UInt_t | options = kNone |
||
) |
Constructor. In place cloning.
This object would transfer the data from 'from' the original location to 'newdirectory' the new directory using the sorting method indicated in method. It updates the 'from' TTree with the new information. See TTreeCloner::TTreeCloner(TTree *from, TTree *to, Option_t *method, UInt_t options) for details on the sorting methods.
Definition at line 119 of file TTreeCloner.cxx.
|
virtual |
TTreeCloner destructor.
Definition at line 246 of file TTreeCloner.cxx.
TTreeCloner::ClassDef | ( | TTreeCloner | , |
0 | |||
) |
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 262 of file TTreeCloner.cxx.
void TTreeCloner::CollectBaskets | ( | ) |
Collect the information about the on-file basket that need to be copied.
Definition at line 451 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 430 of file TTreeCloner.cxx.
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 279 of file TTreeCloner.cxx.
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 365 of file TTreeCloner.cxx.
void TTreeCloner::CopyMemoryBaskets | ( | ) |
Transfer the basket from the input file to the output file.
Definition at line 513 of file TTreeCloner.cxx.
void TTreeCloner::CopyProcessIds | ( | ) |
Make sure that all the needed TStreamerInfo are present in the output file.
Definition at line 543 of file TTreeCloner.cxx.
void TTreeCloner::CopyStreamerInfos | ( | ) |
Make sure that all the needed TStreamerInfo are present in the output file.
Definition at line 472 of file TTreeCloner.cxx.
|
private |
Create a TFileCacheRead if it was requested.
Definition at line 596 of file TTreeCloner.cxx.
bool TTreeCloner::Exec | ( | ) |
Execute the cloning.
Definition at line 222 of file TTreeCloner.cxx.
Fill the file cache with the next set of basket.
from | index of the first lement of fFromBranches to start caching |
Definition at line 702 of file TTreeCloner.cxx.
|
inline |
Definition at line 117 of file TTreeCloner.h.
|
private |
Set the entries and import the cluster range of the.
Definition at line 626 of file TTreeCloner.cxx.
|
inline |
Definition at line 118 of file TTreeCloner.h.
|
inline |
Definition at line 120 of file TTreeCloner.h.
|
inline |
Definition at line 121 of file TTreeCloner.h.
|
privatedelete |
|
private |
Restore the TFileCacheRead to its previous value.
Definition at line 615 of file TTreeCloner.cxx.
void TTreeCloner::SetCacheSize | ( | Long64_t | size | ) |
Set the cache size used by the matching TFile.
Note that the default is to use the same size as the default TTreeCache for the input tree.
size | Size of the cache. |
Definition at line 656 of file TTreeCloner.cxx.
void TTreeCloner::SortBaskets | ( | ) |
Sort the basket according to the user request.
Definition at line 674 of file TTreeCloner.cxx.
void TTreeCloner::WriteBaskets | ( | ) |
Transfer the basket from the input file to the output file.
Definition at line 729 of file TTreeCloner.cxx.
|
friend |
Definition at line 84 of file TTreeCloner.h.
|
friend |
Definition at line 83 of file TTreeCloner.h.
|
private |
[fMaxBaskets] Index of the branch(es) of the basket.
Definition at line 46 of file TTreeCloner.h.
|
private |
[fMaxBaskets] list of basket start entries.
Definition at line 50 of file TTreeCloner.h.
|
private |
[fMaxBaskets] ordered list of basket indices to be written.
Definition at line 51 of file TTreeCloner.h.
|
private |
[fMaxBaskets] index of the basket within the branch.
Definition at line 47 of file TTreeCloner.h.
|
private |
[fMaxBaskets] list of basket position to be read.
Definition at line 49 of file TTreeCloner.h.
|
private |
Requested size of the file cache.
Definition at line 58 of file TTreeCloner.h.
|
private |
Indicates which cloning method was selected.
Definition at line 55 of file TTreeCloner.h.
|
private |
File Cache used to reduce the number of individual reads.
Definition at line 59 of file TTreeCloner.h.
|
private |
Definition at line 42 of file TTreeCloner.h.
|
private |
Definition at line 37 of file TTreeCloner.h.
|
private |
Definition at line 34 of file TTreeCloner.h.
|
private |
Definition at line 45 of file TTreeCloner.h.
|
private |
Definition at line 41 of file TTreeCloner.h.
|
private |
True if the fast merge is not possible but a slow merge might possible.
Definition at line 35 of file TTreeCloner.h.
|
private |
Definition at line 36 of file TTreeCloner.h.
|
private |
Offset to be added to the copied key/basket.
Definition at line 53 of file TTreeCloner.h.
|
private |
Cache that set before the TTreeCloner ctor for the 'from' TTree if any.
Definition at line 60 of file TTreeCloner.h.
|
private |
Definition at line 43 of file TTreeCloner.h.
|
private |
Definition at line 39 of file TTreeCloner.h.
|
private |
Definition at line 40 of file TTreeCloner.h.
|
private |
Number of entries in the target tree before any addition.
Definition at line 56 of file TTreeCloner.h.
|
private |
Definition at line 38 of file TTreeCloner.h.
|
private |
Text of the error message lead to an 'invalid' state.
Definition at line 32 of file TTreeCloner.h.