ATLAS Offline Software
TrigOpMonitor.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TRIGONLINEMONITOR_TRIGOPMONITOR_H
6 #define TRIGONLINEMONITOR_TRIGOPMONITOR_H
7 
16 #include "AthenaKernel/IIOVDbSvc.h"
17 #include "AthenaKernel/IOVRange.h"
18 #include "GaudiKernel/EventIDBase.h"
19 #include "GaudiKernel/ITHistSvc.h"
20 #include "GaudiKernel/ServiceHandle.h"
21 #include "GaudiKernel/ToolHandle.h"
25 
26 #include "TH1I.h"
27 #include "TH2I.h"
28 #include "TProfile.h"
29 
30 #include <unordered_map>
31 #include <string>
32 #include <vector>
33 
34 // Forward declarations
35 class IIncidentSvc;
36 
37 class TrigOpMonitor : public extends<AthAlgorithm, IIncidentListener> {
38 public:
39  TrigOpMonitor(const std::string& name, ISvcLocator* pSvcLocator);
40 
41  virtual StatusCode initialize() override;
42  virtual StatusCode start() override;
43  virtual StatusCode execute() override;
44  virtual void handle( const Incident& incident ) override;
45 
46  /* Ensure this algorithm is a singleton.
47  This should not cause any bottle-necks as the algorithm does very
48  minimal work. */
49  virtual unsigned int cardinality() const override { return 1; }
50 
51 private:
52  void fillMagFieldHist();
53  void fillReleaseDataHist();
54  void fillProcThreadHist(int workerID);
55  void fillSubDetHist();
56  void fillIOVDbHist();
57  void fillIOVDbChangeHist(const EventContext& ctx);
58  void fillLumiHist(const EventContext& ctx);
59 
61 
63  struct FolderHist {
64  TH1F* h_time{nullptr};
65  TH1F* h_bytes{nullptr};
66  float total_time{0};
67  float total_bytes{0};
68  };
69 
70  ServiceHandle<IIncidentSvc> m_incidentSvc{ this, "IncidentSvc", "IncidentSvc", "Incident service"};
71  ServiceHandle<ITHistSvc> m_histSvc{this, "THistSvc", "THistSvc"};
72 
73  SmartIF<IIOVDbSvc> m_IOVDbSvc;
74 
75  TH2I* m_magFieldHist{nullptr};
76  TH2I* m_iovChangeHist{nullptr};
77  TH1I* m_releaseHist{nullptr};
78  TH2I* m_mtConfigHist{nullptr};
79  TH1I* m_workersHist{nullptr};
80  TH2I* m_subdetHist{nullptr};
81  TProfile* m_lumiHist{nullptr};
82  TProfile* m_muHist{nullptr};
83 
85  std::unordered_map<std::string, IOVRange> m_currentIOVs;
86  std::unordered_map<std::string, FolderHist> m_folderHist;
87  std::string m_histPath;
88 
89  /* Properties */
90  SG::ReadCondHandleKey<LuminosityCondData> m_lumiDataKey{this, "LuminosityCondDataKey", ""};
91  SG::ReadCondHandleKey<AtlasFieldMapCondObj> m_fieldMapKey {this, "AtlasFieldMapCondDataKey", ""};
92 
93  Gaudi::Property<std::string> m_releaseData{
94  this, "ReleaseDataFile", "../ReleaseData",
95  "Path to ReleaseData file (relative to LD_LIBRARY_PATH entries"};
96 
97  Gaudi::Property<bool> m_detailedHists{this, "DetailedFolderHists", true,
98  "Detailed histograms for COOL folder updates during run"};
99 
100  Gaudi::Property<unsigned short int> m_maxLB{this, "MaxLumiblocks", 3000,
101  "Number of lumiblocks for histograms"};
102 };
103 
104 #endif // TRIGSTEERMONITOR_TRIGOPMONI_H
TrigOpMonitor::m_releaseData
Gaudi::Property< std::string > m_releaseData
Definition: TrigOpMonitor.h:93
TrigOpMonitor::FolderHist
Histograms for COOL folders.
Definition: TrigOpMonitor.h:63
AtlasFieldMapCondObj.h
TrigOpMonitor::handle
virtual void handle(const Incident &incident) override
Definition: TrigOpMonitor.cxx:71
IOVRange.h
Validity Range object. Holds two IOVTime instances (start and stop)
TrigOpMonitor::FolderHist::total_time
float total_time
Definition: TrigOpMonitor.h:66
TrigOpMonitor::m_histSvc
ServiceHandle< ITHistSvc > m_histSvc
Definition: TrigOpMonitor.h:71
TrigOpMonitor::bookHists
StatusCode bookHists()
Definition: TrigOpMonitor.cxx:115
AtlasMcWeight::number_type
unsigned int number_type
Definition: AtlasMcWeight.h:20
TrigOpMonitor::FolderHist::h_bytes
TH1F * h_bytes
Definition: TrigOpMonitor.h:65
TrigOpMonitor::m_lumiHist
TProfile * m_lumiHist
Definition: TrigOpMonitor.h:81
TrigOpMonitor::fillIOVDbHist
void fillIOVDbHist()
Definition: TrigOpMonitor.cxx:174
IIOVDbSvc.h
Abstract interface to IOVDbSvc to access IOVRange and tag information.
TrigOpMonitor::initialize
virtual StatusCode initialize() override
Definition: TrigOpMonitor.cxx:59
TrigOpMonitor::m_workersHist
TH1I * m_workersHist
Definition: TrigOpMonitor.h:79
TrigOpMonitor::fillIOVDbChangeHist
void fillIOVDbChangeHist(const EventContext &ctx)
Definition: TrigOpMonitor.cxx:254
TrigOpMonitor
Definition: TrigOpMonitor.h:37
TrigOpMonitor::TrigOpMonitor
TrigOpMonitor(const std::string &name, ISvcLocator *pSvcLocator)
Definition: TrigOpMonitor.cxx:54
TrigOpMonitor::fillMagFieldHist
void fillMagFieldHist()
Definition: TrigOpMonitor.cxx:163
TrigOpMonitor::m_lumiDataKey
SG::ReadCondHandleKey< LuminosityCondData > m_lumiDataKey
Definition: TrigOpMonitor.h:90
AthAlgorithm.h
TrigOpMonitor::start
virtual StatusCode start() override
Definition: TrigOpMonitor.cxx:82
TrigOpMonitor::m_magFieldHist
TH2I * m_magFieldHist
Definition: TrigOpMonitor.h:75
TrigOpMonitor::m_histPath
std::string m_histPath
histogram booking path
Definition: TrigOpMonitor.h:87
python.TrigEgammaMonitorHelper.TProfile
def TProfile(*args, **kwargs)
Definition: TrigEgammaMonitorHelper.py:81
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TrigOpMonitor::m_mtConfigHist
TH2I * m_mtConfigHist
Definition: TrigOpMonitor.h:78
TrigOpMonitor::m_previousLB
EventIDBase::number_type m_previousLB
LB of previous event.
Definition: TrigOpMonitor.h:84
LuminosityCondData.h
Hold luminosity data produced by LuminosityCondAlg.
TrigOpMonitor::fillSubDetHist
void fillSubDetHist()
Definition: TrigOpMonitor.cxx:398
ReadCondHandleKey.h
TrigOpMonitor::m_maxLB
Gaudi::Property< unsigned short int > m_maxLB
Definition: TrigOpMonitor.h:100
TrigOpMonitor::m_IOVDbSvc
SmartIF< IIOVDbSvc > m_IOVDbSvc
Definition: TrigOpMonitor.h:73
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TrigOpMonitor::m_currentIOVs
std::unordered_map< std::string, IOVRange > m_currentIOVs
current IOVs managed by IOVDbSvc
Definition: TrigOpMonitor.h:85
TrigOpMonitor::m_fieldMapKey
SG::ReadCondHandleKey< AtlasFieldMapCondObj > m_fieldMapKey
Definition: TrigOpMonitor.h:91
TrigOpMonitor::m_folderHist
std::unordered_map< std::string, FolderHist > m_folderHist
histograms for COOL folders
Definition: TrigOpMonitor.h:86
TrigOpMonitor::FolderHist::total_bytes
float total_bytes
Definition: TrigOpMonitor.h:67
TrigOpMonitor::fillProcThreadHist
void fillProcThreadHist(int workerID)
Definition: TrigOpMonitor.cxx:366
SG::ReadCondHandleKey< LuminosityCondData >
TrigOpMonitor::FolderHist::h_time
TH1F * h_time
Definition: TrigOpMonitor.h:64
TrigOpMonitor::m_muHist
TProfile * m_muHist
Definition: TrigOpMonitor.h:82
TrigOpMonitor::execute
virtual StatusCode execute() override
Definition: TrigOpMonitor.cxx:92
TrigOpMonitor::m_incidentSvc
ServiceHandle< IIncidentSvc > m_incidentSvc
Definition: TrigOpMonitor.h:70
TrigOpMonitor::m_detailedHists
Gaudi::Property< bool > m_detailedHists
Definition: TrigOpMonitor.h:97
TrigOpMonitor::m_iovChangeHist
TH2I * m_iovChangeHist
Definition: TrigOpMonitor.h:76
python.TrigEgammaMonitorHelper.TH1F
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:24
TrigOpMonitor::cardinality
virtual unsigned int cardinality() const override
Definition: TrigOpMonitor.h:49
TrigOpMonitor::fillLumiHist
void fillLumiHist(const EventContext &ctx)
Definition: TrigOpMonitor.cxx:319
TrigOpMonitor::m_releaseHist
TH1I * m_releaseHist
Definition: TrigOpMonitor.h:77
TrigOpMonitor::fillReleaseDataHist
void fillReleaseDataHist()
Definition: TrigOpMonitor.cxx:328
TrigOpMonitor::m_subdetHist
TH2I * m_subdetHist
Definition: TrigOpMonitor.h:80
ServiceHandle< IIncidentSvc >