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
39 static std::string mftrace_module_;
40 static std::string mftrace_iteration_;
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();
74 auto part = getenv(
"ARTDAQ_PARTITION_NUMBER");
80 auto part_s = std::string(part);
81 part_u =
static_cast<uint32_t
>(std::stoll(part_s, 0, 0));
83 catch (std::invalid_argument) {}
84 catch (std::out_of_range) {}
87 return (part_u & 0x7F);
92 #include "artdaq-core/Utilities/configureMessageFacility.hh"
94 #include "artdaq-core/Utilities/TimeUtils.hh"
95 #include "fhiclcpp/ParameterSet.h"
96 #include "fhiclcpp/types/Atom.h"
97 #include "fhiclcpp/types/Table.h"
98 #include "fhiclcpp/types/Sequence.h"
99 #include "fhiclcpp/types/TableFragment.h"
100 #if MESSAGEFACILITY_HEX_VERSION >= 0x20103
101 # include "fhiclcpp/types/ConfigurationTable.h"
103 #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...
The artdaq::Globals class contains several variables which are useful across the entire artdaq system...