ROOT 6.14/05 Reference Guide |
This class provides file copy and merging services.
It can be used to copy files (not only ROOT files), using TFile or any of its remote file access plugins. It is therefore useful in a Grid environment where the files might be accessible via Castor, rfio, dcap, etc. The merging interface allows files containing histograms and trees to be merged, like the standalone hadd program.
Definition at line 30 of file TFileMerger.h.
Public Types | |
enum | EPartialMergeType { kRegular = 0, kIncremental = BIT(1), kResetable = BIT(2), kNonResetable = BIT(3), kAll = BIT(2)|BIT(3), kAllIncremental = kIncremental | kAll, kOnlyListed = BIT(4), kSkipListed = BIT(5), kKeepCompression = BIT(6) } |
Type of the partial merge. More... | |
Public Types inherited from TObject | |
enum | { kIsOnHeap = 0x01000000, kNotDeleted = 0x02000000, kZombie = 0x04000000, kInconsistent = 0x08000000, kBitMask = 0x00ffffff } |
enum | { kSingleKey = BIT(0), kOverwrite = BIT(1), kWriteDelete = BIT(2) } |
enum | EDeprecatedStatusBits { kObjInCanvas = BIT(3) } |
enum | EStatusBits { kCanDelete = BIT(0), kMustCleanup = BIT(3), kIsReferenced = BIT(4), kHasUUID = BIT(5), kCannotPick = BIT(6), kNoContextMenu = BIT(8), kInvalidObject = BIT(13) } |
Public Member Functions | |
TFileMerger (Bool_t isLocal=kTRUE, Bool_t histoOneGo=kTRUE) | |
Create file merger object. More... | |
virtual | ~TFileMerger () |
Cleanup. More... | |
virtual Bool_t | AddAdoptFile (TFile *source, Bool_t cpProgress=kTRUE) |
Add the TFile to this file merger and give ownership of the TFile to this object (unless kFALSE is returned). More... | |
virtual Bool_t | AddFile (const char *url, Bool_t cpProgress=kTRUE) |
Add file to file merger. More... | |
virtual Bool_t | AddFile (TFile *source, Bool_t cpProgress=kTRUE) |
Add the TFile to this file merger and do not give ownership of the TFile to this object. More... | |
void | AddObjectNames (const char *name) |
void | ClearObjectNames () |
virtual const char * | GetCWD () |
Int_t | GetMaxOpenedFiles () const |
TList * | GetMergeList () |
const char * | GetMergeOptions () |
const char * | GetMsgPrefix () const |
const char * | GetObjectNames () const |
TFile * | GetOutputFile () const |
const char * | GetOutputFileName () const |
Int_t | GetPrintLevel () const |
Bool_t | HasCompressionChange () const |
virtual Bool_t | Merge (Bool_t=kTRUE) |
Merge the files. More... | |
virtual Bool_t | OutputFile (const char *url, Bool_t force) |
Open merger output file. More... | |
virtual Bool_t | OutputFile (const char *url, Bool_t force, Int_t compressionLevel) |
Open merger output file. More... | |
virtual Bool_t | OutputFile (const char *url, const char *mode="RECREATE") |
Open merger output file. More... | |
virtual Bool_t | OutputFile (const char *url, const char *mode, Int_t compressionLevel) |
Open merger output file. More... | |
virtual Bool_t | OutputFile (std::unique_ptr< TFile > file) |
Set an output file opened externally by the users. More... | |
virtual Bool_t | PartialMerge (Int_t type=kAll|kIncremental) |
Merge the files. More... | |
virtual void | PrintFiles (Option_t *options) |
Print list of files being merged. More... | |
virtual void | RecursiveRemove (TObject *obj) |
Intercept the case where the output TFile is deleted! More... | |
virtual void | Reset () |
Reset merger file list. More... | |
virtual Bool_t | SetCWD (const char *) |
virtual void | SetFastMethod (Bool_t fast=kTRUE) |
void | SetIOFeatures (ROOT::TIOFeatures &features) |
void | SetMaxOpenedFiles (Int_t newmax) |
Set a limit to the number of files that TFileMerger will open simultaneously. More... | |
void | SetMergeOptions (const TString &options) |
void | SetMergeOptions (const std::string_view &options) |
void | SetMsgPrefix (const char *prefix) |
Set the prefix to be used when printing informational message. More... | |
virtual void | SetNotrees (Bool_t notrees=kFALSE) |
void | SetPrintLevel (Int_t level) |
Public Member Functions inherited from TObject | |
TObject () | |
TObject constructor. More... | |
TObject (const TObject &object) | |
TObject copy ctor. More... | |
virtual | ~TObject () |
TObject destructor. More... | |
void | AbstractMethod (const char *method) const |
Use this method to implement an "abstract" method that you don't want to leave purely abstract. More... | |
virtual void | AppendPad (Option_t *option="") |
Append graphics object to current pad. More... | |
virtual void | Browse (TBrowser *b) |
Browse object. May be overridden for another default action. More... | |
ULong_t | CheckedHash () |
Checked and record whether for this class has a consistent Hash/RecursiveRemove setup (*) and then return the regular Hash value for this object. More... | |
virtual const char * | ClassName () const |
Returns name of class to which the object belongs. More... | |
virtual void | Clear (Option_t *="") |
virtual TObject * | Clone (const char *newname="") const |
Make a clone of an object using the Streamer facility. More... | |
virtual Int_t | Compare (const TObject *obj) const |
Compare abstract method. More... | |
virtual void | Copy (TObject &object) const |
Copy this to obj. More... | |
virtual void | Delete (Option_t *option="") |
Delete this object. More... | |
virtual Int_t | DistancetoPrimitive (Int_t px, Int_t py) |
Computes distance from point (px,py) to the object. More... | |
virtual void | Draw (Option_t *option="") |
Default Draw method for all objects. More... | |
virtual void | DrawClass () const |
Draw class inheritance tree of the class to which this object belongs. More... | |
virtual TObject * | DrawClone (Option_t *option="") const |
Draw a clone of this object in the current selected pad for instance with: gROOT->SetSelectedPad(gPad) . More... | |
virtual void | Dump () const |
Dump contents of object on stdout. More... | |
virtual void | Error (const char *method, const char *msgfmt,...) const |
Issue error message. More... | |
virtual void | Execute (const char *method, const char *params, Int_t *error=0) |
Execute method on this object with the given parameter string, e.g. More... | |
virtual void | Execute (TMethod *method, TObjArray *params, Int_t *error=0) |
Execute method on this object with parameters stored in the TObjArray. More... | |
virtual void | ExecuteEvent (Int_t event, Int_t px, Int_t py) |
Execute action corresponding to an event at (px,py). More... | |
virtual void | Fatal (const char *method, const char *msgfmt,...) const |
Issue fatal error message. More... | |
virtual TObject * | FindObject (const char *name) const |
Must be redefined in derived classes. More... | |
virtual TObject * | FindObject (const TObject *obj) const |
Must be redefined in derived classes. More... | |
virtual Option_t * | GetDrawOption () const |
Get option used by the graphics system to draw this object. More... | |
virtual const char * | GetIconName () const |
Returns mime type name of object. More... | |
virtual const char * | GetName () const |
Returns name of object. More... | |
virtual char * | GetObjectInfo (Int_t px, Int_t py) const |
Returns string containing info about the object at position (px,py). More... | |
virtual Option_t * | GetOption () const |
virtual const char * | GetTitle () const |
Returns title of object. More... | |
virtual UInt_t | GetUniqueID () const |
Return the unique object id. More... | |
virtual Bool_t | HandleTimer (TTimer *timer) |
Execute action in response of a timer timing out. More... | |
virtual ULong_t | Hash () const |
Return hash value for this object. More... | |
Bool_t | HasInconsistentHash () const |
Return true is the type of this object is known to have an inconsistent setup for Hash and RecursiveRemove (i.e. More... | |
virtual void | Info (const char *method, const char *msgfmt,...) const |
Issue info message. More... | |
virtual Bool_t | InheritsFrom (const char *classname) const |
Returns kTRUE if object inherits from class "classname". More... | |
virtual Bool_t | InheritsFrom (const TClass *cl) const |
Returns kTRUE if object inherits from TClass cl. More... | |
virtual void | Inspect () const |
Dump contents of this object in a graphics canvas. More... | |
void | InvertBit (UInt_t f) |
virtual Bool_t | IsEqual (const TObject *obj) const |
Default equal comparison (objects are equal if they have the same address in memory). More... | |
virtual Bool_t | IsFolder () const |
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects). More... | |
R__ALWAYS_INLINE Bool_t | IsOnHeap () const |
virtual Bool_t | IsSortable () const |
R__ALWAYS_INLINE Bool_t | IsZombie () const |
virtual void | ls (Option_t *option="") const |
The ls function lists the contents of a class on stdout. More... | |
void | MayNotUse (const char *method) const |
Use this method to signal that a method (defined in a base class) may not be called in a derived class (in principle against good design since a child class should not provide less functionality than its parent, however, sometimes it is necessary). More... | |
virtual Bool_t | Notify () |
This method must be overridden to handle object notification. More... | |
void | Obsolete (const char *method, const char *asOfVers, const char *removedFromVers) const |
Use this method to declare a method obsolete. More... | |
void | operator delete (void *ptr) |
Operator delete. More... | |
void | operator delete[] (void *ptr) |
Operator delete []. More... | |
void * | operator new (size_t sz) |
void * | operator new (size_t sz, void *vp) |
void * | operator new[] (size_t sz) |
void * | operator new[] (size_t sz, void *vp) |
TObject & | operator= (const TObject &rhs) |
TObject assignment operator. More... | |
virtual void | Paint (Option_t *option="") |
This method must be overridden if a class wants to paint itself. More... | |
virtual void | Pop () |
Pop on object drawn in a pad to the top of the display list. More... | |
virtual void | Print (Option_t *option="") const |
This method must be overridden when a class wants to print itself. More... | |
virtual Int_t | Read (const char *name) |
Read contents of object with specified name from the current directory. More... | |
void | ResetBit (UInt_t f) |
virtual void | SaveAs (const char *filename="", Option_t *option="") const |
Save this object in the file specified by filename. More... | |
virtual void | SavePrimitive (std::ostream &out, Option_t *option="") |
Save a primitive as a C++ statement(s) on output stream "out". More... | |
void | SetBit (UInt_t f, Bool_t set) |
Set or unset the user status bits as specified in f. More... | |
void | SetBit (UInt_t f) |
virtual void | SetDrawOption (Option_t *option="") |
Set drawing option for object. More... | |
virtual void | SetUniqueID (UInt_t uid) |
Set the unique object id. More... | |
virtual void | SysError (const char *method, const char *msgfmt,...) const |
Issue system error message. More... | |
R__ALWAYS_INLINE Bool_t | TestBit (UInt_t f) const |
Int_t | TestBits (UInt_t f) const |
virtual void | UseCurrentStyle () |
Set current style settings in this object This function is called when either TCanvas::UseCurrentStyle or TROOT::ForceStyle have been invoked. More... | |
virtual void | Warning (const char *method, const char *msgfmt,...) const |
Issue warning message. More... | |
virtual Int_t | Write (const char *name=0, Int_t option=0, Int_t bufsize=0) |
Write this object to the current directory. More... | |
virtual Int_t | Write (const char *name=0, Int_t option=0, Int_t bufsize=0) const |
Write this object to the current directory. More... | |
Protected Member Functions | |
virtual Bool_t | AddFile (TFile *source, Bool_t own, Bool_t cpProgress) |
Add the TFile to this file merger and give ownership of the TFile to this object (unless kFALSE is returned). More... | |
virtual Bool_t | MergeRecursive (TDirectory *target, TList *sourcelist, Int_t type=kRegular|kAll) |
Merge all objects in a directory. More... | |
Bool_t | OpenExcessFiles () |
Open up to fMaxOpenedFiles of the excess files. More... | |
Protected Member Functions inherited from TObject | |
virtual void | DoError (int level, const char *location, const char *fmt, va_list va) const |
Interface to ErrorHandler (protected). More... | |
void | MakeZombie () |
Protected Attributes | |
Bool_t | fCompressionChange {kFALSE} |
True if the output and input have different compression level (default kFALSE) More... | |
TList | fExcessFiles |
! List of TObjString containing the name of the files not yet added to fFileList due to user or system limitiation on the max number of files opened. More... | |
Bool_t | fExplicitCompLevel {kFALSE} |
True if the user explicitly requested a compressio level change (default kFALSE) More... | |
Bool_t | fFastMethod {kTRUE} |
True if using Fast merging algorithm (default) More... | |
TList | fFileList |
A list the file (TFile*) which shall be merged. More... | |
Bool_t | fHistoOneGo |
Merger histos in one go (default is kTRUE) More... | |
TIOFeatures * | fIOFeatures {nullptr} |
IO features to use in the output file. More... | |
Bool_t | fLocal |
Makes local copies of merging files if True (default is kTRUE) More... | |
Int_t | fMaxOpenedFiles |
Maximum number of files opened at the same time by the TFileMerger. More... | |
TList | fMergeList |
list of TObjString containing the name of the files need to be merged More... | |
TString | fMergeOptions |
Options (in string format) to be passed down to the Merge functions. More... | |
TString | fMsgPrefix {"TFileMerger"} |
Prefix to be used when printing informational message (default TFileMerger) More... | |
Bool_t | fNoTrees {kFALSE} |
True if Trees should not be merged (default is kFALSE) More... | |
TString | fObjectNames |
List of object names to be either merged exclusively or skipped. More... | |
TFile * | fOutputFile {nullptr} |
The outputfile for merging. More... | |
TString | fOutputFilename |
The name of the outputfile for merging. More... | |
Int_t | fPrintLevel {0} |
How much information to print out at run time. More... | |
TStopwatch | fWatch |
Stop watch to measure file copy speed. More... | |
Private Types | |
using | TIOFeatures = ROOT::TIOFeatures |
Private Member Functions | |
TFileMerger (const TFileMerger &)=delete | |
TFileMerger & | operator= (const TFileMerger &)=delete |
Additional Inherited Members | |
Static Public Member Functions inherited from TObject | |
static Long_t | GetDtorOnly () |
Return destructor only flag. More... | |
static Bool_t | GetObjectStat () |
Get status of object stat flag. More... | |
static void | SetDtorOnly (void *obj) |
Set destructor only flag. More... | |
static void | SetObjectStat (Bool_t stat) |
Turn on/off tracking of objects in the TObjectTable. More... | |
#include <TFileMerger.h>
|
private |
Definition at line 32 of file TFileMerger.h.
Type of the partial merge.
Definition at line 64 of file TFileMerger.h.
|
privatedelete |
Create file merger object.
Definition at line 90 of file TFileMerger.cxx.
|
virtual |
Cleanup.
Definition at line 104 of file TFileMerger.cxx.
Add the TFile to this file merger and give ownership of the TFile to this object (unless kFALSE is returned).
Return kTRUE if the addition was successful.
Definition at line 205 of file TFileMerger.cxx.
Add the TFile to this file merger and give ownership of the TFile to this object (unless kFALSE is returned).
Return kTRUE if the addition was successful.
Definition at line 216 of file TFileMerger.cxx.
Add file to file merger.
Definition at line 127 of file TFileMerger.cxx.
Add the TFile to this file merger and do not give ownership of the TFile to this object.
Return kTRUE if the addition was successful.
Definition at line 194 of file TFileMerger.cxx.
|
inline |
Definition at line 95 of file TFileMerger.h.
|
inline |
Definition at line 97 of file TFileMerger.h.
|
inlinevirtual |
Definition at line 101 of file TFileMerger.h.
|
inline |
Definition at line 87 of file TFileMerger.h.
|
inline |
Definition at line 85 of file TFileMerger.h.
|
inline |
Definition at line 91 of file TFileMerger.h.
|
inline |
Definition at line 89 of file TFileMerger.h.
|
inline |
Definition at line 96 of file TFileMerger.h.
|
inline |
Definition at line 86 of file TFileMerger.h.
|
inline |
Definition at line 84 of file TFileMerger.h.
|
inline |
Definition at line 81 of file TFileMerger.h.
|
inline |
Definition at line 83 of file TFileMerger.h.
Merge the files.
If no output file was specified it will write into the file "FileMerger.root" in the working directory. Returns true on success, false in case of error.
Definition at line 369 of file TFileMerger.cxx.
|
protectedvirtual |
Merge all objects in a directory.
The type is defined by the bit values in TFileMerger::EPartialMergeType.
Definition at line 379 of file TFileMerger.cxx.
|
protected |
Open up to fMaxOpenedFiles of the excess files.
Definition at line 903 of file TFileMerger.cxx.
|
privatedelete |
Open merger output file.
Definition at line 286 of file TFileMerger.cxx.
Open merger output file.
Definition at line 278 of file TFileMerger.cxx.
|
virtual |
Open merger output file.
'mode' is passed to the TFile constructor as the option, it should be one of 'NEW','CREATE','RECREATE','UPDATE' 'UPDATE' is usually used in conjunction with IncrementalMerge.
Definition at line 346 of file TFileMerger.cxx.
|
virtual |
Open merger output file.
The 'mode' parameter is passed to the TFile constructor as the option, it should be one of 'NEW','CREATE','RECREATE','UPDATE' 'UPDATE' is usually used in conjunction with IncrementalMerge.
Definition at line 300 of file TFileMerger.cxx.
Set an output file opened externally by the users.
Definition at line 314 of file TFileMerger.cxx.
|
virtual |
Merge the files.
If no output file was specified it will write into the file "FileMerger.root" in the working directory. Returns true on success, false in case of error. The type is defined by the bit values in EPartialMergeType: kRegular : normal merge, overwritting the output file kIncremental : merge the input file with the content of the output file (if already exising) (default) kAll : merge all type of objects (default) kResetable : merge only the objects with a MergeAfterReset member function. kNonResetable : merge only the objects without a MergeAfterReset member function.
If the type is set to kIncremental the output file is done deleted at the end of this operation. If the type is not set to kIncremental, the output file is closed.
Definition at line 802 of file TFileMerger.cxx.
Print list of files being merged.
Definition at line 356 of file TFileMerger.cxx.
Intercept the case where the output TFile is deleted!
Reimplemented from TObject.
Definition at line 950 of file TFileMerger.cxx.
Reset merger file list.
Definition at line 116 of file TFileMerger.cxx.
|
inlinevirtual |
Definition at line 100 of file TFileMerger.h.
Definition at line 116 of file TFileMerger.h.
|
inline |
Definition at line 94 of file TFileMerger.h.
Set a limit to the number of files that TFileMerger will open simultaneously.
If the request is higher than the system limit, we reset it to the system limit. If the request is less than two, we reset it to 2 (one for the output file and one for the input file).
Definition at line 964 of file TFileMerger.cxx.
Definition at line 92 of file TFileMerger.h.
|
inline |
Definition at line 93 of file TFileMerger.h.
void TFileMerger::SetMsgPrefix | ( | const char * | prefix | ) |
Set the prefix to be used when printing informational message.
Definition at line 980 of file TFileMerger.cxx.
Definition at line 117 of file TFileMerger.h.
Definition at line 82 of file TFileMerger.h.
True if the output and input have different compression level (default kFALSE)
Definition at line 45 of file TFileMerger.h.
|
protected |
! List of TObjString containing the name of the files not yet added to fFileList due to user or system limitiation on the max number of files opened.
Definition at line 56 of file TFileMerger.h.
True if the user explicitly requested a compressio level change (default kFALSE)
Definition at line 44 of file TFileMerger.h.
True if using Fast merging algorithm (default)
Definition at line 42 of file TFileMerger.h.
|
protected |
A list the file (TFile*) which shall be merged.
Definition at line 39 of file TFileMerger.h.
|
protected |
Merger histos in one go (default is kTRUE)
Definition at line 53 of file TFileMerger.h.
|
protected |
IO features to use in the output file.
Definition at line 48 of file TFileMerger.h.
|
protected |
Makes local copies of merging files if True (default is kTRUE)
Definition at line 52 of file TFileMerger.h.
|
protected |
Maximum number of files opened at the same time by the TFileMerger.
Definition at line 51 of file TFileMerger.h.
|
protected |
list of TObjString containing the name of the files need to be merged
Definition at line 55 of file TFileMerger.h.
|
protected |
Options (in string format) to be passed down to the Merge functions.
Definition at line 47 of file TFileMerger.h.
|
protected |
Prefix to be used when printing informational message (default TFileMerger)
Definition at line 49 of file TFileMerger.h.
True if Trees should not be merged (default is kFALSE)
Definition at line 43 of file TFileMerger.h.
|
protected |
List of object names to be either merged exclusively or skipped.
Definition at line 54 of file TFileMerger.h.
|
protected |
The outputfile for merging.
Definition at line 40 of file TFileMerger.h.
|
protected |
The name of the outputfile for merging.
Definition at line 41 of file TFileMerger.h.
|
protected |
How much information to print out at run time.
Definition at line 46 of file TFileMerger.h.
|
protected |
Stop watch to measure file copy speed.
Definition at line 38 of file TFileMerger.h.