psana::Module Class Reference
[psana package]

Base class for user modules in psana framework. More...

#include <Module.h>

Inheritance diagram for psana::Module:

psana::Configurable psana::EventKeys psana::PrintEventId psana::PrintSeparator List of all members.

Public Types

 OK
 processing finished normally
 Skip
 skip all remaining modules for this event
 Stop
 finish with the events
 Abort
 abort immediately, no finalization
enum  Status { OK, Skip, Stop, Abort }
 Event processing status. More...

Public Member Functions

virtual ~Module ()
virtual void beginJob (Event &evt, Env &env)
 Method which is called once at the beginning of the job.
virtual void beginRun (Event &evt, Env &env)
 Method which is called at the beginning of new run.
virtual void beginCalibCycle (Event &evt, Env &env)
 Method which is called at the beginning of new calibration cycle (step).
virtual void event (Event &evt, Env &env)=0
 Method which is called with event data.
virtual void endCalibCycle (Event &evt, Env &env)
 Method which is called at the end of the calibration cycle (step).
virtual void endRun (Event &evt, Env &env)
 Method which is called at the end of the run.
virtual void endJob (Event &evt, Env &env)
 Method which is called once at the end of the job.
void reset ()
 reset module status
Status status () const
 get status
bool observeAllEvents () const
 Returns true if this module is interested in all events including skipped.

Protected Member Functions

 Module (const std::string &name, bool observeAllEvents=false)
 The one and only constructor, needs module name.
void skip ()
 Signal framework to skip current event and do not call other downstream modules.
void stop ()
 Signal framework to stop event loop and finish job gracefully.
void terminate ()
 Signal framework to terminate immediately.

Detailed Description

Base class for user modules in psana framework.

This is the major customization point available to users. All analysis code should inherit from this class and provide implementation of one or few methods which have access to all event and non-event data being processed by framework.

User modules have some influence on the framework event loop, by calling one of the skip(), stop(), or terminate() methods user module can signal the framework to either skip the processing of the current event, stop analysis gracefully (after closing all output files) or abort anaylis immediately.

Subclasses must implement at least event() method, other methods have default implementation which does nothing useful.

This software was developed for the LCLS project. If you use all or part of it, please give an appropriate acknowledgment.

Version:
$Id: Module.h 9879 2015-04-08 21:17:39Z davidsch@SLAC.STANFORD.EDU $
Author:
Andrei Salnikov

Definition at line 90 of file Module.h.


Member Enumeration Documentation

enum psana::Module::Status

Event processing status.

The value returned from status() signals to framework what it should do next.

Enumerator:
OK  processing finished normally
Skip  skip all remaining modules for this event
Stop  finish with the events
Abort  abort immediately, no finalization

Definition at line 98 of file Module.h.


Constructor & Destructor Documentation

psana::Module::~Module (  )  [virtual]

Definition at line 49 of file Module.cpp.

psana::Module::Module ( const std::string &  name,
bool  observeAllEvents = false 
) [protected]

The one and only constructor, needs module name.

Definition at line 39 of file Module.cpp.


Member Function Documentation

virtual void psana::Module::beginCalibCycle ( Event evt,
Env env 
) [virtual]

Method which is called at the beginning of new calibration cycle (step).

Parameters:
[in,out] evt Event object. In this call it does not have any event data but can be used to pass information between modules.
[in] env Environment object.

Referenced by psana::EventLoop::EventLoop().

virtual void psana::Module::beginJob ( Event evt,
Env env 
) [virtual]

Method which is called once at the beginning of the job.

Parameters:
[in,out] evt Event object. In this call it does not have any event data but can be used to pass information between modules.
[in] env Environment object.

Referenced by psana::EventLoop::EventLoop().

virtual void psana::Module::beginRun ( Event evt,
Env env 
) [virtual]

Method which is called at the beginning of new run.

Parameters:
[in,out] evt Event object. In this call it does not have any event data but can be used to pass information between modules.
[in] env Environment object.

Referenced by psana::EventLoop::EventLoop().

virtual void psana::Module::endCalibCycle ( Event evt,
Env env 
) [virtual]

Method which is called at the end of the calibration cycle (step).

Parameters:
[in,out] evt Event object. In this call it does not have any event data but can be used to pass information between modules.
[in] env Environment object.

Referenced by psana::EventLoop::EventLoop().

virtual void psana::Module::endJob ( Event evt,
Env env 
) [virtual]

Method which is called once at the end of the job.

Parameters:
[in,out] evt Event object. In this call it does not have any event data but can be used to pass information between modules.
[in] env Environment object.

Referenced by psana::EventLoop::EventLoop().

virtual void psana::Module::endRun ( Event evt,
Env env 
) [virtual]

Method which is called at the end of the run.

Parameters:
[in,out] evt Event object. In this call it does not have any event data but can be used to pass information between modules.
[in] env Environment object.

Referenced by psana::EventLoop::EventLoop().

virtual void psana::Module::event ( Event evt,
Env env 
) [pure virtual]

Method which is called with event data.

Parameters:
[in,out] evt Event object.
[in] env Environment object.

Referenced by psana::EventLoop::EventLoop().

bool psana::Module::observeAllEvents (  )  const [inline]

Returns true if this module is interested in all events including skipped.

Definition at line 182 of file Module.h.

void psana::Module::reset (  )  [inline]

reset module status

Definition at line 176 of file Module.h.

References OK.

void psana::Module::skip (  )  [inline, protected]

Signal framework to skip current event and do not call other downstream modules.

Note that this method does not skip code in the current module, control is returned back to the module. If you want to stop processing after this call then add a return statement.

Definition at line 196 of file Module.h.

References Skip.

Status psana::Module::status (  )  const [inline]

get status

Definition at line 179 of file Module.h.

void psana::Module::stop (  )  [inline, protected]

Signal framework to stop event loop and finish job gracefully.

Note that this method does not terminate processing in the current module. If you want to stop processing after this call then add a return statement.

Definition at line 204 of file Module.h.

References Stop.

void psana::Module::terminate (  )  [inline, protected]

Signal framework to terminate immediately.

Note that this method does not terminate processing in the current module. If you want to stop processing after this call then add a return statement.

Definition at line 212 of file Module.h.

References Abort.


The documentation for this class was generated from the following files:
Generated on 19 Dec 2016 for PSANAclasses by  doxygen 1.4.7