All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SIOVChannelStatusProvider.h
Go to the documentation of this file.
1 /**
2  * @file SIOVChannelStatusProvider.h
3  * @brief Channel quality provider with information from configuration file
4  * @author Brandon Eberly (eberly@fnal.gov)
5  * @date August 24, 2015
6  * @see ChannelStatusService.h SIOVChannelStatusProvider.cpp
7  */
8 
9 
10 #ifndef SIOVCHANNELSTATUSPROVIDER_H
11 #define SIOVCHANNELSTATUSPROVIDER_H 1
12 
13 // LArSoft libraries
21 
22 // Utility libraries
23 namespace fhicl { class ParameterSet; }
24 
25 /// Filters for channels, events, etc
26 namespace lariov {
27 
28 
29  /** **************************************************************************
30  * @brief Class providing information about the quality of channels
31  *
32  * This class serves information read from a FHiCL configuration file and/or a database.
33  *
34  * LArSoft interface to this class is through the service
35  * SIOVChannelStatusService.
36  */
38 
39  public:
40 
41  /// Constructor
42  SIOVChannelStatusProvider(fhicl::ParameterSet const& pset);
43 
44  ///Default destructor
45  virtual ~SIOVChannelStatusProvider() = default;
46 
47  //
48  // non-interface methods
49  //
50  /// Returns Channel Status
51  const ChannelStatus& GetChannelStatus(raw::ChannelID_t channel) const;
52 
53  //
54  // interface methods
55  //
56 
57  /// @name Single channel queries
58  /// @{
59  /// Returns whether the specified channel is physical and connected to wire
60  bool IsPresent(raw::ChannelID_t channel) const override {
61  return GetChannelStatus(channel).IsPresent();
62  }
63 
64  /// Returns whether the specified channel is bad in the current run
65  bool IsBad(raw::ChannelID_t channel) const override {
66  return GetChannelStatus(channel).IsDead() || GetChannelStatus(channel).IsLowNoise() || !IsPresent(channel);
67  }
68 
69  /// Returns whether the specified channel is noisy in the current run
70  bool IsNoisy(raw::ChannelID_t channel) const override {
71  return GetChannelStatus(channel).IsNoisy();
72  }
73 
74  /// Returns whether the specified channel is physical and good
75  bool IsGood(raw::ChannelID_t channel) const override {
76  return GetChannelStatus(channel).IsGood();
77  }
78  /// @}
79 
80  Status_t Status(raw::ChannelID_t channel) const override {
81  return (Status_t) this->GetChannelStatus(channel).Status();
82  }
83 
84  /// @name Global channel queries
85  /// @{
86  /// Returns a copy of set of good channel IDs for the current run
87  ChannelSet_t GoodChannels() const override;
88 
89  /// Returns a copy of set of bad channel IDs for the current run
90  ChannelSet_t BadChannels() const override;
91 
92  /// Returns a copy of set of noisy channel IDs for the current run
93  ChannelSet_t NoisyChannels() const override;
94  /// @}
95 
96 
97  /// Update event time stamp.
99 
100  /// @name Configuration functions
101  /// @{
102  /// Prepares the object to provide information about the specified time
103  bool Update(DBTimeStamp_t);
104 
105  /// Allows a service to add to the list of noisy channels
107 
108  ///@}
109 
110 
111  /// Converts LArSoft channel ID in the one proper for the DB
113  { return DBChannelID_t(channel); }
114 
115  private:
116 
117  /// Do actual database updates.
118 
119  bool DBUpdate() const; // Uses current event time.
120  bool DBUpdate(DBTimeStamp_t ts) const;
121 
122  // Time stamps.
123 
124  DBTimeStamp_t fEventTimeStamp; // Most recently seen time stamp.
125  mutable DBTimeStamp_t fCurrentTimeStamp; // Time stamp of cached data.
126 
128  mutable Snapshot<ChannelStatus> fData; // Lazily updated once per IOV.
129  Snapshot<ChannelStatus> fNewNoisy; // Updated once per event.
131 
133 
134  }; // class SIOVChannelStatusProvider
135 
136 
137 } // namespace lariov
138 
139 
140 #endif // SIOVCHANNELSTATUSPROVIDER_H
virtual ~SIOVChannelStatusProvider()=default
Default destructor.
Status_t Status(raw::ChannelID_t channel) const override
Returns a status integer with arbitrary meaning.
ChannelSet_t GoodChannels() const override
Returns a copy of set of good channel IDs for the current run.
bool IsNoisy() const
Definition: ChannelStatus.h:38
std::set< raw::ChannelID_t > ChannelSet_t
Type of set of channel IDs.
bool IsPresent() const
Definition: ChannelStatus.h:39
bool IsNoisy(raw::ChannelID_t channel) const override
Returns whether the specified channel is noisy in the current run.
static DBChannelID_t rawToDBChannel(raw::ChannelID_t channel)
Converts LArSoft channel ID in the one proper for the DB.
chStatus Status() const
Definition: ChannelStatus.h:41
bool IsLowNoise() const
Definition: ChannelStatus.h:37
std::uint32_t DBChannelID_t
Class def header for a class Snapshot.
ChannelSet_t NoisyChannels() const override
Returns a copy of set of noisy channel IDs for the current run.
std::uint64_t DBTimeStamp_t
void UpdateTimeStamp(DBTimeStamp_t ts)
Update event time stamp.
Class providing information about the quality of channels.
unsigned short Status_t
type representing channel status
bool IsGood(raw::ChannelID_t channel) const override
Returns whether the specified channel is physical and good.
bool IsDead() const
Definition: ChannelStatus.h:36
bool IsGood() const
Definition: ChannelStatus.h:40
Class providing information about the quality of channels.
ChannelSet_t BadChannels() const override
Returns a copy of set of bad channel IDs for the current run.
Class def header for a class DatabaseRetrievalAlg.
bool IsBad(raw::ChannelID_t channel) const override
Returns whether the specified channel is bad in the current run.
ChannelSet_t GetChannelsWithStatus(chStatus status) const
const ChannelStatus & GetChannelStatus(raw::ChannelID_t channel) const
Returns Channel Status.
Interface for experiment-specific channel quality info provider.
bool DBUpdate() const
Do actual database updates.
SIOVChannelStatusProvider(fhicl::ParameterSet const &pset)
Constructor.
void AddNoisyChannel(raw::ChannelID_t ch)
Allows a service to add to the list of noisy channels.
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
bool IsPresent(raw::ChannelID_t channel) const override
Returns whether the specified channel is physical and connected to wire.
Class def header for a class ChannelStatus.