_test_framer.cxx
Go to the documentation of this file.
1 #include "WireCellGen/Framer.h"
2 
3 #include "WireCellIface/SimpleChannelSlice.h"
4 
5 #include "WireCellUtil/Testing.h"
6 #include "WireCellUtil/Units.h"
7 
8 #include <iostream>
9 
10 using namespace WireCell;
11 using namespace std;
12 
13 int main()
14 {
15 
16  Framer framer;
17 
18  ChannelCharge cc;
19  cc[1] = 1.0;
20  cc[2] = 2.0;
21  cc[3] = 3.0;
22  const double the_time = 11.0*units::microsecond;
23  IChannelSlice::pointer cs(new SimpleChannelSlice(the_time, cc));
24 
25  IFramer::output_queue frameq;
26  Assert(framer(cs,frameq));
27  cerr << "test_framer: frame queue size: " << frameq.size() << endl;
28  Assert(frameq.size() == 1);
29 
30  IFrame::pointer frame = frameq.front();
31  Assert(frame);
32 
33  Assert(frame->time() == the_time);
34  ITrace::shared_vector traces = frame->traces();
35  Assert(traces);
36  Assert(!traces->empty());
37  int ntraces = traces->size();
38 
39  cerr << "test_framer: Frame: #" << frame->ident()
40  << " at t=" << frame->time()/units::microsecond << " usec"
41  << " with " << ntraces << " traces"
42  << endl;
43 
44  for (auto trace : *traces) {
45  cerr << "\ttrace ch:" << trace->channel()
46  << " start tbin=" << trace->tbin()
47  << " #time bins=" << trace->charge().size()
48  << endl;
49  }
50 
51  frameq.clear();
52  Assert(framer(nullptr,frameq));
53  Assert(frameq.size() == 1);
54  IFrame::pointer eos = frameq.front();
55  Assert(!eos);
56  return 0;
57 }
std::shared_ptr< const IFrame > pointer
Definition: IData.h:19
STL namespace.
static const double microsecond
Definition: Units.h:94
#define Assert
Definition: Testing.h:7
Definition: test_any.cxx:16
Definition: Main.h:22
const char * cs
const GenericPointer< typename T::ValueType > & pointer
Definition: pointer.h:1124
std::shared_ptr< const vector > shared_vector
Definition: IData.h:22
int main()
QTextStream & endl(QTextStream &s)