ATLAS Offline Software
Loading...
Searching...
No Matches
MonitorChain.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 "MonitorChain.h"
7
8MonitorChain::MonitorChain(const std::string& name, const MonitoredRange* parent)
9 : MonitorBase(name, parent) {
10}
11
12StatusCode MonitorChain::newEvent(const CostData& data, const float weight) {
13
14 const std::vector<TrigCompositeUtils::AlgToChainTool::ChainInfo>& seededChains = data.seededChains();
15 for (size_t i = 0; i < seededChains.size(); ++i){
16 std::string chainName = seededChains[i].name;
17 if (!counterExists(chainName)){
18 // Create a new counter using specialized constructor in order to pass number of bins for some of the histograms
19 m_counters.insert( std::make_pair(chainName, newCounter(chainName, data.costROSData().getNROS())) );
20 }
21 ATH_CHECK( getCounter(chainName)->newEvent(data, i, weight) );
22 }
23
24 return StatusCode::SUCCESS;
25}
26
27std::unique_ptr<CounterBase> MonitorChain::newCounter(const std::string& name) {
28 return std::make_unique<CounterChain>(name, this);
29}
30
31std::unique_ptr<CounterBase> MonitorChain::newCounter(const std::string& name, unsigned nROS) {
32 return std::make_unique<CounterChain>(name, nROS, this);
33}
#define ATH_CHECK
Evaluate an expression and check for errors.
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
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.
MonitorChain()=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.
Container which represents a time range and holds a collection of Monitors which monitor this range.