otsdaq-mu2e-stm  5.02.01
mu2e_config.hh
1 #ifndef MU2E_CONFIG_HH_
2 #define MU2E_CONFIG_HH_
3 
4 // Include config files
5 #include "Mu2e-STMDAQ/config/config.hh"
6 #include "Mu2e-STMDAQ/config/include/fw_config.hh"
7 
8 // Mu2e configurable variables
9 struct mu2e_info{
10 
11  // The minumum mu2e event period (us)
12  const double min_event_period;
13  // The minumum mu2e event length (ADC values)
14  const size_t min_event_len;
15  // The minumum mu2e event size (bytes)
16  const size_t min_event_size;
17  // The maximum mu2e event period (us)
18  const double max_event_period;
19  // The maximum mu2e event length (ADC values)
20  const size_t max_event_len;
21  // The maximum mu2e event size (bytes)
22  const size_t max_event_size;
23  // The on-spill mu2e event period (us)
24  const double on_spill_period;
25  // The mu2e on-spill event length (ADC values)
26  const size_t on_spill_len;
27  // The mu2e on-spill event size (bytes)
28  const size_t on_spill_size;
29  // The off-spill mu2e event period (us)
30  const double off_spill_period;
31  // The mu2e off-spill event length (ADC values)
32  const size_t off_spill_len;
33  // The mu2e off-spill event size (bytes)
34  const size_t off_spill_size;
35 
36  // Constructor
37  mu2e_info(Config& cfg,
38  const std::shared_ptr<AsyncLogger> logger,
39  fw_info fw_config) :
40  min_event_period(cfg.getValue<double>("stm.mu2e.min_event_period")),
41  min_event_len(std::ceil(min_event_period*fw_config.fADC)),
42  min_event_size(min_event_len*sizeof(int16_t)),
43  max_event_period(cfg.getValue<double>("stm.mu2e.max_event_period")),
44  max_event_len(std::ceil(max_event_period*fw_config.fADC)),
45  max_event_size(max_event_len*sizeof(int16_t)),
46  on_spill_period(cfg.getValue<double>("stm.mu2e.on_spill_period")),
47  on_spill_len(std::ceil(on_spill_period*fw_config.fADC)),
48  on_spill_size(on_spill_len*sizeof(int16_t)),
49  off_spill_period(cfg.getValue<double>("stm.mu2e.off_spill_period")),
50  off_spill_len(std::ceil(off_spill_period*fw_config.fADC)),
51  off_spill_size(off_spill_len*sizeof(int16_t))
52  {
53 
54  // Notify user
55  if (logger){
56  logger->log("Config:mu2e_info: Minimum Mu2e event period set to " +
57  std::to_string(min_event_period) +
58  " us = " +
59  std::to_string(min_event_len) +
60  " ADC values = " +
61  std::to_string(min_event_size) +
62  " bytes.",1);
63  logger->log("Config:mu2e_info: Maximum Mu2e event period set to " +
64  std::to_string(max_event_period) +
65  " us = " +
66  std::to_string(max_event_len) +
67  " ADC values = " +
68  std::to_string(max_event_size) +
69  " bytes.",1);
70  logger->log("Config:mu2e_info: Mu2e on-spill event period set to " +
71  std::to_string(on_spill_period) +
72  " us = " +
73  std::to_string(on_spill_len) +
74  " ADC values = " +
75  std::to_string(on_spill_size) +
76  " bytes.",1);
77  logger->log("Config:mu2e_info: Mu2e off-spill event period set to " +
78  std::to_string(off_spill_period) +
79  " us = " +
80  std::to_string(off_spill_len) +
81  " ADC values = " +
82  std::to_string(off_spill_size) +
83  " bytes.",1);
84  }
85  }
86 
87 };
88 
89 #endif
Definition: config.hh:19