CnrByGroup.h
Go to the documentation of this file.
1 // CnrByGroup.h
2 //
3 // David Adams
4 // November 2021
5 //
6 // Remove correlated noise by subtracting the mean or median signal from the group for each channel.
7 // Channel groups are obtained from the channel group tool channelGroups.
8 //
9 // Adapted from PdspNoiseRemoval.
10 //
11 // Configuration:
12 // LogLevel: Log frequency: 0=none, 1=initialization, 2=every event
13 // Groups: List of group names.
14 // Options: List of options (last overrides):
15 // mean: Evaluate correction using mean of samples (default)
16 // median: Evaluate correction using median of samples
17 
18 #ifndef CnrByGroup_H
19 #define CnrByGroup_H
20 
22 #include "fhiclcpp/ParameterSet.h"
24 #include <string>
25 #include <vector>
26 #include <map>
27 
29 
30 public:
31 
32  // Ctor.
34 
35  // Dtor.
36  ~CnrByGroup() override =default;
37 
38  // Noise removal.
39  DataMap updateMap(AdcChannelDataMap& acds) const override;
40 
41 private:
42 
43  using Name = std::string;
44  using NameVector = std::vector<Name>;
45  using Index = unsigned int;
46  using IndexVector = std::vector<Index>;
47  using ChannelGroups = std::map<Name, IndexVector>;
48  using FloatVector = std::vector<float>;
49 
50  // Configuration data.
54 
55  // Derived data.
57  bool m_useMedian =false;
58  bool m_dropSignal =true;
60 
62 
63 };
64 
65 #endif
NameVector m_Groups
Definition: CnrByGroup.h:52
unsigned int Index
std::string string
Definition: nybbler.cc:12
CnrByGroup(fhicl::ParameterSet const &ps)
NameVector m_Options
Definition: CnrByGroup.h:53
FloatVector getCorrection(const IndexVector &channels, const AdcChannelDataMap &acds) const
int m_LogLevel
Definition: CnrByGroup.h:51
std::vector< Index > IndexVector
Definition: CnrByGroup.h:46
std::vector< float > FloatVector
Definition: CnrByGroup.h:48
DataMap updateMap(AdcChannelDataMap &acds) const override
static constexpr double ps
Definition: Units.h:99
bool m_dropSignal
Definition: CnrByGroup.h:58
bool m_requireGoodChannel
Definition: CnrByGroup.h:59
bool m_useMedian
Definition: CnrByGroup.h:57
~CnrByGroup() override=default
std::map< Name, IndexVector > ChannelGroups
Definition: CnrByGroup.h:47
std::map< AdcChannel, AdcChannelData > AdcChannelDataMap
std::vector< Name > NameVector
Definition: CnrByGroup.h:44
ChannelGroups m_chg
Definition: CnrByGroup.h:56
std::string Name
Definition: CnrByGroup.h:43