ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigCost
TrigCostAnalysis
src
counters
CounterGlobal.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 "
CounterGlobal.h
"
8
#include <limits>
9
#include <algorithm>
10
11
CounterGlobal::CounterGlobal
(
const
std::string& name,
const
MonitorBase
* parent)
12
:
CounterBase
(name, parent)
13
{
14
regHistogram
(
"AlgTime_perCall"
,
"Algorithm CPU Time/Call;Time [ms];Events"
,
VariableType::kPerCall
,
kLog
, 0.01, 100000);
15
regHistogram
(
"AlgTime_perEvent"
,
"Algorithm CPU Time/Event;Time [ms];Events"
,
VariableType::kPerEvent
);
16
regHistogram
(
"AlgCalls_perEvent"
,
"Algorithm Calls/Event;Calls;Events"
,
VariableType::kPerEvent
,
kLinear
, -0.5, 4999.5, 500);
17
regHistogram
(
"SteeringTime_perEvent"
,
"Steering Time/Event;Time [ms];Events"
,
VariableType::kPerEvent
);
18
regHistogram
(
"LbLength"
,
"LBLength;Entry;LB Length [s]"
,
VariableType::kPerEvent
,
kLinear
, -0.5, 0.5, 1);
19
}
20
21
22
StatusCode
CounterGlobal::newEvent
(
const
CostData
& data,
size_t
incrementWalltime,
const
float
weight) {
23
24
uint64_t lowTimestamp = std::numeric_limits<uint64_t>::max();
25
uint64_t highTimestamp = 0;
26
const
std::string stopStr{
"stop"
};
27
const
std::string startStr{
"start"
};
28
const
std::string slotStr{
"slot"
};
29
for
(
const
xAOD::TrigComposite
*
tc
: data.costCollection()) {
30
const
uint32_t slot =
tc
->getDetail<uint32_t>(slotStr);
31
if
(slot != data.onlineSlot()) {
32
continue
;
// When monitoring the master slot, this Counter ignores algs running in different slots
33
}
34
35
const
uint64_t start =
tc
->getDetail<uint64_t>(startStr);
// in mus
36
const
uint64_t stop =
tc
->getDetail<uint64_t>(stopStr);
// in mus
37
const
float
cpuTime =
timeToMilliSec
(start, stop);
38
ATH_CHECK
(
fill
(
"AlgTime_perCall"
, cpuTime, weight) );
39
ATH_CHECK
(
fill
(
"AlgTime_perEvent"
, cpuTime, weight) );
40
ATH_CHECK
(
increment
(
"AlgCalls_perEvent"
, weight) );
41
lowTimestamp = std::min(lowTimestamp, start);
42
highTimestamp = std::max(highTimestamp, stop);
43
}
44
45
const
float
steeringTime =
timeToMilliSec
(lowTimestamp, highTimestamp);
46
ATH_CHECK
(
fill
(
"SteeringTime_perEvent"
, steeringTime, weight) );
47
48
if
(incrementWalltime == 1) {
49
// Note: This accumulator doesn't use the standard weight.
50
// For P1 data taking it will be filled exactly once per LB
51
ATH_CHECK
(
fill
(
"LbLength"
, 0.0, data.liveTime()) );
52
}
53
54
return
StatusCode::SUCCESS;
55
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
CounterGlobal.h
tc
static Double_t tc
Definition
LArPhysWaveHECTool.cxx:38
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::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
CounterGlobal::CounterGlobal
CounterGlobal()=delete
Forbid default constructor.
CounterGlobal::newEvent
virtual StatusCode newEvent(const CostData &data, size_t incrementWalltime, const float weight=1.) override
Concrete implementation.
Definition
CounterGlobal.cxx:22
MonitorBase
Forward declare.
Definition
Trigger/TrigCost/TrigCostAnalysis/src/MonitorBase.h:33
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