Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | Related Pages

marlin::Processor Class Reference

Base class for Marlin processors. More...

#include <Processor.h>

Inheritance diagram for marlin::Processor:

marlin::AIDAProcessor marlin::ConditionsProcessor marlin::DataSourceProcessor marlin::LCIOOutputProcessor marlin::SimpleFastMCProcessor marlin::TestProcessor marlin::StdHepReader List of all members.

Public Member Functions

 Processor (const std::string &typeName)
 Default constructor - subclasses need to call this in their default constructor.

virtual ~Processor ()
 Destructor.

virtual ProcessornewProcessor ()=0
 Return a new instance of the processor.

virtual void init ()
 Called at the begin of the job before anything is read.

virtual void processRunHeader (LCRunHeader *)
 Called for every run, e.g.

virtual void processEvent (LCEvent *)
 Called for every event - the working horse.

virtual void check (LCEvent *)
 Called for every event - right after processEvent() has been called for this processor.

virtual void end ()
 Called after data processing for clean up in the inverse order of the init() method so that resources allocated in the first processor also will be available for all following processors.

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 StringParametersparameters ()
 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.

std::string getLCIOInType (const std::string &colName)
 Return the LCIO input type for the collection colName - empty string if colName is not a registered collection name.

std::string getLCIOOutType (const std::string &colName)
 Return the LCIO output type for the collection colName - empty string if colName is not a registered collection name.

bool isInputCollectionName (const std::string &parameterName)
 True if the given parameter defines an LCIO input collection, i.e.

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().

void setReturnValue (const std::string &name, bool val)
 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.

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.

void registerInputCollection (const std::string &type, const std::string &name, const std::string &description, std::string &parameter, const std::string &defaultVal, int setSize=0)
 Specialization of registerProcessorParameter() for a parameter that defines an input collection - can be used fo checking the consistency of the steering file.

void registerOutputCollection (const std::string &type, const std::string &name, const std::string &description, std::string &parameter, const std::string &defaultVal, int setSize=0)
 Specialization of registerProcessorParameter() for a parameter that defines an output collection - can be used fo checking the consistency of the steering file.

void registerInputCollections (const std::string &type, const std::string &name, const std::string &description, StringVec &parameter, const StringVec &defaultVal, int setSize=0)
 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 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.

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 of the templated parameter (one of DEBUG, MESSAGE, WARNING, ERROR ) and the global parameter "Verbosity".

template<class T> void message (const std::basic_ostream< char, std::char_traits< char > > &m) const
 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.:.

std::stringstream & log () const
 Returns an empty stringstream that is used by the message method.


Protected Attributes

std::string _description
 Describes what the processor does.

std::string _typeName
std::string _processorName
StringParameters_parameters
ProcParamMap _map
bool _isFirstEvent
LCIOTypeMap _inTypeMap
LCIOTypeMap _outTypeMap

Friends

class ProcessorMgr
class CMProcessor
class XMLFixCollTypes

Detailed Description

Base class for Marlin processors.

Users can optionaly overwrite the following methods:
init, processRun, processEvent 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

processRun

processEvent

end

Author:
F. Gaede, DESY
Version:
Id
Processor.h,v 1.38 2008/06/26 10:25:36 gaede Exp


Member Function Documentation

virtual void marlin::Processor::check LCEvent *   )  [inline, virtual]
 

Called for every event - right after processEvent() has been called for this processor.

Use to check processing and/or produce check plots.

Reimplemented in marlin::AIDAProcessor, marlin::SimpleFastMCProcessor, and marlin::TestProcessor.

virtual void marlin::Processor::init  )  [inline, virtual]
 

Called at the begin of the job before anything is read.

Use to initialize the processor, e.g. book histograms.

Reimplemented in marlin::AIDAProcessor, marlin::ConditionsProcessor, marlin::LCIOOutputProcessor, marlin::SimpleFastMCProcessor, marlin::StdHepReader, and marlin::TestProcessor.

bool marlin::Processor::isFirstEvent  )  [inline]
 

True if first event in processEvent(evt) - use this e.g.

to initialize histograms etc.

bool marlin::Processor::isInputCollectionName const std::string &  parameterName  ) 
 

True if the given parameter defines an LCIO input collection, i.e.

the type has been defined with setLCIOInType().

std::stringstream & marlin::Processor::log  )  const [protected]
 

Returns an empty stringstream that is used by the message method.

Deprecated:

template<class T>
void marlin::Processor::message const std::basic_ostream< char, std::char_traits< char > > &  m  )  const [inline, protected]
 

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() ) ;

Deprecated:
See also:
void message( const std::string& message )

std::stringstream& log()

template<class T>
void marlin::Processor::message const std::string &  message  )  const [inline, protected]
 

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)
Deprecated:

virtual Processor* marlin::Processor::newProcessor  )  [pure virtual]
 

Return a new instance of the processor.

Has to be implemented by subclasses.

Implemented in marlin::AIDAProcessor, marlin::ConditionsProcessor, marlin::LCIOOutputProcessor, marlin::SimpleFastMCProcessor, marlin::StdHepReader, and marlin::TestProcessor.

virtual void marlin::Processor::processRunHeader LCRunHeader *   )  [inline, virtual]
 

Called for every run, e.g.

overwrite to initialize run dependent histograms.

Reimplemented in marlin::AIDAProcessor, marlin::LCIOOutputProcessor, marlin::SimpleFastMCProcessor, and marlin::TestProcessor.

template<class T>
void marlin::Processor::registerOptionalParameter const std::string &  name,
const std::string &  description,
T &  parameter,
const T &  defaultVal,
int  setSize = 0
[inline, protected]
 

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.

template<class T>
void marlin::Processor::registerProcessorParameter const std::string &  name,
const std::string &  description,
T &  parameter,
const T &  defaultVal,
int  setSize = 0
[inline, protected]
 

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.

void marlin::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.


Member Data Documentation

std::string marlin::Processor::_description [protected]
 

Describes what the processor does.

Set in constructor.


The documentation for this class was generated from the following files:
Generated on Mon Jan 12 09:48:57 2009 for Marlin by doxygen 1.3.5