25 using std::istringstream;
    34   const string myname = 
"test_ProtoduneOnlineChannel: ";
    36   cout << myname << 
"NDEBUG must be off." << 
endl;
    39   string line = 
"-----------------------------";
    41   cout << myname << line << 
endl;
    42   string fclfile = 
"test_ProtoduneOnlineChannel.fcl";
    43   if ( ! useExistingFcl ) {
    44     cout << myname << 
"Creating top-level FCL." << 
endl;
    45     ofstream 
fout(fclfile.c_str());
    48     fout << 
"    tool_type: ProtoduneOnlineChannel" << 
endl;
    53     cout << myname << 
"Using existing top-level FCL." << 
endl;
    56   cout << myname << line << 
endl;
    57   cout << myname << 
"Fetching tool manager." << 
endl;
    59   assert ( ptm != 
nullptr );
    64   cout << myname << line << 
endl;
    65   cout << myname << 
"Fetching tool." << 
endl;
    67   assert( cma != 
nullptr );
    71   cout << myname << line << 
endl;
    72   cout << myname << 
"Check some good values." << 
endl;
    73   for ( 
Index ichaOff : { 0, 102, 1234, 1407, 3967, 15359 } ) {
    74     Index ichaOn = cma->get(ichaOff);
    75     cout << myname << ichaOff << 
" --> " << ichaOn << 
endl;
    76     assert( ichaOff != badIndex );
    79   cout << myname << line << 
endl;
    80   cout << myname << 
"Check some bad values." << 
endl;
    81   for ( 
Index ichaOff : { -1, 15360, 20000 } ) {
    82     Index ichaOn = cma->get(ichaOff);
    83     cout << myname << ichaOff << 
" --> " << ichaOn << 
endl;
    84     assert( ichaOn == badIndex );
    87   cout << myname << line << 
endl;
    88   cout << myname << 
"Check each online index appears exactly once." << 
endl;
    89   const Index ncha = 15360;
    93   for ( 
Index ichaOff=0; ichaOff<ncha; ++ichaOff ) {
    94     Index ichaOn = cma->get(ichaOff);
    96     Index itps = irem/2560;
    98     Index ifmb = irem/128 + 1;
   100     Index iasc = irem/16 + 1;
   101     Index iach = irem%16;
   102     if ( nshow*(ichaOff/nshow) == ichaOff || ichaOn >= ncha ) {
   103       cout <<  myname << 
" " << 
setw(4) << ichaOff << 
" --> " << 
setw(4) << ichaOn
   104            << 
" (" << itps << 
", " << 
setw(2) << ifmb << 
", "   105            << iasc << 
", " << 
setw(2) << iach << 
")" << 
endl;
   107     assert( itps == chh.
tpcSet(ichaOn) );
   108     assert( ifmb == chh.
femb(ichaOn) );
   109     assert( iasc == chh.
asic(ichaOn) );
   111     assert( ichaOn < ncha );
   112     if ( offlineChannel[ichaOn] != badIndex ) {
   113       cout << myname << 
"ERROR: Online channel " << ichaOn
   114            << 
" is mapped to two offline channels:" << 
endl;
   115       cout << 
"  " << offlineChannel[ichaOn] << 
endl;
   116       cout << 
"  " << ichaOff << 
endl;
   119     assert( onlineCounts[ichaOn] == 0 );
   120     onlineCounts[ichaOn] += 1;
   121     offlineChannel[ichaOn] = ichaOff;
   123   for ( 
Index ichaOn=0; ichaOn<ncha; ++ichaOn ) {
   124     assert( onlineCounts[ichaOn] == 1 );
   125     assert( offlineChannel[ichaOn] != badIndex );
   128   cout << myname << line << 
endl;
   129   cout << myname << 
"Done." << 
endl;
   136   bool useExistingFcl = 
false;
   139     string sarg(argv[1]);
   140     if ( sarg == 
"-h" ) {
   141       cout << 
"Usage: " << argv[0] << 
" [keepFCL] [NSHOW]" << 
endl;
   142       cout << 
"  keepFCL [false]: If true, existing FCL file is used." << 
endl;
   143       cout << 
"  NSHOW [64]: Every nshow'th channels will be displayed in log." << 
endl;
   146     useExistingFcl = sarg == 
"true" || sarg == 
"1";
   149     string sarg(argv[2]);
   150     nshow = std::stoi(sarg);
 
int test_ProtoduneOnlineChannel(bool useExistingFcl=false, Index nshow=64)
 
static Index femb(Index chan, bool isOff)
 
static Index asicChannel(Index chan, bool isOff)
 
Q_EXPORT QTSManip setw(int w)
 
int main(int argc, char *argv[])
 
void line(double t, double *p, double &x, double &y, double &z)
 
static Index asic(Index chan, bool isOff)
 
static Index tpcSet(Index chan, bool isOff)
 
QTextStream & endl(QTextStream &s)