ATLAS Offline Software
Loading...
Searching...
No Matches
MonitorROS.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "MonitorROS.h"
7
8#include <algorithm>
9
10MonitorROS::MonitorROS(const std::string& name, const MonitoredRange* parent)
11 : MonitorBase(name, parent) {
12}
13
14
15StatusCode MonitorROS::newEvent(const CostData& data, const float weight) {
16
17 if (data.rosCollection().empty()){
18 ATH_MSG_DEBUG("The ROS collection is empty!");
19 }
20
21 for (const xAOD::TrigComposite* tc : data.rosCollection()) {
22 auto robIds = tc->getDetail<std::vector<uint32_t>>("robs_id");
23 // Create set of unique ROS for this request
24 std::set<std::string> rosPerRequest;
25 for (uint32_t robId : robIds) {
26 if (data.costROSData().getROSForROB(robId).empty()){
27 ATH_MSG_WARNING("ROS for ROB 0x" << std::hex << robId << " is missing");
28 continue;
29 }
30 std::string rosForROB = data.costROSData().getROSForROB(robId);
31 if (!rosForROB.empty()){
32 rosPerRequest.insert(std::move(rosForROB));
33 }
34 }
35
36 for (const std::string& rosName : rosPerRequest) {
37 if (!counterExists(rosName)){
38 // Create a new counter using specialized constructor in order to pass number of bins for some of the histograms
39 unsigned nRobs = data.costROSData().getROBForROS(rosName).size(); // Number of all possible ROBs for this ROS
40 m_counters.insert( std::make_pair(rosName, newCounter(rosName, nRobs)) );
41 }
42
43 ATH_CHECK( getCounter(rosName)->newEvent(data, tc->index(), weight) );
44 }
45 }
46
47 return StatusCode::SUCCESS;
48}
49
50
51std::unique_ptr<CounterBase> MonitorROS::newCounter(const std::string& name) {
52 return std::make_unique<CounterROS>(name, this);
53}
54
55std::unique_ptr<CounterBase> MonitorROS::newCounter(const std::string& name, unsigned nRobs) {
56 return std::make_unique<CounterROS>(name, nRobs, this);
57}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
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.