From: cvetan Date: Sun, 18 Oct 2009 21:18:59 +0000 (+0000) Subject: Providing access to the RCU payload and size (GetRCUPayloadInSOD and GetRCUPayloadSiz... X-Git-Url: http://git.uio.no/git/?a=commitdiff_plain;h=eae29211710216d9d12dc1a22a7b2f97acea64eb;p=u%2Fmrichter%2FAliRoot.git Providing access to the RCU payload and size (GetRCUPayloadInSOD and GetRCUPayloadSizeInSOD) for start--of-data events. Will allow FMD to the use the same RCU trailer decoding as for physics events. --- diff --git a/RAW/AliAltroRawStream.cxx b/RAW/AliAltroRawStream.cxx index 69f8983adba..581712a362a 100644 --- a/RAW/AliAltroRawStream.cxx +++ b/RAW/AliAltroRawStream.cxx @@ -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; +} diff --git a/RAW/AliAltroRawStream.h b/RAW/AliAltroRawStream.h index d9f2626a588..068c1a59896 100644 --- a/RAW/AliAltroRawStream.h +++ b/RAW/AliAltroRawStream.h @@ -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 diff --git a/RAW/AliAltroRawStreamV3.cxx b/RAW/AliAltroRawStreamV3.cxx index aa848fab95e..145bab80f13 100644 --- a/RAW/AliAltroRawStreamV3.cxx +++ b/RAW/AliAltroRawStreamV3.cxx @@ -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; +} diff --git a/RAW/AliAltroRawStreamV3.h b/RAW/AliAltroRawStreamV3.h index ea7a21f3cec..6559a4a076e 100644 --- a/RAW/AliAltroRawStreamV3.h +++ b/RAW/AliAltroRawStreamV3.h @@ -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