Project

General

Profile

Sending metric data from User Code

From a Fragment Generator

In each artdaq application, there is a global pointer to a MetricManager instance (defined in artdaq:source:artdaq/DAQdata/Globals.hh). To send a metric to all defined plugins, use the following function:


void sendMetric(std::string const& name, T value, std::string const& unit, int level, bool applyPrefix = true, bool accumulate = true)

i.e.


if(metricMan != nullptr) metricMan->sendMetric("Test Metric", 1, "Tests", 5);

Note that the "accumulate" parameter should be false for metrics which should NOT be averaged, like event counters, but true for one which should, such as event rates. Also note that your CMakeLists.txt file must include MF_MessageLogger and ${ARTDAQ-CORE_UTILITIES} in the module's library list.