AdcCodeMitigator.h
Go to the documentation of this file.
1 // AdcCodeMitigator.h
2 
3 // David Adams
4 // October 2018
5 //
6 // Tool to mitigate sticky codes (i.e. set acd.flags) from fcl.
7 //
8 // If the flag for a sample is in FixFlags, then the sample is set to zero.
9 // If the flag is in InterpolateFlags, then the sample is obtained by
10 // interpolating between the first non-sticky samples before and after.
11 //
12 // The algorithm for interpolation depends on the data and the the
13 // curvature threshold FCT:
14 //
15 // 1. If FCT > 0 and two non-sticky codes are found on at least one side
16 // of the mitigated samples, the signal jump is evaluted on each side
17 // difference between two nearest non-sticky samples. A constant-curvature
18 // interpolation is done if the magnitude of either of these jumps exceeds FCT.
19 //
20 // The interpolation passes through the closest point on each side and equally
21 // far from the second point on each side.
22 //
23 // 2. Otherwise and if one non-sticky code is found on either side of the
24 // mitigated samples, linear interpolate is performed between the nearest
25 // samples on each side.
26 //
27 // 3. Otherwise if a non-sticky sample is found on one side, that value is used.
28 //
29 // 4. Otherwise the mitigated samples are set to zero.
30 //
31 // Here non-sticky means not in InterpolateFlags or SkipFlags.
32 //
33 // The fix mitigation is done before the interpolation.
34 //
35 // Configuration:
36 // LogLevel - 0=silent, 1=init, 2=each event, >2=more
37 // FixFlags - Samples with these flags are set to zero
38 // InterpolateFlags - Samples with these flags are interpolated from neighbors
39 // SkipFlags - Samples with these flags are not used for interpolation.
40 // FixedCurvThresh - The parameter FCT discussed above.
41 
42 #ifndef AdcCodeMitigator_H
43 #define AdcCodeMitigator_H
44 
47 #include "fhiclcpp/ParameterSet.h"
48 #include <vector>
49 #include <set>
50 #include <map>
51 
53 
54 public:
55 
56  using Index = unsigned int;
57  using IndexVector = std::vector<Index>;
58  using IndexSet = std::set<Index>;
59  using Name = std::string;
60 
62 
63  ~AdcCodeMitigator() override =default;
64 
65  DataMap update(AdcChannelData& acds) const override;
66 
67 private:
68 
69  // Configuration data.
75 
76  // Configuration derived data.
80 
81 };
82 
83 
84 #endif
std::vector< Index > IndexVector
IndexVector m_SkipFlags
unsigned int Index
std::string string
Definition: nybbler.cc:12
~AdcCodeMitigator() override=default
AdcCodeMitigator(fhicl::ParameterSet const &ps)
IndexVector m_InterpolateFlags
IndexSet m_interpolateSet
std::set< Index > IndexSet
static constexpr double ps
Definition: Units.h:99
IndexVector m_FixFlags
DataMap update(AdcChannelData &acds) const override