ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigCost
TrigCostAnalysis
src
counters
CounterChain.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 "
xAODTrigger/TrigCompositeContainer.h
"
6
7
#include "
CounterChain.h
"
8
#include <cstdint>
9
10
11
CounterChain::CounterChain
(
const
std::string& name,
const
MonitorBase
* parent)
12
:
CounterBase
(name, parent)
13
{
14
regHistogram
(
"Group_perCall"
,
"Chain group/Call;Group;Calls"
,
VariableType::kPerCall
,
kLinear
, -0.5, 9.5, 10);
15
regHistogram
(
"Chain_perEvent"
,
"Chain calls/Event;Chain call;Events"
,
VariableType::kPerEvent
,
kLinear
, -0.5, 49.5);
16
regHistogram
(
"AlgCalls_perEvent"
,
"Algorithm Calls/Event;Calls;Events"
,
VariableType::kPerEvent
,
kLinear
, -0.5, 999.5, 100);
17
regHistogram
(
"Time_perCall"
,
"CPU Time/Call;Time [ms];Calls"
,
VariableType::kPerCall
,
kLog
, 0.01, 100000);
18
regHistogram
(
"Time_perEvent"
,
"CPU Time/Event;Time [ms];Events"
,
VariableType::kPerEvent
);
19
regHistogram
(
"UniqueTime_perCall"
,
"Unique CPU Time/Call;Time [ms];Calls"
,
VariableType::kPerCall
,
kLog
, 0.01, 100000);
20
regHistogram
(
"ChainPassed_perEvent"
,
"Passed chain/Event;Passsed;Events"
,
VariableType::kPerEvent
,
kLinear
, -0.5, 1.5, 2);
21
regHistogram
(
"Request_perEvent"
,
"Number of requests/Event;Number of requests;Events"
,
VariableType::kPerEvent
,
LogType::kLinear
, -0.5, 299.5, 300);
22
}
23
24
25
StatusCode
CounterChain::newEvent
(
const
CostData
& data,
size_t
index
,
const
float
weight) {
26
27
ATH_CHECK
(
increment
(
"Chain_perEvent"
, weight) );
28
29
if
(data.seededChains()[
index
].isPassRaw){
30
ATH_CHECK
(
increment
(
"ChainPassed_perEvent"
, weight) );
31
}
32
33
// Monitor algorithms associated with chain name
34
if
(!data.chainToAlgMap().count(
getName
()))
return
StatusCode::SUCCESS;
35
36
const
std::string slotStr{
"slot"
};
37
const
std::string startStr{
"start"
};
38
const
std::string stopStr{
"stop"
};
39
for
(
const
size_t
algIndex : data.chainToAlgMap().at(
getName
())){
40
const
xAOD::TrigComposite
* alg = data.costCollection().at(algIndex);
41
const
uint32_t slot = alg->getDetail<uint32_t>(slotStr);
42
if
(slot != data.onlineSlot()) {
43
continue
;
// When monitoring the master slot, this Monitor ignores algs running in different slots
44
}
45
46
ATH_CHECK
(
increment
(
"AlgCalls_perEvent"
, weight) );
47
48
const
uint64_t start = alg->getDetail<uint64_t>(startStr);
// in mus
49
const
uint64_t stop = alg->getDetail<uint64_t>(stopStr);
// in mus
50
const
float
cpuTime =
timeToMilliSec
(start, stop);
51
ATH_CHECK
(
fill
(
"Time_perEvent"
, cpuTime, weight) );
52
ATH_CHECK
(
fill
(
"Time_perCall"
, cpuTime, weight) );
53
}
54
55
// Monitor unique algorithms associated with chain name
56
if
(!data.chainToUniqAlgMap().count(
getName
()))
return
StatusCode::SUCCESS;
57
58
for
(
const
size_t
algIndex : data.chainToUniqAlgMap().at(
getName
())){
59
const
xAOD::TrigComposite
* alg = data.costCollection().at(algIndex);
60
const
uint32_t slot = alg->getDetail<uint32_t>(slotStr);
61
if
(slot != data.onlineSlot()) {
62
continue
;
63
}
64
const
uint64_t start = alg->getDetail<uint64_t>(startStr);
// in mus
65
const
uint64_t stop = alg->getDetail<uint64_t>(stopStr);
// in mus
66
const
float
cpuTime =
timeToMilliSec
(start, stop);
67
68
ATH_CHECK
(
fill
(
"UniqueTime_perCall"
, cpuTime, weight) );
69
}
70
71
return
StatusCode::SUCCESS;
72
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
CounterChain.h
TrigCompositeContainer.h
kPerEvent
@ kPerEvent
Variable should buffer fill calls in an accumulator and fill the underlying histogram once at the end...
Definition
Variable.h:21
kPerCall
@ kPerCall
Variable should fill underlying histogram on each fill.
Definition
Variable.h:20
kLinear
@ kLinear
Linear x-binning.
Definition
Variable.h:29
kLog
@ kLog
Logarithmic x-binning.
Definition
Variable.h:30
CostData
Caches and propagates event data to be used by monitoring algorithms.
Definition
CostData.h:26
CounterBase::timeToMilliSec
float timeToMilliSec(const uint64_t start, const uint64_t stop) const
Helper function.
Definition
CounterBase.cxx:245
CounterBase::CounterBase
CounterBase()=delete
Forbid default constructor.
CounterBase::increment
StatusCode increment(std::string_view name, float weight=1.0)
Convenience function.
Definition
CounterBase.cxx:222
CounterBase::regHistogram
void regHistogram(const std::string &name, const std::string &title, const VariableType type=VariableType::kPerCall, const LogType xaxis=kLog, const float min=0.1, const float max=1000000., const size_t bins=70)
Book a histogram for this Counter, to be filled in per-event monitoring.
Definition
CounterBase.cxx:29
CounterBase::getName
const std::string & getName() const
Getter for Counter's name.
Definition
CounterBase.cxx:19
CounterBase::fill
StatusCode fill(std::string_view name, float value, float weight=1.0)
Fill (for per-Call) or accumulate in a buffer (for per-Event) a quantity histogrammed by a named Vari...
Definition
CounterBase.cxx:193
CounterChain::newEvent
virtual StatusCode newEvent(const CostData &data, size_t index, const float weight=1.) override
Concrete implimentation.
Definition
CounterChain.cxx:25
CounterChain::CounterChain
CounterChain()=delete
Forbid default constructor.
MonitorBase
Forward declare.
Definition
Trigger/TrigCost/TrigCostAnalysis/src/MonitorBase.h:33
index
Definition
index.py:1
xAOD::TrigComposite
TrigComposite_v1 TrigComposite
Declare the latest version of the class.
Definition
TrigComposite.h:16
Generated on
for ATLAS Offline Software by
1.17.0