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

Base class for Luiza processors. More...

#include <Processor.h>

Inheritance diagram for luiza::Processor:
luiza::ApplyFlatKernel luiza::ApplyGausKernel luiza::AstroImageAdder luiza::Astrometry luiza::BackgroundImage luiza::CalculateGausPSF luiza::CalibrateFrameObjects luiza::DataSourceProcessor luiza::ExampleProcessor luiza::FastAperturePhotometry luiza::FindLineTrajectory luiza::FitsImageWriter luiza::FitsTableWriter luiza::ImageLaplace luiza::ImageMedian luiza::ImageNormalizationProcessor luiza::MatchSkyCatalog luiza::ObjectLightCurve luiza::PiHalvesEqualizer luiza::PixelClusterFinder luiza::RootProcessor luiza::SatelliteSearching luiza::SelectNewObjects luiza::SelectTableData luiza::SimpleImageAdder luiza::SimpleImageRotator luiza::SimpleSourceFinder luiza::TableTextWriter luiza::TestProcessor luiza::WeightedAperturePhotometry

Public Member Functions

 Processor (const std::string &typeName)
 Default constructor. More...
 
virtual ~Processor ()
 Destructor.
 
virtual ProcessornewProcessor ()=0
 Return a new instance of the processor. More...
 
virtual void init ()
 Called at the begin of the job before anything is read. More...
 
virtual void startAnalysis (GloriaDataContainer *)
 Called before first data processing loop. More...
 
virtual void processData (GloriaDataContainer *)
 Called for every data processing loop. More...
 
virtual void check (GloriaDataContainer *)
 Called for every loop - right after processData() call. More...
 
virtual void concludeAnalysis (GloriaDataContainer *)
 Called after all data processing loops. More...
 
virtual void end ()
 Called after data processing is finished. 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 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::string _description
 Describes what the processor does. Set in constructor.
 

Detailed Description

Base class for Luiza processors.

Users can optionaly overwrite the following methods: init(), startAnalysis(), processData(), concludeAnalysis() and end().

Use registerProcessorParameter() to define all parameters that the module uses. Registered parameters are filled automatically before init() is called. With MyAplication -l you can print a list of available processors including the steering parameters they use/need.
With MyAplication -x you can print an example XML steering file for all known processors.

See also
init
startAnalysis
processData
concludeAnalysis
end
Author
Developed by by F. Gaede, DESY, for Marlin package, please refer to F. Gaede, Marlin and LCCD: Software tools for the ILC, Nucl.Instrum.Meth.A559:177-180,2006.

Modified for Luiza by A.F.Zarnecki, University of Warsaw, zarne.nosp@m.cki@.nosp@m.fuw.e.nosp@m.du.p.nosp@m.l

Constructor & Destructor Documentation

luiza::Processor::Processor ( const std::string &  typeName)

Default constructor.

Possible verbosity levels Global variable used to set the verbosity level

Subclasses need to call this in their default constructor.

References luiza::ProcessorMgr::instance(), registerOptionalParameter(), and luiza::ProcessorMgr::registerProcessor().

Member Function Documentation

virtual void luiza::Processor::check ( GloriaDataContainer )
inlinevirtual
virtual void luiza::Processor::concludeAnalysis ( GloriaDataContainer )
inlinevirtual

Called after all data processing loops.

This method is called to finalize the analysis, after all input data was read (or required number of loops was reached). Analysis of data collected in permanent data collections is possible here.

Reimplemented in luiza::FindLineTrajectory, luiza::CalibrateFrameObjects, luiza::ObjectLightCurve, luiza::SelectNewObjects, luiza::SatelliteSearching, luiza::FitsImageWriter, luiza::SociSelect, luiza::AstroImageAdder, luiza::ApplyFlatKernel, luiza::RootTreeWriter, luiza::SimpleImageAdder, luiza::MatchSkyCatalog, luiza::SelectTableData, luiza::PiTableReader, luiza::TableTextWriter, luiza::FitsTableWriter, luiza::ExampleProcessor, and luiza::TestProcessor.

virtual void luiza::Processor::end ( )
inlinevirtual
GloriaCollectionType luiza::Processor::getGloriaInType ( const std::string &  colName)

Return the input type for the collection colName.

Returns UndefinedCollection if colName is not a registered collection name

References isInputCollectionName().

GloriaCollectionType luiza::Processor::getGloriaOutType ( const std::string &  colName)

