ChannelFilter.cxx
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////
2 //
3 // ChannelFilter Class
4 //
5 // This class has been obsoleted and is now a deprecated interface for
6 // ChannelStatusService.
7 //
8 // Please update your code to use the service directly.
9 //
10 //
11 // Original class: pagebri3@msu.edu
12 //
13 ///////////////////////////////////////////////////////
14 
15 
16 // Our header
18 
19 
20 // Framework libraries
24 
25 // LArSoft libraries
28 
29 
30 
31 //
32 // The following construct is rarely used:
33 // I have a C++ reference as a member class, that needs to be constructed in
34 // the initialization list. The construction could throw an exception,
35 // and I want to do some special handling if that happens.
36 // The way to do that is to use a special syntax commonly called
37 // "function try block".
38 //
39 // Note that the "special handling" is not that special as it ends rethrowing
40 // the exception. The purpose here is just to provide a bit of additional
41 // information about why the failure could have occurred, since art messages
42 // often don't have enough.
43 //
45  provider(art::ServiceHandle<lariov::ChannelStatusService const>()->GetProvider())
46 {
47 
48  MF_LOG_ERROR("ChannelFilter") << "ChannelFilter is now deprecated."
49  " Replace it with ChannelStatusService";
50 
51 } // function try
52 catch (art::Exception& e) { // automatic rethrow happens at end of block
53  if (e.categoryCode() == art::errors::ServiceNotFound) {
54  MF_LOG_SYSTEM("ChannelFilter") <<
55  "Failed to obtain an instance of ChannelStatusService service;"
56  " you should update your configuration, *and* update the code using"
57  " ChannelFilter, that is deprecated."
58  " An example are in ChannelFilter class documentation"
59  ;
60  }
61 } // filter::ChannelFilter::ChannelFilter() (function catch)
62 
63 
64 ///////////////////////////////////////////////////////
66  return provider.IsBad(channel);
67 }
68 
69 ///////////////////////////////////////////////////////
71  return provider.IsNoisy(channel);
72 }
73 
74 ///////////////////////////////////////////////////////
75 std::set<uint32_t> filter::ChannelFilter::SetOfBadChannels() const {
76  return provider.BadChannels();
77 }
78 
79 ///////////////////////////////////////////////////////
80 std::set<uint32_t> filter::ChannelFilter::SetOfNoisyChannels() const {
81  return provider.NoisyChannels();
82 }
83 
84 ///////////////////////////////////////////////////////
86 {
87 
88  if (provider.IsGood(channel)) return GOOD;
89  else if (!provider.IsPresent(channel)) return NOTPHYSICAL;
90  else if (provider.IsBad(channel)) return DEAD;
91  else if (provider.IsNoisy(channel)) return NOISY;
92  else return DEAD; //assume all other status are equivalent to DEAD
93 }
virtual bool IsBad(raw::ChannelID_t channel) const =0
Returns whether the specified channel is bad in the current run.
virtual ChannelSet_t BadChannels() const =0
Returns a copy of set of bad channel IDs for the current run.
bool NoisyChannel(uint32_t channel) const
ChannelStatus GetChannelStatus(uint32_t channel) const
bool BadChannel(uint32_t channel) const
virtual bool IsNoisy(raw::ChannelID_t channel) const =0
Returns whether the specified channel is noisy in the current run.
#define MF_LOG_ERROR(category)
virtual const provider_type * provider() const override
virtual ChannelSet_t NoisyChannels() const =0
Returns a copy of set of noisy channel IDs for the current run.
uint8_t channel
Definition: CRTFragment.hh:201
std::set< uint32_t > SetOfNoisyChannels() const
const double e
virtual bool IsGood(raw::ChannelID_t channel) const
Returns whether the specified channel is physical and good.
Filters for channels, events, etc.
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
virtual bool IsPresent(raw::ChannelID_t channel) const =0
Returns whether the specified channel is physical and connected to wire.
Interface for experiment-specific channel quality info provider.
Interface for experiment-specific service for channel quality info.
lariov::ChannelStatusProvider const & provider
object doing the job
Definition: ChannelFilter.h:45
#define MF_LOG_SYSTEM(category)
std::set< uint32_t > SetOfBadChannels() const