DepoBagger.cxx
Go to the documentation of this file.
3 
7 using namespace std;
8 using namespace WireCell;
9 
11  : m_count(0)
12  , m_gate(0,0)
13 {
14 
15 }
16 
17 Gen::DepoBagger::~DepoBagger()
18 {
19 }
20 
22 {
24 
25  /// Set the time gate with a two element array of times. Only
26  /// depos within the gate are output.
27  cfg["gate"] = Json::arrayValue;
28 
29  return cfg;
30 }
31 
33 {
34  m_gate = std::pair<double,double>(cfg["gate"][0].asDouble(),
35  cfg["gate"][1].asDouble());
36 }
37 
38 
39 bool Gen::DepoBagger::operator()(const input_pointer& depo, output_queue& deposetqueue)
40 {
41  if (!depo) { // EOS
42  // even if empyt, must send out something to retain sync.
43  auto out = std::make_shared<SimpleDepoSet>(m_count, m_depos);
44  deposetqueue.push_back(out);
45  m_depos.clear();
46  deposetqueue.push_back(nullptr); // pass on EOS
47  ++m_count;
48  return true;
49  }
50 
51  const double t = depo->time();
52  if (m_gate.first <= t and t < m_gate.second) {
53  m_depos.push_back(depo);
54  }
55  return true;
56 }
57 
58 
virtual bool operator()(const input_pointer &depo, output_queue &deposetqueue)
The calling signature:
Definition: DepoBagger.cxx:39
std::pair< double, double > m_gate
Definition: DepoBagger.h:41
STL namespace.
cfg
Definition: dbjson.py:29
std::deque< output_pointer > output_queue
WIRECELL_FACTORY(DepoBagger, WireCell::Gen::DepoBagger, WireCell::IDepoCollector, WireCell::IConfigurable) using namespace std
Definition: Main.h:22
IDepo::vector m_depos
Definition: DepoBagger.h:44
virtual void configure(const WireCell::Configuration &config)
Accept a configuration.
Definition: DepoBagger.cxx:32
Json::Value Configuration
Definition: Configuration.h:50
std::shared_ptr< const IDepo > input_pointer
virtual WireCell::Configuration default_configuration() const
Optional, override to return a hard-coded default configuration.
Definition: DepoBagger.cxx:21