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)
53 static bool initialized_ =
false;
56 int fp = open(
"/dev/random", O_RDONLY);
57 if (fp == -1) abort();
60 while (pos <
sizeof(seed))
62 int amt = read(fp, (
char *)&seed + pos,
sizeof(seed) - pos);
63 if (amt <= 0) abort();
90 auto part = getenv(
"ARTDAQ_PARTITION_NUMBER");
95 auto part_s = std::string(part);
96 part_u =
static_cast<uint32_t
>(std::stoll(part_s, 0, 0));
98 catch (
const std::invalid_argument&) {}
99 catch (
const std::out_of_range&) {}
104 return (part_u & 0x7F);
158 #include "artdaq-core/Utilities/configureMessageFacility.hh"
160 #include "artdaq-core/Utilities/TimeUtils.hh"
161 #include "fhiclcpp/ParameterSet.h"
162 #include "fhiclcpp/types/Atom.h"
163 #include "fhiclcpp/types/Table.h"
164 #include "fhiclcpp/types/Sequence.h"
165 #include "fhiclcpp/types/TableFragment.h"
166 #include "fhiclcpp/types/ConfigurationTable.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 std::string mftrace_iteration_
MessageFacility's module and iteration are thread-local, but we want to use them to represent global ...
static void SetMFModuleName_(std::string name)
Set the current module name for MessageFacility messages.
static std::unique_ptr< PortManager > portMan_
A handle to PortManager.
static void SetMFIteration_(std::string name)
Set the current iteration for MessageFacility messages.
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.