1 #ifndef ARTDAQ_DAQDATA_GLOBALS_HH
2 #define ARTDAQ_DAQDATA_GLOBALS_HH
5 #include "artdaq-utilities/Plugins/MetricManager.hh"
7 #define my_rank artdaq::Globals::my_rank_
8 #define app_name artdaq::Globals::app_name_
9 #define metricMan artdaq::Globals::metricMan_
10 #define seedAndRandom() artdaq::Globals::seedAndRandom_()
12 #define mftrace_iteration artdaq::Globals::mftrace_iteration_
13 #define mftrace_module artdaq::Globals::mftrace_module_
14 #define SetMFModuleName(name) mftrace_module = name
15 #define SetMFIteration(name) mftrace_iteration = name
48 static bool initialized_ =
false;
51 int fp = open(
"/dev/random", O_RDONLY);
52 if (fp == -1) abort();
55 while (pos <
sizeof(seed))
57 int amt = read(fp, (
char *)&seed + pos,
sizeof(seed) - pos);
58 if (amt <= 0) abort();
85 auto part = getenv(
"ARTDAQ_PARTITION_NUMBER");
90 auto part_s = std::string(part);
91 part_u =
static_cast<uint32_t
>(std::stoll(part_s, 0, 0));
93 catch (std::invalid_argument) {}
94 catch (std::out_of_range) {}
98 return (part_u & 0x7F);
103 #include "artdaq-core/Utilities/configureMessageFacility.hh"
105 #include "artdaq-core/Utilities/TimeUtils.hh"
106 #include "fhiclcpp/ParameterSet.h"
107 #include "fhiclcpp/types/Atom.h"
108 #include "fhiclcpp/types/Table.h"
109 #include "fhiclcpp/types/Sequence.h"
110 #include "fhiclcpp/types/TableFragment.h"
111 #if MESSAGEFACILITY_HEX_VERSION >= 0x20103
112 # include "fhiclcpp/types/ConfigurationTable.h"
114 #endif // ARTDAQ_DAQDATA_GLOBALS_HH
static uint32_t seedAndRandom_()
Seed the C random number generator with the current time (if that has not been done already) and gene...
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 MetricManager * metricMan_
A handle to MetricManager.
static int GetPartitionNumber()
Get the current partition number, as defined by the ARTDAQ_PARTITION_NUMBER environment variable...
static std::string mftrace_iteration_
MessageFacility's module and iteration are thread-local, but we want to use them to represent global ...
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.