LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
SimpleChannelStatus.h
Go to the documentation of this file.
1 
9 #ifndef SIMPLECHANNELFILTER_H
10 #define SIMPLECHANNELFILTER_H 1
11 
12 // LArSoft libraries
13 #include "larcoreobj/SimpleTypesAndConstants/RawTypes.h" // raw::ChannelID_t
14 #include "larevt/CalibrationDBI/Interface/ChannelStatusProvider.h"
15 
16 // Utility libraries
17 namespace fhicl {
18  class ParameterSet;
19 }
20 
21 // C/C++ standard library
22 #include <memory> // std::unique_ptr<>
23 
24 namespace lariov {
25 
48  class SimpleChannelStatus : public lariov::ChannelStatusProvider {
49  public:
50  using ChannelSet_t = lariov::ChannelStatusProvider::ChannelSet_t;
51 
53  explicit SimpleChannelStatus(fhicl::ParameterSet const& pset);
54 
55  //
56  // interface methods
57  //
58 
62  bool IsPresent(raw::ChannelID_t channel) const override;
63 
65  bool IsGood(raw::ChannelID_t channel) const override
66  {
67  return IsPresent(channel) && !IsBad(channel) && !IsNoisy(channel);
68  }
69 
71  bool IsBad(raw::ChannelID_t channel) const override { return fBadChannels.count(channel) > 0; }
72 
74  bool IsNoisy(raw::ChannelID_t channel) const override
75  {
76  return fNoisyChannels.count(channel) > 0;
77  }
79 
83  ChannelSet_t GoodChannels() const override;
84 
86  ChannelSet_t BadChannels() const override { return fBadChannels; }
87 
89  ChannelSet_t NoisyChannels() const override { return fNoisyChannels; }
91 
92  //
93  // non-interface methods and configuration methods
94  //
95 
97  raw::ChannelID_t MaxChannel() const { return fMaxChannel; }
98 
100  raw::ChannelID_t MaxChannelPresent() const { return fMaxPresentChannel; }
101 
104 
114  void Setup(raw::ChannelID_t MaxChannel, raw::ChannelID_t MaxGoodChannel);
115 
123  void Setup(raw::ChannelID_t MaxChannel) { Setup(MaxChannel, MaxChannel); }
124 
126 
127  protected:
130 
133 
135  mutable std::unique_ptr<ChannelSet_t> fGoodChannels;
136 
138  void FillGoodChannels() const;
139 
140  }; // class SimpleChannelStatus
141 
142 } // namespace lariov
143 
144 #endif // SIMPLECHANNELFILTER_H
raw::ChannelID_t MaxChannelPresent() const
Returns the ID of the largest present channel.
ChannelSet_t fNoisyChannels
set of noisy channels
bool IsGood(raw::ChannelID_t channel) const override
Returns whether the specified channel is physical and good.
std::unique_ptr< ChannelSet_t > fGoodChannels
cached set of good channels (lazy evaluation)
raw::ChannelID_t MaxChannel() const
Returns the ID of the largest known channel.
raw::ChannelID_t fMaxPresentChannel
largest ID among present channels
ChannelSet_t fBadChannels
set of bad channels
ChannelSet_t BadChannels() const override
Returns a copy of set of bad channel IDs for the current run.
parameter set interface
bool IsBad(raw::ChannelID_t channel) const override
Returns whether the specified channel is bad in the current run.
lariov::ChannelStatusProvider::ChannelSet_t ChannelSet_t
Filters for channels, events, etc.
Class providing information about the quality of channels.
void Setup(raw::ChannelID_t MaxChannel)
Sets the service provider up.
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
raw::ChannelID_t fMaxChannel
largest ID among existing channels
bool IsNoisy(raw::ChannelID_t channel) const override
Returns whether the specified channel is noisy in the current run.
ChannelSet_t NoisyChannels() const override
Returns a copy of set of noisy channel IDs for the current run.