Functions
_test_framer.cxx File Reference
#include "WireCellGen/Framer.h"
#include "WireCellIface/SimpleChannelSlice.h"
#include "WireCellUtil/Testing.h"
#include "WireCellUtil/Units.h"
#include <iostream>

Go to the source code of this file.

Functions

int main ()
 

Function Documentation

int main ( void  )

Definition at line 13 of file _test_framer.cxx.

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 }
microsecond_as<> microsecond
Type of time stored in microseconds, in double precision.
Definition: spacetime.h:114
#define Assert
Definition: Testing.h:7
Definition: test_any.cxx:16
const char * cs
const GenericPointer< typename T::ValueType > & pointer
Definition: pointer.h:1124
QTextStream & endl(QTextStream &s)