]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Providing access to the RCU payload and size (GetRCUPayloadInSOD and GetRCUPayloadSiz...
authorcvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 18 Oct 2009 21:18:59 +0000 (21:18 +0000)
committercvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 18 Oct 2009 21:18:59 +0000 (21:18 +0000)
RAW/AliAltroRawStream.cxx
RAW/AliAltroRawStream.h
RAW/AliAltroRawStreamV3.cxx
RAW/AliAltroRawStreamV3.h

index 69f8983adbafded246b950dc01a70eae63e2b63a..581712a362a5fafde6ed520d63cb045359c3cd28 100644 (file)
@@ -29,6 +29,7 @@
 #include "AliAltroRawStream.h"
 #include "AliRawReader.h"
 #include "AliLog.h"
+#include "AliRawEventHeaderBase.h"
 
 ClassImp(AliAltroRawStream)
 
@@ -454,25 +455,33 @@ Int_t AliAltroRawStream::GetPosition()
     }
 
     Int_t position = ReadRCUTrailer(index,trailerSize);
-    // The size is specified in a number of 40bits
-    // Therefore we need to transform it to number of bytes
-    position *= 5;
+    if (fRawReader->GetType() != AliRawEventHeaderBase::kStartOfData) {
+      // The size is specified in a number of 40bits
+      // Therefore we need to transform it to number of bytes
+      position *= 5;
 
-    // Check the consistency of the header and trailer
-    if (((fRawReader->GetDataSize() - trailerSize*4) < position) ||
-       ((fRawReader->GetDataSize() - trailerSize*4) >= (position + 4))) {
-      fRawReader->AddMajorErrorLog(kRCUTrailerSizeErr,Form("h=%d tr=%d rcu=%d bytes",
-                                                          fRawReader->GetDataSize(),
-                                                          trailerSize*4,
-                                                          position));
-      AliWarning(Form("Inconsistent raw data size ! Raw data size - %d bytes (from the header), RCU trailer - %d bytes, raw data paylod - %d bytes !",
-                   fRawReader->GetDataSize(),
-                   trailerSize*4,
-                   position));
-      position = fRawReader->GetDataSize() - trailerSize*4;
-    }
+      // Check the consistency of the header and trailer
+      if (((fRawReader->GetDataSize() - trailerSize*4) < position) ||
+         ((fRawReader->GetDataSize() - trailerSize*4) >= (position + 4))) {
+       fRawReader->AddMajorErrorLog(kRCUTrailerSizeErr,Form("h=%d tr=%d rcu=%d bytes",
+                                                            fRawReader->GetDataSize(),
+                                                            trailerSize*4,
+                                                            position));
+       AliWarning(Form("Inconsistent raw data size ! Raw data size - %d bytes (from the header), RCU trailer - %d bytes, raw data paylod - %d bytes !",
+                       fRawReader->GetDataSize(),
+                       trailerSize*4,
+                       position));
+       position = fRawReader->GetDataSize() - trailerSize*4;
+      }
 
-    return position * 8 / 10;
+      return position * 8 / 10;
+    }
+    else {
+      // Special RCU payload in case of SOD events
+      // The decoding is left to the user code
+      // Here we just retrieve the payload size
+      return position;
+    }
   }
   else {
     // In case of the Old RCU trailer format
@@ -798,3 +807,16 @@ void AliAltroRawStream::AddMappingErrorLog(const char *message)
 
   if (fRawReader) fRawReader->AddMinorErrorLog(kBadAltroMapping,message);
 }
+
+//_____________________________________________________________________________
+Int_t AliAltroRawStream::GetRCUPayloadSizeInSOD() const
+{
+  // Get the size of the RCU data in case
+  // of SOD events
+  if (fRawReader) {
+    if (fRawReader->GetType() == AliRawEventHeaderBase::kStartOfData) {
+      return fPosition;
+    }
+  }
+  return -1;
+}
index d9f2626a588e09b4327411a464968ac86d33f2d3..068c1a5989682ed077f7dc0e3f9545edc3d8be01 100644 (file)
@@ -49,6 +49,7 @@ class AliAltroRawStream: public TObject {
     Int_t GetTimeLength() const { return fTimeBunch; }  // Provide total length of current time bunch
 
     Int_t GetChannelPayloadSize() const { return fChannelPayloadSize; }
+    Int_t GetRCUPayloadSizeInSOD() const;
 
     Int_t GetBranch()     const; // Provide the branch index for the current hardware address
     Int_t GetFEC()        const; // Provide the front-end card index for the current hardware address
index aa848fab95e77d836bc6d43b8cd6a7a49b69000f..145bab80f137f61a057a0db9131e81d70f8366c8 100644 (file)
@@ -30,6 +30,7 @@
 #include "AliRawReader.h"
 #include "AliLog.h"
 #include "AliAltroRawStream.h"
+#include "AliRawEventHeaderBase.h"
 
 ClassImp(AliAltroRawStreamV3)
 
@@ -229,6 +230,8 @@ Bool_t AliAltroRawStreamV3::NextDDL()
       fActiveFECsB = fOldStream->GetActiveFECsB();
       fAltroCFG1 = fOldStream->GetAltroCFG1();
       fAltroCFG2 = fOldStream->GetAltroCFG2();
+      if (fRawReader->GetType() == AliRawEventHeaderBase::kStartOfData)
+       fPayloadSize = fOldStream->GetRCUPayloadSizeInSOD();
     }
     return status;
   }
@@ -686,3 +689,29 @@ void AliAltroRawStreamV3::AddMappingErrorLog(const char *message)
 
   if (fRawReader) fRawReader->AddMinorErrorLog(kBadAltroMapping,message);
 }
+
+//_____________________________________________________________________________
+UChar_t *AliAltroRawStreamV3::GetRCUPayloadInSOD() const
+{
+  // Get a pointer to the data in case
+  // of SOD events
+  if (fRawReader) {
+    if (fRawReader->GetType() == AliRawEventHeaderBase::kStartOfData) {
+      return fData;
+    }
+  }
+  return NULL;
+}
+
+//_____________________________________________________________________________
+Int_t AliAltroRawStreamV3::GetRCUPayloadSizeInSOD() const
+{
+  // Get the size of the RCU data in case
+  // of SOD events
+  if (fRawReader) {
+    if (fRawReader->GetType() == AliRawEventHeaderBase::kStartOfData) {
+      return fPayloadSize;
+    }
+  }
+  return -1;
+}
index ea7a21f3cec66f6fea45b4859afff6b22bce9bfc..6559a4a076eac249e061ad55584003682e021dcd 100644 (file)
@@ -49,6 +49,8 @@ class AliAltroRawStreamV3: public TObject {
     Bool_t IsChannelBad()      const { return fBadChannel; }   // Is the channel data bad or not
 
     Int_t GetChannelPayloadSize() const { return fChannelPayloadSize; }
+    UChar_t *GetRCUPayloadInSOD() const;
+    Int_t GetRCUPayloadSizeInSOD() const;
 
     Int_t GetBranch()     const; // Provide the branch index for the current hardware address
     Int_t GetFEC()        const; // Provide the front-end card index for the current hardware address