/[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 1.1 by kusanagi, Tue Jul 6 12:20:23 2004 UTC revision 1.2 by kusanagi, Sat Jul 17 20:03:38 2004 UTC
# Line 1  Line 1 
1  /** @file  /** @file
2   * $Source: /home/cvspamela/yoda/techmodel/CalibS4Reader.cpp,v $   * $Source: /home/cvsmanager/yoda/techmodel/CalibS4Reader.cpp,v $
3   * $Id: CalibS4Reader.cpp,v 1.1 2004/05/11 10:12:35 nagni Exp $   * $Id: CalibS4Reader.cpp,v 1.1.1.1 2004/07/06 12:20:23 kusanagi Exp $
4   * $Author: nagni $   * $Author: kusanagi $
5   *   *
6   * Implementation of the LogReader class.   * Implementation of the LogReader class.
7  * ToBeDone:  * ToBeDone:
# Line 44  CalibS4Reader::CalibS4Reader(void): Line 44  CalibS4Reader::CalibS4Reader(void):
44   */   */
45  std::string CalibS4Reader::GetVersionInfo(void) const {  std::string CalibS4Reader::GetVersionInfo(void) const {
46    return    return
47      "$Header: /home/cvspamela/yoda/techmodel/CalibS4Reader.cpp,v 1.1 2004/05/11 10:12:35 nagni Exp $\n";      "$Header: /home/cvsmanager/yoda/techmodel/CalibS4Reader.cpp,v 1.1.1.1 2004/07/06 12:20:23 kusanagi Exp $\n";
48  }  }
49    
50  /**  /**
# Line 60  void CalibS4Reader::Init(PamelaRun *run) Line 60  void CalibS4Reader::Init(PamelaRun *run)
60   * Unpack the CalibS4 event from an input file.   * Unpack the CalibS4 event from an input file.
61   */   */
62  void CalibS4Reader::RunEvent(int EventNumber, long int length) {  void CalibS4Reader::RunEvent(int EventNumber, long int length) {
63        char     *subData;
64        char      eventCRC[2];
65        UINT16    subCRC;      //CRC of the data
66        UINT16    readCRC;     //CRC read from the end of the subpacket
67        long int  dataLength;
68    
69        //the 2 bytes subtracted belong to the final event CRC bytes
70        dataLength = length - (long int)2;
71    
72        subData = new char[dataLength];
73        InputFile->read(subData, sizeof(unsigned char)*dataLength);
74        subCRC = CM_Compute_CRC16(0, (BYTE*)subData, dataLength);
75    
76        //took the final CRC to compare it with the previous calculated CRC of the data
77        InputFile->read(eventCRC, sizeof(eventCRC));
78        readCRC = (((UINT16)(eventCRC[0]<<8))&0xFF00) + (((UINT16)eventCRC[1])&0x00FF);
79            
80        if (subCRC == readCRC){
81            //put here the reader
82        } else {
83            cat <<  log4cpp::Priority::ERROR
84                <<  "Wrong CRC for CalibS4 Packet "
85                <<  "\n " << log4cpp::CategoryStream::ENDLINE;
86        }
87            
88  }  }
89    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.23