| 1 | 
 /** @file | 
 /** @file | 
| 2 | 
  * $Author: mocchiut $ | 
  * $Author: mocchiut $ | 
| 3 | 
  * $Date: 2006/11/13 11:45:49 $ | 
  * $Date: 2006/11/16 11:01:34 $ | 
| 4 | 
  * $Revision: 6.10 $ | 
  * $Revision: 6.13 $ | 
| 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. | 
| 87 | 
  */ | 
  */ | 
| 88 | 
 std::string EventReader::GetVersionInfo(void) const { | 
 std::string EventReader::GetVersionInfo(void) const { | 
| 89 | 
   return  | 
   return  | 
| 90 | 
     "$Header: /afs/ba.infn.it/user/pamela/src/CVS/yoda/techmodel/EventReader.cpp,v 6.10 2006/11/13 11:45:49 mocchiut Exp $\n"; | 
     "$Header: /afs/ba.infn.it/user/pamela/src/CVS/yoda/techmodel/EventReader.cpp,v 6.13 2006/11/16 11:01:34 mocchiut Exp $\n"; | 
| 91 | 
 } | 
 } | 
| 92 | 
  | 
  | 
| 93 | 
 /** | 
 /** | 
| 120 | 
   stringstream oss; | 
   stringstream oss; | 
| 121 | 
   int step = 0; | 
   int step = 0; | 
| 122 | 
   const PacketType* type; | 
   const PacketType* type; | 
| 123 | 
   while (InputFile->good() && !InputFile->eof() && ((step++ < maxPackets) || (maxPackets == 0))){ | 
   while ( InputFile->good() && !InputFile->eof() && ((step++ < maxPackets) || (maxPackets == 0))){ | 
| 124 | 
     try { | 
     try { | 
| 125 | 
       if (FindStart()) { | 
       if (FindStart()) { | 
| 126 | 
             UnpackPscuHeader(); | 
             UnpackPscuHeader(); | 
| 150 | 
             Float_t padfrac = 64. - pd1 * 64.; | 
             Float_t padfrac = 64. - pd1 * 64.; | 
| 151 | 
             // | 
             // | 
| 152 | 
             UInt_t padbytes = (UInt_t)padfrac; | 
             UInt_t padbytes = (UInt_t)padfrac; | 
| 153 | 
             if ( padbytes > 0 ){ | 
             if ( padbytes > 0 && !InputFile->eof() ){ | 
| 154 | 
               oss.str(""); | 
               oss.str(""); | 
| 155 | 
               oss << " padbytes is " << padbytes << " \n skipping these bytes\n"; | 
               oss << " padbytes is " << padbytes << " \n skipping these bytes\n"; | 
| 156 | 
               logger->info(oss.str().c_str()); | 
               logger->info(oss.str().c_str()); | 
| 201 | 
     oss << "----endPck " << Header->GetPscuHeader()->GetCounter() << "\n"; | 
     oss << "----endPck " << Header->GetPscuHeader()->GetCounter() << "\n"; | 
| 202 | 
     logger->info(oss.str().c_str()); | 
     logger->info(oss.str().c_str()); | 
| 203 | 
   } | 
   } | 
| 204 | 
  | 
   if ( !InputFile->eof() && ( InputFile->bad() || InputFile->fail() ) ) printf("\n\n ERROR READING RAW FILE! \n\n"); // E. Mocchiutti | 
| 205 | 
  | 
  | 
| 206 | 
     Header->GetCounter()->PrintCounters(); | 
     Header->GetCounter()->PrintCounters(); | 
| 207 | 
     //if (corruptedPacketFile.is_open()) corruptedPacketFile.close(); | 
     //if (corruptedPacketFile.is_open()) corruptedPacketFile.close(); | 
| 208 | 
 } | 
 } | 
| 224 | 
   unsigned int  OrbitalTime  = (((UINT32)buff[8]<<24)&0xFF000000) + (((UINT32)buff[9]<<16)&0x00FF0000) +  (((UINT32)buff[10]<<8)&0x0000FF00) + (((UINT32)buff[11])&0x000000FF); | 
   unsigned int  OrbitalTime  = (((UINT32)buff[8]<<24)&0xFF000000) + (((UINT32)buff[9]<<16)&0x00FF0000) +  (((UINT32)buff[10]<<8)&0x0000FF00) + (((UINT32)buff[11])&0x000000FF); | 
| 225 | 
   unsigned int  PacketLenght = (((UINT32)buff[12]<<16)&0x00FF0000) +  (((UINT32)buff[13]<<8)&0x0000FF00) + (((UINT32)buff[14])&0x000000FF); | 
   unsigned int  PacketLenght = (((UINT32)buff[12]<<16)&0x00FF0000) +  (((UINT32)buff[13]<<8)&0x0000FF00) + (((UINT32)buff[14])&0x000000FF); | 
| 226 | 
   unsigned char CRC          = buff[15]; | 
   unsigned char CRC          = buff[15]; | 
| 227 | 
   unsigned char FileOffset   = buff[15]; | 
   unsigned char FileOffset   = 0; | 
| 228 | 
  | 
  | 
| 229 | 
  | 
  | 
| 230 | 
   if (Counter < prevPckCounter){ | 
   if (Counter < prevPckCounter){ | 
| 266 | 
     //plus the CRC legth (which varies for each type of packet) | 
     //plus the CRC legth (which varies for each type of packet) | 
| 267 | 
     Header->GetPscuHeader()->SetPacketLenght(PacketLenght); | 
     Header->GetPscuHeader()->SetPacketLenght(PacketLenght); | 
| 268 | 
     Header->GetPscuHeader()->SetCRC(CRC); | 
     Header->GetPscuHeader()->SetCRC(CRC); | 
| 269 | 
     Header->GetPscuHeader()->SetFileOffset(((long int)(InputFile->tellg()) - 16)); | 
     Header->GetPscuHeader()->SetFileOffset(((unsigned long int)((unsigned long int)(InputFile->tellg()) - 16))); | 
| 270 | 
  | 
     //(unsigned long int)(InputFile->tellg() - 16)); | 
| 271 | 
   } else { | 
   } else { | 
| 272 | 
      /*Here i should extract the block of Data for later analysis */ | 
      /*Here i should extract the block of Data for later analysis */ | 
| 273 | 
     InputFile->seekg(-(13), std::ios::cur); | 
     InputFile->seekg(-(13), std::ios::cur); |