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

#include <DepoChunker.h>

Inheritance diagram for WireCell::Gen::DepoChunker:
WireCell::IDepoCollector WireCell::IConfigurable WireCell::IQueuedoutNode< IDepo, IDepoSet > WireCell::IComponent< IConfigurable > WireCell::IQueuedoutNodeBase WireCell::Interface WireCell::INode WireCell::IComponent< INode > WireCell::Interface

Public Member Functions

 DepoChunker ()
 
virtual ~DepoChunker ()
 
virtual bool operator() (const input_pointer &depo, output_queue &deposetqueue)
 The calling signature: More...
 
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::IDepoCollector
virtual ~IDepoCollector ()
 
virtual std::string signature ()
 
- Public Member Functions inherited from WireCell::IQueuedoutNode< IDepo, IDepoSet >
virtual ~IQueuedoutNode ()
 
virtual bool operator() (const boost::any &anyin, queuedany &outanyq)
 The calling signature: More...
 
virtual std::vector< std::stringinput_types ()
 
virtual std::vector< std::stringoutput_types ()
 
- Public Member Functions inherited from WireCell::IQueuedoutNodeBase
virtual ~IQueuedoutNodeBase ()
 
virtual NodeCategory category ()
 Return the behavior category type. More...
 
virtual int concurrency ()
 By default assume all subclasses maintain state. 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 Member Functions

void emit (output_queue &out)
 

Private Attributes

int m_count
 
std::pair< double, double > m_gate
 
std::pair< double, double > m_starting_gate
 
IDepo::vector m_depos
 

Additional Inherited Members

- Public Types inherited from WireCell::IDepoCollector
typedef std::shared_ptr< IDepoCollectorpointer
 
- Public Types inherited from WireCell::IQueuedoutNode< IDepo, IDepoSet >
typedef std::shared_ptr< IQueuedoutNodeBasepointer
 
typedef IDepo input_type
 
typedef IDepoSet output_type
 
typedef std::shared_ptr< const IDepoinput_pointer
 
typedef std::shared_ptr< const IDepoSetoutput_pointer
 
typedef std::deque< output_pointeroutput_queue
 
- Public Types inherited from WireCell::IQueuedoutNodeBase
typedef std::shared_ptr< IQueuedoutNodeBasepointer
 
typedef std::deque< boost::any > queuedany
 
- 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 26 of file DepoChunker.h.

Constructor & Destructor Documentation

Gen::DepoChunker::DepoChunker ( )

Definition at line 11 of file DepoChunker.cxx.

12  : m_count(0)
13  , m_gate(0,0)
14  , m_starting_gate(0,0)
15 {
16 
17 }
std::pair< double, double > m_gate
Definition: DepoChunker.h:43
std::pair< double, double > m_starting_gate
Definition: DepoChunker.h:43
Gen::DepoChunker::~DepoChunker ( )
virtual

Definition at line 19 of file DepoChunker.cxx.

20 {
21 }

Member Function Documentation

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

Accept a configuration.

Implements WireCell::IConfigurable.

Definition at line 34 of file DepoChunker.cxx.

35 {
36  m_starting_gate = m_gate = std::pair<double,double>(cfg["gate"][0].asDouble(),
37  cfg["gate"][1].asDouble());
38 }
std::pair< double, double > m_gate
Definition: DepoChunker.h:43
cfg
Definition: dbjson.py:29
std::pair< double, double > m_starting_gate
Definition: DepoChunker.h:43
WireCell::Configuration Gen::DepoChunker::default_configuration ( ) const
virtual

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

Set the time gate with a two element array of times. Only depos within the gate are output.

Reimplemented from WireCell::IConfigurable.

Definition at line 23 of file DepoChunker.cxx.

24 {
26 
27  /// Set the time gate with a two element array of times. Only
28  /// depos within the gate are output.
29  cfg["gate"] = Json::arrayValue;
30 
31  return cfg;
32 }
cfg
Definition: dbjson.py:29
Json::Value Configuration
Definition: Configuration.h:50
void Gen::DepoChunker::emit ( output_queue out)
private

Definition at line 40 of file DepoChunker.cxx.

41 {
42  out.push_back(std::make_shared<SimpleDepoSet>(m_count, m_depos));
43  m_depos.clear();
44  ++m_count;
45 }
bool Gen::DepoChunker::operator() ( const input_pointer in,
output_queue outq 
)
virtual

The calling signature:

Implements WireCell::IQueuedoutNode< IDepo, IDepoSet >.

Definition at line 47 of file DepoChunker.cxx.

48 {
49  if (!depo) { // EOS
50  emit(deposetqueue);
51  m_depos.push_back(depo);
53  return true;
54  }
55 
56  const double now = depo->time();
57 
58  // inside current gate.
59  if (m_gate.first <= now and now < m_gate.second) {
60  m_depos.push_back(depo);
61  return true;
62  }
63 
64  if (now >= m_gate.second) { // start new gate
65  emit(deposetqueue);
66  const double window = m_gate.second - m_gate.first;
67  m_gate = std::pair<double,double>(m_gate.second, m_gate.second + window);
68  m_depos.push_back(depo);
69  return true;
70  }
71 
72  std::cerr << "Gen::DepoChunker: out of time order depo received: now=" << now/units::s << "s\n";
73  return false;
74 }
void emit(output_queue &out)
Definition: DepoChunker.cxx:40
std::pair< double, double > m_gate
Definition: DepoChunker.h:43
std::pair< double, double > m_starting_gate
Definition: DepoChunker.h:43
static const double s
Definition: Units.h:103

Member Data Documentation

int WireCell::Gen::DepoChunker::m_count
private

Definition at line 40 of file DepoChunker.h.

IDepo::vector WireCell::Gen::DepoChunker::m_depos
private

Definition at line 46 of file DepoChunker.h.

std::pair<double,double> WireCell::Gen::DepoChunker::m_gate
private

Definition at line 43 of file DepoChunker.h.

std::pair<double,double> WireCell::Gen::DepoChunker::m_starting_gate
private

Definition at line 43 of file DepoChunker.h.


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