ATLAS Offline Software
MonitorROS.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "MonitorROS.h"
6 #include "../counters/CounterROS.h"
7 
8 #include <algorithm>
9 
10 MonitorROS::MonitorROS(const std::string& name, const MonitoredRange* parent)
11  : MonitorBase(name, parent) {
12 }
13 
14 
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(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 
51 std::unique_ptr<CounterBase> MonitorROS::newCounter(const std::string& name) {
52  return std::make_unique<CounterROS>(name, this);
53 }
54 
55 std::unique_ptr<CounterBase> MonitorROS::newCounter(const std::string& name, unsigned nRobs) {
56  return std::make_unique<CounterROS>(name, nRobs, this);
57 }
MonitorROS::newCounter
virtual std::unique_ptr< CounterBase > newCounter(const std::string &name) override
Concrete counter instantiation.
Definition: MonitorROS.cxx:51
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
MonitorBase::m_counters
std::unordered_map< std::string, std::unique_ptr< CounterBase > > m_counters
Storage of Monitor's collection of Counters.
Definition: Trigger/TrigCost/TrigCostAnalysis/src/MonitorBase.h:138
MonitorROS::MonitorROS
MonitorROS()=delete
Forbid default constructor.
MonitorBase::counterExists
bool counterExists(const std::string &name) const
Check if a counter of a given name exists.
Definition: Trigger/TrigCost/TrigCostAnalysis/src/MonitorBase.cxx:47
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:189
MonitorBase::getCounter
CounterBase * getCounter(const std::string &name)
Retrieve counter by name.
Definition: Trigger/TrigCost/TrigCostAnalysis/src/MonitorBase.cxx:52
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
MonitorROS.h
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
xAOD::TrigComposite_v1
Class used to describe composite objects in the HLT.
Definition: TrigComposite_v1.h:52
MonitorROS::newEvent
virtual StatusCode newEvent(const CostData &data, const float weight=1.) override
Concrete dispatch method.
Definition: MonitorROS.cxx:15
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
MonitorBase
Forward declare.
Definition: Trigger/TrigCost/TrigCostAnalysis/src/MonitorBase.h:33
MonitoredRange
Container which represents a time range and holds a collection of Monitors which monitor this range.
Definition: MonitoredRange.h:29
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
CostData
Caches and propagates event data to be used by monitoring algorithms.
Definition: CostData.h:26