DBChannelSelector.cxx
Go to the documentation of this file.
5 
7 
10 
11 using namespace WireCell;
12 using namespace WireCell::SigProc;
13 
15 {
16 }
17 
18 DBChannelSelector::~DBChannelSelector()
19 {
20 }
21 
22 
24 {
26 
27  cfg["type"] = "misconfigured";
28 
29  //must supply
30  //database: wclsMiscfgChannelDB, OmniChannelNoiseDB, wclsChannelNoiseDB
31  cfg["channelDB"] = "";
32 
33  return cfg;
34 }
35 
37 {
38  m_type = get<std::string>(cfg, "type", "misconfigured");
39 
40  // channels from database
41  auto jcndb = cfg["channelDB"];
42  if (!jcndb.empty()) {
43  m_db = Factory::find_tn<IChannelNoiseDatabase>(jcndb.asString());
44  std::cerr <<"DBChannelSelector: using channel database object: "
45  << " \"" << jcndb.asString() << "\" type: \"" << m_type << "\"\n";
46  }
47  else{
48  THROW(ValueError() << errmsg{"DBChannelSelector: no database configured"});
49  }
50 }
51 
53 {
54  if( m_type == "bad" ) ChannelSelector::set_channels(m_db->bad_channels());
55  if( m_type == "misconfigured" ) ChannelSelector::set_channels(m_db->miscfg_channels());
56  //std::vector<int> miscfg_channels = db->miscfg_channels();
57  //std::cout << "miscfg channel size: " << miscfg_channels.size() <<"\n";
58  //for(size_t i=0; i< miscfg_channels.size(); i++) {
59  //std::cout << "miscfg channel: " << miscfg_channels.at(i) <<"\n";
60  //}
61 
62  return ChannelSelector::operator()(in, out);
63 }
boost::error_info< struct tag_errmsg, std::string > errmsg
Definition: Exceptions.h:54
virtual bool operator()(const input_pointer &in, output_pointer &out)
IFrameFilter interface.
cfg
Definition: dbjson.py:29
WIRECELL_FACTORY(DBChannelSelector, WireCell::SigProc::DBChannelSelector, WireCell::IFrameFilter, WireCell::IConfigurable) using namespace WireCell
std::shared_ptr< const IFrame > input_pointer
Definition: IFunctionNode.h:39
#define THROW(e)
Definition: Exceptions.h:25
std::shared_ptr< const IFrame > output_pointer
Definition: IFunctionNode.h:40
Thrown when a wrong value has been encountered.
Definition: Exceptions.h:37
virtual void set_channels(const std::vector< int > &channels)
Definition: Main.h:22
Json::Value Configuration
Definition: Configuration.h:50
WireCell::Configuration default_configuration() const
Optional, override to return a hard-coded default configuration.
void configure(const WireCell::Configuration &config)
IConfigurable interface.
WireCell::IChannelNoiseDatabase::pointer m_db
bool operator()(const input_pointer &in, output_pointer &out)
IFrameFilter interface.