Luiza  v03-01
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
luiza::RootTreeWriter Class Reference

Processor for writing numerical tables to root tree structure. More...

#include <RootTreeWriter.h>

Inheritance diagram for luiza::RootTreeWriter:
luiza::RootProcessor luiza::Processor

Public Member Functions

virtual RootTreeWriternewProcessor ()
 Return a new instance of the processor. More...
 
virtual void init ()
 
virtual void startAnalysis (GloriaDataContainer *data)
 
virtual void processData (GloriaDataContainer *data)
 
virtual void check (GloriaDataContainer *data)
 Called for every loop - right after processData() call. More...
 
virtual void concludeAnalysis (GloriaDataContainer *data)
 
virtual void end ()
 
- Public Member Functions inherited from luiza::Processor
 Processor (const std::string &typeName)
 Default constructor. More...
 
virtual ~Processor ()
 Destructor.
 
virtual const std::string & type () const
 Return type name for the processor (as set in constructor).
 
virtual const std::string & name () const
 Return name of this processor.
 
virtual const std::string & logLevelName () const
 Return name of the local verbosity level of this processor - "" if not set.
 
virtual StringParameters * parameters ()
 Return parameters defined for this Processor.
 
virtual void printDescription ()
 Print information about this processor in ASCII steering file format.
 
virtual void printDescriptionXML (std::ostream &stream=std::cout)
 Print information about this processor in XML steering file format.
 
template<class T >
void printParameters ()
 Print the parameters and their values depending on the given verbosity level.
 
void printParameters ()
 Print the parameters and their values with verbosity level MESSAGE.
 
const std::string & description ()
 Description of processor.
 
bool isFirstEvent ()
 True if first event in processEvent(evt) - use this e.g. to initialize histograms etc.
 
GloriaCollectionType getGloriaInType (const std::string &colName)
 Return the input type for the collection colName. More...
 
GloriaCollectionType getGloriaOutType (const std::string &colName)
 Return the output type for the collection colName. More...
 
bool isInputCollectionName (const std::string &parameterName)
 Check if parameter defines collection. More...
 
bool isOutputCollectionName (const std::string &parameterName)
 True if the given parameter defines an LCIO output collection */.
 

Protected Member Functions

void InitializeRootTree (string treeName, GloriaFitsTable *source)
 Tree definition based on table.
 
void FillRootTree (GloriaFitsTable *source)
 Tree definition based on table.
 
void WriteRootTree ()
 Write tree to file and close root file.
 
- Protected Member Functions inherited from luiza::Processor
void setReturnValue (bool val)
 Set the return value for this processor - typically at end of processEvent(). More...
 
void setReturnValue (const std::string &name, bool val)
 Set a named return value for this processor - typically at end of processEvent() More...
 
template<class T >
void registerProcessorParameter (const std::string &name, const std::string &description, T &parameter, const T &defaultVal, int setSize=0)
 Register a steering variable for this processor - call in constructor of processor. More...
 
void registerInputCollection (const GloriaCollectionType &type, const std::string &name, const std::string &description, std::string &parameter, const std::string &defaultVal, int setSize=0)
 Register parameter describing input collection. More...
 
void registerOutputCollection (const GloriaCollectionType &type, const std::string &name, const std::string &description, std::string &parameter, const std::string &defaultVal, int setSize=0)
 Register parameter describing output collection. More...
 
void registerInputCollections (const GloriaCollectionType &type, const std::string &name, const std::string &description, StringVec &parameter, const StringVec &defaultVal, int setSize=0)
 Register parameter describing input collections. More...
 
template<class T >
void registerOptionalParameter (const std::string &name, const std::string &description, T &parameter, const T &defaultVal, int setSize=0)
 Same as registerProcessorParameter except that the parameter is optional. More...
 
bool parameterSet (const std::string &name)
 Tests whether the parameter has been set in the steering file.
 
template<class T >
void message (const std::string &message) const
 Print message according to verbosity level. More...
 
template<class T >
void message (const std::basic_ostream< char, std::char_traits< char > > &m) const
 Similar to message(const std::string& message) More...
 
std::stringstream & log () const
 Returns an empty stringstream that is used by the message method.
 
virtual void setProcessorParameters (StringParameters *parameters)
 Allow friend class CCProcessor to change/reset processor parameters.
 
virtual void updateParameters ()
 Allow friend class CCProcessor to update processor parameters.
 
virtual void updateTelescopeParameters (std::string name)
 Allow to update processor parameters for given telescope name. More...
 
