TFileMerger.h

Go to the documentation of this file.
00001 // @(#)root/proofplayer:$Id: TFileMerger.h 32130 2010-01-28 10:45:53Z rdm $
00002 // Author: Andreas Peters + Fons Rademakers   26/5/2005
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TFileMerger
00013 #define ROOT_TFileMerger
00014 
00015 //////////////////////////////////////////////////////////////////////////
00016 //                                                                      //
00017 // TFileMerger                                                          //
00018 //                                                                      //
00019 // This class provides file copy and merging services.                  //
00020 //                                                                      //
00021 // It can be used to copy files (not only ROOT files), using TFile or   //
00022 // any of its remote file access plugins. It is therefore usefull in    //
00023 // a Grid environment where the files might be accessable via Castor,   //
00024 // rfio, dcap, etc.                                                     //
00025 // The merging interface allows files containing histograms and trees   //
00026 // to be merged, like the standalone hadd program.                      //
00027 //                                                                      //
00028 //////////////////////////////////////////////////////////////////////////
00029 
00030 #ifndef ROOT_TObject
00031 #include "TObject.h"
00032 #endif
00033 #ifndef ROOT_TString
00034 #include "TString.h"
00035 #endif
00036 #ifndef ROOT_TStopwatch
00037 #include "TStopwatch.h"
00038 #endif
00039 
00040 class TList;
00041 class TFile;
00042 class TDirectory;
00043 
00044 
00045 class TFileMerger : public TObject {
00046 private:
00047    TFileMerger(const TFileMerger&); // Not implemented
00048    TFileMerger& operator=(const TFileMerger&); // Not implemented
00049 
00050 protected:
00051    TStopwatch     fWatch;           // stop watch to measure file copy speed
00052    TList         *fFileList;        // a list of files, which shall be merged
00053    TFile         *fOutputFile;      // the outputfile for merging
00054    TString        fOutputFilename;  // the name of the outputfile for merging
00055    TString        fOutputFilename1; // the name of the temporary outputfile for merging
00056    Bool_t         fFastMethod;      // True if using Fast merging algorithm (default)
00057    Bool_t         fNoTrees;         // True if Trees should not be merged (default is kFALSE)
00058 
00059    Bool_t             fLocal;           // Makes local copies of merging files if True (default is kTRUE)
00060    Bool_t             fHistoOneGo;      // Merger histos in one go (default is kTRUE)
00061    TList                *fMergeList;       // list of the files need to be merged
00062 
00063 public:
00064    TFileMerger(Bool_t isLocal = kTRUE, Bool_t histoOneGo = kTRUE);
00065    virtual ~TFileMerger();
00066 
00067    const char *GetOutputFileName() const { return fOutputFilename; }
00068    TList      *GetMergeList() const { return fMergeList;  }
00069 
00070     //--- file management interface
00071    virtual Bool_t SetCWD(const char * /*path*/) { MayNotUse("SetCWD"); return kFALSE; }
00072    virtual const char *GetCWD() { MayNotUse("GetCWD"); return 0; }
00073 
00074    //--- file merging interface
00075    virtual void   Reset();
00076    virtual Bool_t AddFile(const char *url, Bool_t cpProgress = kTRUE);
00077    virtual Bool_t OutputFile(const char *url);
00078    virtual void   PrintFiles(Option_t *options);
00079    virtual Bool_t Merge(Bool_t = kTRUE);
00080    virtual Bool_t MergeRecursive(TDirectory *target, TList *sourcelist);
00081    virtual void   SetFastMethod(Bool_t fast=kTRUE)  {fFastMethod = fast;}
00082    virtual void   SetNotrees(Bool_t notrees=kFALSE) {fNoTrees = notrees;}
00083 
00084    ClassDef(TFileMerger,2)  // File copying and merging services
00085 };
00086 
00087 #endif

Generated on Tue Jul 5 14:26:49 2011 for ROOT_528-00b_version by  doxygen 1.5.1