ChannelStatusProvider.h
Go to the documentation of this file.
1 /**
2  * @file ChannelStatusProvider.h
3  * @brief Interface for experiment-specific channel quality info provider
4  * @author Gianluca Petrillo (petrillo@fnal.gov)
5  * @date November 24th, 2014
6  * @see ChannelStatusService.h
7  *
8  * This is the interface of ChannelStatus service provider core object.
9  * A ChannelStatus service provider object (with the interface of ChannelStatus
10  * service provider core object) provides the actual information about channels.
11  * It can be instanciated by a art service (an implementation of
12  * ChannelStatusService) or from whatever system needs it.
13  */
14 
15 
16 #ifndef CHANNELSTATUSPROVIDER_H
17 #define CHANNELSTATUSPROVIDER_H 1
18 
19 // C/C++ standard libraries
20 #include <set>
21 #include <limits> // std::numeric_limits<>
22 
23 // LArSoft libraries
25 #include "larcoreobj/SimpleTypesAndConstants/RawTypes.h" // raw::ChannelID_t
26 
27 
28 /// Filters for channels, events, etc
29 namespace lariov {
30 
31  /** **************************************************************************
32  * @brief Class providing information about the quality of channels
33  *
34  * This class provides only a simple interface.
35  * Experiments need to implement and configure their own class implementing
36  * this interface.
37  * The simplest implementation is provided in LArSoft:
38  * SimpleChannelStatus.
39  *
40  * Currently, the class provides interface for the following information:
41  * - goodness of the channel: good or bad (dead or unusable)
42  * - noisiness of the channel: good or noisy (or compromised in some way)
43  * - physical channel: physically connected to a wire or not
44  *
45  * It also has a stub interface to inform the object of which time we are
46  * interested in.
47  *
48  */
50 
51  public:
52 
53  using Status_t = unsigned short; ///< type representing channel status
54 
55  /// Type of set of channel IDs
56  using ChannelSet_t = std::set<raw::ChannelID_t>;
57 
58  /// Value or invalid status
59  static constexpr Status_t InvalidStatus
61 
62  /// Default constructor
63  ChannelStatusProvider() = default;
64 
65  // do not allow for copies or moves of this class
70 
71  /// Virtual destructor; destructs nothing
72  virtual ~ChannelStatusProvider() = default;
73 
74  /// Returns whether the specified channel is physical and connected to wire
75  virtual bool IsPresent(raw::ChannelID_t channel) const = 0;
76 
77  /// Returns whether the specified channel is bad in the current run
78  virtual bool IsBad(raw::ChannelID_t channel) const = 0;
79 
80  /// Returns whether the specified channel is noisy in the current run
81  virtual bool IsNoisy(raw::ChannelID_t channel) const = 0;
82 
83  /// Returns whether the specified channel is physical and good
84  virtual bool IsGood(raw::ChannelID_t channel) const {
85  return IsPresent(channel) && !IsBad(channel) && !IsNoisy(channel);
86  }
87 
88  /// Returns a status integer with arbitrary meaning
90  { return InvalidStatus; }
91 
92  /// Returns whether the specified status is a valid one
93  virtual bool HasStatus(raw::ChannelID_t channel) const
94  { return IsValidStatus(Status(channel)); }
95 
96 
97  /// Returns a copy of set of good channel IDs for the current run
98  virtual ChannelSet_t GoodChannels() const = 0;
99 
100  /// Returns a copy of set of bad channel IDs for the current run
101  virtual ChannelSet_t BadChannels() const = 0;
102 
103  /// Returns a copy of set of noisy channel IDs for the current run
104  virtual ChannelSet_t NoisyChannels() const = 0;
105 
106 
107  /* TODO DELME
108  /// Prepares the object to provide information about the specified time
109  /// @return whether information is available for the specified time
110  virtual bool Update(DBTimeStamp_t ts) = 0;
111  */
112 
113  /// Returns whether the specified status is a valid one
115  { return status != InvalidStatus; }
116 
117  }; // class ChannelStatusProvider
118 
119 } // namespace lariov
120 
121 
122 #endif // CHANNELSTATUSPROVIDER_H
virtual bool IsBad(raw::ChannelID_t channel) const =0
Returns whether the specified channel is bad in the current run.
virtual ChannelSet_t BadChannels() const =0
Returns a copy of set of bad channel IDs for the current run.
An empty class that can&#39;t be copied nor moved.
std::set< raw::ChannelID_t > ChannelSet_t
Type of set of channel IDs.
Defines classes that can&#39;t be copied nor moved.
virtual bool IsNoisy(raw::ChannelID_t channel) const =0
Returns whether the specified channel is noisy in the current run.
virtual ChannelSet_t NoisyChannels() const =0
Returns a copy of set of noisy channel IDs for the current run.
ChannelStatusProvider()=default
Default constructor.
uint8_t channel
Definition: CRTFragment.hh:201
virtual ChannelSet_t GoodChannels() const =0
Returns a copy of set of good channel IDs for the current run.
virtual ~ChannelStatusProvider()=default
Virtual destructor; destructs nothing.
unsigned short Status_t
type representing channel status
ChannelStatusProvider & operator=(ChannelStatusProvider const &)=delete
static constexpr Status_t InvalidStatus
Value or invalid status.
virtual Status_t Status(raw::ChannelID_t channel) const
Returns a status integer with arbitrary meaning.
virtual bool IsGood(raw::ChannelID_t channel) const
Returns whether the specified channel is physical and good.
Class providing information about the quality of channels.
static int max(int a, int b)
Filters for channels, events, etc.
virtual bool IsPresent(raw::ChannelID_t channel) const =0
Returns whether the specified channel is physical and connected to wire.
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
virtual bool HasStatus(raw::ChannelID_t channel) const
Returns whether the specified status is a valid one.
static bool IsValidStatus(Status_t status)
Returns whether the specified status is a valid one.