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

#include <FrameSummer.h>

Inheritance diagram for WireCell::Gen::FrameSummer:
WireCell::IFrameJoiner WireCell::IConfigurable WireCell::IJoinNode< std::tuple< IFrame, IFrame >, IFrame > WireCell::IComponent< IConfigurable > WireCell::IJoinNodeBase WireCell::Interface WireCell::INode WireCell::IComponent< INode > WireCell::Interface

Public Member Functions

 FrameSummer ()
 
virtual ~FrameSummer ()
 
virtual bool operator() (const input_tuple_type &intup, output_pointer &out)
 
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...
 
- Public Member Functions inherited from WireCell::IFrameJoiner
virtual ~IFrameJoiner ()
 
virtual std::string signature ()
 
- Public Member Functions inherited from WireCell::IJoinNode< std::tuple< IFrame, IFrame >, IFrame >
virtual ~IJoinNode ()
 
virtual bool operator() (const any_vector &anyv, 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::IJoinNodeBase
virtual ~IJoinNodeBase ()
 
virtual NodeCategory category ()
 Return the behavior category type. More...
 
virtual int concurrency ()
 Join nodes can usually do their thing 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

double m_toffset
 
bool m_align
 

Additional Inherited Members

- Public Types inherited from WireCell::IFrameJoiner
typedef std::shared_ptr< IFrameJoinerpointer
 
- Public Types inherited from WireCell::IJoinNode< std::tuple< IFrame, IFrame >, IFrame >
typedef tuple_helper< std::tuple< IFrame, IFrame > > port_helper_type
 
typedef port_helper_type::template WrappedConst< std::shared_ptr >::type input_tuple_type
 
typedef tuple_helper< input_tuple_typeinput_helper_type
 
typedef IFrame output_type
 
typedef std::shared_ptr< const IFrameoutput_pointer
 
- Public Types inherited from WireCell::IJoinNodeBase
typedef std::shared_ptr< IJoinNodeBasepointer
 
typedef std::vector< boost::any > any_vector
 
- 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

Definition at line 12 of file FrameSummer.h.

Constructor & Destructor Documentation

Gen::FrameSummer::FrameSummer ( )

Definition at line 62 of file FrameSummer.cxx.

63  : m_toffset(0.0)
64  , m_align(false)
65 
66 {
67 }
Gen::FrameSummer::~FrameSummer ( )
virtual

Definition at line 69 of file FrameSummer.cxx.

70 {
71 }

Member Function Documentation

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

Accept a configuration.

Implements WireCell::IConfigurable.

Definition at line 30 of file FrameSummer.cxx.

31 {
32  m_align = get(cfg, "align", m_align);
33  m_toffset = get(cfg, "offset", m_toffset);
34 }
cfg
Definition: dbjson.py:29
Configuration Gen::FrameSummer::default_configuration ( ) const
virtual

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

Reimplemented from WireCell::IConfigurable.

Definition at line 12 of file FrameSummer.cxx.

13 {
14  // fixme: maybe add operators, scaleing, offsets.
15 
17 
18  // if true, the time of the second frame is ignored in favor of
19  // the first. Does not affect "tbin" values of individual traces.
20  cfg["align"] = m_align;
21 
22  // Amount of time offset to apply to the time of the second frame.
23  // If frame two is "aligned" then this offset is applied to frame
24  // two relative to the time of frame one
25  cfg["offset"] = m_toffset;
26 
27  return cfg;
28 }
cfg
Definition: dbjson.py:29
Json::Value Configuration
Definition: Configuration.h:50
bool Gen::FrameSummer::operator() ( const input_tuple_type intup,
output_pointer out 
)
virtual

Implements WireCell::IJoinNode< std::tuple< IFrame, IFrame >, IFrame >.

Definition at line 36 of file FrameSummer.cxx.

38 {
39  auto one = std::get<0>(intup);
40  auto two = std::get<1>(intup);
41  if (!one or !two) {
42  // assume eos
43  out = nullptr;
44  return true;
45  }
46 
47  double t2 = two->time();
48  if (m_align) {
49  t2 = one->time();
50  }
51  t2 += m_toffset;
52 
53  auto vtraces2 = two->traces();
54  ITrace::vector out_traces(vtraces2->begin(), vtraces2->end());
55  auto newtwo = std::make_shared<SimpleFrame>(two->ident(), t2, out_traces, two->tick());
56 
57  out = Gen::sum(IFrame::vector{one,two}, one->ident());
58  return true;
59 }
std::vector< pointer > vector
Definition: IData.h:21
IFrame::pointer sum(std::vector< IFrame::pointer > frames, int ident)
Definition: FrameUtil.cxx:15

Member Data Documentation

bool WireCell::Gen::FrameSummer::m_align
private

Definition at line 26 of file FrameSummer.h.

double WireCell::Gen::FrameSummer::m_toffset
private

Definition at line 25 of file FrameSummer.h.


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