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
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.
98  void UpdateTimeStamp(DBTimeStamp_t ts);
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
106  void AddNoisyChannel(raw::ChannelID_t ch);
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 
132  ChannelSet_t GetChannelsWithStatus(chStatus status) const;
133 
134  }; // class SIOVChannelStatusProvider
135 
136 
137 } // namespace lariov
138 
139 
140 #endif // SIOVCHANNELSTATUSPROVIDER_H
bool IsPresent(raw::ChannelID_t channel) const override
Returns whether the specified channel is physical and connected to wire.
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
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.
bool IsNoisy(raw::ChannelID_t channel) const override
Returns whether the specified channel is noisy in the current run.
std::uint64_t DBTimeStamp_t
Status_t Status(raw::ChannelID_t channel) const override
Returns a status integer with arbitrary meaning.
uint8_t channel
Definition: CRTFragment.hh:201
Class providing information about the quality of channels.
unsigned short Status_t
type representing channel status
bool IsBad(raw::ChannelID_t channel) const override
Returns whether the specified channel is bad in the current run.
bool IsDead() const
Definition: ChannelStatus.h:36
bool IsGood() const
Definition: ChannelStatus.h:40
Class providing information about the quality of channels.
Class def header for a class DatabaseRetrievalAlg.
Filters for channels, events, etc.
bool IsGood(raw::ChannelID_t channel) const override
Returns whether the specified channel is physical and good.
Interface for experiment-specific channel quality info provider.
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
Class def header for a class ChannelStatus.
bool Update(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, PFPStruct &pfp, bool prt)
Definition: PFPUtils.cxx:1056