#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 98 of file test_AdcKeepAllSignalFinder.cxx.
99 bool useExistingFcl =
false;
101 string sarg(
argv[1]);
102 if ( sarg ==
"-h" ) {
103 cout <<
"Usage: " <<
argv[0] <<
" [ARG]" <<
endl;
104 cout <<
" If ARG = true, existing FCL file is used." <<
endl;
107 useExistingFcl = sarg ==
"true" || sarg ==
"1";
int test_AdcKeepAllSignalFinder(bool useExistingFcl=false)
QTextStream & endl(QTextStream &s)
int test_AdcKeepAllSignalFinder |
( |
bool |
useExistingFcl = false | ) |
|
Definition at line 25 of file test_AdcKeepAllSignalFinder.cxx.
26 const string myname =
"test_AdcKeepAllSignalFinder: ";
28 cout << myname <<
"NDEBUG must be off." <<
endl;
31 string line =
"-----------------------------";
33 cout << myname << line <<
endl;
34 string fclfile =
"test_AdcKeepAllSignalFinder.fcl";
35 if ( ! useExistingFcl ) {
36 cout << myname <<
"Creating top-level FCL." <<
endl;
37 ofstream
fout(fclfile.c_str());
40 fout <<
" tool_type: AdcKeepAllSignalFinder" <<
endl;
47 cout << myname <<
"Using existing top-level FCL." <<
endl;
50 cout << myname << line <<
endl;
51 cout << myname <<
"Fetching tool manager." <<
endl;
53 assert ( ptm !=
nullptr );
58 cout << myname << line <<
endl;
59 cout << myname <<
"Fetching tool." <<
endl;
61 assert( psgf !=
nullptr );
63 assert( psgfmod !=
nullptr );
65 cout << myname << line <<
endl;
66 cout << myname <<
"Create data and call tool." <<
endl;
68 for (
AdcIndex itic=0; itic<100; ++itic ) {
69 float xadc = rand()%20 - 10.0;
73 assert( data.
signal.size() == 0 );
74 assert( data.
rois.size() == 0 );
75 assert( data.
samples[30] = 150 );
77 cout << myname << line <<
endl;
78 cout << myname <<
"Running tool." <<
endl;
79 DataMap resmod = psgfmod->update(data);
82 cout << myname << line <<
endl;
83 cout << myname <<
"Checking results." <<
endl;
84 assert( resmod == 0 );
85 assert( resmod.
getInt(
"nroi") == 1 );
86 assert( data.
signal.size() == 100 );
87 assert( data.
rois.size() == 1 );
88 assert( data.
rois[0].first == 0 );
89 assert( data.
rois[0].second == 99 );
91 cout << myname << line <<
endl;
92 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)