Diana Software
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
QRootFileWriterBase Class Reference

Base class for writers for diana and apollo root files. More...

Inheritance diagram for QRootFileWriterBase:
MRootFileWriter

Public Member Functions

 QRootFileWriterBase ()
 Default ctor. More...
 
virtual ~QRootFileWriterBase ()
 Defautl dtor (Calls Close()) More...
 
virtual void Open (const std::string &filename, const Diana::QEventInspector &evi)
 Open a file. More...
 
void Dump (const Diana::QEventInspector &evi)
 Write the event to the output tree. More...
 
void Done ()
 Done run at the end of the event loop. More...
 
void Close ()
 Close any open files. More...
 

Protected Member Functions

void AppendToInput ()
 Append the output files to the input files. More...
 
virtual void AppendFileToFile (const char *fromFile, const char *toFile) const
 Merge an individual file into another. More...
 

Protected Attributes

TFile * fRootOutput
 The current file being written. More...
 
QTreefTree
 The current tree being written. More...
 
QGlobalWriterfGlobalWriter
 The current global writer for the file. More...
 
QTFilePointer fRootOutputAddress
 Pointer to the output file. More...
 
bool fAppendToInput
 Flag to specify append to input. More...
 
bool fSkipGenerated
 Option to skip events that are generated by the reader. More...
 
std::map< std::string, std::string > fReaderWriterFiles
 Map of output files and the input files they are synced to. More...
 

Detailed Description

Base class for writers for diana and apollo root files.

Author
Jon Ouellet

Contains common branch access methods. All RootFileWriters should inherit from and overload this class.

Definition at line 23 of file QRootFileWriterBase.hh.

Constructor & Destructor Documentation

◆ QRootFileWriterBase()

QRootFileWriterBase::QRootFileWriterBase ( )

Default ctor.

Definition at line 22 of file QRootFileWriterBase.cc.

References fRootOutput, and fTree.

◆ ~QRootFileWriterBase()

virtual QRootFileWriterBase::~QRootFileWriterBase ( )
inlinevirtual

Defautl dtor (Calls Close())

Definition at line 28 of file QRootFileWriterBase.hh.

References Close().

Member Function Documentation

◆ AppendFileToFile()

void QRootFileWriterBase::AppendFileToFile ( const char *  fromFile,
const char *  toFile 
) const
protectedvirtual

Merge an individual file into another.

Called by AppendToInput(), to copy one tree into another file. This performs a fast copy of the tree from fromFile to toFile, and renames it to qtree_SEQUENCENAME. Appends any global data from toFile into fromFile.

Definition at line 242 of file QRootFileWriterBase.cc.

References QOptions::GetInstance(), and ROOT_GLOBAL_DIR.

Referenced by AppendToInput().

◆ AppendToInput()

void QRootFileWriterBase::AppendToInput ( )
protected

Append the output files to the input files.

Begins by opening all the input/output file pairs listed in fRWCommon->fReaderWriterFiles, and testing to make sure that the number of events matches. Then copies the tree from the output file to the input file. Does not perform any other kind of alignment test of the trees.

Definition at line 176 of file QRootFileWriterBase.cc.

References AppendFileToFile(), and fReaderWriterFiles.

Referenced by Done().

◆ Close()

void QRootFileWriterBase::Close ( )

Close any open files.

Definition at line 230 of file QRootFileWriterBase.cc.

References fRootOutput, and fTree.

Referenced by Done(), and ~QRootFileWriterBase().

◆ Done()

void QRootFileWriterBase::Done ( )

Done run at the end of the event loop.

Closes any open files. And runs AppendToInput(). Deletes any extraneous files or filelists.

Definition at line 154 of file QRootFileWriterBase.cc.

References AppendToInput(), Close(), QFileWriter::Done(), fAppendToInput, fGlobalWriter, fReaderWriterFiles, fRootOutputAddress, and QGlobalWriter::Set().

◆ Dump()

void QRootFileWriterBase::Dump ( const Diana::QEventInspector &  evi)

Write the event to the output tree.

Skip the event if it was generated by the reader and we are skipping such events.

Definition at line 145 of file QRootFileWriterBase.cc.

References fGlobalWriter, fRootOutputAddress, fSkipGenerated, fTree, QEvent::Get(), QEventInspector::GetEvent(), and QGlobalWriter::Set().

◆ Open()

void QRootFileWriterBase::Open ( const std::string &  filename,
const Diana::QEventInspector &  evi 
)
virtual

Member Data Documentation

◆ fAppendToInput

bool QRootFileWriterBase::fAppendToInput
protected

Flag to specify append to input.

Definition at line 88 of file QRootFileWriterBase.hh.

Referenced by Done(), and Open().

◆ fGlobalWriter

QGlobalWriter* QRootFileWriterBase::fGlobalWriter
protected

The current global writer for the file.

Definition at line 84 of file QRootFileWriterBase.hh.

Referenced by Done(), Dump(), and Open().

◆ fReaderWriterFiles

std::map<std::string,std::string> QRootFileWriterBase::fReaderWriterFiles
protected

Map of output files and the input files they are synced to.

Definition at line 92 of file QRootFileWriterBase.hh.

Referenced by AppendToInput(), Done(), and Open().

◆ fRootOutput

TFile* QRootFileWriterBase::fRootOutput
protected

The current file being written.

Definition at line 80 of file QRootFileWriterBase.hh.

Referenced by Close(), Open(), and QRootFileWriterBase().

◆ fRootOutputAddress

QTFilePointer QRootFileWriterBase::fRootOutputAddress
protected

Pointer to the output file.

Definition at line 86 of file QRootFileWriterBase.hh.

Referenced by Done(), Dump(), and Open().

◆ fSkipGenerated

bool QRootFileWriterBase::fSkipGenerated
protected

Option to skip events that are generated by the reader.

Definition at line 90 of file QRootFileWriterBase.hh.

Referenced by Dump().

◆ fTree

QTree* QRootFileWriterBase::fTree
protected

The current tree being written.

Definition at line 82 of file QRootFileWriterBase.hh.

Referenced by Close(), Dump(), Open(), and QRootFileWriterBase().


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