| 1 |
/** @file |
/** @file |
| 2 |
* $Source: /home/cvspamela/yoda/techmodel/TabDumpReader.cpp,v $ |
* $Source: /home/cvsmanager/yoda/techmodel/TabDumpReader.cpp,v $ |
| 3 |
* $Id: TabDumpReader.cpp,v 1.7 2004/05/11 10:12:35 nagni Exp $ |
* $Id: TabDumpReader.cpp,v 1.3 2004/07/26 23:09:45 kusanagi Exp $ |
| 4 |
* $Author: nagni $ |
* $Author: kusanagi $ |
| 5 |
* |
* |
| 6 |
* Implementation of the TabDumpReader class. |
* Implementation of the TabDumpReader class. |
| 7 |
*/ |
*/ |
| 32 |
* Get a string with the version info of the algorithm. |
* Get a string with the version info of the algorithm. |
| 33 |
*/ |
*/ |
| 34 |
std::string TabDumpReader::GetVersionInfo(void) const { |
std::string TabDumpReader::GetVersionInfo(void) const { |
| 35 |
return "$Header: /home/cvspamela/yoda/techmodel/TabDumpReader.cpp,v 1.7 2004/05/11 10:12:35 nagni Exp $\n"; |
return "$Header: /home/cvsmanager/yoda/techmodel/TabDumpReader.cpp,v 1.3 2004/07/26 23:09:45 kusanagi Exp $\n"; |
| 36 |
} |
} |
| 37 |
|
|
| 38 |
/** |
/** |
| 65 |
//took the final CRC to compare it with the previous calculated CRC of the data |
//took the final CRC to compare it with the previous calculated CRC of the data |
| 66 |
InputFile->read(eventCRC, sizeof(eventCRC)); |
InputFile->read(eventCRC, sizeof(eventCRC)); |
| 67 |
readCRC = (((UINT16)(eventCRC[0]<<8))&0xFF00) + (((UINT16)eventCRC[1])&0x00FF); |
readCRC = (((UINT16)(eventCRC[0]<<8))&0xFF00) + (((UINT16)eventCRC[1])&0x00FF); |
| 68 |
|
|
|
if(!(subCRC == readCRC)) { |
|
|
cat << log4cpp::Priority::ERROR |
|
|
<< "The test of calculated CRC with one wrote on file FAILED!!" |
|
|
<< "\n " << log4cpp::CategoryStream::ENDLINE; |
|
|
} |
|
|
|
|
| 69 |
//finally check if the RecordCRC is correct and finally update the partialCRC |
//finally check if the RecordCRC is correct and finally update the partialCRC |
| 70 |
if (subCRC == readCRC){ |
if (subCRC == readCRC){ |
| 71 |
/**************************************************************************** |
TabDumpRecord* rec; |
| 72 |
---------------------TBD read the data--------------------------- |
long int offset = 0; |
| 73 |
****************************************************************************/ |
int i = 0; |
| 74 |
free(subData); |
int size; |
| 75 |
|
TabDump->Records->Clear(); |
| 76 |
|
TClonesArray &recs = *(TabDump->Records); |
| 77 |
|
while (offset < dataLength){ |
| 78 |
|
rec = new(recs[i++]) TabDumpRecord(); //add a new TabDump |
| 79 |
|
rec->Tab_ID = ((UINT8)subData[offset])&0xFF; |
| 80 |
|
rec->Nrow = ((UINT8)subData[offset+1])&0xFF; |
| 81 |
|
rec->Ncol = ((UINT8)subData[offset+2])&0xFF; |
| 82 |
|
rec->Data = new UINT32[(rec->Nrow)*(rec->Ncol)]; |
| 83 |
|
size = sizeof(UINT32)*(rec->Nrow)*(rec->Ncol); |
| 84 |
|
memcpy(rec->Data, (UINT32*)(subData+offset+3), size); |
| 85 |
|
offset = offset + size + 3; |
| 86 |
|
} |
| 87 |
} else { |
} else { |
| 88 |
cat << log4cpp::Priority::ERROR |
cat << log4cpp::Priority::ERROR |
| 89 |
<< "Wrong CRC on Subpacket in TabDump Packet " |
<< "Wrong CRC on Subpacket in TabDump Packet " |
| 90 |
<< "\n " << log4cpp::CategoryStream::ENDLINE; |
<< "\n " << log4cpp::CategoryStream::ENDLINE; |
| 91 |
} |
} |
| 92 |
|
delete [] subData; |
| 93 |
} |
} |