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

Diff of /yoda/techmodel/EventReader.cpp

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

revision 2.6 by kusanagi, Thu Dec 16 17:32:57 2004 UTC revision 2.7 by kusanagi, Wed Dec 22 11:38:35 2004 UTC
# Line 1  Line 1 
1  /** @file  /** @file
2   * $Author: kusanagi $   * $Author: kusanagi $
3   * $Date: 2004/12/09 08:48:41 $   * $Date: 2004/12/16 17:32:57 $
4   * $Revision: 2.5 $   * $Revision: 2.6 $
5   *   *
6   * Implementation of the functions of a sample Algorithm class.   * Implementation of the functions of a sample Algorithm class.
7   * This file can be used as a templace to develop your own algorithm.   * This file can be used as a templace to develop your own algorithm.
# Line 88  EventReader::EventReader(int packetsLimi Line 88  EventReader::EventReader(int packetsLimi
88   */   */
89  std::string EventReader::GetVersionInfo(void) const {  std::string EventReader::GetVersionInfo(void) const {
90    return    return
91      "$Header: /home/cvsmanager/yoda/techmodel/EventReader.cpp,v 2.5 2004/12/09 08:48:41 kusanagi Exp $\n";      "$Header: /home/cvsmanager/yoda/techmodel/EventReader.cpp,v 2.6 2004/12/16 17:32:57 kusanagi Exp $\n";
92  }  }
93    
94  /**  /**
# Line 231  void EventReader::UnpackPscuHeader(void) Line 231  void EventReader::UnpackPscuHeader(void)
231            
232      //commented out because of the above test code      //commented out because of the above test code
233      InputFile->seekg(Header->GetPscuHeader()->GetPacketLenght(), std::ios::cur);      InputFile->seekg(Header->GetPscuHeader()->GetPacketLenght(), std::ios::cur);
234      FindStart();      if (FindStart()) {
235      finalPos =  (long int)InputFile->tellg() - (1 + initPos + (long int)(Header->GetPscuHeader()->GetPacketLenght()));          finalPos =  (long int)InputFile->tellg() - (initPos + (long int)(Header->GetPscuHeader()->GetPacketLenght()));
236          if(finalPos == 0){          if(finalPos == 0){
237              logger->debug(_T("Correct packet length"));              logger->debug(_T(" Correct packet length"));
238              }              }
239          if (finalPos > 0 && finalPos < 64) {          if (finalPos > 0 && finalPos < 64) {
240              oss.str("");              oss.str("");
# Line 243  void EventReader::UnpackPscuHeader(void) Line 243  void EventReader::UnpackPscuHeader(void)
243          }          }
244          if (finalPos > 64){          if (finalPos > 64){
245              oss.str("");              oss.str("");
246              oss << "The begin of the next packet is far more than 64 byte from the end of the previous."              oss << " The begin of the next packet is far more than 64 byte from the end of the previous."
247                  << Header->GetPscuHeader()->Print();                  << Header->GetPscuHeader()->Print();
248              logger->error(oss.str().c_str());              logger->error(oss.str().c_str());
249              //throw LengthException("The begin of the next packet is far more than 64 byte from the end of the previous.");              //throw LengthException("The begin of the next packet is far more than 64 byte from the end of the previous.");
250          }          }
251        }
252        else {
253            logger->debug(_T(" END OF FILE"));        
254        }
255            
256          InputFile->seekg(initPos, std::ios::beg);          InputFile->seekg(initPos, std::ios::beg);
257    } else {    } else {
258      InputFile->seekg(-(13), std::ios::cur);      InputFile->seekg(-(13), std::ios::cur);
# Line 285  void EventReader::UnpackPscuTrailer(void Line 290  void EventReader::UnpackPscuTrailer(void
290  /**  /**
291   * Find the next starting poin for the PSCU event looking for a {0xFA, 0xFE, 0xDE} sequence   * Find the next starting poin for the PSCU event looking for a {0xFA, 0xFE, 0xDE} sequence
292   */   */
293  int EventReader::FindStart(void) throw (std::exception) {  bool EventReader::FindStart(void) throw (std::exception) {
294  //search an hexadecimal sequence in a file  //search an hexadecimal sequence in a file
295  //subSign    ------> pointer to the sequence buffer  //subSign    ------> pointer to the sequence buffer
296  //subSignDim ------> dimension of the buffer  //subSignDim ------> dimension of the buffer
# Line 313  int EventReader::FindStart(void) throw ( Line 318  int EventReader::FindStart(void) throw (
318          if (dataByte == (char)(*(subSign+subIndex))){          if (dataByte == (char)(*(subSign+subIndex))){
319              if (subIndex++ == (subSignDim-1)) {              if (subIndex++ == (subSignDim-1)) {
320                  InputFile->seekg( (index - (subIndex + buffSize)), std::ios::cur);                  InputFile->seekg( (index - (subIndex + buffSize)), std::ios::cur);
321                  return 1;                  return true;
322              }              }
323          } else {          } else {
324              index = index - (subIndex);              index = index - (subIndex);
# Line 322  int EventReader::FindStart(void) throw ( Line 327  int EventReader::FindStart(void) throw (
327      }      }
328      //Needs to guarantee the overap of the buffer(s) in several loop      //Needs to guarantee the overap of the buffer(s) in several loop
329      InputFile->seekg( (-1)*(subSignDim + 1) , std::ios::cur);      InputFile->seekg( (-1)*(subSignDim + 1) , std::ios::cur);
330    }    }
331    return 0;    return false;
332  }  }
333    
334  ClassImp(EventReader)  ClassImp(EventReader)

Legend:
Removed from v.2.6  
changed lines
  Added in v.2.7

  ViewVC Help
Powered by ViewVC 1.1.23