New features:
DQM Agent application provides
now a possibility of adding user-specific plug-ins as its Input or
Output streams. An implementation of the Input stream can be used to
get histograms which have to be checked by DQ algorithms. A user
specific instance of the Output stream is usable for writing the DQ
Results to some user specific place, e.g. text file, database, HTML
pages, etc.
Some changes are required for all DQ configurations !!!
Now each DQAgent must have at least 1 DQInput and 1
DQOutput streams associated with it in the OKS configuration database.
The file daq/sw/dqm-default-streams.data.xml
provides configuration objects for the default general streams.
Each agent must reference at least the DefaultInput
(via the DQInputs
relationship) and DefaultOutput
(via the DQOutputs
relationship) objects. In addition to that an agent which want its
results to be written to the COOL database must be linked with the CoolOutput
object as well.
Implementing custom stream
In order to implement a custom Output (or
Input) stream a user has to do the following steps:
- Declare a class which inherits from the dqm_core::Output interface and
implements the publishResult,
activate and deactivate functions (empty
implementations should be provided for the two addListener functions). The main
work is done by the publishResult
function which will be called any time a new DQ Result is produced. For
example:
class DQFileOutput : public dqm_core::Output
{
bool m_active;
std::string m_filename;
std::ofstream m_out;
// Constructor mas have fixed format. The parameters vector
// contains parameters from the OKS configuration DB
// Constructor may throw any exception which is based on ers::Issue
DQFileOutput( const std::vector<std::string> & parameters ) {
m_active = false;
}
};
- Create the OutputFactory class for your specific Output and
register it with the FactoryManager. One can do this "manually" by
declaring a new class which inherits from the dqm_core::OutputFactory and
implement the createOutput
function. A more simple (and preferred solution) is to use the helper
template class and just place a sinlgle line of code into your stream
implementation .cxx file, e.g.:
namespace
{
dqm_core::OutputFactoryT<DQFileOutput> __factory__( "DQFileOutput" );
}
- Compile and build a shared library from your class. Create OKS
configuration object of the DQOutput class which describes the
DQFileOutput.
IMPORTANT:
The value of the Name
attribute must be the same as the string which has been passed to the
factory registration object, i.e. "DQFileOutput".
<obj class="DQOutput" id="MyFileOutput">
<attr name="Name" type="string">"DQFileOutput"</attr>
<attr name="Library" type="string">"lib_my_dq_output.so"</attr>
<attr name="Parameters" type="string" num="1">
"/tmp/DQResults.txt"
</attr>
</obj>
- Last step is to add this object to the DQOutputs relationship of
the DQAgent.
<obj class="DQAgent" id="Calorimeter">
...
<rel name="DQInputs" num="1">
"DQInput" "DefaultInput"
</rel>
<rel name="DQOutputs" num="2">
"DQOutput" "DefaultOutput"
"DQOutput" "MyFileOutput"
</rel>
</obj>