test_chirp.cxx
Go to the documentation of this file.
3 #include "WireCellUtil/Testing.h"
4 
5 #include <iostream>
6 #include <string>
7 
8 // provides vectors "horig" and "hfilt"
9 // generate like:
10 // $ dump-root-hist-to-waveform sigproc/test/example-chirp.root horig hfilt > sigproc/test/example-chirp.h
11 #include <vector>
12 #include "example-chirp.h"
13 
14 using namespace std;
15 
16 using namespace WireCell;
17 using namespace WireCell::SigProc;
18 
19 int main(int argc, char* argv[])
20 {
21  // vectors are in example-chirp.h
22 
23  int beg=-1, end=-1;
24  Diagnostics::Chirp chirp;
25  bool found = chirp(horig, beg, end);
26  Assert(found);
27 
28  // the function should find something starting at the beginning.
29  Assert(beg == 0);
30  // and the chirp does not extend to the end
31  Assert(end !=0 && end != (int)horig.size());
32 
33  Assert (beg >= 0);
34  Assert (end >= 0);
35  Assert (beg < end);
36 
37  // The algorithm works in chunks of 20
38  Assert ((end-beg)%20 == 0);
39 
40  for (int ind=beg; ind<end; ++ind) {
41  Assert(hfilt[ind] == 0);
42  }
43 
44  cerr << "chirp at " << beg << " --> " << end << endl;
45  Assert (end == 4240);
46 
47  return 0;
48 }
std::vector< float > horig
Definition: example-chirp.h:1
STL namespace.
int main(int argc, char *argv[])
Definition: test_chirp.cxx:19
std::vector< float > hfilt
Definition: example-chirp.h:1
#define Assert
Definition: Testing.h:7
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:72
Definition: Main.h:22
QTextStream & endl(QTextStream &s)