ATLAS Offline Software
Loading...
Searching...
No Matches
WebdaqHistSvc.cxx File Reference
#include "WebdaqHistSvc.h"
#include "GaudiKernel/IIncidentSvc.h"
#include "AthenaInterprocess/Incidents.h"
#include "AthenaMonitoringKernel/OHLockedHist.h"
#include "webdaq/webdaq-root.hpp"
#include "webdaq/webdaq.hpp"
#include "TError.h"
#include "TGraph.h"
#include "TH1.h"
#include "TH2.h"
#include "TH3.h"
#include "TObject.h"
#include "TROOT.h"
#include "TTree.h"
#include <TBufferJSON.h>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/date_time/gregorian/gregorian_types.hpp>

Go to the source code of this file.

Functions

StatusCode WebdaqHistSvc::initialize ATLAS_NOT_THREAD_SAFE ()
 Install fatal handler with default options.

Function Documentation

◆ ATLAS_NOT_THREAD_SAFE()

StatusCode WebdaqHistSvc::initialize ATLAS_NOT_THREAD_SAFE ( )
inline

Install fatal handler with default options.

This is meant to be easy to call from python via ctypes.

Definition at line 30 of file WebdaqHistSvc.cxx.

31{
32 // Protect against multiple instances of TROOT
33 if (0 == gROOT) {
34 static TROOT root("root", "ROOT I/O");
35 }
36 else {
37 ATH_MSG_VERBOSE("ROOT already initialized, debug = " << gDebug);
38 }
39
40 gErrorIgnoreLevel = kBreak; // ignore warnings see TError.h in ROOT base src
41
42 // compile regexes
43 m_excludeTypeRegex = boost::regex(m_excludeType.value());
44 m_includeTypeRegex = boost::regex(m_includeType.value());
45 m_excludeNameRegex = boost::regex(m_excludeName.value());
46 m_includeNameRegex = boost::regex(m_includeName.value());
47 m_PublicationIncludeNameRegex = boost::regex(m_PublicationIncludeName.value());
48 m_fastPublicationIncludeNameRegex = boost::regex(m_fastPublicationIncludeName.value());
49
50 // Create and set OH mutex
51 ATH_MSG_INFO("Enabling use of OH histogram mutex");
52 static std::mutex mutex;
54
55 // Application name
56 ATH_CHECK( m_jobOptionsSvc.retrieve() );
57 m_appName = m_jobOptionsSvc->get("DataFlowConfig.DF_ApplicationName");
58
59 //Retireve enviroment variables
60 const char* tdaq_partition_cstr = std::getenv("TDAQ_PARTITION");
61 if (tdaq_partition_cstr != nullptr) {
62 m_partition = std::string(tdaq_partition_cstr);
63 ATH_MSG_INFO("Partition: " << m_partition);
64 } else {
65 ATH_MSG_ERROR("TDAQ_PARTITION environment variable not set");
66 return StatusCode::FAILURE;
67 }
68 const char* tdaqWebdaqBase_cstr = std::getenv("TDAQ_WEBDAQ_BASE");
69 if (tdaqWebdaqBase_cstr != nullptr) {
70 m_tdaqWebdaqBase = std::string(tdaqWebdaqBase_cstr);
71 ATH_MSG_INFO("TDAQ_WEBDAQ_BASE value: " << m_tdaqWebdaqBase);
72 } else {
73 ATH_MSG_ERROR("TDAQ_WEBDAQ_BASE environment variable not set! Is needed for the OH publication through webdaq");
74 return StatusCode::FAILURE;
75 }
76 const char* tdaq_oh_server = std::getenv("TDAQ_OH_SERVER");
77 if (tdaq_oh_server != nullptr) {
78 m_tdaqOHServerName = std::string(tdaq_oh_server);
79 } else {
80 m_tdaqOHServerName = m_OHServerName.value();
81 }
82 ATH_MSG_INFO("TDAQ_OH_SERVER value: " << m_tdaqOHServerName);
83
84 // Incident handler
85 ServiceHandle<IIncidentSvc> incSvc("IncidentSvc", name());
86 ATH_CHECK( incSvc.retrieve() );
87 incSvc->addListener(this, AthenaInterprocess::UpdateAfterFork::type());
88
89 return StatusCode::SUCCESS;
90}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_VERBOSE(x)
static const std::string & type()
Incident type.
Definition Incidents.h:49
STL class.
static void set_histogram_mutex(std::mutex &mutex)
Set mutex to be used in oh_lock_histogram.