ATLAS Offline Software
Public Types | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
xAOD::TFileMerger Class Reference

Helper class for merging xAOD files. More...

#include <TFileMerger.h>

Inheritance diagram for xAOD::TFileMerger:
Collaboration diagram for xAOD::TFileMerger:

Public Types

enum  EMergeMode { kSlowMerge = 0, kFastMerge = 1 }
 Types of merging that can be done. More...
 

Public Member Functions

 TFileMerger ()
 Default constructor. More...
 
 ~TFileMerger ()
 Destructor. More...
 
StatusCode setOutputFileName (const std::string &name, const std::string &mode="RECREATE")
 Set the name of the output file that should be created. More...
 
StatusCode addFile (const std::string &name, bool copyLocally=false)
 Add a file to the list to be merged, by name. More...
 
StatusCode addMetaDataTool (const std::string &typeName)
 Add a metadata tool to be used during the merging. More...
 
StatusCode merge (EMergeMode mode=kFastMerge, ::Long64_t entries=kBigNumber)
 Execute the file merge itself. More...
 
TEvent::EAuxMode accessMode () const
 The access mode used for slow and metadata merging. More...
 
void setAccessMode (TEvent::EAuxMode mode)
 Set the access mode used for slow and metadata merging. More...
 
int verbosity () const
 The current verbosity level. More...
 
void setVerbosity (int value)
 Set verbosity level (meant for debugging mainly) More...
 
const std::set< std::string > & treesSkipped () const
 Get the names of the trees that will be skipped from the merge. More...
 
void addTreeToSkip (const std::string &name)
 Add a tree name that should be skipped during the merging. More...
 

Static Public Attributes

static const ::Long64_t kBigNumber = 1234567890
 Number of entries that are assumed to be never exceeded in a file. More...
 

Private Member Functions

StatusCode closeFiles ()
 Close all the open files. More...
 
StatusCode mergeDirectory (::TDirectory &input, ::TDirectory &output, EMergeMode mode, bool topLevelDir)
 Merge the contents of one directory from the input files. More...
 
StatusCode mergeObject (::TObject &input, ::TObject &output)
 Merge two top level objects that were found in the inputs. More...
 
StatusCode createMetaDataTools ()
 Instantiate the metadata handling tools. More...
 
std::vector< ::TBranch * > getMissingBranches (::TTree *first, ::TTree *second) const
 Get the auxiliary branches missing in one of the trees. More...
 
std::vector< ::TBranch * > getSkippedBranches (::TTree *tree) const
 Get the branches that should be skipped from merging. More...
 
StatusCode addAuxBranch (::TTree *otree, ::TBranch *ibranch) const
 Duplicate an auxiliary branch from the input into the output. More...
 

Private Attributes

std::vector< ::TFile * > m_input
 The list of input files to be merged. More...
 
std::vector< boolm_copiedInput
 Whether the files were copied locally before being merged. More...
 
::TFile * m_output
 The output file to write to. More...
 
std::set< std::string > m_treesToSkip
 Names of the TTrees to skip from the merge. More...
 
std::map< std::string, std::unique_ptr< TEvent > > m_events
 Helper objects for merging the xAOD Tree(s) from the input file(s) More...
 
std::vector< ::TFile * > m_helperFiles
 Helper in-memory files used during fast merging. More...
 
std::set< std::string > m_metaDataToolNames
 Names of the metadata handling tools. More...
 
std::map< std::string, THolderm_metaDataTools
 Metadata tools instantiated for the file merging. More...
 
TEvent::EAuxMode m_mode
 Access mode for the created TEvent objects. More...
 
::Long64_t m_entriesToMerge
 Events to merge into the output. More...
 
int m_verbosity
 Verbosity level. More...
 

Detailed Description

Helper class for merging xAOD files.

This is a slightly dubmed down version of ROOT's TFileMerger class in some respects, and is a bit smarter in other respects. It can be used by user code to merge xAOD files in a user friendly way from C++ code. It is also used by the xAODMerge application to do the heavy lifting during the merge.

Author
Attila Krasznahorkay Attil.nosp@m.a.Kr.nosp@m.aszna.nosp@m.hork.nosp@m.ay@ce.nosp@m.rn.c.nosp@m.h
Revision
784654
Date
2016-11-16 18:17:32 +0100 (Wed, 16 Nov 2016)

Definition at line 47 of file TFileMerger.h.

Member Enumeration Documentation

◆ EMergeMode

Types of merging that can be done.

Non-xAOD trees are always merged using fast TTree merging. It's only the method for the xAOD tree merging that can be controlled here.

Enumerator
kSlowMerge 

Merging is done using TEvent.

kFastMerge 

Merging is done using fast TTree merge.

Definition at line 71 of file TFileMerger.h.

71  {
72  kSlowMerge = 0,
73  kFastMerge = 1
74  };

Constructor & Destructor Documentation

◆ TFileMerger()

xAOD::TFileMerger::TFileMerger ( )

Default constructor.

◆ ~TFileMerger()

xAOD::TFileMerger::~TFileMerger ( )

Destructor.

Member Function Documentation

◆ accessMode()

TEvent::EAuxMode xAOD::TFileMerger::accessMode ( ) const

The access mode used for slow and metadata merging.

◆ addAuxBranch()

StatusCode xAOD::TFileMerger::addAuxBranch ( ::TTree *  otree,
::TBranch *  ibranch 
) const
private