Return the output type for the collection colName.

Returns UndefinedCollection if colName is not a registered collection name

References isOutputCollectionName().

virtual void luiza::Processor::init ( )
inlinevirtual
bool luiza::Processor::isInputCollectionName ( const std::string &  parameterName)

Check if parameter defines collection.

True if the given parameter defines an input collection, i.e. the type has been defined with setGloriaInType().

Referenced by getGloriaInType(), and printDescriptionXML().

template<class T >
void luiza::Processor::message ( const std::string &  message) const
inlineprotected

Print message according to verbosity level.

Print message according to verbosity level of the templated parameter (one of DEBUG, MESSAGE, WARNING, ERROR ) and the global parameter "Verbosity". If Marlin is compiled w/o debug mode ($MARLINDEBUG not set) then DEBUG messages will be ignored completely at compile time, i.e. no output (and code!) will be generated, regardless of the value of the "Verbosity" parameter. This is useful in order to save CPU time in production mode.
Every line of the output string will be prepended by the verbosity level of the message and the processor name, e.g:

  [ MESSAGE "MyTestProcessor" ]  processing event 42 in run 4711

Use this method for simple strings. In order to use more complex messages, including numbers, use:

See also
void message( const std::basic_ostream<char, std::char_traits<char> >& m)

References streamlog::out.

template<class T >
void luiza::Processor::message ( const std::basic_ostream< char, std::char_traits< char > > &  m) const
inlineprotected

Similar to message(const std::string& message)

Same as message(const std::string& message) except that it allows the output of more complex messages in the argument using the log() method, e.g.:

message<MESSAGE>( log() 
                  << " processing event " << evt->getEventNumber() 
                  << "  in run "          << evt->getRunNumber() 
                  ) ;
virtual Processor* luiza::Processor::newProcessor ( )
pure virtual
virtual void luiza::Processor::processData ( GloriaDataContainer )
inlinevirtual
void luiza::Processor::registerInputCollection ( const GloriaCollectionType type,
const std::string &  name,
const std::string &  description,
std::string &  parameter,
const std::string &  defaultVal,
int  setSize = 0 
)
inlineprotected

Register parameter describing input collection.

Specialization of registerProcessorParameter() for a parameter that defines an input collection - can be used fo checking the consistency of the steering file.

Referenced by luiza::FindLineTrajectory::FindLineTrajectory().

void luiza::Processor::registerInputCollections ( const GloriaCollectionType type,
const std::string &  name,
const std::string &  description,
StringVec &  parameter,
const StringVec &  defaultVal,
int  setSize = 0 
)
inlineprotected

Register parameter describing input collections.

Specialization of registerProcessorParameter() for a parameter that defines one or several input collections - can be used fo checking the consistency of the steering file.

template<class T >
void luiza::Processor::registerOptionalParameter ( const std::string &  name,
const std::string &  description,
T &  parameter,
const T &  defaultVal,
int  setSize = 0 
)
inlineprotected

Same as registerProcessorParameter except that the parameter is optional.

The value of the parameter will still be set to the default value, which is used to print an example steering line. Use parameterSet() to check whether it actually has been set in the steering file.

Referenced by luiza::FindLineTrajectory::FindLineTrajectory(), and Processor().

void luiza::Processor::registerOutputCollection ( const GloriaCollectionType type,
const std::string &  name,
const std::string &  description,
std::string &  parameter,
const std::string &  defaultVal,
int  setSize = 0 
)
inlineprotected

Register parameter describing output collection.

Specialization of registerProcessorParameter() for a parameter that defines an output collection - can be used fo checking the consistency of the steering file.

Referenced by luiza::FindLineTrajectory::FindLineTrajectory().

template<class T >
void luiza::Processor::registerProcessorParameter ( const std::string &  name,
const std::string &  description,
T &  parameter,
const T &  defaultVal,
int  setSize = 0 
)
inlineprotected

Register a steering variable for this processor - call in constructor of processor.

The default value has to be of the same type as the parameter, e.g.
float _cut ;
...
registerProcessorParameter( "Cut", "cut...", _cut , float( 3.141592 ) ) ;
as implicit conversions don't work for templates.
The optional parameter setSize is used for formating the printout of parameters. This can be used if the parameter values are expected to come in sets of fixed size.

Referenced by luiza::FindLineTrajectory::FindLineTrajectory().