virtual void updateTelescopeParameters (GloriaFitsHeader *header)
 Update processor parameters based on FITS header. More...
 

Protected Attributes

string _tableCollectionName
 Name of the table collection which should be stored.
 
string _rootFileName
 Output file name root.
 
bool _oneFile
 Flag for output to single file.
 
bool _memoryResident
 Flag for keeping output tree in memory.
 
bool _addCounter
 Flag for output to single file.
 
std::vector< std::string > _selectedColumns
 Table columns to be stored.
 
std::vector< std::string > _intHeaderRecords
 Header records to be stored as long integers.
 
std::vector< std::string > _floatHeaderRecords
 Header records to be stored as doubles.
 
TTree * _outputTree
 Temporary table to prepare text output.
 
string _outputFileName
 Output file name.
 
TFile * _outputFile
 Output file pointer.
 
int _nLoops
 Loop counter.
 
int _nTables
 Table counter, used to number file name.
 
int _nWritten
 Counter for tables successfully written to file.
 
int _iRow
 Row counter.
 
long * _intBranch
 Pointer to table of long values.
 
double * _floatBranch
 Pointer to table of long values.
 
bool _inLoop
 Flag to recognize event loop.
 
- Protected Attributes inherited from luiza::Processor
std::string _description
 Describes what the processor does. Set in constructor.
 

Static Protected Attributes

static TApplication * rootApl
 Main root application instance.
 

Detailed Description

Processor for writing numerical tables to root tree structure.

This processor converts tables to root tree and stores as binary root file. They can then loaded directly into root.

Input
Tables are taken from the data collection. User has to specify in the steering file:
Parameters
TableCollectionName- Name of the table collection which should be stored to file(s)
Output
GloriaFitsTables from given collection are stored to root tree(s). Root file names consist of file name root, table number (if multiple files should be created; starting from 1) and .root extension. Tables are stored at each loop unless the collection is permanent - then they are stored only at concludeAnalysis() call.
Parameters
RootFileName- Output file name root, which will be appended by the table number, if multiple root files are created, and extension. If the path name is given (ending with '/'), input file name is used.
OneFile- flag for storing all tables in one big tree (default is true).
MemoryResident- flag for filling created tree in memory and writing to the file only when completed (memory resident tree) or writing it to disk while filling (disk resident tree). Default is true, i.e. memory resident, which can however consume significant amount of memory.
SelectedColumns- names of columns to be stored in the tree. If not specified (empty list) all columns are written.
AddCounter- flag to add table number (if one file is created) and row number as the variables in the generated tree.
IntHeaderRecords- list of FITS header fields to be added as long integer numbers to the root tree.
FloatHeaderRecords- list of FITS header fields to be added as double numbers to the root tree.
Author
A.F. Zarnecki, University of Warsaw

Member Function Documentation

void luiza::RootTreeWriter::check ( GloriaDataContainer )
virtual

Called for every loop - right after processData() call.

Can be used to check processing and/or produce check plots.

Reimplemented from luiza::Processor.

void luiza::RootTreeWriter::concludeAnalysis ( GloriaDataContainer data)
virtual

Called after all data loops to conclude analysis

Reimplemented from luiza::Processor.

References _inLoop, _nTables, _nWritten, _oneFile, _outputTree, _tableCollectionName, FillRootTree(), InitializeRootTree(), luiza::Processor::setReturnValue(), and WriteRootTree().

Referenced by processData().

void luiza::RootTreeWriter::end ( )
virtual

Called after data processing for clean up.

Reimplemented from luiza::Processor.

void luiza::RootTreeWriter::init ( )
virtual

Called at the begin of the job before anything is read. Use to initialize the processor, e.g. book histograms.

Reimplemented from luiza::Processor.

References _floatBranch, _inLoop, _intBranch, _nLoops, _nTables, _nWritten, _outputFile, _outputTree, luiza::Processor::name(), and luiza::Processor::parameters().

RootTreeWriter * luiza::RootTreeWriter::newProcessor ( )
virtual

Return a new instance of the processor.

Has to be implemented by subclasses.

Implements luiza::Processor.

void luiza::RootTreeWriter::processData ( GloriaDataContainer data)
virtual

Called for every data collection

Reimplemented from luiza::Processor.

References _inLoop, _nLoops, _tableCollectionName, and concludeAnalysis().

void luiza::RootTreeWriter::startAnalysis ( GloriaDataContainer data)
virtual

Called for before first data loop

Reimplemented from luiza::Processor.


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