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

Diff of /yoda/techmodel/TabDumpReader.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/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.1.1.1 2004/07/06 12:20:23 kusanagi Exp $
4   * $Author: nagni $   * $Author: kusanagi $
5   *   *
6   * Implementation of the TabDumpReader class.   * Implementation of the TabDumpReader class.
7   */   */
# Line 32  TabDumpReader::TabDumpReader(void): Line 32  TabDumpReader::TabDumpReader(void):
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.1.1.1 2004/07/06 12:20:23 kusanagi Exp $\n";
36  }  }
37    
38  /**  /**
# Line 65  void TabDumpReader::RunEvent(int EventNu Line 65  void TabDumpReader::RunEvent(int EventNu
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            TabDump->Records->Clear();
75            TClonesArray &recs = *(TabDump->Records);
76            while (offset < dataLength){
77                rec = new(recs[i++]) TabDumpRecord(); //add a new TabDump
78                rec->Tab_ID  = ((UINT8)subData[offset])&0xFF;
79                rec->Nrow  = ((UINT8)subData[offset+1])&0xFF;
80                rec->Ncol  = ((UINT8)subData[offset+2])&0xFF;
81                memcpy(rec->Data, subData+offset+3, sizeof(UINT32)*((rec->Nrow)+(rec->Ncol)));
82                offset = offset + (sizeof(UINT32)*((rec->Nrow)+(rec->Ncol))) + 3;
83            }
84          free(subData);          free(subData);
85      } else {      } else {
86          cat <<  log4cpp::Priority::ERROR          cat <<  log4cpp::Priority::ERROR

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

  ViewVC Help
Powered by ViewVC 1.1.23