31 const string myname =
"test_ProtoduneChannelHelper: ";
33 cout << myname <<
"NDEBUG must be off." <<
endl;
36 string line =
"-----------------------------";
38 cout << myname << line <<
endl;
43 cout << myname <<
"Check some good values." <<
endl;
44 for (
Index ichaOff : { 0, 102, 1234, 1407, 3967, 15359 } ) {
45 Index ichaOn = chh.onlineChannel(ichaOff);
46 cout << myname << ichaOff <<
" --> " << ichaOn <<
endl;
47 assert( ichaOff != badIndex );
50 cout << myname << line <<
endl;
51 cout << myname <<
"Check some bad values." <<
endl;
52 for (
Index ichaOff : { -1, 15360, 20000 } ) {
53 Index ichaOn = chh.onlineChannel(ichaOff);
54 cout << myname << ichaOff <<
" --> " << ichaOn <<
endl;
55 assert( ichaOn == badIndex );
58 cout << myname << line <<
endl;
59 cout << myname <<
"Check each online index appears exactly once." <<
endl;
60 const Index ncha = 15360;
63 for (
Index ichaOff=0; ichaOff<ncha; ++ichaOff ) {
64 Index ichaOn = chh.onlineChannel(ichaOff);
66 Index itps = irem/2560;
68 Index ifmb = irem/128 + 1;
70 Index iasc = irem/16 + 1;
72 if ( nshow*(ichaOff/nshow) == ichaOff || ichaOn >= ncha ) {
73 cout << myname <<
" " <<
setw(4) << ichaOff <<
" --> " <<
setw(4) << ichaOn
74 <<
" (" << itps <<
", " <<
setw(2) << ifmb <<
", " 75 << iasc <<
", " <<
setw(2) << iach <<
")" <<
endl;
77 assert( itps == chh.tpcSet(ichaOn) );
78 assert( ifmb == chh.femb(ichaOn) );
79 assert( iasc == chh.asic(ichaOn) );
80 assert( iach == chh.asicChannel(ichaOn) );
81 assert( ichaOn < ncha );
82 if ( offlineChannel[ichaOn] != badIndex ) {
83 cout << myname <<
"ERROR: Online channel " << ichaOn
84 <<
" is mapped to two offline channels:" <<
endl;
85 cout <<
" " << offlineChannel[ichaOn] <<
endl;
86 cout <<
" " << ichaOff <<
endl;
89 assert( onlineCounts[ichaOn] == 0 );
90 onlineCounts[ichaOn] += 1;
91 offlineChannel[ichaOn] = ichaOff;
93 for (
Index ichaOn=0; ichaOn<ncha; ++ichaOn ) {
94 assert( onlineCounts[ichaOn] == 1 );
95 assert( offlineChannel[ichaOn] != badIndex );
98 cout << myname << line <<
endl;
99 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)