Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
wire-cell-build
sigproc
test
test_chirp.cxx
Go to the documentation of this file.
1
#include "
WireCellSigProc/Diagnostics.h
"
2
#include "
WireCellUtil/Waveform.h
"
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
}
horig
std::vector< float > horig
Definition:
example-chirp.h:1
std
STL namespace.
main
int main(int argc, char *argv[])
Definition:
test_chirp.cxx:19
hfilt
std::vector< float > hfilt
Definition:
example-chirp.h:1
WireCell::SigProc::Diagnostics::Chirp
Definition:
Diagnostics.h:11
freeze_graph.argv
argv
Definition:
freeze_graph.py:218
WireCell::SigProc
Definition:
ChannelSelector.h:18
Assert
#define Assert
Definition:
Testing.h:7
util::end
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition:
StdUtils.h:72
Diagnostics.h
Testing.h
Waveform.h
WireCell
Definition:
Main.h:22
example-chirp.h
ValidateOpDetReco.found
bool found
Definition:
ValidateOpDetReco.py:354
test_gen_rays_pdsp.argc
argc
Definition:
test_gen_rays_pdsp.py:6
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
Generated by
1.8.11