ATLAS Offline Software
Loading...
Searching...
No Matches
MonitorChainAlgorithm.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
7#include <cstdint>
8
9MonitorChainAlgorithm::MonitorChainAlgorithm(const std::string& name, const MonitoredRange* parent)
10 : MonitorBase(name, parent) {
11}
12
13StatusCode MonitorChainAlgorithm::newEvent(const CostData& data, const float weight) {
14 const std::vector<TrigCompositeUtils::AlgToChainTool::ChainInfo>& seededChains = data.seededChains();
15 const std::string slotStr{"slot"};
16 const std::string algStr{"alg"};
17 const std::string ALGStr{"ALG"};
18 for (size_t i = 0; i < seededChains.size(); ++i){
19 // Find algorithms associated with chain name
20 if (!data.chainToAlgMap().count(seededChains[i].name)) continue;
21
22 for (const size_t algIndex : data.chainToAlgMap().at(seededChains[i].name)){
23 const xAOD::TrigComposite* alg = data.costCollection().at(algIndex);
24
25 const uint32_t slot = alg->getDetail<uint32_t>(slotStr);
26 if (slot != data.onlineSlot()) {
27 continue; // When monitoring the master slot, this Monitor ignores algs running in different slots
28 }
29
30 const uint32_t nameHash = alg->getDetail<TrigConf::HLTHash>(algStr);
31 const std::string algName = TrigConf::HLTUtils::hash2string(nameHash, ALGStr);
32
33 std::stringstream counterName;
34 counterName << seededChains[i].name << "__" << algName;
35 ATH_CHECK( getCounter(counterName.str())->newEvent(data, algIndex, weight) );
36 }
37 }
38
39 return StatusCode::SUCCESS;
40}
41
42
43std::unique_ptr<CounterBase> MonitorChainAlgorithm::newCounter(const std::string& name) {
44 return std::make_unique<CounterAlgorithm>(name, this);
45}
#define ATH_CHECK
Evaluate an expression and check for errors.
Caches and propagates event data to be used by monitoring algorithms.
Definition CostData.h:26
virtual StatusCode newEvent(const CostData &data, size_t index, float weight=1.0)=0
Pure virtual interface called by Monitor to instruct this Counter to perform its analysis.
CounterBase * getCounter(const std::string &name)
Retrieve counter by name.
MonitorBase()=delete
Forbid default constructor.
virtual StatusCode newEvent(const CostData &data, const float weight=1.) override
Concrete dispatch method.
virtual std::unique_ptr< CounterBase > newCounter(const std::string &name) override
Concrete counter instantiation.
MonitorChainAlgorithm()=delete
Forbid default constructor.
Container which represents a time range and holds a collection of Monitors which monitor this range.
static const std::string hash2string(HLTHash, const std::string &category="TE")
hash function translating identifiers into names (via internal dictionary)
TrigComposite_v1 TrigComposite
Declare the latest version of the class.