]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
protection against truncated data
authortkuhr <tkuhr@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 12 Jan 2004 17:28:36 +0000 (17:28 +0000)
committertkuhr <tkuhr@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 12 Jan 2004 17:28:36 +0000 (17:28 +0000)
RAW/AliRawReaderDate.cxx
RAW/AliRawReaderRoot.cxx

index 739f05a8e7f6842e2231a6da9e2d24f59051a9b7..a8043f63193ef376bcd660a2b0fbc27f144a1016 100644 (file)
@@ -189,7 +189,14 @@ Bool_t AliRawReaderDate::ReadMiniHeader()
     fCount = fMiniHeader->fSize;
     if (fPosition + fCount > fEnd) {  // check data size in mini header and sub event
       Error("ReadMiniHeader", "size in mini header exceeds event size!");
-      fMiniHeader->fSize = fCount = fEnd - fPosition;
+      Warning("ReadMiniHeader", "skipping %d bytes\n"
+             " run: %d  event: %d %d  LDC: %d  GDC: %d\n", 
+             fEnd - fPosition, fSubEvent->eventRunNb, 
+             fSubEvent->eventId[0], fSubEvent->eventId[1],
+             fSubEvent->eventLdcId, fSubEvent->eventGdcId);
+      fCount = 0;
+      fPosition = fEnd;
+      continue;
     }
   } while (!IsSelected());
   return kTRUE;
index 7c87d5379f10f7e454884f50d358e934e62d855d..9192445a0fb088a70621a31b8d7c264e34a33cae 100644 (file)
@@ -32,7 +32,9 @@ AliRawReaderRoot::AliRawReaderRoot(const char* fileName, Int_t eventNumber)
 // create an object to read digits from the given input file for the
 // event with the given number
 
+  TDirectory* dir = gDirectory;
   fFile = TFile::Open(fileName);
+  dir->cd();
   if (!fFile || !fFile->IsOpen()) {
     Error("AliRawReaderRoot", "could not open file %s", fileName);
     return;
@@ -204,7 +206,11 @@ Bool_t AliRawReaderRoot::ReadMiniHeader()
     fCount = fMiniHeader->fSize;
     if (fPosition + fCount > fEnd) {  // check data size in mini header and sub event
       Error("ReadMiniHeader", "size in mini header exceeds event size!");
-      fMiniHeader->fSize = fCount = fEnd - fPosition;
+      Warning("ReadMiniHeader", "skipping %d bytes", fEnd - fPosition);
+      fSubEvent->GetHeader()->Dump();
+      fCount = 0;
+      fPosition = fEnd;
+      continue;
     }
   } while (!IsSelected());
   return kTRUE;