#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include "dunecore/ArtSupport/DuneToolManager.h"
#include "dunecore/DuneInterface/Tool/FloatArrayTool.h"
#include "TH1F.h"
#include <cassert>
Go to the source code of this file.
|
using | Index = unsigned int |
|
using Index = unsigned int |
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 120 of file test_FclFileFloatArray.cxx.
121 bool useExistingFcl =
false;
123 string sarg(
argv[1]);
124 if ( sarg ==
"-h" ) {
125 cout <<
"Usage: " <<
argv[0] <<
" [keepFCL] [RUN]" <<
endl;
126 cout <<
" If keepFCL = true, existing FCL file is used." <<
endl;
129 useExistingFcl = sarg ==
"true" || sarg ==
"1";
int test_FclFileFloatArray(bool useExistingFcl=false)
QTextStream & endl(QTextStream &s)
int test_FclFileFloatArray |
( |
bool |
useExistingFcl = false | ) |
|
Definition at line 31 of file test_FclFileFloatArray.cxx.
32 const string myname =
"test_FclFileFloatArray: ";
34 cout << myname <<
"NDEBUG must be off." <<
endl;
37 string line =
"-----------------------------";
39 cout << myname << line <<
endl;
40 if ( ! useExistingFcl ) {
41 cout << myname <<
"Creating float array FCL." <<
endl;
43 ofstream
fout(
"test_FclFileFloatArray_arr1.fcl");
44 fout <<
" tool_type: FclFloatArray" <<
endl;
50 fout <<
" Values: [ 110, 111, 112, 113, 114, 115, 116, 117, 118, 119 ]" <<
endl;
54 ofstream
fout(
"test_FclFileFloatArray_arr3.fcl");
55 fout <<
" tool_type: FclFloatArray" <<
endl;
61 fout <<
" Values: [ 130, 131, 132, 133, 134, 135, 136, 137, 138, 139 ]" <<
endl;
65 string fclfile =
"test_FclFileFloatArray.fcl";
66 if ( ! useExistingFcl ) {
67 cout << myname <<
"Creating top-level FCL." <<
endl;
68 ofstream
fout(fclfile.c_str());
71 fout <<
" tool_type: FclFileFloatArray" <<
endl;
73 fout <<
" FileNames: [\"test_FclFileFloatArray_arr1.fcl\", \"test_FclFileFloatArray_arr3.fcl\"]" <<
endl;
74 fout <<
" DefaultValue: 999" <<
endl;
79 cout << myname <<
"Using existing top-level FCL." <<
endl;
82 cout << myname << line <<
endl;
83 cout << myname <<
"Fetching tool manager." <<
endl;
85 assert ( ptm !=
nullptr );
90 cout << myname << line <<
endl;
91 cout << myname <<
"Fetching tool." <<
endl;
93 assert( ptoo !=
nullptr );
95 cout << myname << line <<
endl;
96 cout <<
"size = " << ptoo->size() <<
endl;
97 assert( ptoo->size() == 40 );
99 cout << myname << line <<
endl;
100 cout <<
"Unit = " << ptoo->unit() <<
endl;
101 assert( ptoo->unit() ==
"cm" );
103 cout << myname << line <<
endl;
104 cout << myname <<
"Check values." <<
endl;
106 for (
int ival=10; ival<20; ++ival ) exp[ival] = 100 + ival;
107 for (
int ival=30; ival<40; ++ival ) exp[ival] = 100 + ival;
108 for (
Index ival=0; ival<ptoo->size(); ++ival ) {
109 cout <<
setw(4) << ival <<
": " << ptoo->value(ival) <<
endl;
110 assert( fabs(ptoo->value(ival) - exp[ival]) < 1.
e-6 );
113 cout << myname << line <<
endl;
114 cout << myname <<
"Done." <<
endl;
Q_EXPORT QTSManip setw(int w)
void line(double t, double *p, double &x, double &y, double &z)
QTextStream & endl(QTextStream &s)