otsdaq-mu2e-stm  5.02.01
dqm_config.hh
1 #ifndef DQM_CONFIG_HH_
2 #define DQM_CONFIG_HH_
3 
4 #include <limits>
5 
6 // Include config files
7 #include "Mu2e-STMDAQ/config/config.hh"
8 #include "Mu2e-STMDAQ/config/include/fw_config.hh"
9 
10 // DQM configurable variables
11 struct dqm_info{
12 
13  // Get the right channel sub-string
14  const std::string channel;
15 
16  // Number of raw ADC values to store
17  const size_t raw_period;
18  const size_t raw_len;
19 
20  // Number of noise ADC values to store
21  const size_t noise_period;
22  const size_t noise_len;
23 
24  // Peak hist info
25  const size_t peak_nbins;
26  const int16_t min_ph;
27  const double inv_bin_wid;
28 
29  // Constructor
30  dqm_info(Config& cfg, const std::shared_ptr<AsyncLogger> logger,
31  fw_info fw_config) :
32  raw_period(cfg.getValue<int>("stm.dqm.raw_data.raw_length")), // Raw time to store
33  raw_len(raw_period*fw_config.fADC), // Number of raw ADC values to store
34  noise_period(cfg.getValue<int>("stm.dqm.baseline.noise_length")), // Noise time to store
35  noise_len(noise_period*fw_config.fADC), // Number of noise ADC values to store
36  peak_nbins(cfg.getValue<int>("stm.dqm.pulses.peak_nbins")), // Number of bins in peak histogram
37  min_ph(std::clamp(cfg.getValue<int>("stm.dqm.pulses.min_height"), // Min adc of peak histogram
38  static_cast<int>(std::numeric_limits<int16_t>::min()),
39  static_cast<int>(std::numeric_limits<int16_t>::max()))),
40  inv_bin_wid(-1.0 * (double)peak_nbins/(double)min_ph) // inverse bin width
41  {
42  // Notify user
43  if (logger){
44  logger->log("Config:dqm_info: Storing " +
45  std::to_string(raw_len) +
46  " raw ADC values for DQM.",1);
47  logger->log("Config:dqm_info: Storing " +
48  std::to_string(noise_len) +
49  " noise ADC values for DQM.",1);
50  logger->log("Config:dqm_info: Peak histogram bins = " +
51  std::to_string(peak_nbins) + ", min height = " +
52  std::to_string(min_ph) + ", inverse bin width = " +
53  std::to_string(inv_bin_wid) ,1);
54  }
55  }
56 
57 
58 };
59 
60 #endif
Definition: config.hh:19