Public Member Functions | Private Attributes | List of all members
WireCell::Gen::SilentNoise Class Reference

#include <SilentNoise.h>

Inheritance diagram for WireCell::Gen::SilentNoise:
WireCell::IFrameSource WireCell::IConfigurable WireCell::ISourceNode< IFrame > WireCell::IComponent< IConfigurable > WireCell::ISourceNodeBase WireCell::Interface WireCell::INode WireCell::IComponent< INode > WireCell::Interface

Public Member Functions

 SilentNoise ()
 
virtual ~SilentNoise ()
 
virtual void configure (const WireCell::Configuration &config)
 Accept a configuration. More...
 
virtual WireCell::Configuration default_configuration () const
 Optional, override to return a hard-coded default configuration. More...
 
virtual bool operator() (output_pointer &out)
 The calling signature: More...
 
- Public Member Functions inherited from WireCell::IFrameSource
virtual ~IFrameSource ()
 
- Public Member Functions inherited from WireCell::ISourceNode< IFrame >
virtual ~ISourceNode ()
 
virtual NodeCategory category ()
 Return the behavior category type. More...
 
virtual std::string signature ()
 Set the signature for all subclasses. More...
 
virtual bool operator() (boost::any &anyout)
 
virtual std::vector< std::stringoutput_types ()
 
- Public Member Functions inherited from WireCell::ISourceNodeBase
virtual ~ISourceNodeBase ()
 
- Public Member Functions inherited from WireCell::INode
virtual ~INode ()
 
virtual int concurrency ()
 
virtual std::vector< std::stringinput_types ()
 
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

int m_count
 
int m_noutputs
 
int m_nchannels
 
std::string m_traces_tag
 

Additional Inherited Members

- Public Types inherited from WireCell::IFrameSource
typedef std::shared_ptr< IFrameSourcepointer
 
- Public Types inherited from WireCell::ISourceNode< IFrame >
typedef IFrame output_type
 
typedef ISourceNode< IFramesignature_type
 
typedef std::shared_ptr< signature_typepointer
 
typedef std::shared_ptr< const IFrameoutput_pointer
 
- Public Types inherited from WireCell::ISourceNodeBase
typedef std::shared_ptr< ISourceNodeBasepointer
 
- 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...
 

Detailed Description

A source of "noise" which has no noise. It's used just as an trivial example which real noise models may copy. Although it inherits from IConfigurable, it's not really. Again, just giving an example.

Definition at line 14 of file SilentNoise.h.

Constructor & Destructor Documentation

Gen::SilentNoise::SilentNoise ( )

Definition at line 16 of file SilentNoise.cxx.

17  : m_count(0)
18 {
19 }
Gen::SilentNoise::~SilentNoise ( )
virtual

Definition at line 21 of file SilentNoise.cxx.

22 {
23 }

Member Function Documentation

void Gen::SilentNoise::configure ( const WireCell::Configuration config)
virtual

Accept a configuration.

Implements WireCell::IConfigurable.

Definition at line 25 of file SilentNoise.cxx.

26 {
27  m_noutputs = get(cfg,"noutputs",0);
28  m_nchannels = get(cfg,"nchannels",0);
29  m_traces_tag = cfg["traces_tag"].asString();
30 }
cfg
Definition: dbjson.py:29
WireCell::Configuration Gen::SilentNoise::default_configuration ( ) const
virtual

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

Reimplemented from WireCell::IConfigurable.

Definition at line 32 of file SilentNoise.cxx.

33 {
35  cfg["noutputs"] = 0; // run forever
36  cfg["nchannels"] = 0; // empty
37  cfg["traces_tag"] = ""; // empty string means no tag on traces
38  return cfg;
39 }
cfg
Definition: dbjson.py:29
Json::Value Configuration
Definition: Configuration.h:50
bool Gen::SilentNoise::operator() ( output_pointer out)
virtual

The calling signature:

Implements WireCell::ISourceNode< IFrame >.

Definition at line 42 of file SilentNoise.cxx.

43 {
44  out = nullptr;
45  if (m_noutputs and m_count == m_noutputs) {
46  ++m_count;
47  return true;
48  }
49  if (m_noutputs and m_count >= m_noutputs) {
50  return false;
51  }
52  //std::cerr << "SilentNoise: output #" << m_count << " / " << m_noutputs << std::endl;
54  for (int ind=0; ind<m_nchannels; ++ind) {
55  traces[ind] = std::make_shared<SimpleTrace>(ind, 0, 0); // boring traces
56  }
57  auto sfout = new SimpleFrame(m_count, m_count*5.0*units::ms, traces);
58  if (m_traces_tag != "") {
59  IFrame::trace_list_t tl(m_nchannels);
60  std::iota(tl.begin(), tl.end(), 0);
61  sfout->tag_traces(m_traces_tag, tl);
62  }
63  out = IFrame::pointer(sfout);
64  ++m_count;
65  return true;
66 }
std::shared_ptr< const IFrame > pointer
Definition: IData.h:19
std::vector< pointer > vector
Definition: IData.h:21
static const double ms
Definition: Units.h:104
std::vector< size_t > trace_list_t
Definition: IFrame.h:36

Member Data Documentation

int WireCell::Gen::SilentNoise::m_count
private

Definition at line 28 of file SilentNoise.h.

int WireCell::Gen::SilentNoise::m_nchannels
private

Definition at line 29 of file SilentNoise.h.

int WireCell::Gen::SilentNoise::m_noutputs
private

Definition at line 29 of file SilentNoise.h.

std::string WireCell::Gen::SilentNoise::m_traces_tag
private

Definition at line 30 of file SilentNoise.h.


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