/[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 1.5 by kusanagi, Thu Jul 29 16:19:11 2004 UTC revision 1.6 by kusanagi, Thu Aug 19 15:24:46 2004 UTC
# Line 1  Line 1 
1  /** @file  /** @file
2   * $Author: kusanagi $   * $Author: kusanagi $
3   * $Date: 2004/07/17 20:03:38 $   * $Date: 2004/07/29 16:19:11 $
4   * $Revision: 1.4 $   * $Revision: 1.5 $
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 36  EventReader::EventReader(void): Line 36  EventReader::EventReader(void):
36        <<  "\n " << log4cpp::CategoryStream::ENDLINE;        <<  "\n " << log4cpp::CategoryStream::ENDLINE;
37    Header = new EventHeader();    Header = new EventHeader();
38    
39    TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::Physics,    new PhysicsReader()));    TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::PhysEndRun,      new PhysEndRunReader()));
40    TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::RunHeader,  new RunHeaderReader()));    TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::CalibCalPulse1,  new CalibCalPulse1Reader()));
41    TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::RunTrailer, new RunTrailerReader()));    TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::CalibCalPulse2,  new CalibCalPulse2Reader()));
42    TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::Log,        new LogReader()));    TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::Physics,         new PhysicsReader()));
43    TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::VarDump,    new VarDumpReader()));    TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::CalibTrkBoth,    new CalibTrkBothReader()));
44    TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::ArrDump,    new ArrDumpReader()));    TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::CalibTrk1,       new CalibTrk1Reader()));
45    TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::TabDump,    new TabDumpReader()));    TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::CalibTrk2,       new CalibTrk2Reader()));
46    TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::Tmtc,       new TmtcReader()));    TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::CalibTrd,        new CalibTrdReader()));
47    TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::Mcmd,       new McmdReader()));    TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::CalibTof,        new CalibTofReader()));
48    TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::CalibCal,   new CalibCalReader()));    TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::CalibS4,         new CalibS4Reader()));
49    TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::CalibCalPed,new CalibCalPedReader()));    TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::CalibCalPed,     new CalibCalPedReader()));
50    TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::CalibCal,   new CalibAcReader()));    TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::CalibAc,         new CalibAcReader()));
51    TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::CalibTrk1,  new CalibTrk1Reader()));    TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::RunHeader,       new RunHeaderReader()));
52    TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::CalibTrk2,  new CalibTrk2Reader()));    TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::RunTrailer,      new RunTrailerReader()));
53    TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::CalibTrd,   new CalibTrdReader()));    TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::CalibHeader,     new CalibHeaderReader()));
54    TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::CalibTof,   new CalibTofReader()));    TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::CalibTrailer,    new CalibTrailerReader()));
55    TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::CalibS4,    new CalibS4Reader()));    TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::InitHeader,      new InitHeaderReader()));
56    /*    TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::InitTrailer,     new InitTrailerReader()));
57    TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::HA_Header_E5,    TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::EventTrk,        new EventTrkReader()));
58                                                    new E5Reader()));    TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::TestTrk,         new TestTrkReader()));
59  */    TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::Log,             new LogReader()));
60      TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::VarDump,         new VarDumpReader()));
61      TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::ArrDump,         new ArrDumpReader()));
62      TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::TabDump,         new TabDumpReader()));
63      TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::Tmtc,            new TmtcReader()));
64      TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::Mcmd,            new McmdReader()));
65      TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::ForcedFECmd,     new ForcedFECmdReader()));
66      TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::AcInit,          new AcInitReader()));
67      TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::CalInit,         new CalInitReader()));
68      TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::TrkInit,         new TrkInitReader()));
69      TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::TofInit,         new TofInitReader()));
70      TechmodelAlgorithmMap.insert(AlgorithmMap::value_type(PacketType::TrgInit,         new TrgInitReader()));
71  }  }
72    
73  /**  /**
# Line 64  EventReader::EventReader(void): Line 75  EventReader::EventReader(void):
75   */   */
76  std::string EventReader::GetVersionInfo(void) const {  std::string EventReader::GetVersionInfo(void) const {
77    return    return
78      "$Header: /home/cvsmanager/yoda/techmodel/EventReader.cpp,v 1.4 2004/07/17 20:03:38 kusanagi Exp $\n";      "$Header: /home/cvsmanager/yoda/techmodel/EventReader.cpp,v 1.5 2004/07/29 16:19:11 kusanagi Exp $\n";
79  }  }
80    
81  /**  /**
# Line 102  static void SkipToNextHeader(ifstream *) Line 113  static void SkipToNextHeader(ifstream *)
113  // 15 June 2004 ---note------------------  // 15 June 2004 ---note------------------
114  void EventReader::RunEvent(int EventNumber) {  void EventReader::RunEvent(int EventNumber) {
115        
116    cat <<  log4cpp::Priority::ERROR <<  "Start Unpacking........"    cat <<  log4cpp::Priority::INFO <<  "Start Unpacking........"
117        <<  "\n " << log4cpp::CategoryStream::ENDLINE;        <<  "\n " << log4cpp::CategoryStream::ENDLINE;
118    //for now i'll suppose that the raw file starts immediately with the right bytes    //for now i'll suppose that the raw file starts immediately with the right bytes
119    //to insert a GetPacketStart()    //to insert a GetPacketStart()
# Line 162  int EventReader::UnpackPscuHeader(void) Line 173  int EventReader::UnpackPscuHeader(void)
173    unsigned char CRC          = buff[15];    unsigned char CRC          = buff[15];
174    
175    if (Counter < prevPckCounter){    if (Counter < prevPckCounter){
176      cat <<  log4cpp::Priority::ERROR      cat <<  log4cpp::Priority::WARN
177          <<  " Packet counter is less than before of " << (prevPckCounter - Counter)          <<  " Packet counter is less than before of " << (prevPckCounter - Counter)
178          <<  "\n " << log4cpp::CategoryStream::ENDLINE;          <<  "\n " << log4cpp::CategoryStream::ENDLINE;
179    }    }
# Line 190  int EventReader::UnpackPscuHeader(void) Line 201  int EventReader::UnpackPscuHeader(void)
201      FindStart();      FindStart();
202      finalPos =  (long int)InputFile->tellg() - (1 + initPos + (long int)(Header->GetPscuHeader()->GetPacketLenght()));      finalPos =  (long int)InputFile->tellg() - (1 + initPos + (long int)(Header->GetPscuHeader()->GetPacketLenght()));
203          if(finalPos == 0){          if(finalPos == 0){
204              cat <<  log4cpp::Priority::INFO <<  " Correct packet length \n"              cat <<  log4cpp::Priority::DEBUG <<  " Correct packet length \n"
205                  <<  "\n " << log4cpp::CategoryStream::ENDLINE;                  <<  "\n " << log4cpp::CategoryStream::ENDLINE;
206              }              }
207          if (finalPos > 0 && finalPos < 64) {          if (finalPos > 0 && finalPos < 64) {

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

  ViewVC Help
Powered by ViewVC 1.1.23