BaseModule Class Reference
[modules - functions to process raw data in series]

Abstract base module class. More...

#include <BaseModule.hh>

Inheritance diagram for BaseModule:
ParameterList VParameterNode AverageWaveforms ChannelModule ConvertData GenericAnalysis ProcessedPlotter PulseFinder PulseShapeEval RawWriter RootGraphix RootWriter S1S2Evaluation SpectrumMaker SumChannels SumOfIntegralEval TriggerHistory WarpVeto

List of all members.

Public Member Functions

 BaseModule (const std::string &name="", const std::string &helptext="")
 Constructor takes module name.
virtual ~BaseModule ()
 virtual desctructor
const std::string & GetName ()
 Get the registered name of the module (and parameter list).
void SetName (const std::string &name)
 Set the name of the module.
virtual int Initialize ()
 Initialize the module before starting a run. Return 0 if no error.
virtual int Process (EventPtr event)=0
 Process a single event. Must be overridden. Return 0 if no error.
virtual int Finalize ()
 Finalize state after a run has processed. Return 0 if no error.
int HandleEvent (EventPtr event, bool process_now=false)
 This function is called to handle things like cuts before real processing.
int GetLastProcessReturn ()
 Get the return value of the last Process() call.
int AddDependency (const std::string &module)
 State that we want another module to run first.
template<class T >
int AddDependency ()
 Keep the templated function for backward compatibility.
const std::set< std::string > * GetDependencies ()
 Get the list of modules which this module depends on.
void AddProcessingCut (ProcessingCut *cut)
 Add a condition to determine whether this module will process an event.
const std::vector
< ProcessingCut * > * 
GetCuts ()
 Get the list of cuts.
void ClearCuts ()
 Clear the list of cuts.
bool CheckCuts (EventPtr event)
 Check whether <event> passes all defined cuts.

Public Attributes

bool enabled
 should this module be called?

Protected Attributes

int _last_process_return
 Value returned from last Process call.
std::set< std::string > _dependencies
 list of modules we need to run first
std::vector< ProcessingCut * > _cuts
 list of cuts to take before processing
std::set< int > _skip_channels
 list of channels not to process

Detailed Description

Abstract base module class.

All processing functions should inherit from BaseModule; EventHandler contains a set of BaseModule pointers.

Inherited classes must override the Process function, and can optionally override the Initialize and Finalize functions. For all the templated dependency functions to work, modules must also override the const std::string GetDefaultName() function.

UPDATE 2012-03-22 (bloer): Modules are no longer allowed to disable themselves during the Initialize() step. If config settings are found to have improper values, etc, the module should print an error message and return failure.

Dependencies have also been updated in several ways: 1) No more templates; dependencies are specified by name. If you really want to make sure you're using the right name, call AddDependency(Module::GetDefaultName())

2) The only thing the dependency mechanism does now is check that all listed dependencies are enabled after configuration. Previously, You could add "downstream" modules without explicitly adding their dependencies, e.g., you could add Integrator without first adding BaselineFinder, and it would automatically be added. This is no longer supported. Automated ordering of modules based on dependencies is also no longer supported. This means that it is up to the user to add modules in the right order, or things will not work! The only check that will be taken is, when you try to register a new module, if it's dependencies are not yet registered, you will get an error

3) As a consequence of 2), there is no longer and such thing as an optional dependency, since that only controlled ordering previously. ALL dependencies should be declared in the constructor

4) You can additionally add dependencies in the config file. This is primarily to handle auto-disabling of spectrum generators

Definition at line 60 of file BaseModule.hh.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines

Generated on 20 Jun 2014 for daqman by  doxygen 1.6.1