void luiza::Processor::setReturnValue ( bool  val)
protected

Set the return value for this processor - typically at end of processEvent().

The value can be used in a condition in the steering file referred to by the name of the processor.

References luiza::ProcessorMgr::instance(), and luiza::ProcessorMgr::setProcessorReturnValue().

Referenced by luiza::FitsTableWriter::concludeAnalysis(), luiza::TableTextWriter::concludeAnalysis(), luiza::RootTreeWriter::concludeAnalysis(), luiza::FitsImageReader::init(), luiza::FitsTableReader::init(), luiza::PiFitcImageReader::init(), luiza::PiTableReader::init(), luiza::SimpleImageAdder::init(), luiza::SelectTableData::init(), luiza::TableTextReader::init(), luiza::Astrometry::init(), luiza::TestProcessor::processData(), luiza::RootImageViewer::processData(), luiza::SimpleSourceFinder::processData(), luiza::ExampleProcessor::processData(), luiza::PiHalvesEqualizer::processData(), luiza::ImageMedian::processData(), luiza::FitsImageReader::processData(), luiza::FitsTableReader::processData(), luiza::PiFitcImageReader::processData(), luiza::SimpleImageRotator::processData(), luiza::BackgroundImage::processData(), luiza::PiTableReader::processData(), luiza::SimpleImageAdder::processData(), luiza::SelectTableData::processData(), luiza::MatchSkyCatalog::processData(), luiza::TableTextReader::processData(), luiza::AstroImageAdder::processData(), luiza::SociSelect::processData(), luiza::FastAperturePhotometry::processData(), luiza::SelectNewObjects::processData(), luiza::SatelliteSearching::processData(), luiza::ImageNormalizationProcessor::processData(), luiza::ApplyGausKernel::processData(), luiza::PixelClusterFinder::processData(), luiza::Astrometry::processData(), luiza::ObjectLightCurve::processData(), luiza::CalibrateFrameObjects::processData(), and luiza::FitsImageWriter::processImages().

void luiza::Processor::setReturnValue ( const std::string &  name,
bool  val 
)
protected

Set a named return value for this processor - typically at end of processEvent()

The value can be used in a condition in the steering file referred to by ProcessorName.name of the processor.

References luiza::ProcessorMgr::instance(), and luiza::ProcessorMgr::setProcessorReturnValue().

virtual void luiza::Processor::startAnalysis ( GloriaDataContainer )
inlinevirtual

Called before first data processing loop.

Can be used to initialize data collections required for analysis, eg. define permanent collections, or fill them with external data (from file, database or net). It is possible as GloriaDataContainer is already defined, contrary to init().

Reimplemented in luiza::FindLineTrajectory, luiza::CalibrateFrameObjects, luiza::ObjectLightCurve, luiza::ApplyGausKernel, luiza::CalculateGausPSF, luiza::SatelliteSearching, luiza::SelectNewObjects, luiza::SociSelect, luiza::RootTreeWriter, luiza::FitsImageWriter, luiza::MatchSkyCatalog, luiza::SelectTableData, luiza::AstroImageAdder, luiza::ApplyFlatKernel, luiza::SimpleImageAdder, luiza::PiTableReader, luiza::TableTextWriter, luiza::FitsTableWriter, luiza::ExampleProcessor, and luiza::TestProcessor.

void luiza::Processor::updateTelescopeParameters ( std::string  name)
protectedvirtual

Allow to update processor parameters for given telescope name.

Processor parameters are updated based on the information stored in the network configuration file. If parameters for given telescope are found there, they overwrite default parameters of the processor and parameters given by user. Telescope name given as a string.

References gloria::GloriaTelescope::parameters().

Referenced by luiza::BackgroundImage::processData(), luiza::FastAperturePhotometry::processData(), luiza::PixelClusterFinder::processData(), and updateTelescopeParameters().

void luiza::Processor::updateTelescopeParameters ( GloriaFitsHeader header)
protectedvirtual

Update processor parameters based on FITS header.

Processor parameters are updated based on the information stored in the network configuration file. If parameters for given telescope are found there, they overwrite default parameters of the processor and parameters given by user. Telescope name is taken from the FITS header

References gloria::GloriaFitsHeader::GetKeywordValue(), gloria::GloriaFitsHeader::IsKeywordSet(), updateParameters(), and updateTelescopeParameters().


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