| 1 |
/** @file |
/** @file |
| 2 |
* $Source: /home/cvsmanager/yoda/techmodel/CalibS4Reader.cpp,v $ |
* $Source: /home/cvsmanager/yoda/techmodel/CalibS4Reader.cpp,v $ |
| 3 |
* $Id: CalibS4Reader.cpp,v 2.3 2004/12/16 17:32:57 kusanagi Exp $ |
* $Id: CalibS4Reader.cpp,v 2.4 2005/02/18 18:19:14 kusanagi Exp $ |
| 4 |
* $Author: kusanagi $ |
* $Author: kusanagi $ |
| 5 |
* |
* |
| 6 |
* Implementation of the LogReader class. |
* Implementation of the LogReader class. |
| 43 |
*/ |
*/ |
| 44 |
std::string CalibS4Reader::GetVersionInfo(void) const { |
std::string CalibS4Reader::GetVersionInfo(void) const { |
| 45 |
return |
return |
| 46 |
"$Header: /home/cvsmanager/yoda/techmodel/CalibS4Reader.cpp,v 2.3 2004/12/16 17:32:57 kusanagi Exp $\n"; |
"$Header: /home/cvsmanager/yoda/techmodel/CalibS4Reader.cpp,v 2.4 2005/02/18 18:19:14 kusanagi Exp $\n"; |
| 47 |
} |
} |
| 48 |
|
|
| 49 |
/** |
/** |
| 62 |
void CalibS4Reader::RunEvent(int EventNumber, long int length) throw (WrongCRCException){ |
void CalibS4Reader::RunEvent(int EventNumber, long int length) throw (WrongCRCException){ |
| 63 |
|
|
| 64 |
int offset; |
int offset; |
| 65 |
char subData[3074]; //impulse*(11 + 10 + 01 + 00)*eventLength + CRC = 128*4*6 + UINT16 |
char subData[length]; //impulse*(11 + 10 + 01 + 00)*eventLength + CRC = 128*4*6 + UINT16 |
| 66 |
UINT16 subCRC; //CRC of the data |
UINT16 subCRC; //CRC of the data |
| 67 |
UINT16 readCRC; //CRC read from the end of the subpacket |
UINT16 readCRC; //CRC read from the end of the subpacket |
| 68 |
|
|
| 73 |
TClonesArray &recs = *(calibS4->Records); |
TClonesArray &recs = *(calibS4->Records); |
| 74 |
|
|
| 75 |
InputFile->read(subData, sizeof(unsigned char)*length); |
InputFile->read(subData, sizeof(unsigned char)*length); |
|
|
|
| 76 |
subCRC = CM_Compute_CRC16(0, (BYTE*)subData, length - 2); |
subCRC = CM_Compute_CRC16(0, (BYTE*)subData, length - 2); |
| 77 |
readCRC = (((UINT16)(subData[3072]<<8))&0xFF00) + (((UINT16)subData[3073])&0x00FF); |
readCRC = (((UINT16)(subData[length - 2]<<8))&0xFF00) + (((UINT16)subData[length - 1])&0x00FF); |
| 78 |
|
|
| 79 |
if (subCRC != readCRC) throw WrongCRCException(" Wrong CRC for CalibS4 Packet "); |
if (subCRC != readCRC) throw WrongCRCException(" Wrong CRC for CalibS4 Packet "); |
| 80 |
|
|