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

Processor for reading data tables from input text files. More...

#include <TableTextReader.h>

Inheritance diagram for luiza::TableTextReader:
luiza::DataSourceProcessor luiza::Processor

Public Member Functions

virtual TableTextReadernewProcessor ()
 Return a new instance of the processor. More...
 
virtual void init ()
 
virtual void processData (GloriaDataContainer *data)
 
virtual void check (GloriaDataContainer *data)
 Called for every loop - right after processData() call. More...
 
virtual void end ()
 
- Public Member Functions inherited from luiza::DataSourceProcessor
bool OpenDataSource ()
 
- Public Member Functions inherited from luiza::Processor
 Processor (const std::string &typeName)
 Default constructor. More...
 
virtual ~Processor ()
 Destructor.
 
virtual void startAnalysis (GloriaDataContainer *)
 Called before first data processing loop. More...
 
virtual void concludeAnalysis (GloriaDataContainer *)
 Called after all data processing loops. More...
 
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 printEndMessage () const
 
- 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

std::vector< std::string > _tableFileList
 List of text table files to be read.
 
std::vector< std::string > _listFileList
 Names of files containing lists of table file names (one per line)
 
std::vector< std::string > _columnNames
 Names of columns in the input table.
 
std::vector< std::string > _columnTypes
 Types of columns in the input table.
 
std::vector< std::string > _columnUnits
 Units of columns in the input table.
 
std::vector< std::string > _columnDefaults
 Default values for columns in the input table.
 
std::string _tableCollectionName
 Name of the table collection to which tables from file should be stored.
 
bool _permanentCollection
 Flag for collections, which should not be deleted after loop is finished.
 
int _tablesPerLoop
 Number of tables to be read per processing loop (0 for all)
 
int _nLoops
 Loop counter.
 
int _nTables
 Table counter.
 
int _nFiles
 File counter.
 
GloriaFitsTable_inputTable
 Template of input table, as defined by user.
 
- Protected Attributes inherited from luiza::Processor
std::string _description
 Describes what the processor does. Set in constructor.
 

Detailed Description

Processor for reading data tables from input text files.

This processor reads data tables from given files. It is be used for reading eg. reference star list object lists stored previously. It is defined as luiza::DataSourceProcessor, so it can be the first processor in the analysis chain.

Input
Names of input text files can be given in two ways: directly, or by specifying names of list files (i.e. text files containing table file names, one per line).
Parameters
TableFileListList of table text files to be read
ListFileListNames of files containing list of table file names (one per line)
TablesPerLoopNumber of tables to be read in each processor call. Default is one. If zero value is set, all tables from the list are read at the first call (!)
Data format
As only data are read from text file, other parameters required to define a table need to be given as processor parameters. User has to specify ColumnNames and ColumnTypes. Optional parameters are ColumnDefaults and ColumnUnits (zero value or empty string will be used if missing).
Parameters
ColumnNamesNames which will be given to data columns, which are read from the text file.
ColumnTypesTypes of data columns in the text file. Valid types are I or L for long integer, F or D for double, S or T for text string. As space is used as column separator no spaces inside strings are allowes.
ColumnDefaultsDefault values for subsequent columns.
ColumnUnitsUnits for subsequent columns.
Output
Tables read as gloria::GloriaFitsTable are added to specified table collection (named table vector) and put into global gloria::GloriaDataContainer.
Parameters
TableCollectionNameName of the created GloriaTableCollection (default is "TextTable");
PermanentCollectionFlag indicating that created collection should be kept in memory for the whole processing time. This is needed in case of eg. tables containing reference stars.
Author
A.F. Zarnecki, University of Warsaw, zarne.nosp@m.cki@.nosp@m.fuw.e.nosp@m.du.p.nosp@m.l

Member Function Documentation

void luiza::TableTextReader::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.

References _tableCollectionName, and gloria::GloriaDataContainer::GetTableCollection().

void luiza::TableTextReader::end ( )
virtual

Called after data processing for clean up.

Reimplemented from luiza::Processor.

References printEndMessage().

void luiza::TableTextReader::init ( )
virtual
TableTextReader * luiza::TableTextReader::newProcessor ( )
virtual

Return a new instance of the processor.

Has to be implemented by subclasses.

Implements luiza::Processor.

void luiza::TableTextReader::printEndMessage ( ) const
protected

Test method for const.

References _nFiles, _nLoops, and _nTables.

Referenced by end().

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

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