ROOT
6.06/09
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 usefull in a Grid environment where the files might be accessable 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 | EStatusBits { kCanDelete = BIT(0), kMustCleanup = BIT(3), kObjInCanvas = BIT(3), kIsReferenced = BIT(4), kHasUUID = BIT(5), kCannotPick = BIT(6), kNoContextMenu = BIT(8), kInvalidObject = BIT(13) } |
enum | { kIsOnHeap = 0x01000000, kNotDeleted = 0x02000000, kZombie = 0x04000000, kBitMask = 0x00ffffff } |
enum | { kSingleKey = BIT(0), kOverwrite = BIT(1), kWriteDelete = BIT(2) } |
Public Member Functions | |
TFileMerger (Bool_t isLocal=kTRUE, Bool_t histoOneGo=kTRUE) | |
Create file merger object. More... | |
virtual | ~TFileMerger () |
Cleanup. More... | |
Int_t | GetPrintLevel () const |
void | SetPrintLevel (Int_t level) |
Bool_t | HasCompressionChange () const |
const char * | GetOutputFileName () const |
TList * | GetMergeList () const |
TFile * | GetOutputFile () const |
Int_t | GetMaxOpenedFiles () const |
void | SetMaxOpenedFiles (Int_t newmax) |
Set a limit to the number file that TFileMerger will opened at one time. More... | |
const char * | GetMsgPrefix () const |
void | SetMsgPrefix (const char *prefix) |
Set the prefix to be used when printing informational message. More... | |
const char * | GetMergeOptions () |
void | SetMergeOptions (const std::string_view &options) |
void | AddObjectNames (const char *name) |
const char * | GetObjectNames () const |
void | ClearObjectNames () |
virtual Bool_t | SetCWD (const char *) |
virtual const char * | GetCWD () |
virtual void | Reset () |
Reset merger file list. 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... | |
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 | 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 void | PrintFiles (Option_t *options) |
Print list of files being merged. More... | |
virtual Bool_t | Merge (Bool_t=kTRUE) |
Merge the files. More... | |
virtual Bool_t | PartialMerge (Int_t type=kAll|kIncremental) |
Merge the files. More... | |
virtual void | SetFastMethod (Bool_t fast=kTRUE) |
virtual void | SetNotrees (Bool_t notrees=kFALSE) |
virtual void | RecursiveRemove (TObject *obj) |
Intercept the case where the output TFile is deleted! More... | |
Public Member Functions inherited from TObject | |
TObject () | |
TObject (const TObject &object) | |
TObject copy ctor. More... | |
TObject & | operator= (const TObject &rhs) |
TObject assignment operator. More... | |
virtual | ~TObject () |
TObject destructor. 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... | |
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 pad. More... | |
virtual void | Dump () const |
Dump contents of object on stdout. 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 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 UInt_t | GetUniqueID () const |
Return the unique object id. More... | |
virtual const char * | GetName () const |
Returns name of object. More... | |
virtual const char * | GetIconName () const |
Returns mime type name of object. More... | |
virtual Option_t * | GetOption () const |
virtual char * | GetObjectInfo (Int_t px, Int_t py) const |
Returns string containing info about the object at position (px,py). More... | |
virtual const char * | GetTitle () const |
Returns title of object. 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... | |
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... | |
virtual Bool_t | IsFolder () const |
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects). More... | |
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 | IsSortable () const |
Bool_t | IsOnHeap () const |
Bool_t | IsZombie () const |
virtual Bool_t | Notify () |
This method must be overridden to handle object notification. More... | |
virtual void | ls (Option_t *option="") const |
The ls function lists the contents of a class on stdout. 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... | |
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... | |
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 | UseCurrentStyle () |
Set current style settings in this object This function is called when either TCanvas::UseCurrentStyle or TROOT::ForceStyle have been invoked. 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... | |
void * | operator new (size_t sz) |
void * | operator new[] (size_t sz) |
void * | operator new (size_t sz, void *vp) |
void * | operator new[] (size_t sz, void *vp) |
void | operator delete (void *ptr) |
Operator delete. More... | |
void | operator delete[] (void *ptr) |
Operator delete []. 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) |
void | ResetBit (UInt_t f) |
Bool_t | TestBit (UInt_t f) const |
Int_t | TestBits (UInt_t f) const |
void | InvertBit (UInt_t f) |
virtual void | Info (const char *method, const char *msgfmt,...) const |
Issue info message. More... | |
virtual void | Warning (const char *method, const char *msgfmt,...) const |
Issue warning message. More... | |
virtual void | Error (const char *method, const char *msgfmt,...) const |
Issue error message. More... | |
virtual void | SysError (const char *method, const char *msgfmt,...) const |
Issue system error message. More... | |
virtual void | Fatal (const char *method, const char *msgfmt,...) const |
Issue fatal error message. 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... | |
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... | |
void | Obsolete (const char *method, const char *asOfVers, const char *removedFromVers) const |
Use this method to declare a method obsolete. More... | |
Protected Member Functions | |
Bool_t | OpenExcessFiles () |
Open up to fMaxOpenedFiles of the excess files. More... | |
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... | |
Protected Member Functions inherited from TObject | |
void | MakeZombie () |
virtual void | DoError (int level, const char *location, const char *fmt, va_list va) const |
Interface to ErrorHandler (protected). More... | |
Protected Attributes | |
TStopwatch | fWatch |
Stop watch to measure file copy speed. More... | |
TList * | fFileList |
A list the file (TFile*) which shall be merged. More... | |
TFile * | fOutputFile |
The outputfile for merging. More... | |
TString | fOutputFilename |
The name of the outputfile for merging. More... | |
Bool_t | fFastMethod |
True if using Fast merging algorithm (default) More... | |
Bool_t | fNoTrees |
True if Trees should not be merged (default is kFALSE) More... | |
Bool_t | fExplicitCompLevel |
True if the user explicitly requested a compressio level change (default kFALSE) More... | |
Bool_t | fCompressionChange |
True if the output and input have different compression level (default kFALSE) More... | |
Int_t | fPrintLevel |
How much information to print out at run time. More... | |
TString | fMergeOptions |
Options (in string format) to be passed down to the Merge functions. More... | |
TString | fMsgPrefix |
Prefix to be used when printing informational message (default TFileMerger) More... | |
Int_t | fMaxOpenedFiles |
Maximum number of files opened at the same time by the TFileMerger. More... | |
Bool_t | fLocal |
Makes local copies of merging files if True (default is kTRUE) More... | |
Bool_t | fHistoOneGo |
Merger histos in one go (default is kTRUE) More... | |
TString | fObjectNames |
List of object names to be either merged exclusively or skipped. More... | |
TList * | fMergeList |
list of TObjString containing the name of the files need to be merged 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... | |
Private Member Functions | |
TFileMerger (const TFileMerger &) | |
TFileMerger & | operator= (const TFileMerger &) |
Additional Inherited Members | |
Static Public Member Functions inherited from TObject | |
static Long_t | GetDtorOnly () |
Return destructor only flag. More... | |
static void | SetDtorOnly (void *obj) |
Set destructor only flag. More... | |
static Bool_t | GetObjectStat () |
Get status of object stat flag. More... | |
static void | SetObjectStat (Bool_t stat) |
Turn on/off tracking of objects in the TObjectTable. More... | |
#include <TFileMerger.h>
Type of the partial merge.
Definition at line 61 of file TFileMerger.h.
|
private |
Create file merger object.
Definition at line 89 of file TFileMerger.cxx.
|
virtual |
Cleanup.
Definition at line 108 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 203 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 214 of file TFileMerger.cxx.
Referenced by AddAdoptFile(), TProofOutputFile::AddFile(), AddFile(), TAlienMasterJob::Merge(), and TProofPlayerRemote::MergeOutputFiles().
Add file to file merger.
Definition at line 131 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 192 of file TFileMerger.cxx.
|
inline |
Definition at line 89 of file TFileMerger.h.
|
inline |
Definition at line 91 of file TFileMerger.h.
|
inlinevirtual |
Definition at line 95 of file TFileMerger.h.
|
inline |
Definition at line 83 of file TFileMerger.h.
|
inline |
Definition at line 81 of file TFileMerger.h.
Referenced by TProofPlayerRemote::MergeOutputFiles().
|
inline |
Definition at line 87 of file TFileMerger.h.
|
inline |
Definition at line 85 of file TFileMerger.h.
|
inline |
Definition at line 90 of file TFileMerger.h.
|
inline |
Definition at line 82 of file TFileMerger.h.
|
inline |
Definition at line 80 of file TFileMerger.h.
|
inline |
Definition at line 77 of file TFileMerger.h.
|
inline |
Definition at line 79 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 343 of file TFileMerger.cxx.
Referenced by TAlienMasterJob::Merge(), and TProofPlayerRemote::MergeOutputFiles().
|
protectedvirtual |
Merge all objects in a directory.
The type is defined by the bit values in TFileMerger::EPartialMergeType.
Definition at line 353 of file TFileMerger.cxx.
Referenced by PartialMerge().
|
protected |
Open up to fMaxOpenedFiles of the excess files.
Definition at line 876 of file TFileMerger.cxx.
Referenced by PartialMerge().
|
private |
Open merger output file.
Definition at line 282 of file TFileMerger.cxx.
Referenced by TAlienMasterJob::Merge(), TProofOutputFile::Merge(), TProofPlayerRemote::MergeOutputFiles(), OutputFile(), and PartialMerge().
Open merger output file.
Definition at line 274 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 320 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 296 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 775 of file TFileMerger.cxx.
Referenced by Merge().
Print list of files being merged.
Definition at line 330 of file TFileMerger.cxx.
Referenced by TProofPlayerRemote::MergeOutputFiles().
Intercept the case where the output TFile is deleted!
Reimplemented from TObject.
Definition at line 923 of file TFileMerger.cxx.
Reset merger file list.
Definition at line 120 of file TFileMerger.cxx.
Referenced by TProofPlayerRemote::MergeOutputFiles().
|
inlinevirtual |
Definition at line 94 of file TFileMerger.h.
Definition at line 109 of file TFileMerger.h.
Set a limit to the number file that TFileMerger will opened at one time.
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 937 of file TFileMerger.cxx.
|
inline |
Definition at line 88 of file TFileMerger.h.
void TFileMerger::SetMsgPrefix | ( | const char * | prefix | ) |
Set the prefix to be used when printing informational message.
Definition at line 953 of file TFileMerger.cxx.
Definition at line 110 of file TFileMerger.h.
Definition at line 78 of file TFileMerger.h.
|
protected |
True if the output and input have different compression level (default kFALSE)
Definition at line 43 of file TFileMerger.h.
Referenced by AddFile(), HasCompressionChange(), MergeRecursive(), OpenExcessFiles(), and PartialMerge().
|
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 53 of file TFileMerger.h.
Referenced by AddFile(), OpenExcessFiles(), PartialMerge(), PrintFiles(), Reset(), TFileMerger(), and ~TFileMerger().
|
protected |
True if the user explicitly requested a compressio level change (default kFALSE)
Definition at line 42 of file TFileMerger.h.
Referenced by OutputFile(), and PartialMerge().
|
protected |
True if using Fast merging algorithm (default)
Definition at line 40 of file TFileMerger.h.
Referenced by MergeRecursive().
|
protected |
A list the file (TFile*) which shall be merged.
Definition at line 37 of file TFileMerger.h.
Referenced by AddFile(), OpenExcessFiles(), PartialMerge(), PrintFiles(), Reset(), TFileMerger(), and ~TFileMerger().
|
protected |
Merger histos in one go (default is kTRUE)
Definition at line 50 of file TFileMerger.h.
Referenced by MergeRecursive().
|
protected |
Makes local copies of merging files if True (default is kTRUE)
Definition at line 49 of file TFileMerger.h.
Referenced by AddFile(), OpenExcessFiles(), and PartialMerge().
|
protected |
Maximum number of files opened at the same time by the TFileMerger.
Definition at line 48 of file TFileMerger.h.
Referenced by AddFile(), GetMaxOpenedFiles(), OpenExcessFiles(), and SetMaxOpenedFiles().
|
protected |
list of TObjString containing the name of the files need to be merged
Definition at line 52 of file TFileMerger.h.
Referenced by AddFile(), GetMergeList(), Reset(), TFileMerger(), and ~TFileMerger().
|
protected |
Options (in string format) to be passed down to the Merge functions.
Definition at line 45 of file TFileMerger.h.
Referenced by GetMergeOptions(), and MergeRecursive().
|
protected |
Prefix to be used when printing informational message (default TFileMerger)
Definition at line 46 of file TFileMerger.h.
Referenced by AddFile(), GetMsgPrefix(), MergeRecursive(), OpenExcessFiles(), and SetMsgPrefix().
|
protected |
True if Trees should not be merged (default is kFALSE)
Definition at line 41 of file TFileMerger.h.
Referenced by MergeRecursive().
|
protected |
List of object names to be either merged exclusively or skipped.
Definition at line 51 of file TFileMerger.h.
Referenced by MergeRecursive(), and Reset().
|
protected |
The outputfile for merging.
Definition at line 38 of file TFileMerger.h.
Referenced by AddFile(), GetOutputFile(), OpenExcessFiles(), OutputFile(), PartialMerge(), RecursiveRemove(), and ~TFileMerger().
|
protected |
The name of the outputfile for merging.
Definition at line 39 of file TFileMerger.h.
Referenced by GetOutputFileName(), OutputFile(), PartialMerge(), and RecursiveRemove().
|
protected |
How much information to print out at run time.
Definition at line 44 of file TFileMerger.h.
Referenced by AddFile(), GetPrintLevel(), MergeRecursive(), and OpenExcessFiles().
|
protected |
Stop watch to measure file copy speed.
Definition at line 36 of file TFileMerger.h.