TimeGatedDepos.cxx
Go to the documentation of this file.
3 #include "WireCellUtil/Units.h"
4 #include "WireCellUtil/String.h"
5 
10 
11 #include <boost/range.hpp>
12 
13 #include <sstream>
14 #include <iostream>
15 
18 
19 using namespace std;
20 using namespace WireCell;
21 
22 
23 
24 WireCell::Configuration Gen::TimeGatedDepos::default_configuration() const
25 {
27  cfg["accept"] = m_accept;
28  cfg["period"] = m_period;
29  cfg["start"] = m_start;
30  cfg["duration"] = m_duration;
31  return cfg;
32 }
33 
34 
35 
36 Gen::TimeGatedDepos::TimeGatedDepos()
37  : m_accept(true)
38  , m_period(0.0)
39  , m_start(0.0)
40  , m_duration(0.0)
41 
42 {
43 }
45 {
46 }
47 
49 {
50  if (!depo) {
51  m_start += m_period;
52  outq.push_back(nullptr);
53  return true;
54  }
55 
56  const double t = depo->time();
57  const bool ingate = m_start <= t && t < m_start + m_duration;
58  if (ingate == m_accept) {
59  outq.push_back(depo);
60  }
61  return true;
62 }
63 
65 {
66  m_accept = cfg["accept"].asString() == "accept";
67  m_period = get(cfg, "period", m_period);
68  m_start = get(cfg, "start", m_start);
69  m_duration = get(cfg, "duration", m_duration);
70 }
WIRECELL_FACTORY(TimeGatedDepos, WireCell::Gen::TimeGatedDepos, WireCell::IDrifter, WireCell::IConfigurable) using namespace std
STL namespace.
cfg
Definition: dbjson.py:29
std::deque< output_pointer > output_queue
virtual void configure(const WireCell::Configuration &config)
Accept a configuration.
virtual bool operator()(const input_pointer &depo, output_queue &outq)
The calling signature:
Definition: Main.h:22
Json::Value Configuration
Definition: Configuration.h:50
std::shared_ptr< const IDepo > input_pointer