LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
SIOVChannelStatusProvider.h
Go to the documentation of this file.
1 
9 #ifndef SIOVCHANNELSTATUSPROVIDER_H
10 #define SIOVCHANNELSTATUSPROVIDER_H 1
11 
12 // LArSoft libraries
17 #include "larevt/CalibrationDBI/Interface/CalibrationDBIFwd.h"
18 #include "larevt/CalibrationDBI/Interface/ChannelStatusProvider.h"
20 
21 // Utility libraries
22 namespace fhicl {
23  class ParameterSet;
24 }
25 
27 namespace lariov {
28 
37  class SIOVChannelStatusProvider : public DatabaseRetrievalAlg, public ChannelStatusProvider {
38 
39  public:
42 
44  virtual ~SIOVChannelStatusProvider() = default;
45 
46  //
47  // non-interface methods
48  //
50  const ChannelStatus& GetChannelStatus(raw::ChannelID_t channel) const;
51 
52  //
53  // interface methods
54  //
55 
59  bool IsPresent(raw::ChannelID_t channel) const override
60  {
61  return GetChannelStatus(channel).IsPresent();
62  }
63 
65  bool IsBad(raw::ChannelID_t channel) const override
66  {
67  return GetChannelStatus(channel).IsDead() || GetChannelStatus(channel).IsLowNoise() ||
68  !IsPresent(channel);
69  }
70 
72  bool IsNoisy(raw::ChannelID_t channel) const override
73  {
74  return GetChannelStatus(channel).IsNoisy();
75  }
76 
78  bool IsGood(raw::ChannelID_t channel) const override
79  {
80  return GetChannelStatus(channel).IsGood();
81  }
83 
84  Status_t Status(raw::ChannelID_t channel) const override
85  {
86  return (Status_t)this->GetChannelStatus(channel).Status();
87  }
88 
92  ChannelSet_t GoodChannels() const override;
93 
95  ChannelSet_t BadChannels() const override;
96 
98  ChannelSet_t NoisyChannels() const override;
100 
102  void UpdateTimeStamp(DBTimeStamp_t ts);
103 
107  bool Update(DBTimeStamp_t);
108 
110  void AddNoisyChannel(raw::ChannelID_t ch);
111 
113 
115  static DBChannelID_t rawToDBChannel(raw::ChannelID_t channel) { return DBChannelID_t(channel); }
116 
117  private:
119 
120  bool DBUpdate() const; // Uses current event time.
121  bool DBUpdate(DBTimeStamp_t ts) const;
122 
123  // Time stamps.
124 
125  DBTimeStamp_t fEventTimeStamp; // Most recently seen time stamp.
126  mutable DBTimeStamp_t fCurrentTimeStamp; // Time stamp of cached data.
127 
129  mutable Snapshot<ChannelStatus> fData; // Lazily updated once per IOV.
130  Snapshot<ChannelStatus> fNewNoisy; // Updated once per event.
132 
133  ChannelSet_t GetChannelsWithStatus(chStatus status) const;
134 
135  }; // class SIOVChannelStatusProvider
136 
137 } // namespace lariov
138 
139 #endif // SIOVCHANNELSTATUSPROVIDER_H
bool IsPresent(raw::ChannelID_t channel) const override
Returns whether the specified channel is bad in the current run.
bool IsNoisy() const
Definition: ChannelStatus.h:44
bool IsPresent() const
Definition: ChannelStatus.h:45
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:47
bool IsLowNoise() const
Definition: ChannelStatus.h:43
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.
Status_t Status(raw::ChannelID_t channel) const override
bool Update(detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, PFPStruct &pfp)
Definition: PFPUtils.cxx:1055
Class providing information about the quality of channels.
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:42
bool IsGood() const
Definition: ChannelStatus.h:46
parameter set interface
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.
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
Class def header for a class ChannelStatus.