otsdaq-mu2e-stm  5.02.01
dqm_structs.hh
1 #ifndef DQM_STRUCTS_HH
2 #define DQM_STRUCTS_HH
3 
4 #include <cstdint> // For fixed-width integer types like uint64_t
5 #include <atomic> // For std::atomic used in generation counters
6 
7 #pragma pack(push, 1)
8 
9 // Struct for ADC Baseline monitoring with generation counters for lock-free reading
11  std::atomic<uint64_t> gen_start; // Start generation counter
12  uint64_t timestamp_ns; // Time the struct was written
13  double baseline_mean_prev; // Mean baseline from previous run
14  double baseline_sigma_prev; // SIGMA from previous run
15  double baseline_mean_avg; // Average across runs or channels
16  double baseline_sigma_avg; // SIGMA of average baseline
17  double baseline_mean_current; // Current run mean
18  double baseline_sigma_current; // Current run SIGMA
19  double baseline_fit_mean_all; // Fit mean all time
20  double baseline_fit_sigma_all; // Fit width all time
21  double baseline_fit_mean_wind; // Fit mean all time
22  double baseline_fit_sigma_wind; // Fit width all time
23  size_t baseline_bins;
24  size_t noise_len;
25  uint8_t baseline_data[1]; // Baseline hist, noise data and end generation counter
26 };
27 
28 // Struct for Physics monitoring (no generation counter used here for simplicity)
30  uint64_t event_count; // Total number of events processed
31  double average_energy; // Average energy of physics events
32  double sigma_energy; // sigma of energy distribution
33 };
34 
35 // Struct for raw data monitoring with generation counters for lock-free reading
36 struct dqm_data_raw {
37  std::atomic<uint64_t> gen_start; // Start generation counter
38  uint64_t timestamp_ns; // Time the struct was written
39  size_t raw_len;
40  uint8_t raw_data[1]; // Raw ADC samples and end generation counter
41 };
42 
43 // Struct for peak histogramming with generation counters for lock-free reading
44 struct dqm_data_peak {
45  std::atomic<uint64_t> gen_start; // Start generation counter
46  uint64_t timestamp_ns; // Time the struct was written
47  size_t peak_nbins;
48  uint64_t peak_data[1]; // Peak samples and generation counter
49 };
50 
51 
52 // Struct for operations name and CPU performance
53 struct op_entry {
54  char name[32]; // Fixed 32-byte buffer for the name
55  double speed; // 8-byte double
56 };
57 
58 struct dqm_data_daq {
59  std::atomic<uint64_t> gen_start; // Start generation counter
60  uint64_t timestamp_ns; // Time the struct was written
61  size_t num_dropped_packets;
62  double adc_temp;
63  size_t num_ops;
64  op_entry ops_data[1]; // CPU speed and generation counter
65 };
66 
67 struct alarm_entry {
68  char text[128];
69  size_t level;
70  uint64_t time_ns;
71 };
72 
74  std::atomic<uint64_t> gen_start; // Start generation counter
75  uint64_t timestamp_ns; // Time the struct was written
76  size_t max_alarms;
77  size_t num_alarms;
78  size_t write_idx;
79  alarm_entry alarms[1];
80 };
81 
82 #pragma pack(pop)
83 
84 #endif // DQM_STRUCTS_HH
Definition: dqm_structs.hh:67
Definition: dqm_structs.hh:53