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