#include "dunecore/ArtSupport/DuneToolManager.h"
#include "dunecore/DuneInterface/Tool/IndexMapTool.h"
#include "TH1F.h"
#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#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 97 of file test_BlockIndexMapTool.cxx.
98 bool useExistingFcl =
false;
100 string sarg(
argv[1]);
101 if ( sarg ==
"-h" ) {
102 cout <<
"Usage: " <<
argv[0] <<
" [keepFCL]" <<
endl;
103 cout <<
" If keepFCL = true, existing FCL file is used." <<
endl;
106 useExistingFcl = sarg ==
"true" || sarg ==
"1";
QTextStream & endl(QTextStream &s)
int test_BlockIndexMapTool |
( |
bool |
useExistingFcl = false | ) |
|
Definition at line 32 of file test_BlockIndexMapTool.cxx.
33 const string myname =
"test_BlockIndexMapTool: ";
35 cout << myname <<
"NDEBUG must be off." <<
endl;
38 string line =
"-----------------------------";
40 cout << myname << line <<
endl;
41 string fclfile =
"test_BlockIndexMapTool.fcl";
42 if ( ! useExistingFcl ) {
43 cout << myname <<
"Creating top-level FCL." <<
endl;
44 ofstream
fout(fclfile.c_str());
47 fout <<
" tool_type: BlockIndexMapTool" <<
endl;
49 fout <<
" Starts: [20, 10, 30]" <<
endl;
50 fout <<
" Values: [ 2, 1, 3]" <<
endl;
56 cout << myname <<
"Using existing top-level FCL." <<
endl;
59 cout << myname << line <<
endl;
60 cout << myname <<
"Fetching tool manager." <<
endl;
62 assert ( ptm !=
nullptr );
67 cout << myname << line <<
endl;
68 cout << myname <<
"Fetching tool." <<
endl;
70 assert( ptoo !=
nullptr );
72 cout << myname << line <<
endl;
73 map<Index, Index> chk;
74 for (
Index idx= 0; idx< 10; ++idx ) chk[idx] = 0;
75 for (
Index idx= 10; idx< 20; ++idx ) chk[idx] = 1;
76 for (
Index idx= 20; idx< 30; ++idx ) chk[idx] = 2;
77 for (
Index idx= 30; idx<100; ++idx ) chk[idx] = 3;
78 for (
Index idx=100; idx<110; ++idx ) chk[idx] = 0;
79 for (
Index idx=110; idx<120; ++idx ) chk[idx] = 1;
80 for (
Index idx=120; idx<130; ++idx ) chk[idx] = 2;
81 for (
Index idx=130; idx<200; ++idx ) chk[idx] = 3;
82 for (
auto kchk : chk ) {
83 Index idx = kchk.first;
84 Index chkval = kchk.second;
86 cout << myname <<
setw(10) << idx <<
": " <<
setw(5) << val <<
endl;
87 assert( val == chkval );
90 cout << myname << line <<
endl;
91 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)