LArSoft  v09_90_00
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  virtual bool IsPresent(raw::ChannelID_t channel) const override;
63 
65  virtual bool IsGood(raw::ChannelID_t channel) const override
66  {
67  return IsPresent(channel) && !IsBad(channel) && !IsNoisy(channel);
68  }
69 
71  virtual bool IsBad(raw::ChannelID_t channel) const override
72  {
73  return fBadChannels.count(channel) > 0;
74  }
75 
77  virtual bool IsNoisy(raw::ChannelID_t channel) const override
78  {
79  return fNoisyChannels.count(channel) > 0;
80  }
82 
86  virtual ChannelSet_t GoodChannels() const override;
87 
89  virtual ChannelSet_t BadChannels() const override { return fBadChannels; }
90 
92  virtual ChannelSet_t NoisyChannels() const override { return fNoisyChannels; }
94 
95  //
96  // non-interface methods and configuration methods
97  //
98 
100  raw::ChannelID_t MaxChannel() const { return fMaxChannel; }
101 
103  raw::ChannelID_t MaxChannelPresent() const { return fMaxPresentChannel; }
104 
107 
117  void Setup(raw::ChannelID_t MaxChannel, raw::ChannelID_t MaxGoodChannel);
118 
126  void Setup(raw::ChannelID_t MaxChannel) { Setup(MaxChannel, MaxChannel); }
127 
128  /* TODO DELME
131  virtual bool Update(std::uint64_t) override { return true; }
132  */
133 
135 
136  protected:
139 
142 
144  mutable std::unique_ptr<ChannelSet_t> fGoodChannels;
145 
147  void FillGoodChannels() const;
148 
149  }; // class SimpleChannelStatus
150 
151 } // namespace lariov
152 
153 #endif // SIMPLECHANNELFILTER_H
raw::ChannelID_t MaxChannelPresent() const
Returns the ID of the largest present channel.
ChannelSet_t fNoisyChannels
set of noisy channels
virtual bool IsBad(raw::ChannelID_t channel) const override
Returns whether the specified channel is bad in the current run.
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
virtual ChannelSet_t NoisyChannels() const override
Returns a copy of set of noisy channel IDs for the current run.
parameter set interface
lariov::ChannelStatusProvider::ChannelSet_t ChannelSet_t
Filters for channels, events, etc.
virtual ChannelSet_t BadChannels() const override
Returns a copy of set of bad channel IDs for the current run.
Class providing information about the quality of channels.
virtual bool IsNoisy(raw::ChannelID_t channel) const override
Returns whether the specified channel is noisy in the current run.
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
virtual bool IsGood(raw::ChannelID_t channel) const override
Returns whether the specified channel is physical and good.
raw::ChannelID_t fMaxChannel
largest ID among existing channels