LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
ChannelFilter.cxx
Go to the documentation of this file.
1 //
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 //
14 
15 // Our header
17 
18 // Framework libraries
22 
23 // LArSoft libraries
24 #include "larevt/CalibrationDBI/Interface/ChannelStatusProvider.h"
25 #include "larevt/CalibrationDBI/Interface/ChannelStatusService.h"
26 
27 //
28 // The following construct is rarely used:
29 // I have a C++ reference as a member class, that needs to be constructed in
30 // the initialization list. The construction could throw an exception,
31 // and I want to do some special handling if that happens.
32 // The way to do that is to use a special syntax commonly called
33 // "function try block".
34 //
35 // Note that the "special handling" is not that special as it ends rethrowing
36 // the exception. The purpose here is just to provide a bit of additional
37 // information about why the failure could have occurred, since art messages
38 // often don't have enough.
39 //
41 try : provider(art::ServiceHandle<lariov::ChannelStatusService const>()->GetProvider()) {
42 
43  MF_LOG_ERROR("ChannelFilter") << "ChannelFilter is now deprecated."
44  " Replace it with ChannelStatusService";
45 
46 } // function try
47 catch (art::Exception& e) { // automatic rethrow happens at end of block
48  if (e.categoryCode() == art::errors::ServiceNotFound) {
49  MF_LOG_SYSTEM("ChannelFilter")
50  << "Failed to obtain an instance of ChannelStatusService service;"
51  " you should update your configuration, *and* update the code using"
52  " ChannelFilter, that is deprecated."
53  " An example are in ChannelFilter class documentation";
54  }
55 } // filter::ChannelFilter::ChannelFilter() (function catch)
56 
58 bool filter::ChannelFilter::BadChannel(uint32_t channel) const
59 {
60  return provider.IsBad(channel);
61 }
62 
64 bool filter::ChannelFilter::NoisyChannel(uint32_t channel) const
65 {
66  return provider.IsNoisy(channel);
67 }
68 
70 std::set<uint32_t> filter::ChannelFilter::SetOfBadChannels() const
71 {
72  return provider.BadChannels();
73 }
74 
77 {
78  return provider.NoisyChannels();
79 }
80 
83 {
84 
85  if (provider.IsGood(channel))
86  return GOOD;
87  else if (!provider.IsPresent(channel))
88  return NOTPHYSICAL;
89  else if (provider.IsBad(channel))
90  return DEAD;
91  else if (provider.IsNoisy(channel))
92  return NOISY;
93  else
94  return DEAD; //assume all other status are equivalent to DEAD
95 }
bool NoisyChannel(uint32_t channel) const
ChannelStatus GetChannelStatus(uint32_t channel) const
bool BadChannel(uint32_t channel) const
#define MF_LOG_ERROR(category)
std::set< uint32_t > SetOfNoisyChannels() const
Filters for channels, events, etc.
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
Definition: MVAAlg.h:12
Float_t e
Definition: plot.C:35
lariov::ChannelStatusProvider const & provider
object doing the job
Definition: ChannelFilter.h:42
#define MF_LOG_SYSTEM(category)
std::set< uint32_t > SetOfBadChannels() const