5#ifndef TRIGSERVICES_WEBDAQINFOSVC_H
6#define TRIGSERVICES_WEBDAQINFOSVC_H
9#include "GaudiKernel/IIncidentListener.h"
14#include "hltinterface/IInfoRegister.h"
16#include <nlohmann/json_fwd.hpp>
24#include <unordered_map>
30 class ContainerFactory;
31 class GenericHLTContainer;
52 public hltinterface::IInfoRegister
55 using base_class::base_class;
59 virtual StatusCode
configure()
override {
return StatusCode::SUCCESS; }
60 virtual StatusCode
stop()
override;
61 virtual StatusCode
finalize()
override;
62 virtual void handle(
const Incident& incident)
override;
67 virtual bool configure (
const boost::property_tree::ptree&)
override {
return true; }
68 virtual bool prepareForRun (
const boost::property_tree::ptree&)
override {
return true; }
69 virtual bool prepareWorker (
const boost::property_tree::ptree&)
override {
return true; }
70 virtual bool finalizeWorker(
const boost::property_tree::ptree&)
override {
return true; }
71 virtual bool finalize (
const boost::property_tree::ptree&)
override {
return true; }
76 std::shared_ptr<hltinterface::GenericHLTContainer> obj)
override;
80 virtual bool releaseObject (
const std::string fullName)
override;
83 virtual bool beginEvent(
const boost::property_tree::ptree&)
override {
return true; }
84 virtual bool endEvent (
const boost::property_tree::ptree&)
override;
86 virtual std::vector<std::shared_ptr<hltinterface::GenericHLTContainer>>
94 std::map<std::string, std::vector<TObject*>>&)
override {
NOSUPPORT_VOID(
DEBUG,
"Histogram retrieval"); }
98 virtual bool registerTObject (
const std::string&,
const std::string&, TObject*)
override {
NOSUPPORT(WARNING,
"Histogram registration"); }
99 virtual bool discoverTObject (
const std::string&,
const std::string&, TObject*&)
override {
NOSUPPORT(WARNING,
"Histogram discovery"); }
133 std::vector<std::shared_ptr<Holder>>
holders()
const;
136 std::shared_ptr<hltinterface::ContainerFactory>
m_factory;
139 std::unordered_map<std::string, std::shared_ptr<Holder>>
m_objs;
154 "Name of the IS server to publish to (used if TDAQ_IS_SERVER unset)"};
156 "Period between publication cycles (s)"};
#define NOSUPPORT(lvl, what)
Helper to mark unsupported interfaces.
#define NOSUPPORT_VOID(lvl, what)
Define macros for attributes used to control the static checker.
#define ATLAS_THREAD_SAFE
Header file for AthHistogramAlgorithm.
Service that publishes IS objects via the webdaq REST API.
virtual ~WebdaqInfoSvc() noexcept override
virtual bool configure(const boost::property_tree::ptree &) override
virtual mutex_type & getPublicationMutex() const override
Producers are expected to hold m_pubMutex while mutating a registered container, and across the endEv...
virtual bool registerTObject(const std::string &, const std::string &, TObject *) override
virtual StatusCode configure() override
std::thread m_thread
Background publishing thread + stop flag.
virtual StatusCode finalize() override
std::mutex m_pubMutex
Publication mutex handed out by getPublicationMutex().
bool publishOne(Holder &h) const
Send the pre-built snapshot via webdaq::is::put.
virtual void clearToRelease(const std::string &) override
virtual std::vector< std::shared_ptr< hltinterface::GenericHLTContainer > > queryISRegistry(const std::string &) override
virtual void get(const std::string &, THList &) override
virtual bool prepareForRun(const boost::property_tree::ptree &) override
virtual StatusCode initialize ATLAS_NOT_THREAD_SAFE() override
virtual bool finalizeWorker(const boost::property_tree::ptree &) override
virtual bool beginEvent(const boost::property_tree::ptree &) override
virtual bool pullInfo(const std::string &, const std::string &) override
virtual bool endEvent(const boost::property_tree::ptree &) override
virtual bool releaseTObject(const std::string &, const std::string &) override
virtual bool registerObject(const std::string publishPath, std::shared_ptr< hltinterface::GenericHLTContainer > obj) override
std::unordered_map< std::string, std::shared_ptr< Holder > > m_objs
Registered IS objects, keyed by full IS name (publishPath + object name).
virtual void getUnsummed(const std::string &, std::map< std::string, std::vector< TObject * > > &) override
std::atomic< bool > m_stopFlag
virtual bool releaseObject(const std::string fullName) override
De-register an object.
std::string m_tdaqIsServerName
virtual void handle(const Incident &incident) override
virtual void clear(const std::string &) override
virtual bool discoverTObject(const std::string &, const std::string &, TObject *&) override
virtual bool finalize(const boost::property_tree::ptree &) override
std::string m_tdaqWebdaqBase
void publishingTask() const
Background loop that periodically publishes containers.
virtual void setModification(bool b) override
std::shared_ptr< hltinterface::ContainerFactory > m_factory
Container factory.
virtual StatusCode stop() override
std::vector< std::shared_ptr< Holder > > holders() const
Copy of the registered holders, taken under m_objsMtx.
virtual void reset(const std::string &) override
Gaudi::Property< std::string > m_isServerName
static nlohmann::json serializeContainer(hltinterface::GenericHLTContainer &cont)
Serialise all supported fields into a JSON object.
virtual bool prepareWorker(const boost::property_tree::ptree &) override
Gaudi::Property< unsigned int > m_intervalSeconds