Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

marlin::Processor Class Reference

#include <Processor.h>

Inheritance diagram for marlin::Processor:

marlin::DataSourceProcessor marlin::LCIOOutputProcessor marlin::SimpleFastMCProcessor marlin::TestProcessor tpc_tracking::CustomMarlinProcessor tpc_tracking::CustomMarlinProcessor marlin::StdHepReader EventInfoProcessor EventInfoProcessor LoadSettingsProcessor LoadSettingsProcessor PutChargeOnPadsProcessor PutChargeOnPadsProcessor tpc_tracking::LoadPadGeometryProcessor tpc_tracking::LoadPadGeometryProcessor EventInfoProcessor EventInfoProcessor LoadSettingsProcessor LoadSettingsProcessor PutChargeOnPadsProcessor PutChargeOnPadsProcessor tpc_tracking::LoadPadGeometryProcessor tpc_tracking::LoadPadGeometryProcessor List of all members.

Public Member Functions

 Processor (const std::string &typeName)
virtual ~Processor ()
virtual ProcessornewProcessor ()=0
virtual void init ()
virtual void processRunHeader (LCRunHeader *)
virtual void processEvent (LCEvent *)
virtual void check (LCEvent *)
virtual void end ()
virtual const std::string & type () const
virtual const std::string & name () const
virtual StringParametersparameters ()
virtual void printDescription ()
virtual void printDescriptionXML (std::ostream &stream=std::cout)
virtual void printParameters ()
const std::string & description ()
bool isFirstEvent ()
std::string getLCIOInType (const std::string &colName)
std::string getLCIOOutType (const std::string &colName)
bool isInputCollectionName (const std::string &parameterName)
bool isOutputCollectionName (const std::string &parameterName)

Protected Member Functions

void setReturnValue (bool val)
void setReturnValue (const std::string &name, bool val)
template<class T>
void registerProcessorParameter (const std::string &name, const std::string &description, T &parameter, const T &defaultVal, int setSize=0)
void registerInputCollection (const std::string &type, const std::string &name, const std::string &description, std::string &parameter, const std::string &defaultVal, int setSize=0)
void registerOutputCollection (const std::string &type, const std::string &name, const std::string &description, std::string &parameter, const std::string &defaultVal, int setSize=0)
void registerInputCollections (const std::string &type, const std::string &name, const std::string &description, StringVec &parameter, const StringVec &defaultVal, int setSize=0)
template<class T>
void registerOptionalParameter (const std::string &name, const std::string &description, T &parameter, const T &defaultVal, int setSize=0)
bool parameterSet (const std::string &name)

Protected Attributes

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

Private Member Functions

virtual void setProcessorParameters (StringParameters *parameters)
virtual void updateParameters ()
virtual void setName (const std::string &name)
virtual void setParameters (StringParameters *parameters)
virtual void baseInit ()
void setFirstEvent (bool isFirstEvent)
void setLCIOInType (const std::string &colName, const std::string &lcioInType)
void setLCIOOutType (const std::string &collectionName, const std::string &lcioOutType)
const ProcParamMapprocMap ()
 Processor ()

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.22 2006/12/18 16:11:49 gaede Exp

Definition at line 48 of file Processor.h.


Constructor & Destructor Documentation

marlin::Processor::Processor const std::string &  typeName  ) 
 

Default constructor - subclasses need to call this in their default constructor.

Definition at line 11 of file Processor.cc.

marlin::Processor::~Processor  )  [virtual]
 

Destructor

Definition at line 25 of file Processor.cc.

References _parameters.

marlin::Processor::Processor  )  [private]
 

Definition at line 23 of file Processor.cc.


Member Function Documentation

void marlin::Processor::baseInit  )  [private, virtual]
 

Sets the registered steering parameters before calling init()

Definition at line 204 of file Processor.cc.

References init(), and updateParameters().

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

Called for every event - right after processEvent() has been called for all processors. Use to check processing and/or produce check plots.

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

