ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigCost
TrigCostAnalysis
src
MonitoredRange.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 "
TrigCostAnalysis.h
"
6
#include "
MonitoredRange.h
"
7
#include "
MonitorBase.h
"
8
9
#include "TProfile.h"
10
11
MonitoredRange::MonitoredRange
(
const
std::string& name,
TrigCostAnalysis
* parent) :
12
m_name
(name),
13
m_parent
(parent),
14
m_cachedLifetimeHistPtr
(nullptr),
15
m_monitors
(),
16
m_seenLB
()
17
{
18
std::string hisSvcName =
getName
() +
"_walltime"
;
19
std::unique_ptr<TProfile> hist = std::make_unique<TProfile>(hisSvcName.c_str(),
"Walltime;;Seconds"
, 5000, 0, 5000);
20
m_cachedLifetimeHistPtr
=
bookGetPointer
(hist.release());
// Now owned by HistSvc
21
}
22
23
24
const
std::string&
MonitoredRange::getName
()
const
{
25
return
m_name
;
26
}
27
28
29
const
TrigCostAnalysis
*
MonitoredRange::getParent
()
const
{
30
return
m_parent
;
31
}
32
33
34
TH1*
MonitoredRange::bookGetPointer
(TH1* hist,
const
std::string& tDir)
const
{
35
std::string dir =
getName
();
36
if
(tDir !=
""
) {
37
dir +=
"/"
;
38
dir += tDir;
39
}
40
return
getParent
()->
bookGetPointer
(hist, dir);
41
}
42
43
44
std::set< std::unique_ptr<MonitorBase> >&
MonitoredRange::getMonitors
() {
45
return
m_monitors
;
46
}
47
48
49
StatusCode
MonitoredRange::addMonitor
(std::unique_ptr<MonitorBase> monitor) {
50
m_monitors
.insert( std::move(monitor) );
51
return
StatusCode::SUCCESS;
52
}
53
54
55
StatusCode
MonitoredRange::newEvent
(
const
CostData
& data,
const
float
weight,
const
bool
skipMonitoringThisEvent) {
56
if
(not skipMonitoringThisEvent) {
57
for
(
auto
& monitor :
getMonitors
()) {
58
ATH_CHECK
(monitor->newEvent(data, weight));
59
ATH_CHECK
(monitor->endEvent(weight));
60
}
61
}
62
ATH_CHECK
(
m_cachedLifetimeHistPtr
!=
nullptr
);
63
const
bool
isNewLB =
m_seenLB
.insert( data.lb() ).second;
// .second is true if a new element was inserted
64
if
(data.liveTimeIsPerEvent() or isNewLB) {
65
// We have two modes of operation. Either we process an EnhancedBias file where we know exactly how many events to expect
66
// and can hence fill a per-event live time (meaning that the normalisation is correct, even if we do not run over all events).
67
// For this case we increment this bin for event event this monitor sees.
68
// Or, we can process P1 data where we only know the LB length and must assume that all events are collected and processed,
69
// otherwise the normalisation will be off. For this case we increment this one for every unique LB this monitor sees.
70
m_cachedLifetimeHistPtr
->Fill(data.lb(), data.liveTime());
71
}
72
73
return
StatusCode::SUCCESS;
74
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
MonitoredRange.h
TrigCostAnalysis.h
MonitorBase.h
CostData
Caches and propagates event data to be used by monitoring algorithms.
Definition
CostData.h:26
MonitoredRange::addMonitor
StatusCode addMonitor(std::unique_ptr< MonitorBase > monitor)
Adds a new Monitor into this Range.
Definition
MonitoredRange.cxx:49
MonitoredRange::getParent
const TrigCostAnalysis * getParent() const
Return cached non-owning ptr to this Monitor's parent TrigCostAnalysis Athena algorithm.
Definition
MonitoredRange.cxx:29
MonitoredRange::m_monitors
std::set< std::unique_ptr< MonitorBase > > m_monitors
Storage of Range's Monitors.
Definition
MonitoredRange.h:104
MonitoredRange::m_parent
TrigCostAnalysis * m_parent
Cached ptr to the parent Athena algorithm.
Definition
MonitoredRange.h:102
MonitoredRange::m_name
const std::string m_name
Name of the Monitored Range.
Definition
MonitoredRange.h:101
MonitoredRange::getMonitors
std::set< std::unique_ptr< MonitorBase > > & getMonitors()
Getter for Range's owned Monitors.
Definition
MonitoredRange.cxx:44
MonitoredRange::m_seenLB
std::set< uint32_t > m_seenLB
Luminosity blocks for which we have seen at least one event.
Definition
MonitoredRange.h:105
MonitoredRange::m_cachedLifetimeHistPtr
TH1 * m_cachedLifetimeHistPtr
Cached histogram ptr used to store normalisation quantities.
Definition
MonitoredRange.h:103
MonitoredRange::getName
const std::string & getName() const
Getter for Range's name.
Definition
MonitoredRange.cxx:24
MonitoredRange::MonitoredRange
MonitoredRange()=delete
Forbid default constructor.
MonitoredRange::bookGetPointer
TH1 * bookGetPointer(TH1 *hist, const std::string &tDir="") const
Appends Range's name (to histogram path) and forwards histogram book request to parent Athena algorit...
Definition
MonitoredRange.cxx:34
MonitoredRange::newEvent
StatusCode newEvent(const CostData &data, const float weight=1., const bool skipMonitoringThisEvent=false)
Interface called by TrigCostAnalysis algorithm to instruct this Range to trigger all its Monitors.
Definition
MonitoredRange.cxx:55
TrigCostAnalysis
Athena algorithm used to process Trigger cost monitoring data in Run 3 and above.
Definition
TrigCostAnalysis.h:36
TrigCostAnalysis::bookGetPointer
TH1 * bookGetPointer(TH1 *hist, const std::string &tDir="") const
Public method forwarded to this class' AthHistogramAlgorithm::bookGetPointer base.
Definition
TrigCostAnalysis.cxx:173
Generated on
for ATLAS Offline Software by
1.17.0