ATLAS Offline Software
Loading...
Searching...
No Matches
GenericMonitoringTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef AthenaMonitoringKernel_GenericMonitoringTool_h
6#define AthenaMonitoringKernel_GenericMonitoringTool_h
7
8#include <functional>
9#include <vector>
10#include <memory>
11
12#include "TH1.h"
13#include "TH2.h"
14#include "TProfile.h"
15#include "TProfile2D.h"
16
19#include "GaudiKernel/ITHistSvc.h"
22
23/* Here, by forward declaring these two classes, which appear as parameters and values
24 in GenericMonitoringTool functions only as pointers (not as the objects themselves),
25 we can avoid including those class headers here, moving them to the implementation
26 file instead. This prevents external dependancy of the public-facing tool on the
27 internals of AthenaMonitoringKernel. */
28namespace Monitored {
30 class HistogramFiller;
33}
34
48namespace Monitored {
49 class Group;
50}
51class GenericMonitoringTool : public extends<AthAlgTool, IIncidentListener> {
52public:
53 using extends::extends;
54
55 virtual ~GenericMonitoringTool() override;
56 virtual StatusCode initialize() override;
57 virtual StatusCode start() override;
58 virtual StatusCode stop() override;
59 void handle( const Incident& ) override;
60
62 void invokeFillers(const std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>>& monitoredVariables) const;
63
65 StatusCode book();
67 void setPath( const std::string& newPath ) { m_histoPath = newPath; }
68 const std::string& getPath() const { return m_histoPath; }
69
70 virtual const ServiceHandle<ITHistSvc>& histogramService() const { return m_histSvc; }
71 virtual uint32_t runNumber();
72 virtual uint32_t lumiBlock();
73
74private:
76 ServiceHandle<ITHistSvc> m_histSvc { this, "THistSvc", "THistSvc", "Histogramming svc" };
77 Gaudi::Property<std::string> m_histoPath { this, "HistPath", {}, "Directory for histograms [name of parent if not set]" };
78 Gaudi::Property<std::vector<std::string> > m_histograms { this, "Histograms", {}, "Definitions of histograms", "OrderedSet<std::string>"};
79 Gaudi::Property<bool> m_explicitBooking { this, "ExplicitBooking", false, "Do not create histograms automatically in initialize but wait until the method book is called." };
80 Gaudi::Property<bool> m_failOnEmpty { this, "FailOnEmpty", true, "Fail in initialize() if no histograms defined" };
81 BooleanProperty m_useCache { this, "UseCache", true, "Cache filler lookups" };
82 BooleanProperty m_registerHandler { this, "RegisterHandler", true, "Use incident handler to make 'always book' plots (else only check once)" };
83
84 std::vector<std::shared_ptr<Monitored::HistogramFiller>> m_fillers;
85 std::vector<std::shared_ptr<Monitored::HistogramFiller>> m_alwaysCreateFillers;
88};
89
99class VoidMonitoringTool : public ToolHandle<GenericMonitoringTool> {
100public:
101 VoidMonitoringTool(const IInterface* parent) :
102 ToolHandle<GenericMonitoringTool>("", parent) {}
103};
104
105#endif /* AthenaMonitoringKernel_GenericMonitoringTool_h */
Hash map from strings to arbitrary objects allowing concurrent, lockless reads.
Property holding a SG store/key/clid from which a ReadHandle is made.
Hash map from strings to arbitrary objects allowing concurrent, lockless reads.
Simple (non-deleting) Updater implementation.
void handle(const Incident &) override
CxxUtils::ConcurrentStrToValMap< std::vector< std::shared_ptr< Monitored::HistogramFiller > >, CxxUtils::SimpleUpdater > fillerCache_t
virtual StatusCode stop() override
Gaudi::Property< bool > m_failOnEmpty
const std::string & getPath() const
virtual const ServiceHandle< ITHistSvc > & histogramService() const
std::vector< std::shared_ptr< Monitored::HistogramFiller > > m_alwaysCreateFillers
fillers that need touching, usually empty
StatusCode book()
Book histograms.
fillerCache_t m_fillerCacheMap ATLAS_THREAD_SAFE
lookup map to speed up filler searches
Gaudi::Property< bool > m_explicitBooking
BooleanProperty m_registerHandler
void invokeFillers(const std::vector< std::reference_wrapper< Monitored::IMonitoredVariable > > &monitoredVariables) const
feed the fillers
Gaudi::Property< std::string > m_histoPath
ServiceHandle< ITHistSvc > m_histSvc
THistSvc (do NOT fix the service type (only the name) to allow for a different implementation online.
Gaudi::Property< std::vector< std::string > > m_histograms
std::vector< std::shared_ptr< Monitored::HistogramFiller > > m_fillers
plain list of fillers
void setPath(const std::string &newPath)
Overrride configured booking path.
virtual StatusCode start() override
Base class for all histogram fillers.
VoidMonitoringTool(const IInterface *parent)
Generic monitoring tool for athena components.
void initialize()