Luiza
v03-01
|
Base class for Luiza processors. More...
#include <Processor.h>
Public Member Functions | |
Processor (const std::string &typeName) | |
Default constructor. More... | |
virtual | ~Processor () |
Destructor. | |
virtual Processor * | newProcessor ()=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 ¶meterName) |
Check if parameter defines collection. More... | |
bool | isOutputCollectionName (const std::string ¶meterName) |
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 ¶meter, 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 ¶meter, 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 ¶meter, 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 ¶meter, 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 ¶meter, 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. | |
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.
Modified for Luiza by A.F.Zarnecki, University of Warsaw, zarne cki@ fuw.e du.p l
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().
|
inlinevirtual |
Called for every loop - right after processData() call.
Can be used to check processing and/or produce check plots.
Reimplemented in luiza::FindLineTrajectory, luiza::CalibrateFrameObjects, luiza::WeightedAperturePhotometry, luiza::ObjectLightCurve, luiza::Astrometry, luiza::PixelClusterFinder, luiza::ApplyGausKernel, luiza::ImageNormalizationProcessor, luiza::SatelliteSearching, luiza::CalculateGausPSF, luiza::SelectNewObjects, luiza::FastAperturePhotometry, luiza::SociSelect, luiza::FitsImageWriter, luiza::AstroImageAdder, luiza::RootTreeWriter, luiza::ApplyFlatKernel, luiza::TableTextReader, luiza::MatchSkyCatalog, luiza::SelectTableData, luiza::SimpleImageAdder, luiza::PiTableReader, luiza::BackgroundImage, luiza::TableTextWriter, luiza::SimpleImageRotator, luiza::PiFitcImageReader, luiza::FitsTableReader, luiza::FitsImageReader, luiza::FitsTableWriter, luiza::ImageLaplace, luiza::ImageMedian, luiza::PiHalvesEqualizer, luiza::ExampleProcessor, luiza::SimpleSourceFinder, luiza::TestProcessor, and luiza::RootImageViewer.
|
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.
|
inlinevirtual |
Called after data processing is finished.
Called after all input sources are closed for clean up. Notice that processors are called in the inverse order of the init() method so that resources allocated in the first processor also will be available for all following processors.
Reimplemented in luiza::FindLineTrajectory, luiza::CalibrateFrameObjects, luiza::ObjectLightCurve, luiza::WeightedAperturePhotometry, luiza::Astrometry, luiza::PixelClusterFinder, luiza::ApplyGausKernel, luiza::ImageNormalizationProcessor, luiza::FitsImageWriter, luiza::AstroImageAdder, luiza::SelectNewObjects, luiza::ApplyFlatKernel, luiza::SatelliteSearching, luiza::SociSelect, luiza::CalculateGausPSF, luiza::FastAperturePhotometry, luiza::SimpleImageAdder, luiza::RootTreeWriter, luiza::MatchSkyCatalog, luiza::SelectTableData, luiza::TableTextReader, luiza::PiTableReader, luiza::TableTextWriter, luiza::BackgroundImage, luiza::SimpleImageRotator, luiza::PiFitcImageReader, luiza::FitsTableWriter, luiza::FitsTableReader, luiza::FitsImageReader, luiza::ImageLaplace, luiza::ExampleProcessor, luiza::ImageMedian, luiza::PiHalvesEqualizer, luiza::SimpleSourceFinder, luiza::TestProcessor, and luiza::RootImageViewer.
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().
|
inlinevirtual |
Called at the begin of the job before anything is read.
Use to initialize the processor, e.g. book histograms.
Reimplemented in luiza::FindLineTrajectory, luiza::WeightedAperturePhotometry, luiza::CalibrateFrameObjects, luiza::ObjectLightCurve, luiza::Astrometry, luiza::PixelClusterFinder, luiza::ApplyGausKernel, luiza::ImageNormalizationProcessor, luiza::FastAperturePhotometry, luiza::CalculateGausPSF, luiza::SatelliteSearching, luiza::SelectNewObjects, luiza::SociSelect, luiza::TableTextReader, luiza::RootTreeWriter, luiza::MatchSkyCatalog, luiza::SelectTableData, luiza::FitsImageWriter, luiza::AstroImageAdder, luiza::BackgroundImage, luiza::ApplyFlatKernel, luiza::SimpleImageRotator, luiza::SimpleImageAdder, luiza::PiFitcImageReader, luiza::PiTableReader, luiza::TableTextWriter, luiza::FitsImageReader, luiza::FitsTableReader, luiza::ImageLaplace, luiza::FitsTableWriter, luiza::ImageMedian, luiza::PiHalvesEqualizer, luiza::SimpleSourceFinder, luiza::ExampleProcessor, luiza::RootImageViewer, and luiza::TestProcessor.
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().
|
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:
References streamlog::out.
|
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() ) ;
|
pure virtual |
Return a new instance of the processor.
Has to be implemented by subclasses.
Implemented in luiza::FindLineTrajectory, luiza::WeightedAperturePhotometry, luiza::CalibrateFrameObjects, luiza::ObjectLightCurve, luiza::Astrometry, luiza::PixelClusterFinder, luiza::ApplyGausKernel, luiza::ImageNormalizationProcessor, luiza::FastAperturePhotometry, luiza::SatelliteSearching, luiza::CalculateGausPSF, luiza::SelectNewObjects, luiza::SociSelect, luiza::TableTextReader, luiza::RootTreeWriter, luiza::MatchSkyCatalog, luiza::SelectTableData, luiza::FitsImageWriter, luiza::AstroImageAdder, luiza::BackgroundImage, luiza::ApplyFlatKernel, luiza::SimpleImageRotator, luiza::SimpleImageAdder, luiza::PiFitcImageReader, luiza::PiTableReader, luiza::TableTextWriter, luiza::FitsImageReader, luiza::FitsTableReader, luiza::ImageLaplace, luiza::FitsTableWriter, luiza::ImageMedian, luiza::PiHalvesEqualizer, luiza::SimpleSourceFinder, luiza::ExampleProcessor, luiza::RootImageViewer, and luiza::TestProcessor.
Referenced by luiza::ProcessorMgr::addActiveProcessor().
|
inlinevirtual |
Called for every data processing loop.
This is where most of the work (analysis) is done. Data is exchanged between processors via GloriaDataContainer
Reimplemented in luiza::FindLineTrajectory, luiza::CalibrateFrameObjects, luiza::WeightedAperturePhotometry, luiza::ObjectLightCurve, luiza::Astrometry, luiza::PixelClusterFinder, luiza::ApplyGausKernel, luiza::ImageNormalizationProcessor, luiza::SatelliteSearching, luiza::SelectNewObjects, luiza::FastAperturePhotometry, luiza::CalculateGausPSF, luiza::SociSelect, luiza::RootTreeWriter, luiza::FitsImageWriter, luiza::TableTextReader, luiza::AstroImageAdder, luiza::MatchSkyCatalog, luiza::SelectTableData, luiza::ApplyFlatKernel, luiza::SimpleImageAdder, luiza::PiTableReader, luiza::BackgroundImage, luiza::TableTextWriter, luiza::SimpleImageRotator, luiza::PiFitcImageReader, luiza::FitsTableReader, luiza::FitsImageReader, luiza::FitsTableWriter, luiza::ImageLaplace, luiza::ImageMedian, luiza::PiHalvesEqualizer, luiza::ExampleProcessor, luiza::SimpleSourceFinder, luiza::TestProcessor, and luiza::RootImageViewer.
|
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().
|
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.
|
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().
|
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().
|
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().
|
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().
|
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().
|
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.
|
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().
|
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().