Definition at line 89 of file Processor.h.

const std::string& marlin::Processor::description  )  [inline]
 

Description of processor.

Definition at line 126 of file Processor.h.

Referenced by marlin::CMProcessor::CMProcessor(), printDescription(), and printDescriptionXML().

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

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.

Reimplemented in tpc_tracking::CustomMarlinProcessor, marlin::LCIOOutputProcessor, marlin::SimpleFastMCProcessor, marlin::StdHepReader, marlin::TestProcessor, and tpc_tracking::CustomMarlinProcessor.

Definition at line 96 of file Processor.h.

Referenced by marlin::CCProcessor::clearParameters(), marlin::ProcessorMgr::dumpRegisteredProcessors(), marlin::ProcessorMgr::dumpRegisteredProcessorsXML(), marlin::ProcessorMgr::getAvailableProcessorTypes(), marlin::XMLFixCollTypes::parse(), and marlin::ProcessorMgr::readDataSource().

std::string marlin::Processor::getLCIOInType const std::string &  colName  ) 
 

Return the LCIO input type for the collection colName - empty string if colName is not a registered collection name

Definition at line 231 of file Processor.cc.

References _inTypeMap, and isInputCollectionName().

Referenced by marlin::CCProcessor::addColsFromParam(), and marlin::XMLFixCollTypes::parse().

std::string marlin::Processor::getLCIOOutType const std::string &  colName  ) 
 

Return the LCIO output type for the collection colName - empty string if colName is not a registered collection name

Definition at line 240 of file Processor.cc.

References _outTypeMap, and isOutputCollectionName().

Referenced by marlin::CCProcessor::addColsFromParam(), and marlin::XMLFixCollTypes::parse().

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 tpc_tracking::CustomMarlinProcessor, tpc_tracking::LoadPadGeometryProcessor, LoadSettingsProcessor, marlin::LCIOOutputProcessor, marlin::SimpleFastMCProcessor, marlin::StdHepReader, marlin::TestProcessor, tpc_tracking::CustomMarlinProcessor, tpc_tracking::LoadPadGeometryProcessor, and LoadSettingsProcessor.

Definition at line 74 of file Processor.h.

Referenced by baseInit().

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

True if first event in processEvent(evt) - use this e.g. to initialize histograms etc.

Definition at line 131 of file Processor.h.

Referenced by marlin::SimpleFastMCProcessor::check(), and marlin::StdHepReader::readDataSource().

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

Definition at line 249 of file Processor.cc.

References _inTypeMap.

Referenced by marlin::CCProcessor::addColsFromParam(), getLCIOInType(), marlin::XMLFixCollTypes::parse(), and printDescriptionXML().

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

True if the given parameter defines an LCIO output collection

Definition at line 257 of file Processor.cc.

References _outTypeMap.

Referenced by marlin::CCProcessor::addColsFromParam(), getLCIOOutType(), marlin::XMLFixCollTypes::parse(), and printDescriptionXML().

virtual const std::string& marlin::Processor::name  )  const [inline, virtual]
 

Return name of this processor.

Definition at line 105 of file Processor.h.

Referenced by marlin::TestProcessor::check(), marlin::TestProcessor::end(), marlin::SimpleFastMCProcessor::end(), marlin::LCIOOutputProcessor::end(), marlin::TestProcessor::init(), printDescriptionXML(), printParameters(), marlin::TestProcessor::processEvent(), marlin::TestProcessor::processRunHeader(), marlin::ProcessorMgr::setProcessorReturnValue(), marlin::SkipEventException::SkipEventException(), and marlin::StopProcessingException::StopProcessingException().

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

Return a new instance of the processor. Has to be implemented by subclasses.

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

Referenced by marlin::ProcessorMgr::addActiveProcessor(), and marlin::CMProcessor::CMProcessor().

virtual StringParameters* marlin::Processor::parameters  )  [inline, virtual]
 

