#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
#include "dunecore/ArtSupport/DuneToolManager.h"
#include "dunecore/DuneInterface/Tool/IndexRangeTool.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 106 of file test_FclIndexRangeTool.cxx.
107 bool useExistingFcl =
false;
110 string sarg(
argv[1]);
111 if ( sarg ==
"-h" ) {
112 cout <<
"Usage: " <<
argv[0] <<
" [keepFCL] [RUN]" <<
endl;
113 cout <<
" If keepFCL = true, existing FCL file is used." <<
endl;
114 cout <<
" If RUN is nonzero, the data for that run are displayed." <<
endl;
117 useExistingFcl = sarg ==
"true" || sarg ==
"1";
120 string sarg(
argv[2]);
121 istringstream ssarg(
argv[2]);
QTextStream & endl(QTextStream &s)
int test_FclIndexRangeTool |
( |
bool |
useExistingFcl = false , |
|
|
Index |
runin = 0 |
|
) |
| |
Definition at line 29 of file test_FclIndexRangeTool.cxx.
30 const string myname =
"test_FclIndexRangeTool: ";
32 cout << myname <<
"NDEBUG must be off." <<
endl;
35 string line =
"-----------------------------";
37 cout << myname << line <<
endl;
38 string fclfile =
"test_FclIndexRangeTool.fcl";
39 if ( ! useExistingFcl ) {
40 cout << myname <<
"Creating top-level FCL." <<
endl;
41 ofstream
fout(fclfile.c_str());
45 fout <<
" tool_type: FclIndexRangeTool" <<
endl;
47 fout <<
" range1: { labels:[\"Range 1\"] begin:10 end:20}" <<
endl;
48 fout <<
" range2: { labels:[\"Range 2\"] begin:20 end:30}" <<
endl;
52 fout <<
"#include \"dunecommon_tools.fcl\"" <<
endl;
53 fout <<
"tools.mytool: @local::tools.protoduneIndexRangeTool" <<
endl;
57 cout << myname <<
"Using existing top-level FCL." <<
endl;
60 cout << myname << line <<
endl;
61 cout << myname <<
"Fetching tool manager." <<
endl;
63 assert ( ptm !=
nullptr );
68 cout << myname << line <<
endl;
69 cout << myname <<
"Fetching tool." <<
endl;
71 assert( irt !=
nullptr );
73 cout << myname << line <<
endl;
74 cout <<
"Fetch range1." <<
endl;
78 assert( ir1.
name ==
"range1" );
79 assert( ir1.
label() ==
"Range 1" );
80 assert( ir1.
begin == 10 );
81 assert( ir1.
end == 20 );
83 cout << myname << line <<
endl;
84 cout <<
"Fetch range2." <<
endl;
88 assert( ir2.
name ==
"range2" );
89 assert( ir2.
label() ==
"Range 2" );
90 assert( ir2.
begin == 20 );
91 assert( ir2.
end == 30 );
93 cout << myname << line <<
endl;
94 cout <<
"Fetch bad range" <<
endl;
99 cout << myname << line <<
endl;
100 cout << myname <<
"Done." <<
endl;
Name label(Index ilab=0) const
void line(double t, double *p, double &x, double &y, double &z)
std::string rangeString() const
QTextStream & endl(QTextStream &s)