ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
MonitoredRange Class Reference

Container which represents a time range and holds a collection of Monitors which monitor this range. More...

#include <MonitoredRange.h>

Collaboration diagram for MonitoredRange:

Public Member Functions

 MonitoredRange ()=delete
 Forbid default constructor. More...
 
 MonitoredRange (const std::string &name, TrigCostAnalysis *parent)
 Construct Range. More...
 
 ~MonitoredRange ()=default
 Default destructor. More...
 
MonitoredRangeoperator= (const MonitoredRange &)=delete
 Forbid assignment. More...
 
 MonitoredRange (const MonitoredRange &)=delete
 Forbid copy. More...
 
const std::string & getName () const
 Getter for Range's name. More...
 
const TrigCostAnalysisgetParent () const
 Return cached non-owning ptr to this Monitor's parent TrigCostAnalysis Athena algorithm. More...
 
TH1bookGetPointer (TH1 *hist, const std::string &tDir="") const
 Appends Range's name (to histogram path) and forwards histogram book request to parent Athena algorithm. More...
 
std::set< std::unique_ptr< MonitorBase > > & getMonitors ()
 Getter for Range's owned Monitors. More...
 
StatusCode addMonitor (std::unique_ptr< MonitorBase > monitor)
 Adds a new Monitor into this Range. More...
 
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. More...
 

Private Attributes

const std::string m_name
 Name of the Monitored Range. More...
 
TrigCostAnalysism_parent
 Cached ptr to the parent Athena algorithm. More...
 
TH1m_cachedLifetimeHistPtr
 Cached histogram ptr used to store normalisation quantities. More...
 
std::set< std::unique_ptr< MonitorBase > > m_monitors
 Storage of Range's Monitors. More...
 
std::set< uint32_t > m_seenLB
 Luminosity blocks for which we have seen at least one event. More...
 

Detailed Description

Container which represents a time range and holds a collection of Monitors which monitor this range.

A job is configured to use a suite of Monitors. However, we also want to separate different regions of the run via lumi block splitting. This class represents one such time interval and hosts a complete set of Monitors which are used to monitor the time range.

Definition at line 29 of file MonitoredRange.h.

Constructor & Destructor Documentation

◆ MonitoredRange() [1/3]

MonitoredRange::MonitoredRange ( )
delete

Forbid default constructor.

◆ MonitoredRange() [2/3]

MonitoredRange::MonitoredRange ( const std::string &  name,
TrigCostAnalysis parent 
)

Construct Range.

Range constructor sets up a histogram which is used to keep track of normalisation quantities.

Parameters
[in]nameRange's name
[in]parentMonitor's parent Range, cached non-owning pointer.

Definition at line 11 of file MonitoredRange.cxx.

11  :
12  m_name(name),
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 }

◆ ~MonitoredRange()

MonitoredRange::~MonitoredRange ( )
default

Default destructor.

◆ MonitoredRange() [3/3]

MonitoredRange::MonitoredRange ( const MonitoredRange )
delete

Forbid copy.

Member Function Documentation

◆ addMonitor()

StatusCode MonitoredRange::addMonitor ( std::unique_ptr< MonitorBase monitor)

Adds a new Monitor into this Range.

@pram[in] Owning unique ptr of new Monitor to add. Typed on Monitor's base class.

Definition at line 49 of file MonitoredRange.cxx.

49  {
50  m_monitors.insert( std::move(monitor) );
51  return StatusCode::SUCCESS;
52 }

◆ bookGetPointer()

TH1 * MonitoredRange::bookGetPointer ( TH1 hist,
const std::string &  tDir = "" 
) const

Appends Range's name (to histogram path) and forwards histogram book request to parent Athena algorithm.

Parameters
[in]histBare pointer to histogram. Ownership transferred to THistSvc.
[in]tDirHistogram name & directory.
Returns
Cached pointer to histogram. Used to fill histogram without having to perform THishSvc lookup.

Definition at line 34 of file MonitoredRange.cxx.

34  {
35  std::string dir = getName();
36  if (tDir != "") {
37  dir += "/";
38  dir += tDir;
39  }
40  return getParent()->bookGetPointer(hist, dir);
41 }

◆ getMonitors()

