LArSoft  v06_85_00
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 
98  bool Update(DBTimeStamp_t);
99 
102 
104 
105 
107  static DBChannelID_t rawToDBChannel(raw::ChannelID_t channel)
108  { return DBChannelID_t(channel); }
109 
110  private:
111 
112  DataSource::ds fDataSource;
113  Snapshot<ChannelStatus> fData;
114  Snapshot<ChannelStatus> fNewNoisy;
115  ChannelStatus fDefault;
116 
117  ChannelSet_t GetChannelsWithStatus(chStatus status) const;
118 
119  }; // class SIOVChannelStatusProvider
120 
121 
122 } // namespace lariov
123 
124 
125 #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.
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.
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.