Return parameters defined for this Processor.

Definition at line 109 of file Processor.h.

Referenced by marlin::TestProcessor::init().

bool marlin::Processor::parameterSet const std::string &  name  )  [protected]
 

Tests whether the parameter has been set in the steering file

Definition at line 194 of file Processor.cc.

References _map, and marlin::ProcessorParameter::valueSet().

Referenced by marlin::LCIOOutputProcessor::dropCollections(), and marlin::LCIOOutputProcessor::init().

void marlin::Processor::printDescription  )  [virtual]
 

Print information about this processor in ASCII steering file format.

Definition at line 75 of file Processor.cc.

References _map, marlin::ProcessorParameter::defaultValue(), marlin::ProcessorParameter::description(), description(), marlin::ProcessorParameter::isOptional(), marlin::ProcessorParameter::name(), marlin::ProcessorParameter::type(), and type().

Referenced by marlin::ProcessorMgr::dumpRegisteredProcessors().

void marlin::Processor::printDescriptionXML std::ostream &  stream = std::cout  )  [virtual]
 

Print information about this processor in XML steering file format.

Definition at line 125 of file Processor.cc.

References _inTypeMap, _map, _outTypeMap, marlin::ProcessorParameter::defaultValue(), marlin::ProcessorParameter::description(), description(), isInputCollectionName(), marlin::ProcessorParameter::isOptional(), isOutputCollectionName(), marlin::ProcessorParameter::name(), name(), marlin::ProcessorParameter::type(), and type().

Referenced by marlin::ProcessorMgr::dumpRegisteredProcessorsXML().

void marlin::Processor::printParameters  )  [virtual]
 

Print the parameters and its values.

Definition at line 53 of file Processor.cc.

References _map, and name().

Referenced by marlin::StdHepReader::init(), marlin::SimpleFastMCProcessor::init(), and marlin::LCIOOutputProcessor::init().

virtual void marlin::Processor::processEvent LCEvent  )  [inline, virtual]
 

Called for every event - the working horse.

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

Definition at line 83 of file Processor.h.

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

Called for every run, e.g. overwrite to initialize run dependent histograms.

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

Definition at line 79 of file Processor.h.

const ProcParamMap& marlin::Processor::procMap  )  [inline, private]
 

Helper function for fixing old steering files

Definition at line 300 of file Processor.h.

References marlin::ProcParamMap.

Referenced by marlin::XMLFixCollTypes::parse().

void marlin::Processor::registerInputCollection const std::string &  type,
const std::string &  name,
const std::string &  description,
std::string &  parameter,
const std::string &  defaultVal,
int  setSize = 0
[inline, protected]
 

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

Definition at line 195 of file Processor.h.

Referenced by marlin::SimpleFastMCProcessor::SimpleFastMCProcessor().

void marlin::Processor::registerInputCollections const std::string &  type,
const std::string &  name,
const std::string &  description,
StringVec parameter,
const StringVec defaultVal,
int  setSize = 0
[inline, protected]
 

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

Definition at line 223 of file Processor.h.

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.

Definition at line 241 of file Processor.h.

Referenced by marlin::LCIOOutputProcessor::LCIOOutputProcessor().

void marlin::Processor::registerOutputCollection const std::string &  type,
const std::string &  name,
const std::string &  description,
std::string &  parameter,
const std::string &  defaultVal,
int  setSize = 0
[inline, protected]
 

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

Definition at line 209 of file Processor.h.

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.

Definition at line 181 of file Processor.h.

Referenced by LoadSettingsProcessor::construct(), tpc_tracking::LoadPadGeometryProcessor::construct(), marlin::LCIOOutputProcessor::LCIOOutputProcessor(), marlin::SimpleFastMCProcessor::SimpleFastMCProcessor(), and marlin::StdHepReader::StdHepReader().

void marlin::Processor::setFirstEvent bool  isFirstEvent  )  [inline, private]
 

