ATLAS Offline Software
Loading...
Searching...
No Matches
MonitorROS.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "MonitorROS.h"
7
8#include <algorithm>
9#include <set>
10#include <utility>
11
12
13MonitorROS::MonitorROS(const std::string& name, const MonitoredRange* parent)
14 : MonitorBase(name, parent) {
15}
16
17
18StatusCode MonitorROS::newEvent(const CostData& data, const float weight) {
19
20 if (data.rosCollection().empty()){
21 ATH_MSG_DEBUG("The ROS collection is empty!");
22 }
23 const std::string robsIdStr{"robs_id"};
24 for (const xAOD::TrigComposite* tc : data.rosCollection()) {
25 auto robIds = tc->getDetail<std::vector<uint32_t>>(robsIdStr);
26 // Create set of unique ROS for this request
27 std::set<std::string> rosPerRequest;
28 for (uint32_t robId : robIds) {
29 if (data.costROSData().getROSForROB(robId).empty()){
30 ATH_MSG_WARNING("ROS for ROB 0x" << std::hex << robId << " is missing");
31 continue;
32 }
33 std::string rosForROB = data.costROSData().getROSForROB(robId);
34 if (!rosForROB.empty()){
35 rosPerRequest.insert(std::move(rosForROB));
36 }
37 }
38
39 for (const std::string& rosName : rosPerRequest) {
40 if (!counterExists(rosName)){
41 // Create a new counter using specialized constructor in order to pass number of bins for some of the histograms
42 unsigned nRobs = data.costROSData().getROBForROS(rosName).size(); // Number of all possible ROBs for this ROS
43 m_counters.insert( std::make_pair(rosName, newCounter(rosName, nRobs)) );
44 }
45
46 ATH_CHECK( getCounter(rosName)->newEvent(data, tc->index(), weight) );
47 }
48 }
49
50 return StatusCode::SUCCESS;
51}
52
53
54std::unique_ptr<CounterBase> MonitorROS::newCounter(const std::string& name) {
55 return std::make_unique<CounterROS>(name, this);
56}
57
58std::unique_ptr<CounterBase> MonitorROS::newCounter(const std::string& name, unsigned nRobs) {
59 return std::make_unique<CounterROS>(name, nRobs, this);
60}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
static Double_t tc
Caches and propagates event data to be used by monitoring algorithms.
Definition CostData.h:26
CounterBase * getCounter(const std::string &name)
Retrieve counter by name.
MonitorBase()=delete
Forbid default constructor.
bool counterExists(const std::string &name) const
Check if a counter of a given name exists.
std::unordered_map< std::string, std::unique_ptr< CounterBase > > m_counters
Storage of Monitor's collection of Counters.
virtual std::unique_ptr< CounterBase > newCounter(const std::string &name) override
Concrete counter instantiation.
virtual StatusCode newEvent(const CostData &data, const float weight=1.) override
Concrete dispatch method.
MonitorROS()=delete
Forbid default constructor.
Container which represents a time range and holds a collection of Monitors which monitor this range.
TrigComposite_v1 TrigComposite
Declare the latest version of the class.