All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ChannelSelectorDB.cxx
Go to the documentation of this file.
1 /**
2  This is to input dynamic list of channels to DBChannelSelector
3  e.g. misconfigured channels or bad channels
4 */
5 
6 #include "ChannelSelectorDB.h"
7 
13 
14 #include "WireCellUtil/NamedFactory.h"
15 
16 WIRECELL_FACTORY(wclsChannelSelectorDB, wcls::ChannelSelectorDB,
18 
19 
20 using namespace WireCell;
21 
23 {
24 }
25 
27 {
28 }
29 
30 void wcls::ChannelSelectorDB::visit(art::Event & event)
31 {
32  std::cerr << "ChannelSelectorDB art::Event visit!\n";
33 
34  // FIXME: the current assumption in this code is that LS channel
35  // numbers are identified with WCT channel IDs. For MicroBooNE
36  // this holds but in general some translation is needed here.
37  auto const& gc = *lar::providerFrom<geo::Geometry>();
38  auto nchans = gc.Nchannels();
39 
40 
41  if (m_type == "bad") {
42  auto const& csvc = art::ServiceHandle<lariov::ChannelStatusService const>()->GetProvider();
43 
44  for(size_t ich=0; ich<nchans; ++ich) {
45  if (csvc.IsBad(ich)) {
46  m_bad_channels.push_back(ich);
47  }
48  }
49  }
50 
51  if (m_type == "misconfigured") {
52  const auto& esvc = art::ServiceHandle<lariov::ElectronicsCalibService const>()->GetProvider();
53 
54  std::vector<int> mc_channels;
55  for(size_t ich=0; ich<nchans; ++ich) {
56  if (esvc.ExtraInfo(ich).GetBoolData("is_misconfigured")) {
57  m_miscfg_channels.push_back(ich);
58  }
59  }
60  }
61 }
62 
63 
64 void wcls::ChannelSelectorDB::configure(const WireCell::Configuration& cfg)
65 {
66  m_type = get<std::string>(cfg, "type", "misconfigured");
67  if(m_type != "bad" && m_type != "misconfigured"){
68  THROW(ValueError() << errmsg{String::format(
69  "Channel type \"%s\" cannot be identified.", m_type)});
70  }
71 }
72 
73 // Local Variables:
74 // mode: c++
75 // c-basic-offset: 4
76 // End:
virtual void visit(art::Event &event)
IArtEventVisitor.
BEGIN_PROLOG could also be cerr
static std::string format(PyObject *obj, unsigned int pos, unsigned int indent, unsigned int maxlen, unsigned int depth)
Definition: fclmodule.cxx:374
Interface for experiment-specific service for pmt gain info.
WIRECELL_FACTORY(wclsChannelNoiseDB, wcls::ChannelNoiseDB, wcls::IArtEventVisitor, WireCell::IChannelNoiseDatabase) using namespace WireCell
virtual void configure(const WireCell::Configuration &config)
IConfigurable.
Interface for experiment-specific channel quality info provider.
Interface for experiment-specific service for channel quality info.
art framework interface to geometry description