SFrame 3.6
SFileMerger Class Reference

Helper class for merging the TTree contents of ROOT files. More...

#include <core/include/SFileMerger.h>

Collaboration diagram for SFileMerger:

List of all members.

Public Member Functions

 SFileMerger ()
 Default constructor.
 ~SFileMerger ()
 Destructor.
Bool_t AddFile (const TString &fileName) throw ( SError )
 Add an input file that should be processed.
Bool_t OutputFile (const TString &fileName, const TString &mode="UPDATE") throw ( SError )
 Specify the output of the merging.
Bool_t Merge () throw ( SError )
 Execute the merging itself.

Detailed Description

Helper class for merging the TTree contents of ROOT files.

This is a dumbed-down version of the TFileMerger class written for PROOF. Unfortunately TFileMerger has some weird behaviour, otherwise I would've just used that class.

The class loops over all input files specified with AddInput(), and copies the TTree-s from them into the output file.

Note that the output can be an existing file. In this case the TTrees from the input files are merged into the TTrees already existing in the output file.

Version:
Revision:
335

Definition at line 46 of file SFileMerger.h.


Constructor & Destructor Documentation

SFileMerger::SFileMerger ( )

Default constructor.

Definition at line 30 of file SFileMerger.cxx.

SFileMerger::~SFileMerger ( )

Destructor.

Definition at line 35 of file SFileMerger.cxx.


Member Function Documentation

Bool_t SFileMerger::AddFile ( const TString &  fileName) throw ( SError )

Add an input file that should be processed.

This function adds a new file as input for the merging.

Parameters:
fileNameThe name of the input file
Returns:
kTRUE if everything went correctly, kFALSE otherwise

Definition at line 48 of file SFileMerger.cxx.

References REPORT_ERROR, REPORT_VERBOSE, and SError::SkipCycle.

Bool_t SFileMerger::Merge ( ) throw ( SError )

Execute the merging itself.

This is the main function of this class. It was heavily inspired by the TFileMerger::MergeRecursive function, which in turn is basically a copy of the MergeRootfile function of the hadd executable.

Returns:
kTRUE if the merge was successful, kFALSE otherwise

Definition at line 121 of file SFileMerger.cxx.

References DEBUG, SLogger::endmsg(), REPORT_ERROR, REPORT_VERBOSE, and WARNING.

Bool_t SFileMerger::OutputFile ( const TString &  fileName,
const TString &  mode = "UPDATE" 
) throw ( SError )

Specify the output of the merging.

This function specifies the name of the output file.

Parameters:
fileNameThe name of the output file to be created
modeMode to open the output file in
Returns:
kTRUE if everything went correctly, kFALSE otherwise

Definition at line 91 of file SFileMerger.cxx.

References REPORT_ERROR, REPORT_VERBOSE, and SError::SkipCycle.


The documentation for this class was generated from the following files: