adding method GetChannelPayload() to get pointer to the current channel raw data
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 22 Aug 2011 10:13:03 +0000 (10:13 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 22 Aug 2011 10:13:03 +0000 (10:13 +0000)
RAW/AliAltroRawStreamV3.cxx
RAW/AliAltroRawStreamV3.h

index e79cff2..35aad3d 100644 (file)
@@ -43,6 +43,7 @@ AliAltroRawStreamV3::AliAltroRawStreamV3(AliRawReader* rawReader) :
   fHWAddress(-1),
   fRawReader(rawReader),
   fData(NULL),
+  fChannelStartPos(-1),
   fPosition(-1),
   fCount(-1),
   fStartTimeBin(-1),
@@ -88,6 +89,7 @@ AliAltroRawStreamV3::AliAltroRawStreamV3(const AliAltroRawStreamV3& stream) :
   fHWAddress(stream.fHWAddress),
   fRawReader(stream.fRawReader),
   fData(stream.fData),
+  fChannelStartPos(stream.fChannelStartPos),
   fPosition(stream.fPosition),
   fCount(stream.fCount),
   fStartTimeBin(stream.fStartTimeBin),
@@ -131,6 +133,7 @@ AliAltroRawStreamV3& AliAltroRawStreamV3::operator = (const AliAltroRawStreamV3&
   fHWAddress         = stream.fHWAddress;
   fRawReader         = stream.fRawReader;
   fData              = stream.fData;
+  fChannelStartPos   = stream.fChannelStartPos;
   fPosition          = stream.fPosition;
   fCount             = stream.fCount;
   fStartTimeBin      = stream.fStartTimeBin;
@@ -171,6 +174,7 @@ void AliAltroRawStreamV3::Reset()
 // Reset of the raw-reader as well
 
   fDDLNumber = fRCUId = fHWAddress = -1;
+  fChannelStartPos = -1;
   fPosition = fCount = -1;
   fBunchLength = fStartTimeBin = -1;
   fBadChannel = kFALSE;
@@ -206,6 +210,7 @@ Bool_t AliAltroRawStreamV3::NextDDL()
 
   fDDLNumber = fRawReader->GetDDLID();
   fChannelPayloadSize = -1;
+  fChannelStartPos = -1;
 
   UChar_t rcuVer = fRawReader->GetBlockAttributes();
 
@@ -256,6 +261,8 @@ Bool_t AliAltroRawStreamV3::NextChannel()
     return status;
   }
 
+  Int_t channelStartPos=fPosition;
+  fChannelStartPos = -1;
   fCount = -1;
   fBadChannel = kFALSE;
   fBunchDataIndex = 0;
@@ -300,6 +307,7 @@ Bool_t AliAltroRawStreamV3::NextChannel()
     fBunchData[isample++] = word & 0x3FF;
   }  
 
+  fChannelStartPos=channelStartPos;
   return kTRUE;
 }
 
@@ -373,6 +381,16 @@ Bool_t AliAltroRawStreamV3::NextBunch()
 }
 
 //_____________________________________________________________________________
+const UChar_t *AliAltroRawStreamV3::GetChannelPayload() const
+{
+  //returns raw channel data, length 4+(fChannelPayloadSize+2)/3*4
+  if (fChannelStartPos<0 || fChannelPayloadSize<0) return NULL;
+  Int_t channelSize=1+(fChannelPayloadSize+2)/3; // nof 32bit words
+  if (fPosition<fChannelStartPos+channelSize) return NULL;
+  return fData+(fChannelStartPos<<2);
+}
+
+//_____________________________________________________________________________
 UInt_t AliAltroRawStreamV3::Get32bitWord(Int_t index) const
 {
   // This method returns the 32 bit word at a given
index 2eb82c1..ce84929 100644 (file)
@@ -49,6 +49,7 @@ class AliAltroRawStreamV3: public TObject {
     Bool_t IsChannelBad()      const { return fBadChannel; }   // Is the channel data bad or not
 
     Int_t GetChannelPayloadSize() const { return fChannelPayloadSize; }
+    const UChar_t *GetChannelPayload() const;//returns raw channel data, length 4+(fChannelPayloadSize+2)/3*4
     UChar_t *GetRCUPayloadInSOD() const;
     Int_t GetRCUPayloadSizeInSOD() const;
 
@@ -127,6 +128,7 @@ class AliAltroRawStreamV3: public TObject {
 
     UChar_t*         fData;         // raw data
 
+    Int_t            fChannelStartPos; // start index of the current channel
     Int_t            fPosition;     // current position (32-bit words) in fData
     Int_t            fCount;        // 
     Int_t            fStartTimeBin; //