![]() |
Diana Software
|
Base class for writers for diana and apollo root files. More...
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... | |
| QTree * | fTree |
| The current tree being written. More... | |
| QGlobalWriter * | fGlobalWriter |
| 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... | |
Base class for writers for diana and apollo root files.
Contains common branch access methods. All RootFileWriters should inherit from and overload this class.
Definition at line 23 of file QRootFileWriterBase.hh.
| QRootFileWriterBase::QRootFileWriterBase | ( | ) |
Default ctor.
Definition at line 22 of file QRootFileWriterBase.cc.
References fRootOutput, and fTree.
|
inlinevirtual |
Defautl dtor (Calls Close())
Definition at line 28 of file QRootFileWriterBase.hh.
References Close().
|
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().
|
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().
| void QRootFileWriterBase::Close | ( | ) |
Close any open files.
Definition at line 230 of file QRootFileWriterBase.cc.
References fRootOutput, and fTree.
Referenced by Done(), and ~QRootFileWriterBase().
| 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().
| 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().
|
virtual |
Open a file.
Creates a new file, and writes the global data to it. Creates a QTree, and adds the branches from the QEvent that are set to be written. (If inclusive mode, then all objects in the event are written.)
Definition at line 27 of file QRootFileWriterBase.cc.
References ap, err, fAppendToInput, QTreeInfo::fExtSWVersion, fGlobalWriter, QAliases::FillFromFile(), QAliases::Find(), QTFilePointer::fP, fReaderWriterFiles, fRootOutput, fRootOutputAddress, QTreeInfo::fSoftwareRevision, fTree, QTreeInfo::fVersionTag, QEventInspector::Get(), QEventInspector::GetAliases(), QOptions::GetInstance(), QGlobalWriterDispatcher::GetInstance(), QVdt::GetName(), QVdt::GetString(), QEventLabel::GetStringLabel(), QBaseTree::GetTreeInfo(), QEventInspector::GetWriteLabels(), QGlobalWriterDispatcher::GetWriter(), QEventLabel::name, QEventLabel::owner, Q_CURRENT_WRITER, QERR_SUCCESS, and vec.
|
protected |
Flag to specify append to input.
Definition at line 88 of file QRootFileWriterBase.hh.
|
protected |
The current global writer for the file.
Definition at line 84 of file QRootFileWriterBase.hh.
|
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().
|
protected |
The current file being written.
Definition at line 80 of file QRootFileWriterBase.hh.
Referenced by Close(), Open(), and QRootFileWriterBase().
|
protected |
Pointer to the output file.
Definition at line 86 of file QRootFileWriterBase.hh.
|
protected |
Option to skip events that are generated by the reader.
Definition at line 90 of file QRootFileWriterBase.hh.
Referenced by Dump().
|
protected |
The current tree being written.
Definition at line 82 of file QRootFileWriterBase.hh.
Referenced by Close(), Dump(), Open(), and QRootFileWriterBase().