LCOV - code coverage report
Current view: top level - /opt/artdaq/srcs/artdaq-mfextensions/ErrorHandler/MessageAnalyzer - ma_function_countpercent.cpp (source / functions) Coverage Total Hit
Test: artdaq.info.cleaned Lines: 0.0 % 19 0
Test Date: 2025-09-04 00:45:34 Functions: 0.0 % 4 0

            Line data    Source code
       1              : 
       2              : #include "ErrorHandler/MessageAnalyzer/ma_function_countpercent.h"
       3              : #include "ErrorHandler/MessageAnalyzer/ma_condition.h"
       4              : #include "ErrorHandler/MessageAnalyzer/ma_participants.h"
       5              : 
       6              : #include <boost/algorithm/string.hpp>
       7              : 
       8              : using namespace novadaq::errorhandler;
       9              : 
      10            0 : REG_MA_FUNCTION(count_percent, ma_func_count_percent)
      11              : 
      12            0 : bool ma_func_count_percent::parse_arguments(anys_t const& args)
      13              : {
      14            0 :         if (args.empty() || args.size() < 2)
      15            0 :                 return false;
      16              : 
      17              :         // double count_percent(cond, 'type', 'group')
      18              :         // return the ratio of count(cond, 'type') to the # participant in 'group'
      19              :         //   type = 'SOURCE'
      20              :         //   type = 'TARGET'
      21              :         //   group : arbitary string
      22              : 
      23            0 :         std::string type = boost::any_cast<std::string>(args[0]);
      24            0 :         boost::to_upper(type);
      25              : 
      26            0 :         if (type == "SOURCE")
      27            0 :                 count_type = SOURCE;
      28            0 :         else if (type == "TARGET")
      29            0 :                 count_type = TARGET;
      30              :         else
      31            0 :                 return false;
      32              : 
      33            0 :         group = boost::any_cast<std::string>(args[1]);
      34              : 
      35            0 :         return true;
      36            0 : }
      37              : 
      38              : boost::any
      39            0 : ma_func_count_percent::evaluate(ma_condition const& cond, ma_cond_domain dom)
      40              : {
      41              :         // get triggering count from hitmap of the condition with give domain
      42            0 :         int count = cond.get_alarm_count(dom, count_type);
      43            0 :         int total = ma_participants::instance().get_group_participant_count(group);
      44              : 
      45            0 :         TLOG(TLVL_DEBUG) << "count = " << count << ", participants = " << total;
      46              : 
      47            0 :         return boost::any((double)count / total);
      48              : }
        

Generated by: LCOV version 2.0-1