Called by ProcessorMgr

Definition at line 280 of file Processor.h.

void marlin::Processor::setLCIOInType const std::string &  colName,
const std::string &  lcioInType
[private]
 

Set the expected LCIO type for a parameter that refers to one or more input collections, e.g.:
   setReturnValue( "InputCollecitonName" , LCIO::MCPARTICLE ) ;
Set to LCIO::LCObject if more than one type is allowed, e.g. for a viewer processor.

Definition at line 227 of file Processor.cc.

References _inTypeMap.

void marlin::Processor::setLCIOOutType const std::string &  collectionName,
const std::string &  lcioOutType
[private]
 

Set the LCIO type for a parameter that refers to an output collections, i.e. the type has been defined with setLCIOOutType().

Definition at line 253 of file Processor.cc.

References _outTypeMap.

virtual void marlin::Processor::setName const std::string &  name  )  [inline, private, virtual]
 

Set processor name

Definition at line 270 of file Processor.h.

Referenced by marlin::ProcessorMgr::addActiveProcessor().

void marlin::Processor::setParameters StringParameters parameters  )  [private, virtual]
 

Initialize the parameters

Definition at line 34 of file Processor.cc.

References _parameters.

Referenced by marlin::ProcessorMgr::addActiveProcessor().

virtual void marlin::Processor::setProcessorParameters StringParameters parameters  )  [inline, private, virtual]
 

Allow friend class CCProcessor to change/reset processor parameters

Definition at line 262 of file Processor.h.

Referenced by marlin::CMProcessor::CMProcessor().

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

Definition at line 261 of file Processor.cc.

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.

Definition at line 222 of file Processor.cc.

Referenced by marlin::TestProcessor::processEvent().

virtual const std::string& marlin::Processor::type  )  const [inline, virtual]
 

Return type name for the processor (as set in constructor).

Definition at line 101 of file Processor.h.

Referenced by printDescription(), printDescriptionXML(), and marlin::ProcessorMgr::registerProcessor().

void marlin::Processor::updateParameters  )  [private, virtual]
 

Allow friend class CCProcessor to update processor parameters

Definition at line 212 of file Processor.cc.

References _map, _parameters, and marlin::ProcessorParameter::setValue().

Referenced by baseInit(), and marlin::CMProcessor::CMProcessor().


Friends And Related Function Documentation

friend class CMProcessor [friend]
 

Definition at line 51 of file Processor.h.

friend class ProcessorMgr [friend]
 

Definition at line 50 of file Processor.h.

friend class XMLFixCollTypes [friend]
 

Definition at line 52 of file Processor.h.


Member Data Documentation

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

Describes what the processor does. Set in constructor.

Definition at line 306 of file Processor.h.

LCIOTypeMap marlin::Processor::_inTypeMap [protected]
 

Definition at line 313 of file Processor.h.

Referenced by getLCIOInType(), isInputCollectionName(), printDescriptionXML(), and setLCIOInType().

bool marlin::Processor::_isFirstEvent [protected]
 

Definition at line 312 of file Processor.h.

ProcParamMap marlin::Processor::_map [protected]
 

Definition at line 311 of file Processor.h.

Referenced by parameterSet(), printDescription(), printDescriptionXML(), printParameters(), and updateParameters().

LCIOTypeMap marlin::Processor::_outTypeMap [protected]
 

Definition at line 314 of file Processor.h.

Referenced by getLCIOOutType(), isOutputCollectionName(), printDescriptionXML(), and setLCIOOutType().

StringParameters* marlin::Processor::_parameters [protected]
 

Definition at line 309 of file Processor.h.

Referenced by setParameters(), updateParameters(), and ~Processor().

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

Definition at line 308 of file Processor.h.

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

Definition at line 307 of file Processor.h.


The documentation for this class was generated from the following files:
Generated on Sun Jun 3 06:32:31 2007 for A TPC Tracking Environment by  doxygen 1.3.9.1