26 using std::istringstream;
35 const string myname =
"test_ChannelStatusServiceTool: ";
37 cout << myname <<
"NDEBUG must be off." <<
endl;
40 string line =
"-----------------------------";
42 cout << myname << line <<
endl;
43 string fclfile =
"test_ChannelStatusServiceTool.fcl";
44 if ( ! useExistingFcl ) {
45 cout << myname <<
"Creating top-level FCL." <<
endl;
46 ofstream
fout(fclfile.c_str());
47 fout <<
"#include \"services_dune.fcl\"" <<
endl;
48 fout <<
"services.Geometry: @local::protodune_geo" <<
endl;
49 fout <<
"services.ExptGeoHelperInterface: @local::dune_geometry_helper" <<
endl;
50 fout <<
"services.ChannelStatusService: {" <<
endl;
51 fout <<
" service_provider: SimpleChannelStatusService" <<
endl;
52 fout <<
" BadChannels: [ 1 ]" <<
endl;
53 fout <<
" NoisyChannels: [3, 4]" <<
endl;
57 fout <<
" tool_type: ChannelStatusServiceTool" <<
endl;
61 if ( extrafcl.size() ) {
62 fout <<
"#include \"" + extrafcl +
"\"" <<
endl;
66 cout << myname <<
"Using existing top-level FCL." <<
endl;
69 cout << myname << line <<
endl;
70 cout << myname <<
"Load services." <<
endl;
73 cout << myname << line <<
endl;
74 cout << myname <<
"Fetching tool manager." <<
endl;
76 assert ( ptm !=
nullptr );
81 cout << myname << line <<
endl;
82 cout << myname <<
"Fetching tool." <<
endl;
84 assert( pcs !=
nullptr );
86 cout << myname << line <<
endl;
87 cout <<
"Check some channels." <<
endl;
88 vector<Index> chks(20, 0);
92 for (
Index icha=0; icha<20; ++icha ) {
93 Index chanStat = pcs->get(icha);
94 cout <<
setw(8) << icha <<
": " <<
setw(2) << chanStat <<
endl;
95 assert( chanStat == chks[icha] );
98 cout << myname << line <<
endl;
99 cout << myname <<
"Done." <<
endl;
106 bool useExistingFcl =
false;
109 string sarg(argv[1]);
110 if ( sarg ==
"-h" ) {
111 cout <<
"Usage: " << argv[0] <<
" [keepFCL] [extrafcl]" <<
endl;
112 cout <<
" If keepFCL = true, existing FCL file is used." <<
endl;
113 cout <<
" If extrafcl is give, that file is included in the config" <<
endl;
116 useExistingFcl = sarg ==
"true" || sarg ==
"1";
static void load(std::string const &filename)
Q_EXPORT QTSManip setw(int w)
void line(double t, double *p, double &x, double &y, double &z)
QTextStream & endl(QTextStream &s)