33 const string myname =
"test_IcebergOnlineChannel: ";
35 cout << myname <<
"NDEBUG must be off." <<
endl;
38 string line =
"-----------------------------";
40 cout << myname << line <<
endl;
41 string fclfile =
"test_IcebergOnlineChannel.fcl";
43 cout << myname <<
"Using existing top-level FCL." <<
endl;
45 cout << myname <<
"Creating top-level FCL." <<
endl;
46 ofstream
fout(fclfile.c_str());
47 fout <<
"#include \"IcebergChannelMapService.fcl\"" <<
endl;
48 fout <<
"services: { IcebergChannelMapService: @local::icebergchannelmap }" <<
endl;
51 fout <<
" tool_type: IcebergOnlineChannel" <<
endl;
53 fout <<
" Ordering: \"FEMB\"" <<
endl;
56 fout <<
" tool_type: ProtoduneOnlineChannel" <<
endl;
63 cout << myname << line <<
endl;
64 cout << myname <<
"Fetching tool manager." <<
endl;
66 assert ( ptm !=
nullptr );
71 std::ifstream
config{fclfile};
74 cout << myname << line <<
endl;
75 cout << myname <<
"Fetching tool." <<
endl;
77 assert( cma !=
nullptr );
81 cout << myname << line <<
endl;
82 cout << myname <<
"Check some good values." <<
endl;
84 while ( ichaOff < 1240 ) {
85 Index ichaOn = cma->get(ichaOff);
86 cout << myname << ichaOff <<
" --> " << ichaOn <<
endl;
87 assert( ichaOff != badIndex );
89 ichaOn = cma->get(ichaOff);
90 cout << myname << ichaOff <<
" --> " << ichaOn <<
endl;
91 assert( ichaOff != badIndex );
92 ichaOff += (ichaOff < 800 ? 40 : 48) - 1;
95 cout << myname << line <<
endl;
96 cout << myname <<
"Check some bad values." <<
endl;
97 cout << myname <<
"Bad index: " << badIndex <<
endl;
98 for (
Index ichaOff : { -1, 1280, 20000 } ) {
99 Index ichaOn = cma->get(ichaOff);
100 cout << myname << ichaOff <<
" --> " << ichaOn <<
endl;
101 assert( ichaOn == badIndex );
104 cout << myname << line <<
endl;
105 cout << myname <<
"Check each online index appears exactly once." <<
endl;
106 const Index ncha = 1280;
110 for (
Index ichaOff=0; ichaOff<ncha; ++ichaOff ) {
111 Index ichaOn = cma->get(ichaOff);
112 if ( nshow*(ichaOff/nshow) == ichaOff || ichaOn >= ncha )
113 cout << myname <<
" " << ichaOff <<
" --> " << ichaOn <<
endl;
114 assert( ichaOn < ncha );
115 if ( offlineChannel[ichaOn] != badIndex ) {
116 cout << myname <<
"ERROR: Online channel " << ichaOn
117 <<
" is mapped to two offline channels:" <<
endl;
118 cout <<
" " << offlineChannel[ichaOn] <<
endl;
119 cout <<
" " << ichaOff <<
endl;
122 assert( onlineCounts[ichaOn] == 0 );
123 onlineCounts[ichaOn] += 1;
124 offlineChannel[ichaOn] = ichaOff;
126 for (
Index ichaOn=0; ichaOn<ncha; ++ichaOn ) {
127 assert( onlineCounts[ichaOn] == 1 );
128 assert( offlineChannel[ichaOn] != badIndex );
131 cout << myname << line <<
endl;
132 cout << myname <<
"Done." <<
endl;
static void load_services(std::string const &config)
void line(double t, double *p, double &x, double &y, double &z)
QTextStream & endl(QTextStream &s)