All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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
21 #include "messagefacility/MessageLogger/MessageLogger.h"
22 #include "art/Framework/Services/Registry/ServiceHandle.h"
23 #include "canvas/Utilities/Exception.h"
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 ///////////////////////////////////////////////////////
65 bool filter::ChannelFilter::BadChannel(uint32_t channel) const {
66  return provider.IsBad(channel);
67 }
68 
69 ///////////////////////////////////////////////////////
70 bool filter::ChannelFilter::NoisyChannel(uint32_t channel) const{
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 }
bool NoisyChannel(uint32_t channel) const
ChannelStatus GetChannelStatus(uint32_t channel) const
bool BadChannel(uint32_t channel) const
std::set< uint32_t > SetOfNoisyChannels() const
Interface for experiment-specific channel quality info provider.
do i e
Interface for experiment-specific service for channel quality info.
std::set< uint32_t > SetOfBadChannels() const