Duplicate an auxiliary branch from the input into the output.

◆ addFile()

StatusCode xAOD::TFileMerger::addFile ( const std::string &  name,
bool  copyLocally = false 
)

Add a file to the list to be merged, by name.

◆ addMetaDataTool()

StatusCode xAOD::TFileMerger::addMetaDataTool ( const std::string &  typeName)

Add a metadata tool to be used during the merging.

◆ addTreeToSkip()

void xAOD::TFileMerger::addTreeToSkip ( const std::string &  name)

Add a tree name that should be skipped during the merging.

◆ closeFiles()

StatusCode xAOD::TFileMerger::closeFiles ( )
private

Close all the open files.

◆ createMetaDataTools()

StatusCode xAOD::TFileMerger::createMetaDataTools ( )
private

Instantiate the metadata handling tools.

◆ getMissingBranches()

std::vector< ::TBranch* > xAOD::TFileMerger::getMissingBranches ( ::TTree *  first,
::TTree *  second 
) const
private

Get the auxiliary branches missing in one of the trees.

◆ getSkippedBranches()

std::vector< ::TBranch* > xAOD::TFileMerger::getSkippedBranches ( ::TTree *  tree) const
private

Get the branches that should be skipped from merging.

◆ merge()

StatusCode xAOD::TFileMerger::merge ( EMergeMode  mode = kFastMerge,
::Long64_t  entries = kBigNumber 
)

Execute the file merge itself.

◆ mergeDirectory()

StatusCode xAOD::TFileMerger::mergeDirectory ( ::TDirectory &  input,
::TDirectory &  output,
EMergeMode  mode,
bool  topLevelDir 
)
private

Merge the contents of one directory from the input files.

◆ mergeObject()

StatusCode xAOD::TFileMerger::mergeObject ( ::TObject &  input,
::TObject &  output 
)
private

Merge two top level objects that were found in the inputs.

◆ setAccessMode()

void xAOD::TFileMerger::setAccessMode ( TEvent::EAuxMode  mode)

Set the access mode used for slow and metadata merging.

◆ setOutputFileName()

StatusCode xAOD::TFileMerger::setOutputFileName ( const std::string &  name,
const std::string &  mode = "RECREATE" 
)

Set the name of the output file that should be created.

◆ setVerbosity()

void xAOD::TFileMerger::setVerbosity ( int  value)

Set verbosity level (meant for debugging mainly)

◆ treesSkipped()

const std::set< std::string >& xAOD::TFileMerger::treesSkipped ( ) const

Get the names of the trees that will be skipped from the merge.

◆ verbosity()

int xAOD::TFileMerger::verbosity ( ) const

The current verbosity level.

Member Data Documentation

◆ kBigNumber

const ::Long64_t xAOD::TFileMerger::kBigNumber = 1234567890
static

Number of entries that are assumed to be never exceeded in a file.

Definition at line 77 of file TFileMerger.h.

◆ m_copiedInput

std::vector< bool > xAOD::TFileMerger::m_copiedInput
private

Whether the files were copied locally before being merged.

Definition at line 119 of file TFileMerger.h.

◆ m_entriesToMerge

::Long64_t xAOD::TFileMerger::m_entriesToMerge
private

Events to merge into the output.

Definition at line 140 of file TFileMerger.h.

◆ m_events

std::map< std::string, std::unique_ptr< TEvent > > xAOD::TFileMerger::m_events
private

Helper objects for merging the xAOD Tree(s) from the input file(s)

Definition at line 127 of file TFileMerger.h.

◆ m_helperFiles

std::vector< ::TFile* > xAOD::TFileMerger::m_helperFiles
private

Helper in-memory files used during fast merging.

Definition at line 129 of file TFileMerger.h.

◆ m_input

std::vector< ::TFile* > xAOD::TFileMerger::m_input
private

The list of input files to be merged.

Definition at line 117 of file TFileMerger.h.

◆ m_metaDataToolNames

std::set< std::string > xAOD::TFileMerger::m_metaDataToolNames
private

Names of the metadata handling tools.

Definition at line 132 of file TFileMerger.h.

◆ m_metaDataTools

std::map< std::string, THolder > xAOD::TFileMerger::m_metaDataTools
private

Metadata tools instantiated for the file merging.

Definition at line 134 of file TFileMerger.h.

◆ m_mode

TEvent::EAuxMode xAOD::TFileMerger::m_mode
private

Access mode for the created TEvent objects.

Definition at line 137 of file TFileMerger.h.

◆ m_output

::TFile* xAOD::TFileMerger::m_output
private

The output file to write to.

Definition at line 121 of file TFileMerger.h.

◆ m_treesToSkip

std::set< std::string > xAOD::TFileMerger::m_treesToSkip
private

Names of the TTrees to skip from the merge.

Definition at line 124 of file TFileMerger.h.

◆ m_verbosity

int xAOD::TFileMerger::m_verbosity
private

Verbosity level.

Definition at line 143 of file TFileMerger.h.


The documentation for this class was generated from the following file:
xAOD::TFileMerger::kSlowMerge
@ kSlowMerge
Merging is done using TEvent.
Definition: TFileMerger.h:72
xAOD::TFileMerger::kFastMerge
@ kFastMerge
Merging is done using fast TTree merge.
Definition: TFileMerger.h:73