SFrame 3.6
core/include/SFileMerger.h
Go to the documentation of this file.
00001 // Dear emacs, this is -*- c++ -*-
00002 // $Id: SFileMerger.h 335 2012-11-21 14:11:47Z krasznaa $
00003 /***************************************************************************
00004  * @Project: SFrame - ROOT-based analysis framework for ATLAS
00005  * @Package: Core
00006  *
00007  * @author Stefan Ask       <Stefan.Ask@cern.ch>           - Manchester
00008  * @author David Berge      <David.Berge@cern.ch>          - CERN
00009  * @author Johannes Haller  <Johannes.Haller@cern.ch>      - Hamburg
00010  * @author A. Krasznahorkay <Attila.Krasznahorkay@cern.ch> - CERN/Debrecen
00011  *
00012  ***************************************************************************/
00013 
00014 #ifndef SFRAME_CORE_SFileMerger_H
00015 #define SFRAME_CORE_SFileMerger_H
00016 
00017 // STL include(s):
00018 #include <vector>
00019 
00020 // ROOT include(s):
00021 #include <TString.h>
00022 
00023 // Local include(s):
00024 #include "SError.h"
00025 #include "SLogger.h"
00026 
00027 // Forward declaration(s):
00028 class TFile;
00029 
00046 class SFileMerger {
00047 
00048 public:
00050    SFileMerger();
00052    ~SFileMerger();
00053 
00055    Bool_t AddFile( const TString& fileName ) throw( SError );
00057    Bool_t OutputFile( const TString& fileName,
00058                       const TString& mode = "UPDATE" ) throw( SError );
00059 
00061    Bool_t Merge() throw( SError );
00062 
00063 private:
00065    void CloseFiles();
00067    void MergeDirectory( TDirectory* input, TDirectory* output ) throw( SError );
00069    void MergeObjects( TObject* in, TObject* out ) throw( SError );
00070 
00071    std::vector< TFile* > m_inputFiles; 
00072    TFile*                m_outputFile; 
00073 
00074    mutable SLogger m_logger; 
00075 
00076 }; // class SFileMerger
00077 
00078 #endif // SFRAME_CORE_SFileMerger_H