/[PAMELA software]/yoda/techmodel/CalibS4Reader.cpp
ViewVC logotype

Diff of /yoda/techmodel/CalibS4Reader.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2.4 by kusanagi, Fri Feb 18 18:19:14 2005 UTC revision 2.5 by kusanagi, Sat Feb 19 17:20:29 2005 UTC
# Line 1  Line 1 
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.
# Line 43  CalibS4Reader::CalibS4Reader(void): Line 43  CalibS4Reader::CalibS4Reader(void):
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  /**  /**
# Line 62  void CalibS4Reader::Init(PamelaRun *run) Line 62  void CalibS4Reader::Init(PamelaRun *run)
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    
# Line 73  void CalibS4Reader::RunEvent(int EventNu Line 73  void CalibS4Reader::RunEvent(int EventNu
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    

Legend:
Removed from v.2.4  
changed lines
  Added in v.2.5

  ViewVC Help
Powered by ViewVC 1.1.23