test_depoplanex.cxx
Go to the documentation of this file.
3 
4 #include <iostream>
5 
6 using namespace WireCell;
7 
9 {
10  const double tunit = units::us; // for display
11 
13  std::vector<double> times{10.,25.,50.,100.0,500.0, 1000.0}; // us
14  std::vector<double> xes{100.0, 0.0, 50.0, 10.0, 75.0}; // cm
15 
16  for (auto t : times) {
17  t *= tunit;
18  for (auto x : xes) {
19  x *= units::cm;
20  auto depo = std::make_shared<SimpleDepo>(t,Point(x,0.0,0.0));
21  auto newdepo = dpx.add(depo);
22  std::cerr << "\tx=" << x/units::cm << "cm, t=" << newdepo->time()/tunit << "us\n";
23  }
24  std::cerr << "^ t=" << t/tunit << "us, fot=" << dpx.freezeout_time()/tunit << "us\n";
25  }
26  dpx.freezeout();
27  double fot = dpx.freezeout_time();
28  std::cerr << dpx.frozen_queue().size() << " frozen with fot=" << fot/tunit << "us, " << dpx.working_queue().size() << " working\n";
29 
30  auto removed = dpx.pop(fot/2.0);
31  std::cerr << "Popped " << removed.size() << " at " << fot/2.0/tunit << std::endl;
32  for (auto depo : removed) {
33  std::cerr << "\tx=" << depo->pos().x()/units::cm << "cm, t=" << depo->time()/tunit << "us";
34  std::cerr << " <--- ";
35  std::cerr << "x=" << depo->prior()->pos().x()/units::cm << "cm, t=" << depo->prior()->time()/tunit << "us\n";
36  }
37  std::cerr << "Frozen " << dpx.frozen_queue().size() << std::endl;
38  for (auto depo : dpx.frozen_queue()) {
39  std::cerr << "\tx=" << depo->pos().x()/units::cm << "cm, t=" << depo->time()/tunit << "us";
40  std::cerr << " <--- ";
41  std::cerr << "x=" << depo->prior()->pos().x()/units::cm << "cm, t=" << depo->prior()->time()/tunit << "us\n";
42  }
43  std::cerr << "Left " << dpx.working_queue().size() << std::endl;
44  for (auto depo : dpx.working_queue()) {
45  std::cerr << "\tx=" << depo->pos().x()/units::cm << "cm, t=" << depo->time()/tunit << "us";
46  std::cerr << " <--- ";
47  std::cerr << "x=" << depo->prior()->pos().x()/units::cm << "cm, t=" << depo->prior()->time()/tunit << "us\n";
48  }
49 }
50 
51 int main()
52 {
54 }
double freezeout_time() const
Definition: DepoPlaneX.cxx:22
IDepo::pointer add(const IDepo::pointer &depo)
Definition: DepoPlaneX.cxx:14
D3Vector< double > Point
A 3D Cartesian point in double precision.
Definition: Point.h:15
const working_queue_t & working_queue() const
Definition: DepoPlaneX.h:61
int main()
const frozen_queue_t & frozen_queue() const
Definition: DepoPlaneX.h:60
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
static const double cm
Definition: Units.h:59
Definition: Main.h:22
static const double us
Definition: Units.h:105
list x
Definition: train.py:276
void test_depoplanex()
QTextStream & endl(QTextStream &s)