LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
SIOVChannelStatusProvider.h
Go to the documentation of this file.
1 
10 #ifndef SIOVCHANNELSTATUSPROVIDER_H
11 #define SIOVCHANNELSTATUSPROVIDER_H 1
12 
13 // LArSoft libraries
14 #include "larevt/CalibrationDBI/Interface/ChannelStatusProvider.h"
16 #include "larevt/CalibrationDBI/IOVData/ChannelStatus.h"
17 #include "larevt/CalibrationDBI/IOVData/Snapshot.h"
18 
19 // Utility libraries
20 #include "fhiclcpp/ParameterSet.h"
21 
22 
24 namespace lariov {
25 
26 
35  class SIOVChannelStatusProvider: public DatabaseRetrievalAlg, public ChannelStatusProvider {
36 
37  public:
38 
41 
43  virtual ~SIOVChannelStatusProvider() = default;
44 
45  //
46  // non-interface methods
47  //
49  const ChannelStatus& GetChannelStatus(raw::ChannelID_t channel) const;
50 
51  //
52  // interface methods
53  //
54 
58  bool IsPresent(raw::ChannelID_t channel) const override {
59  return GetChannelStatus(channel).IsPresent();
60  }
61 
63  bool IsBad(raw::ChannelID_t channel) const override {
64  return GetChannelStatus(channel).IsDead() || GetChannelStatus(channel).IsLowNoise() || !IsPresent(channel);
65  }
66 
68  bool IsNoisy(raw::ChannelID_t channel) const override {
69  return GetChannelStatus(channel).IsNoisy();
70  }
71 
73  bool IsGood(raw::ChannelID_t channel) const override {
74  return GetChannelStatus(channel).IsGood();
75  }
77 
78  Status_t Status(raw::ChannelID_t channel) const override {
79  return (Status_t) this->GetChannelStatus(channel).Status();
80  }
81 
85  ChannelSet_t GoodChannels() const override;
86 
88  ChannelSet_t BadChannels() const override;
89 
91  ChannelSet_t NoisyChannels() const override;
93 
94 
96  void UpdateTimeStamp(DBTimeStamp_t ts);
97 
101  bool Update(DBTimeStamp_t);
102 
105 
107 
108 
110  static DBChannelID_t rawToDBChannel(raw::ChannelID_t channel)
111  { return DBChannelID_t(channel); }
112 
113  private:
114 
116 
117  bool DBUpdate() const; // Uses current event time.
118  bool DBUpdate(DBTimeStamp_t ts) const;
119 
120  // Time stamps.
121 
122  DBTimeStamp_t fEventTimeStamp; // Most recently seen time stamp.
123  mutable DBTimeStamp_t fCurrentTimeStamp; // Time stamp of cached data.
124 
125  DataSource::ds fDataSource;
126  mutable Snapshot<ChannelStatus> fData; // Lazily updated once per IOV.
127  Snapshot<ChannelStatus> fNewNoisy; // Updated once per event.
128  ChannelStatus fDefault;
129 
130  ChannelSet_t GetChannelsWithStatus(chStatus status) const;
131 
132  }; // class SIOVChannelStatusProvider
133 
134 
135 } // namespace lariov
136 
137 
138 #endif // SIOVCHANNELSTATUSPROVIDER_H
virtual ~SIOVChannelStatusProvider()=default
Default destructor.
bool IsPresent(raw::ChannelID_t channel) const override
Returns whether the specified channel is bad in the current run.
static DBChannelID_t rawToDBChannel(raw::ChannelID_t channel)
Converts LArSoft channel ID in the one proper for the DB.
ChannelSet_t GoodChannels() const override
Returns a copy of set of bad channel IDs for the current run.
ChannelSet_t BadChannels() const override
Returns a copy of set of bad channel IDs for the current run.
bool IsNoisy(raw::ChannelID_t channel) const override
Returns whether the specified channel is noisy in the current run.
void UpdateTimeStamp(DBTimeStamp_t ts)
Update event time stamp.
Status_t Status(raw::ChannelID_t channel) const override
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.
Class def header for a class DatabaseRetrievalAlg.
Filters for channels, events, etc.
ChannelSet_t GetChannelsWithStatus(chStatus status) const
bool IsGood(raw::ChannelID_t channel) const override
Returns whether the specified channel is physical and good.
const ChannelStatus & GetChannelStatus(raw::ChannelID_t channel) const
Returns Channel Status.
bool Update(DBTimeStamp_t)
Allows a service to add to the list of noisy channels.
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:27
ChannelSet_t NoisyChannels() const override
Returns a copy of set of noisy channel IDs for the current run.