ATLAS Offline Software
CounterGlobal.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 #include "CounterGlobal.h"
8 
9 CounterGlobal::CounterGlobal(const std::string& name, const MonitorBase* parent)
11 {
12  regHistogram("AlgTime_perCall", "Algorithm CPU Time/Call;Time [ms];Events", VariableType::kPerCall, kLog, 0.01, 100000);
13  regHistogram("AlgTime_perEvent", "Algorithm CPU Time/Event;Time [ms];Events", VariableType::kPerEvent);
14  regHistogram("AlgCalls_perEvent", "Algorithm Calls/Event;Calls;Events", VariableType::kPerEvent, kLinear, -0.5, 4999.5, 500);
15  regHistogram("SteeringTime_perEvent", "Steering Time/Event;Time [ms];Events", VariableType::kPerEvent);
16  regHistogram("LbLength", "LBLength;Entry;LB Length [s]", VariableType::kPerEvent, kLinear, -0.5, 0.5, 1);
17 }
18 
19 
20 StatusCode CounterGlobal::newEvent(const CostData& data, size_t incrementWalltime, const float weight) {
21 
23  uint64_t highTimestamp = 0;
24  for (const xAOD::TrigComposite* tc : data.costCollection()) {
25  const uint32_t slot = tc->getDetail<uint32_t>("slot");
26  if (slot != data.onlineSlot()) {
27  continue; // When monitoring the master slot, this Counter ignores algs running in different slots
28  }
29 
30  const uint64_t start = tc->getDetail<uint64_t>("start"); // in mus
31  const uint64_t stop = tc->getDetail<uint64_t>("stop"); // in mus
32  const float cpuTime = timeToMilliSec(start, stop);
33  ATH_CHECK( fill("AlgTime_perCall", cpuTime, weight) );
34  ATH_CHECK( fill("AlgTime_perEvent", cpuTime, weight) );
35  ATH_CHECK( increment("AlgCalls_perEvent", weight) );
36  lowTimestamp = std::min(lowTimestamp, start);
37  highTimestamp = std::max(highTimestamp, stop);
38  }
39 
40  const float steeringTime = timeToMilliSec(lowTimestamp, highTimestamp);
41  ATH_CHECK( fill("SteeringTime_perEvent", steeringTime, weight) );
42 
43  if (incrementWalltime == 1) {
44  // Note: This accumulator doesn't use the standard weight.
45  // For P1 data taking it will be filled exactly once per LB
46  ATH_CHECK( fill("LbLength", 0.0, data.liveTime()) );
47  }
48 
49  return StatusCode::SUCCESS;
50 }
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
CounterBase
Forward declare.
Definition: CounterBase.h:25
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:27
max
#define max(a, b)
Definition: cfImp.cxx:41
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
CounterBase::fill
StatusCode fill(const std::string &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:191
mergePhysValFiles.start
start
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:14
kPerEvent
@ kPerEvent
Variable should buffer fill calls in an accumulator and fill the underlying histogram once at the end...
Definition: Trigger/TrigCost/TrigCostAnalysis/src/Variable.h:19
CounterGlobal.h
PixelModuleFeMask_create_db.stop
int stop
Definition: PixelModuleFeMask_create_db.py:76
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:200
kLog
@ kLog
Logarithmic x-binning.
Definition: Trigger/TrigCost/TrigCostAnalysis/src/Variable.h:28
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
test_pyathena.parent
parent
Definition: test_pyathena.py:15
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
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
TrigCompositeContainer.h
min
#define min(a, b)
Definition: cfImp.cxx:40
kPerCall
@ kPerCall
Variable should fill underlying histogram on each fill.
Definition: Trigger/TrigCost/TrigCostAnalysis/src/Variable.h:18
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
kLinear
@ kLinear
Linear x-binning.
Definition: Trigger/TrigCost/TrigCostAnalysis/src/Variable.h:27
MonitorBase
Forward declare.
Definition: Trigger/TrigCost/TrigCostAnalysis/src/MonitorBase.h:33
CounterGlobal::newEvent
virtual StatusCode newEvent(const CostData &data, size_t incrementWalltime, const float weight=1.) override
Concrete implementation.
Definition: CounterGlobal.cxx:20
CounterBase::increment
StatusCode increment(const std::string &name, float weight=1.0)
Convenience function.
Definition: CounterBase.cxx:220
CounterGlobal::CounterGlobal
CounterGlobal()=delete
Forbid default constructor.
CounterBase::timeToMilliSec
float timeToMilliSec(const uint64_t start, const uint64_t stop) const
Helper function.
Definition: CounterBase.cxx:243
CostData
Caches and propagates event data to be used by monitoring algorithms.
Definition: CostData.h:26