1 #ifndef ARTDAQ_DAQDATA_GLOBALS_HH
2 #define ARTDAQ_DAQDATA_GLOBALS_HH
5 #include "artdaq-utilities/Plugins/MetricManager.hh"
6 #include "artdaq/DAQdata/PortManager.hh"
8 #define my_rank artdaq::Globals::my_rank_
9 #define app_name artdaq::Globals::app_name_
10 #define metricMan artdaq::Globals::metricMan_
11 #define portMan artdaq::Globals::portMan_
12 #define seedAndRandom() artdaq::Globals::seedAndRandom_()
13 #define GetPartitionNumber() artdaq::Globals::getPartitionNumber_()
15 #define GetMFIteration() artdaq::Globals::GetMFIteration_()
16 #define GetMFModuleName() artdaq::Globals::GetMFModuleName_()
17 #define SetMFModuleName(name) artdaq::Globals::SetMFModuleName_(name)
18 #define SetMFIteration(name) artdaq::Globals::SetMFIteration_(name)
51 static bool initialized_ =
false;
54 int fp = open(
"/dev/random", O_RDONLY);
55 if (fp == -1) abort();
58 while (pos <
sizeof(seed))
60 int amt = read(fp, reinterpret_cast<char *>(&seed) + pos,
sizeof(seed) - pos);
61 if (amt <= 0) abort();
88 auto part = getenv(
"ARTDAQ_PARTITION_NUMBER");
93 auto part_s = std::string(part);
94 part_u =
static_cast<uint32_t
>(std::stoll(part_s,
nullptr, 0));
96 catch (
const std::invalid_argument &)
98 catch (
const std::out_of_range &)
104 return (part_u & 0x7F);
158 #include "artdaq-core/Utilities/TimeUtils.hh"
159 #include "artdaq-core/Utilities/configureMessageFacility.hh"
160 #include "fhiclcpp/ParameterSet.h"
161 #include "fhiclcpp/types/Atom.h"
162 #include "fhiclcpp/types/ConfigurationTable.h"
163 #include "fhiclcpp/types/Sequence.h"
164 #include "fhiclcpp/types/Table.h"
165 #include "fhiclcpp/types/TableFragment.h"
167 #endif // ARTDAQ_DAQDATA_GLOBALS_HH
static int getPartitionNumber_()
Get the current partition number, as defined by the ARTDAQ_PARTITION_NUMBER environment variable...
static uint32_t seedAndRandom_()
Seed the C random number generator with the current time (if that has not been done already) and gene...
static std::unique_ptr< MetricManager > metricMan_
A handle to MetricManager.
static int my_rank_
The rank of the current application.
static std::string app_name_
The name of the current application, to be used in logging and metrics.
static void CleanUpGlobals()
Clean up statically-allocated Manager class instances.
static std::string GetMFIteration_()
Get the current iteration for MessageFacility messages.
static std::mutex mftrace_mutex_
Mutex to protect mftrace_module_ and mftrace_iteration_.
static void SetMFIteration_(std::string const &name)
Set the current iteration for MessageFacility messages.
static void SetMFModuleName_(std::string const &name)
Set the current module name for MessageFacility messages.
static std::string mftrace_iteration_
MessageFacility's module and iteration are thread-local, but we want to use them to represent global ...
static std::unique_ptr< PortManager > portMan_
A handle to PortManager.
The artdaq::Globals class contains several variables which are useful across the entire artdaq system...
static std::string mftrace_module_
MessageFacility's module and iteration are thread-local, but we want to use them to represent global ...
static int partition_number_
The partition number of the current application.
static std::string GetMFModuleName_()
Get the current module name for MessageFacility messages.