File indexing completed on 2024-04-06 12:10:28
0001 #include <stdio.h>
0002 #include <errno.h>
0003 #include "EventFilter/CSCRawToDigi/interface/CSCDCCExaminer.h"
0004
0005
0006 int main(int argc, char *argv[]) {
0007 CSCDCCExaminer examiner;
0008 examiner.modeDDU(true);
0009 examiner.crcCFEB(0);
0010 examiner.crcTMB(0);
0011 examiner.crcALCT(0);
0012 examiner.output1().show();
0013 examiner.output2().show();
0014
0015 if (argc != 2) {
0016 printf("Usage: ./examiner INPUT_FILENAME\n");
0017 return 0;
0018 }
0019 FILE *input;
0020 if ((input = fopen(argv[1], "rt")) == NULL) {
0021 printf("Cannot open input file: %s (errno=%d)\n", argv[2], errno);
0022 return 1;
0023 }
0024
0025
0026 const int bufferSize = 116384;
0027 unsigned short buffer[bufferSize];
0028 int length = 0;
0029 bzero(buffer, sizeof(buffer));
0030
0031
0032
0033 while (!feof(input) && (length = fread((char *)(buffer), sizeof(short), bufferSize, input)) != 0) {
0034 std::cout << "Read " << length << " words" << std::endl;
0035
0036 const unsigned short *buffer_end = buffer;
0037
0038 const unsigned short *buffer_start = buffer;
0039
0040 while ((length = examiner.check(buffer_end, length)) >= 0) {
0041 std::cout << "Event size=" << length << std::endl;
0042
0043
0044 std::vector<int> sourceIDs = examiner.listOfDDUs();
0045
0046 for (unsigned int ddu = 0; ddu < sourceIDs.size(); ddu++) {
0047
0048 const unsigned short *block = examiner.DDU_block()[sourceIDs[ddu]];
0049
0050 unsigned long offset = examiner.DDU_ptrOffsets()[sourceIDs[ddu]];
0051
0052 std::cout << "DDU " << sourceIDs[ddu] << std::hex << " 0x" << *(block + 0) << " 0x" << *(block + 1) << " 0x"
0053 << *(block + 2) << " 0x" << *(block + 3) << " size=" << std::dec
0054 << examiner.DDU_size()[sourceIDs[ddu]] << std::endl
0055 << " method2" << std::hex << " 0x" << *(buffer_start + offset + 0) << " 0x"
0056 << *(buffer_start + offset + 1) << " 0x" << *(buffer_start + offset + 2) << " 0x"
0057 << *(buffer_start + offset + 3) << std::dec << std::endl;
0058
0059 if (examiner.errorsForDDU(sourceIDs[ddu]))
0060 std::cout << std::hex << "Errors for ddu=0x" << sourceIDs[ddu] << " : 0x"
0061 << examiner.errorsForDDU(sourceIDs[ddu]) << std::dec << std::endl;
0062
0063 std::map<short, const unsigned short *> DMBs = examiner.DMB_block()[sourceIDs[ddu]];
0064
0065 std::map<short, unsigned long> _DMBs = examiner.DMB_ptrOffsets()[sourceIDs[ddu]];
0066
0067 for (std::map<short, const unsigned short *>::const_iterator dmb = DMBs.begin(); dmb != DMBs.end(); dmb++)
0068 std::cout << " DMB " << dmb->first << std::hex << " 0x" << *(dmb->second + 0) << " 0x" << *(dmb->second + 1)
0069 << " 0x" << *(dmb->second + 2) << " 0x" << *(dmb->second + 3) << " size=" << std::dec
0070 << examiner.DMB_size()[sourceIDs[ddu]][dmb->first] << std::endl;
0071 for (std::map<short, unsigned long>::const_iterator dmb = _DMBs.begin(); dmb != _DMBs.end(); dmb++)
0072 std::cout << " method2" << std::hex << " 0x" << *(buffer_start + dmb->second + 0) << " 0x"
0073 << *(buffer_start + dmb->second + 1) << " 0x" << *(buffer_start + dmb->second + 2) << " 0x"
0074 << *(buffer_start + dmb->second + 3) << std::dec << std::endl;
0075 }
0076 buffer_start = buffer_end;
0077 }
0078 }
0079
0080 return 0;
0081 }