1 #ifndef PULSEHEIGHT_CONFIG_HH_
2 #define PULSEHEIGHT_CONFIG_HH_
5 #include "Mu2e-STMDAQ/config/config.hh"
6 #include "Mu2e-STMDAQ/config/include/fw_config.hh"
12 const int baselineWindow;
13 const int baselineLookback;
16 const double threshold;
17 const int slopeWindow;
18 const double slopeThreshold;
19 const double noiseTolerance;
20 const int minBaselineCheck;
22 const int localWindowMax;
23 const int persistenceWindow;
24 const float persistenceFraction;
25 const int persistenceCount;
26 const float curvature_threshold;
27 const float contaminatedBaselineStd;
30 const std::array<float,7> sg7_coeffs;
34 const std::shared_ptr<AsyncLogger> logger,
39 baselineWindow(cfg.getValue<
int>(
"stm.ph.baselineWindow")),
40 baselineLookback(cfg.getValue<
int>(
"stm.ph.baselineLookback")),
43 threshold(cfg.getValue<
double>(
"stm.ph.threshold")),
44 slopeWindow(cfg.getValue<
int>(
"stm.ph.slopeWindow")),
45 slopeThreshold(cfg.getValue<
double>(
"stm.ph.slopeThreshold")),
46 noiseTolerance(cfg.getValue<
double>(
"stm.ph.noiseTolerance")),
47 minBaselineCheck(cfg.getValue<
int>(
"stm.ph.minBaselineCheck")),
48 Nsharp(cfg.getValue<
int>(
"stm.ph.Nsharp")),
49 localWindowMax(cfg.getValue<
int>(
"stm.ph.localWindowMax")),
50 persistenceWindow(cfg.getValue<
int>(
"stm.ph.persistenceWindow")),
51 persistenceFraction(cfg.getValue<
float>(
"stm.ph.persistenceFraction")),
52 persistenceCount(cfg.getValue<
int>(
"stm.ph.persistenceCount")),
53 curvature_threshold(cfg.getValue<
float>(
"stm.ph.curvature_threshold")),
54 contaminatedBaselineStd(cfg.getValue<
float>(
"stm.ph.contaminatedBaselineStd")),
58 cfg.getValue<
float>(
"stm.ph.sg7.c0"),
59 cfg.getValue<
float>(
"stm.ph.sg7.c1"),
60 cfg.getValue<
float>(
"stm.ph.sg7.c2"),
61 cfg.getValue<
float>(
"stm.ph.sg7.c3"),
62 cfg.getValue<
float>(
"stm.ph.sg7.c4"),
63 cfg.getValue<
float>(
"stm.ph.sg7.c5"),
64 cfg.getValue<
float>(
"stm.ph.sg7.c6")
69 logger->log(
"Config:pulseheight_info: baselineWindow = " +
70 std::to_string(baselineWindow) +
71 "; baselineLookback = " +
72 std::to_string(baselineLookback) +
".", 1);
74 logger->log(
"Config:pulseheight_info: threshold = " +
75 std::to_string(threshold) +
77 std::to_string(slopeWindow) +
78 "; slopeThreshold = " +
79 std::to_string(slopeThreshold) +
".", 1);
81 logger->log(
"Config:pulseheight_info: noiseTolerance = " +
82 std::to_string(noiseTolerance) +
83 "; minBaselineCheck = " +
84 std::to_string(minBaselineCheck) +
".", 1);
86 logger->log(
"Config:pulseheight_info: Nsharp = " +
87 std::to_string(Nsharp) +
88 "; localWindowMax = " +
89 std::to_string(localWindowMax) +
".", 1);
91 logger->log(
"Config:pulseheight_info: persistence window = " +
92 std::to_string(persistenceWindow) +
93 "; persistence fraction = " +
94 std::to_string(persistenceFraction) +
95 "; persistence count = " +
96 std::to_string(persistenceCount) +
".", 1);
98 logger->log(
"Config:pulseheight_info: curvature_threshold = " +
99 std::to_string(curvature_threshold) +
".", 1);
101 logger->log(
"Config:pulseheight_info: contaminatedBaselineStd = " +
102 std::to_string(contaminatedBaselineStd) +
".", 1);
105 if (sg7_coeffs.size() != 7) {
107 logger->log(
"Config:pulseheight_info: Error! sg7_coeffs must contain 7 values.", 0);
111 std::string coeffs_str;
113 for (
size_t i = 0; i < sg7_coeffs.size(); ++i) {
115 coeffs_str += std::to_string(sg7_coeffs[i]);
117 if (i + 1 < sg7_coeffs.size())
121 logger->log(
"Config:pulseheight_info: sg7_coeffs = [" +
122 coeffs_str +
"].", 1);