#include <string>
#include <iostream>
#include <fstream>
#include "dunecore/DuneInterface/Tool/TpcDataTool.h"
#include "dunecore/ArtSupport/DuneToolManager.h"
#include <cassert>
Go to the source code of this file.
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 110 of file test_DuneAdcSignalFinder.cxx.
111 bool useExistingFcl =
false;
113 string sarg(
argv[1]);
114 if ( sarg ==
"-h" ) {
115 cout <<
"Usage: " <<
argv[0] <<
" [ARG]" <<
endl;
116 cout <<
" If ARG = true, existing FCL file is used." <<
endl;
119 useExistingFcl = sarg ==
"true" || sarg ==
"1";
int test_DuneAdcSignalFinder(bool useExistingFcl=false)
QTextStream & endl(QTextStream &s)
int test_DuneAdcSignalFinder |
( |
bool |
useExistingFcl = false | ) |
|
Definition at line 25 of file test_DuneAdcSignalFinder.cxx.
26 const string myname =
"test_DuneAdcSignalFinder: ";
28 cout << myname <<
"NDEBUG must be off." <<
endl;
31 string line =
"-----------------------------";
33 cout << myname << line <<
endl;
34 string fclfile =
"test_DuneAdcSignalFinder.fcl";
35 if ( ! useExistingFcl ) {
36 cout << myname <<
"Creating top-level FCL." <<
endl;
37 ofstream
fout(fclfile.c_str());
40 fout <<
" tool_type: DuneAdcSignalFinder" <<
endl;
51 cout << myname <<
"Using existing top-level FCL." <<
endl;
54 cout << myname << line <<
endl;
55 cout << myname <<
"Fetching tool manager." <<
endl;
57 assert ( ptm !=
nullptr );
62 cout << myname << line <<
endl;
63 cout << myname <<
"Fetching tool." <<
endl;
65 assert( psgf !=
nullptr );
67 assert( psgfmod !=
nullptr );
69 cout << myname << line <<
endl;
70 cout << myname <<
"Create data and call tool." <<
endl;
72 for (
AdcIndex itic=0; itic<100; ++itic ) {
73 float xadc = rand()%20 - 10.0;
78 assert( data.
signal.size() == 0 );
79 assert( data.
rois.size() == 0 );
80 assert( data.
samples[30] = 150 );
81 assert( data.
samples[31] = 130 );
82 assert( data.
samples[32] = 90 );
83 assert( data.
samples[33] = 70 );
84 assert( data.
samples[34] = 45 );
85 assert( data.
samples[35] = 30 );
86 assert( data.
samples[36] = 20 );
87 assert( data.
samples[37] = 15 );
89 cout << myname << line <<
endl;
90 cout << myname <<
"Running tool." <<
endl;
91 DataMap resmod = psgfmod->update(data);
94 cout << myname << line <<
endl;
95 cout << myname <<
"Checking results." <<
endl;
96 assert( resmod == 0 );
97 assert( resmod.
getInt(
"nroi") == 1 );
98 assert( data.
signal.size() == 100 );
99 assert( data.
rois.size() == 1 );
100 assert( data.
rois[0].first == 25 );
101 assert( data.
rois[0].second == 44 );
103 cout << myname << line <<
endl;
104 cout << myname <<
"Done." <<
endl;
void print(std::ostream *pout) const
int getInt(Name name, int def=0) const
void line(double t, double *p, double &x, double &y, double &z)
QTextStream & endl(QTextStream &s)