Public Member Functions | Private Attributes | List of all members
WireCell::SigProc::DBChannelSelector Class Reference

#include <DBChannelSelector.h>

Inheritance diagram for WireCell::SigProc::DBChannelSelector:
WireCell::SigProc::ChannelSelector WireCell::IFrameFilter WireCell::IConfigurable WireCell::IFunctionNode< IFrame, IFrame > WireCell::IComponent< IConfigurable > WireCell::IFunctionNodeBase WireCell::Interface WireCell::INode WireCell::IComponent< INode > WireCell::Interface

Public Member Functions

 DBChannelSelector ()
 
virtual ~DBChannelSelector ()
 
bool operator() (const input_pointer &in, output_pointer &out)
 IFrameFilter interface. More...
 
void configure (const WireCell::Configuration &config)
 IConfigurable interface. More...
 
WireCell::Configuration default_configuration () const
 Optional, override to return a hard-coded default configuration. More...
 
- Public Member Functions inherited from WireCell::SigProc::ChannelSelector
 ChannelSelector ()
 
virtual ~ChannelSelector ()
 
- Public Member Functions inherited from WireCell::IFrameFilter
virtual ~IFrameFilter ()
 
virtual std::string signature ()
 Set the signature for all subclasses. More...
 
- Public Member Functions inherited from WireCell::IFunctionNode< IFrame, IFrame >
virtual ~IFunctionNode ()
 
virtual bool operator() (const boost::any &anyin, boost::any &anyout)
 The calling signature: More...
 
virtual std::vector< std::stringinput_types ()
 
virtual std::vector< std::stringoutput_types ()
 
- Public Member Functions inherited from WireCell::IFunctionNodeBase
virtual ~IFunctionNodeBase ()
 
virtual NodeCategory category ()
 Return the behavior category type. More...
 
virtual int concurrency ()
 By default assume all subclasses are stateless. More...
 
- Public Member Functions inherited from WireCell::INode
virtual ~INode ()
 
virtual void reset ()
 
- Public Member Functions inherited from WireCell::IComponent< INode >
virtual ~IComponent ()
 
- Public Member Functions inherited from WireCell::Interface
virtual ~Interface ()
 
- Public Member Functions inherited from WireCell::IConfigurable
virtual ~IConfigurable ()
 
- Public Member Functions inherited from WireCell::IComponent< IConfigurable >
virtual ~IComponent ()
 

Private Attributes

std::string m_type
 
WireCell::IChannelNoiseDatabase::pointer m_db
 

Additional Inherited Members

- Public Types inherited from WireCell::IFrameFilter
typedef std::shared_ptr< IFrameFilterpointer
 
- Public Types inherited from WireCell::IFunctionNode< IFrame, IFrame >
typedef IFrame input_type
 
typedef IFrame output_type
 
typedef std::shared_ptr< const IFrameinput_pointer
 
typedef std::shared_ptr< const IFrameoutput_pointer
 
typedef IFunctionNode< IFrame, IFramesignature_type
 
- Public Types inherited from WireCell::IFunctionNodeBase
typedef std::shared_ptr< IFunctionNodeBasepointer
 
- Public Types inherited from WireCell::INode
enum  NodeCategory {
  unknown, sourceNode, sinkNode, functionNode,
  queuedoutNode, joinNode, splitNode, faninNode,
  fanoutNode, multioutNode, hydraNode
}
 
- Public Types inherited from WireCell::IComponent< INode >
typedef std::shared_ptr< INodepointer
 Access subclass facet by pointer. More...
 
typedef std::vector< pointervector
 Vector of shared pointers. More...
 
- Public Types inherited from WireCell::Interface
typedef std::shared_ptr< Interfacepointer
 
- Public Types inherited from WireCell::IComponent< IConfigurable >
typedef std::shared_ptr< IConfigurablepointer
 Access subclass facet by pointer. More...
 
typedef std::vector< pointervector
 Vector of shared pointers. More...
 
- Protected Member Functions inherited from WireCell::SigProc::ChannelSelector
virtual void set_channels (const std::vector< int > &channels)
 

Detailed Description

Definition at line 20 of file DBChannelSelector.h.

Constructor & Destructor Documentation

DBChannelSelector::DBChannelSelector ( )

Definition at line 14 of file DBChannelSelector.cxx.

15 {
16 }
DBChannelSelector::~DBChannelSelector ( )
virtual

Definition at line 18 of file DBChannelSelector.cxx.

19 {
20 }

Member Function Documentation

void DBChannelSelector::configure ( const WireCell::Configuration config)
virtual

IConfigurable interface.

Reimplemented from WireCell::SigProc::ChannelSelector.

Definition at line 36 of file DBChannelSelector.cxx.

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 }
boost::error_info< struct tag_errmsg, std::string > errmsg
Definition: Exceptions.h:54
cfg
Definition: dbjson.py:29
#define THROW(e)
Definition: Exceptions.h:25
WireCell::IChannelNoiseDatabase::pointer m_db
WireCell::Configuration DBChannelSelector::default_configuration ( ) const
virtual

Optional, override to return a hard-coded default configuration.

Only traces with channels in this array will be in the output.

Only traces with these tags will be in the output. If no tags are given then tags are not considered.

Reimplemented from WireCell::SigProc::ChannelSelector.

Definition at line 23 of file DBChannelSelector.cxx.

24 {
26 
27  cfg["type"] = "misconfigured";
28 
29  //must supply
30  //database: wclsMiscfgChannelDB, OmniChannelNoiseDB, wclsChannelNoiseDB
31  cfg["channelDB"] = "";
32 
33  return cfg;
34 }
cfg
Definition: dbjson.py:29
Json::Value Configuration
Definition: Configuration.h:50
bool DBChannelSelector::operator() ( const input_pointer in,
output_pointer out 
)
virtual

IFrameFilter interface.

Reimplemented from WireCell::SigProc::ChannelSelector.

Definition at line 52 of file DBChannelSelector.cxx.

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 }
virtual bool operator()(const input_pointer &in, output_pointer &out)
IFrameFilter interface.
virtual void set_channels(const std::vector< int > &channels)
WireCell::IChannelNoiseDatabase::pointer m_db

Member Data Documentation

WireCell::IChannelNoiseDatabase::pointer WireCell::SigProc::DBChannelSelector::m_db
private

Definition at line 35 of file DBChannelSelector.h.

std::string WireCell::SigProc::DBChannelSelector::m_type
private

Definition at line 34 of file DBChannelSelector.h.


The documentation for this class was generated from the following files: