MarlinMT  0.1.0
marlinmt::Statusmonitor Class Reference

Simple processor for writing out a status message every n-th event. More...

Inherits marlinmt::Processor.

Public Member Functions

 Statusmonitor ()
 
void init () override
 Initialize the processor. More...
 
void processRunHeader (RunHeader *run) override
 Called for every run. More...
 
void processEvent (EventStore *evt) override
 Called for every event - the working horse. More...
 
void end () override
 Called after data processing for clean up. More...
 
- Public Member Functions inherited from marlinmt::Processor
virtual ~Processor ()=default
 
 Processor (const std::string &t)
 Constructor. More...
 
std::optional< bool > runtimeOption (ERuntimeOption option) const
 Get the forced runtime option settings. More...
 
- Public Member Functions inherited from marlinmt::Component
 Component ()=delete
 No default constructor. More...
 
 Component (const Component &)=delete
 No copy or assignement. More...
 
Componentoperator= (const Component &)=delete
 
virtual ~Component ()=default
 Default destructor. More...
 
 Component (const std::string &type)
 Constructor with component type. More...
 
const std::string & type () const
 Get the component name. More...
 
const std::string & name () const
 Get the component name. More...
 
void setName (const std::string &n)
 Set the component name. More...
 
const std::string & description () const
 Get the component description. More...
 
void setDescription (const std::string &desc)
 Set the component description. More...
 
const Applicationapplication () const
 Get the application in which the component is registered. More...
 
Applicationapplication ()
 Get the application in which the component is registered. More...
 
template<class T >
Logging::StreamType log () const
 Log a message with specific log level. More...
 
Logging::StreamType debug () const
 Shortcut for log<DEBUG>() More...
 
Logging::StreamType message () const
 Shortcut for log<MESSAGE>() More...
 
Logging::StreamType warning () const
 Shortcut for log<WARNING>() More...
 
Logging::StreamType error () const
 Shortcut for log<ERROR>() More...
 
void setVerbosity (const std::string &level)
 Set the verbosity level. More...
 
const std::string & verbosity () const
 Get the verbosity level. More...
 
bool isInitialized () const
 Whether the component has been initialized. More...
 
void setup (Application *app)
 Setup the component. More...
 
void printParameters () const
 Print the component parameters. More...
 
template<class T >
void printParameters () const
 Print the component parameters at specific verbosity. More...
 
void setParameters (const ConfigSection &section, bool throwIfNotFound=false)
 Set the parameters from the configuration section. More...
 
void getParameters (ConfigSection &section, const std::set< std::string > &exclude={}) const
 Get the parameters from configurable object and populate the config section with. More...
 
- Public Member Functions inherited from marlinmt::Configurable
 Configurable ()=default
 
virtual ~Configurable ()=default
 
template<typename T >
std::shared_ptr< ParameterImpladdParameter (EParameterType paramType, const std::string &name, const std::string &desc, std::shared_ptr< T > value)
 Add a parameter. More...
 
template<typename T >
std::shared_ptr< ParameterImpladdParameter (EParameterType paramType, const std::string &name, const std::string &desc, std::shared_ptr< T > value, T defVal)
 Add a parameter. More...
 
template<typename T >
parameter (const std::string &name) const
 Get a parameter value. More...
 
template<typename T >
parameter (const std::string &name, const T &fallback) const
 Get a parameter value. More...
 
void checkParameter (const std::string &name) const
 Check if the parameter has been registered. More...
 
bool exists (const std::string &name) const
 Return true if the parameter has been registered. More...
 
bool isSet (const std::string &name) const
 Returns true if the parameter exists and is set, false otherwise. More...
 
void clear ()
 Remove all parameters. More...
 
void unset ()
 Unset all registered parameters. More...
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 

Private Attributes

UIntParameter _howOften
 
int _nRun {0}
 
std::atomic< int > _nEvt {0}
 

Additional Inherited Members

- Public Types inherited from marlinmt::Processor
enum  ERuntimeOption { ERuntimeOption::eCritical, ERuntimeOption::eClone }
 ERuntimeOption enumerator. More...
 
using RuntimeOptions = std::map< ERuntimeOption, bool >
 
- Public Types inherited from marlinmt::Component
using LoggerPtr = Logging::Logger
 
- Public Types inherited from marlinmt::Configurable
using ParameterMap = std::map< std::string, std::shared_ptr< ParameterImpl > >
 
using iterator = ParameterMap::iterator
 
using const_iterator = ParameterMap::const_iterator
 
- Protected Member Functions inherited from marlinmt::Processor
void setRuntimeOption (ERuntimeOption option, bool value)
 Force the runtime option to a given boolean value. More...
 
- Protected Attributes inherited from marlinmt::Component
std::string _type {}
 The component type. More...
 
std::string _name {}
 The component name. More...
 
std::string _description {"No description"}
 The component description. More...
 
Application_application {nullptr}
 The application in which the component has been registered. More...
 
LoggerPtr _logger {nullptr}
 The logger instance. More...
 
StringParameter _verbosity { *this, "Verbosity", "The component verbosity level", "MESSAGE" }
 The verbosity level of the logger (parameter) More...
 
- Protected Attributes inherited from marlinmt::Configurable
ParameterMap _parameters {}
 The parameter map. More...
 

Detailed Description

Simple processor for writing out a status message every n-th event.

Input - Prerequisites

none

Output

none HowOften print run and event number for every HowOften-th event

Author
A.Sailer CERN
Version
$Id:$

Definition at line 27 of file Statusmonitor.cc.

Constructor & Destructor Documentation

◆ Statusmonitor()

Member Function Documentation

◆ end()

void marlinmt::Statusmonitor::end ( )
overridevirtual

Called after data processing for clean up.

Reimplemented from marlinmt::Processor.

Definition at line 94 of file Statusmonitor.cc.

References _nEvt, _nRun, MARLINMT_DECLARE_PROCESSOR, and marlinmt::Component::name().

◆ init()

void marlinmt::Statusmonitor::init ( )
overridevirtual

Initialize the processor.

Called at the begin of the job before anything is read. Use to initialize the processor, e.g. book histograms.

Reimplemented from marlinmt::Processor.

Definition at line 69 of file Statusmonitor.cc.

References marlinmt::Component::printParameters().

◆ processEvent()

void marlinmt::Statusmonitor::processEvent ( EventStore evt)
overridevirtual

Called for every event - the working horse.

Reimplemented from marlinmt::Processor.

Definition at line 83 of file Statusmonitor.cc.

References _howOften, _nEvt, and _nRun.

◆ processRunHeader()

void marlinmt::Statusmonitor::processRunHeader ( RunHeader run)
overridevirtual

Called for every run.

Reimplemented from marlinmt::Processor.

Definition at line 77 of file Statusmonitor.cc.

References _nRun.

Member Data Documentation

◆ _howOften

UIntParameter marlinmt::Statusmonitor::_howOften
private
Initial value:
{*this, "howOften",
"Print event number every N events", 1 }

Definition at line 47 of file Statusmonitor.cc.

Referenced by processEvent().

◆ _nEvt

std::atomic<int> marlinmt::Statusmonitor::_nEvt {0}
private

Definition at line 52 of file Statusmonitor.cc.

Referenced by end(), and processEvent().

◆ _nRun

int marlinmt::Statusmonitor::_nRun {0}
private

Definition at line 51 of file Statusmonitor.cc.

Referenced by end(), processEvent(), and processRunHeader().


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