Background Process Environment
Process Environment Overview
The background process environments provide frameworks in which
monitoring or data processing tasks may be developed and run. The goals
of the background environments are:
- To provide a common implementation of necessary functionality like
- Program sequence control.
- Reading in data frames and spoon-feeding them to the processing
methods.
- Basic command operand parsing.
- Asynchronous request handling.
- Cleanup at termination (especially releasing online resources e.g.
shared buffers).
- To make this functionality easy to use.
- To allow monitors to be combined into a single process if and
where necessary.
- To provide an automatic upgrade path for contributed monitors.
This page describes the environments under which background monitors (i.e. those which don't require
direct interaction with the users) will be run. The basic process
skeletons are written in C++ and should be flexible enough to allow the
monitors implemented within this structure to be combined with other
monitors, run as threads or incorporated into other structures as new
needs develope.
Data Monitors are treated as C++ objects, based on an abstract base
class. Three such base classes have been defined to allow the developer
to chose based on the desired the input data characteristics (i.e. a continuous stream or segments
defined by meta-data) and data preprocessing preferences. The base
classes are:
- DMTBase: is an environment in
which raw frames are delivered to the user-defined monitor
methods. This environment is most useful for monitors scanning raw
data for which type conversion or data manipulation is minimal and
efficiency is essential.
- DatEnv: is an environment in
which the monitor processes reead a continuous stream of data in
segments of a specified length (stride). The base class unpacks
requested data from the frames into Time series (TSeries) containers for
processing by the monitor specific processing method.
- TrigEnv: is an environment in
which a list of triggers supplied to the base class at run time is used
to specify which data are to be read. A virtual method allows the author
to select triggers from the list and specify the extent of the data to
be read in the vicinity of the trigger.
DMTBase Environment
Overview
The DMTBase class provides an environment designed for raw data
monitors. These could include:
Frame format consistency tests
Raw data validity tests
Frame statistics generation.
A continuous stream of raw frames are deivered to a monitor-dependent
processing method. The monitor developer must write any code to extract
data from the frames.
Writing a Raw Data Monitor
To make a raw data monitor monitor, the developer defines a class based
on the DMTBase class. Sample
definition (DMTemplate.hh) and
implementation (DMTemplate.cc) files
are available via ftp and from the DMT documentation directory. In
addition to constructors and destructors for the derived Monitor class,
the DMTBase class requires a frame processing method (ProcessFrame
)
which is invoked to perform the monitor-specific processing. The
monitor developer may also provide a method (Attention
) to
specify how signals (SIGUSR1 & SIGIO
) are to be
handled.
DatEnv Environment
Overview
In addition to the basic framework provided by DMTBase, the DatEnv
environment automates the extraction of those data to be used by the
monitor from the frame. Data requested by the user in the monitor
constructor are packed into Time Series (TSeries) objects for easy
manipulation. The time interval over which the data will be collected
(the stride) can be set in the monitor constructor. The data handling
features of the DatEnv class alleviate the need for the developer to
learn the intricacies of the FrameCPP API or to provide code to combine
data from multiple frames.
Most features of the DatEnv class may be used directly from Root.
This opens the possibility of developing a DatEnv based monitor within
Root, and then compiling it for stand-alone running once the debugging
and verification have been performed.
Because of its easy access to tailored data samples, the DatEnv
framework is appropriate for most data processing monitors such as.
Noise spectrum monitoring
Violin mode tracking
Seismic spectrum analysis and monitoring.
Writing a Data Processing Monitor
To write a continuous input stream data processing program, the
developer defines a class based on the DatEnv
class. Sample definition (DatTemplate.hh)
and implementation (DatTemplate.cc)
files are available from cvs and from the DMT documentation directory.
In addition to constructors and destructors for the derived monitor
class, the DatEnv class requires a data processing method (
ProcessData
) which is
invoked to perform the monitor-specific processing. A method for
attention interrupt (SIGUSR1
) processing may also be
defined if the monitor must provide asynchronous I/O or data
processing. Other member data and methods will be defined in the base
class as the need for them is discovered. These may include:
- Monitor methods for handling external events (signals, etc.)
- Data and interface methods needed to inquire about or to modify
environmental properties.
TrigEnv Environment
Overview
The TrigEnv environment provides the same features as DatEnv, but takes
a series of data snippets rather than a continuous stream of data. The
input data is controlled by an xml list of triggers and a user supplied
trigger processing method. The base class reads the trigger from a list
and passes it to the virtual trigger processing method. This method
decides whether or not the raw data are to be examined and specifies the
start time and duration of the raw data to be examined. The processing
time stride can also be set in the trigger processing method.
Writing a Trigger Processing Monitor
To write a trigger processing monitor, the developer defines a class
based on the TrigEnv
class. Sample definition (TrigTemplate.hh)
and implementation (TrigTemplate.cc)
files are available from cvs and the DMT documentation directory. A
monitor author will generally specify a constructor, a destructor, a
trigger processing method (ProcessTrigger
) and a data
processing method (ProcessData
) which are invoked by the
base class processing method to perform the monitor-specific
processing. A method for attention interrupt (SIGUSR1 & SIGIO
)
handling may also be provided if the monitor needs to handle
asynchronous processing or I/O requests.
C++ Monitor Example
Creation of a monitor involves the completion of a class definition
and the implementation of the creation, destruction and data processing
methods. In general , the monitor is run by coding the
EXECDMT(class)
macro.
The following illustrates the C++ code needed for a DMTBase monitor.
Monitors based on the other environment classes are used in a similar
manner (see templates).
#include "DMTBase.hh"
#include "framecpp/frame.hh"
class MyClass : public
DMTBase {
public:
MyClass(int argc, const
char *argv[]);
~MyClass(void);
void ProcessFrame(FclHeader *Frame);
private:
// data members
};
EXECDMT(MyClass) // Generate a main function
MyClass::MyClass(int argc, const char *argv[])
: DMTBase(argc,argv)
{
.
. // Do initialization
.
}
void MyClass::ProcessFrame(FclHeader *Frame)
{
.
. // Process one data frame
.
}
MyClass::~MyClass(void)
{
.
. // Finish monitor processing
.
}
|
Last Update: April 30, 2003
Please send comments or suggestions to: John Zweizig