DepoPlaneX.cxx
Go to the documentation of this file.
3 
4 using namespace WireCell;
5 
6 Gen::DepoPlaneX::DepoPlaneX(double planex, double speed)
7  : m_planex(planex)
8  , m_speed(speed)
9  , m_queue(IDepoDriftCompare(speed))
10 {
11 }
12 
13 
15 {
16  drain(depo->time());
17  IDepo::pointer newdepo(new TransportedDepo(depo, m_planex, m_speed));
18  m_queue.insert(newdepo);
19  return newdepo;
20 }
21 
23 {
24  if (m_frozen.empty()) {
25  return -1.0*units::second;
26  }
27  return m_frozen.back()->time();
28 }
29 
31 {
32  IDepo::vector doomed;
33  for (auto depo : m_queue) {
34  if (depo->time() < time) {
35  m_frozen.push_back(depo);
36  doomed.push_back(depo);
37  }
38  }
39  for (auto depo : doomed) {
40  m_queue.erase(depo);
41  }
42 }
43 
45 {
46  IDepo::vector doomed;
47  for (auto depo : m_queue) {
48  m_frozen.push_back(depo);
49  doomed.push_back(depo);
50 
51  }
52  for (auto depo : doomed) {
53  m_queue.erase(depo);
54  }
55 }
56 
58 {
59  drain(time);
60  auto found = std::find_if_not (m_frozen.begin(), m_frozen.end(), [time](IDepo::pointer p){return p->time() <= time;} );
61  IDepo::vector ret(m_frozen.begin(), found);
62  m_frozen.erase(m_frozen.begin(), found);
63  return ret;
64 }
std::shared_ptr< const IDepo > pointer
Definition: IData.h:19
double freezeout_time() const
Definition: DepoPlaneX.cxx:22
frozen_queue_t m_frozen
Definition: DepoPlaneX.h:66
IDepo::pointer add(const IDepo::pointer &depo)
Definition: DepoPlaneX.cxx:14
std::vector< pointer > vector
Definition: IData.h:21
void drain(double time)
Move all froze-out depos to the frozen queue.
Definition: DepoPlaneX.cxx:30
IDepo::vector pop(double time)
Definition: DepoPlaneX.cxx:57
void freezeout()
Force any remaining "thawed" depos in the queue to be frozen out.
Definition: DepoPlaneX.cxx:44
Definition: Main.h:22
p
Definition: test.py:223
static const double second
Definition: Units.h:92
working_queue_t m_queue
Definition: DepoPlaneX.h:65
DepoPlaneX(double planex=0.0 *units::cm, double speed=1.6 *units::millimeter/units::microsecond)
Definition: DepoPlaneX.cxx:6