Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:26:11

0001 #include <iostream>
0002 #include <iomanip>
0003 
0004 #include <stdio.h>
0005 #include <string.h>
0006 #include <stdint.h>
0007 
0008 using namespace std;
0009 
0010 #include "EventFilter/L1TXRawToDigi/interface/UCTDAQRawData.h"
0011 #include "EventFilter/L1TXRawToDigi/interface/UCTAMCRawData.h"
0012 #include "EventFilter/L1TXRawToDigi/interface/UCTCTP7RawData.h"
0013 
0014 int main(int argc, char** argv) {
0015   uint32_t index = 0;
0016   uint64_t fedRawDataArray[694];
0017   char line[256];
0018   while (cin.getline(line, 256)) {
0019     char* saveptr;
0020     char* iToken = strtok_r(line, ":", &saveptr);
0021     if (iToken == 0)
0022       continue;
0023     if (sscanf(iToken, "%d", &index) == 1) {
0024       if (index < 694) {
0025         char* fToken = strtok_r(nullptr, "\n", &saveptr);
0026         if (fToken == 0)
0027           continue;
0028         if (sscanf(fToken, "%lX", &fedRawDataArray[index]) != 1) {
0029           cerr << "oops! format error :(" << endl;
0030           continue;
0031         }
0032       } else {
0033         cerr << "oops! index is too high :(" << endl;
0034       }
0035     } else {
0036       cout << line << endl;
0037     }
0038   }
0039   UCTDAQRawData daqData(fedRawDataArray);
0040   daqData.print();
0041   for (uint32_t i = 0; i < daqData.nAMCs(); i++) {
0042     UCTAMCRawData amcData(daqData.amcPayload(i));
0043     cout << endl;
0044     amcData.print();
0045     cout << endl;
0046     UCTCTP7RawData ctp7Data(amcData.payload());
0047     ctp7Data.print();
0048     cout << endl;
0049   }
0050   cout << "Goodbye!" << endl;
0051 }