LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
SimpleChannelStatus.h
Go to the documentation of this file.
1 
10 #ifndef SIMPLECHANNELFILTER_H
11 #define SIMPLECHANNELFILTER_H 1
12 
13 // LArSoft libraries
14 #include "larcoreobj/SimpleTypesAndConstants/RawTypes.h" // raw::ChannelID_t
15 #include "larevt/CalibrationDBI/Interface/ChannelStatusProvider.h"
16 
17 // Utility libraries
18 #include "fhiclcpp/ParameterSet.h"
19 
20 // C/C++ standard library
21 #include <memory> // std::unique_ptr<>
22 
23 
24 namespace lariov {
25 
26 
49  class SimpleChannelStatus: public lariov::ChannelStatusProvider {
50  public:
51  using ChannelSet_t = lariov::ChannelStatusProvider::ChannelSet_t;
52 
54  explicit SimpleChannelStatus(fhicl::ParameterSet const& pset);
55 
56  //
57  // interface methods
58  //
59 
63  virtual bool IsPresent(raw::ChannelID_t channel) const override;
64 
66  virtual bool IsGood(raw::ChannelID_t channel) const override
67  { return IsPresent(channel) && !IsBad(channel) && !IsNoisy(channel); }
68 
70  virtual bool IsBad(raw::ChannelID_t channel) const override
71  { return fBadChannels.count(channel) > 0; }
72 
74  virtual bool IsNoisy(raw::ChannelID_t channel) const override
75  { return fNoisyChannels.count(channel) > 0; }
77 
78 
82  virtual ChannelSet_t GoodChannels() const override;
83 
85  virtual ChannelSet_t BadChannels() const override
86  { return fBadChannels; }
87 
89  virtual ChannelSet_t NoisyChannels() const override
90  { return fNoisyChannels; }
92 
93 
94  //
95  // non-interface methods and configuration methods
96  //
97 
100 
103 
104 
105 
108 
118  void Setup(raw::ChannelID_t MaxChannel, raw::ChannelID_t MaxGoodChannel);
119 
127  void Setup(raw::ChannelID_t MaxChannel) { Setup(MaxChannel, MaxChannel); }
128 
129  /* TODO DELME
132  virtual bool Update(std::uint64_t) override { return true; }
133  */
134 
136 
137  protected:
138 
141 
144 
146  mutable std::unique_ptr<ChannelSet_t> fGoodChannels;
147 
149  void FillGoodChannels() const;
150 
151  }; // class SimpleChannelStatus
152 
153 
154 } // namespace lariov
155 
156 
157 #endif // SIMPLECHANNELFILTER_H
raw::ChannelID_t MaxChannelPresent() const
Returns the ID of the largest present channel.
ChannelSet_t fNoisyChannels
set of noisy channels
void Setup(raw::ChannelID_t MaxChannel, raw::ChannelID_t MaxGoodChannel)
Sets the service provider up.
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
virtual bool IsPresent(raw::ChannelID_t channel) const override
Returns whether the specified channel is physical and good.
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.
lariov::ChannelStatusProvider::ChannelSet_t ChannelSet_t
Filters for channels, events, etc.
void FillGoodChannels() const
Fills the collection of good channels.
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:27
virtual bool IsGood(raw::ChannelID_t channel) const override
Returns whether the specified channel is physical and good.
virtual ChannelSet_t GoodChannels() const override
Returns a copy of set of bad channel IDs for the current run.
raw::ChannelID_t fMaxChannel
largest ID among existing channels
SimpleChannelStatus(fhicl::ParameterSet const &pset)
Configuration.