std::set< std::unique_ptr< MonitorBase > > & MonitoredRange::getMonitors ( )

Getter for Range's owned Monitors.

Returns
Set reference to Range's Monitors

Definition at line 44 of file MonitoredRange.cxx.

44  {
45  return m_monitors;
46 }

◆ getName()

const std::string & MonitoredRange::getName ( ) const

Getter for Range's name.

Returns
Range's name const string reference.

Definition at line 24 of file MonitoredRange.cxx.

24  {
25  return m_name;
26 }

◆ getParent()

const TrigCostAnalysis * MonitoredRange::getParent ( ) const

Return cached non-owning ptr to this Monitor's parent TrigCostAnalysis Athena algorithm.

Returns
Cached pointer to parent TrigCostAnalysis algorithm.

Definition at line 29 of file MonitoredRange.cxx.

29  {
30  return m_parent;
31 }

◆ newEvent()

StatusCode MonitoredRange::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.

Parameters
[in]dataAccess to event data
[in]weightGlobal event weight

Definition at line 55 of file MonitoredRange.cxx.

55  {
56  if (not skipMonitoringThisEvent) {
57  for (auto& monitor : getMonitors()) {
58  ATH_CHECK(monitor->newEvent(data, weight));
59  ATH_CHECK(monitor->endEvent(weight));
60  }
61  }
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 }

◆ operator=()

MonitoredRange& MonitoredRange::operator= ( const MonitoredRange )
delete

Forbid assignment.

Member Data Documentation

◆ m_cachedLifetimeHistPtr

TH1* MonitoredRange::m_cachedLifetimeHistPtr
private

Cached histogram ptr used to store normalisation quantities.

Definition at line 103 of file MonitoredRange.h.

◆ m_monitors

std::set< std::unique_ptr<MonitorBase> > MonitoredRange::m_monitors
private

Storage of Range's Monitors.

Keyed by Monitor's name.

Definition at line 104 of file MonitoredRange.h.

◆ m_name

const std::string MonitoredRange::m_name
private

Name of the Monitored Range.

Definition at line 101 of file MonitoredRange.h.

◆ m_parent

TrigCostAnalysis* MonitoredRange::m_parent
private

Cached ptr to the parent Athena algorithm.

Definition at line 102 of file MonitoredRange.h.

◆ m_seenLB

std::set< uint32_t > MonitoredRange::m_seenLB
private

Luminosity blocks for which we have seen at least one event.

Definition at line 105 of file MonitoredRange.h.


The documentation for this class was generated from the following files:
MonitoredRange::m_parent
TrigCostAnalysis * m_parent
Cached ptr to the parent Athena algorithm.
Definition: MonitoredRange.h:102
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
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
TrigCostAnalysis::bookGetPointer
TH1 * bookGetPointer(TH1 *hist, const std::string &tDir="") const
Public method forwarded to this class' AthHistogramAlgorithm::bookGetPointer base.
Definition: TrigCostAnalysis.cxx:171
plotmaker.hist
hist
Definition: plotmaker.py:148
MonitoredRange::m_monitors
std::set< std::unique_ptr< MonitorBase > > m_monitors
Storage of Range's Monitors.
Definition: MonitoredRange.h:104
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::getName
const std::string & getName() const
Getter for Range's name.
Definition: MonitoredRange.cxx:24
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:200
MonitoredRange::m_name
const std::string m_name
Name of the Monitored Range.
Definition: MonitoredRange.h:101
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
TH1::Fill
int Fill(double)
Definition: rootspy.cxx:285
beamspotman.dir
string dir
Definition: beamspotman.py:623
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
MonitoredRange::getMonitors
std::set< std::unique_ptr< MonitorBase > > & getMonitors()
Getter for Range's owned Monitors.
Definition: MonitoredRange.cxx:44
MonitoredRange::m_cachedLifetimeHistPtr
TH1 * m_cachedLifetimeHistPtr
Cached histogram ptr used to store normalisation quantities.
Definition: MonitoredRange.h:103
MonitoredRange::getParent
const TrigCostAnalysis * getParent() const
Return cached non-owning ptr to this Monitor's parent TrigCostAnalysis Athena algorithm.
Definition: MonitoredRange.cxx:29