From e7fd25556ab6f333dc51cc06692595f4be626efb Mon Sep 17 00:00:00 2001 From: cvetan Date: Thu, 30 Mar 2006 12:58:02 +0000 Subject: [PATCH] New version of AliAltroRawStream. Removed all the TPC realted assumptions so that it can be used for TPC,FMD,PHOS and EMCAL. For the moment we keep the possibility to read dummy trailers (still used in PHOS and EMCAL) --- RAW/AliAltroRawStream.cxx | 64 +++++++++++++++++++++------------------ RAW/AliAltroRawStream.h | 50 ++++++++++++++---------------- 2 files changed, 58 insertions(+), 56 deletions(-) diff --git a/RAW/AliAltroRawStream.cxx b/RAW/AliAltroRawStream.cxx index 89327052da3..bb5ba558c93 100644 --- a/RAW/AliAltroRawStream.cxx +++ b/RAW/AliAltroRawStream.cxx @@ -35,43 +35,39 @@ ClassImp(AliAltroRawStream) //_____________________________________________________________________________ AliAltroRawStream::AliAltroRawStream(AliRawReader* rawReader) : - fSector(-1), - fPrevSector(-1), - fRow(-1), - fPrevRow(-1), - fPad(-1), - fPrevPad(-1), + fNoAltroMapping(kTRUE), + fDDLNumber(-1), + fPrevDDLNumber(-1), fHWAddress(-1), fPrevHWAddress(-1), fTime(-1), + fPrevTime(-1), fSignal(-1), + fTimeBunch(-1), fRawReader(rawReader), fData(NULL), - fNoAltroMapping(kTRUE), fPosition(0), fCount(0), fBunchLength(0) { // create an object to read Altro raw digits - + fSegmentation[0] = fSegmentation[1] = fSegmentation[2] = -1; } //_____________________________________________________________________________ AliAltroRawStream::AliAltroRawStream(const AliAltroRawStream& stream) : TObject(stream), - fSector(-1), - fPrevSector(-1), - fRow(-1), - fPrevRow(-1), - fPad(-1), - fPrevPad(-1), + fNoAltroMapping(kTRUE), + fDDLNumber(-1), + fPrevDDLNumber(-1), fHWAddress(-1), fPrevHWAddress(-1), fTime(-1), + fPrevTime(-1), fSignal(-1), + fTimeBunch(-1), fRawReader(NULL), fData(NULL), - fNoAltroMapping(kTRUE), fPosition(0), fCount(0), fBunchLength(0) @@ -101,9 +97,11 @@ void AliAltroRawStream::Reset() fPosition = fCount = fBunchLength = 0; - fSector = fPrevSector = fRow = fPrevRow = fPad = fPrevPad = fHWAddress = fPrevHWAddress = fTime = fSignal = -1; + fDDLNumber = fPrevDDLNumber = fHWAddress = fPrevHWAddress = fTime = fPrevTime = fSignal = fTimeBunch = -1; if (fRawReader) fRawReader->Reset(); + + fSegmentation[0] = fSegmentation[1] = fSegmentation[2] = -1; } //_____________________________________________________________________________ @@ -112,10 +110,9 @@ Bool_t AliAltroRawStream::Next() // read the next raw digit // returns kFALSE if there is no digit left - fPrevSector = fSector; - fPrevRow = fRow; - fPrevPad = fPad; + fPrevDDLNumber = fDDLNumber; fPrevHWAddress = fHWAddress; + fPrevTime = fTime; while (fCount == 0) { // next trailer if (fPosition <= 0) { // next payload @@ -123,6 +120,8 @@ Bool_t AliAltroRawStream::Next() if (!fRawReader->ReadNextData(fData)) return kFALSE; } while (fRawReader->GetDataSize() == 0); + fDDLNumber = fRawReader->GetDDLID(); + fPosition = GetPosition(); } @@ -140,6 +139,15 @@ Bool_t AliAltroRawStream::Next() return kTRUE; } +//_____________________________________________________________________________ +void AliAltroRawStream::SelectRawData(Int_t detId) +{ + // Select the raw data for specific + // detector id + AliDebug(1,Form("Selecting raw data for detector %d",detId)); + fRawReader->Select(detId); +} + //_____________________________________________________________________________ UShort_t AliAltroRawStream::GetNextWord() { @@ -199,8 +207,6 @@ Bool_t AliAltroRawStream::ReadTrailer() fPosition -= (4 - (fCount % 4)) % 4; // skip fill words - ApplyAltroMapping(); - return kTRUE; } @@ -212,13 +218,15 @@ Bool_t AliAltroRawStream::ReadDummyTrailer() UShort_t temp; while ((temp = GetNextWord()) == 0x2AA); - fSector = temp; - fRow = GetNextWord(); - fPad = GetNextWord(); + fSegmentation[0] = temp; + fSegmentation[1] = GetNextWord(); + fSegmentation[2] = GetNextWord(); fCount = GetNextWord(); if (fCount == 0) return kFALSE; fHWAddress = -1; + fPosition -= (4 - (fCount % 4)) % 4; // skip fill words + return kTRUE; } @@ -262,9 +270,7 @@ Int_t AliAltroRawStream::GetPosition() { // Sets the position in the // input stream - Int_t position = (fRawReader->GetDataSize() * 8) / 10; - if (position <= 4) - AliFatal(Form("Incorrect raw data size ! Expected at lest 4 words but found %d !",position)); - - return position; + if (((fRawReader->GetDataSize() * 8) % 10) != 0) + AliFatal(Form("Incorrect raw data size ! %d words are found !",fRawReader->GetDataSize())); + return (fRawReader->GetDataSize() * 8) / 10; } diff --git a/RAW/AliAltroRawStream.h b/RAW/AliAltroRawStream.h index 6f53f2dcff2..c391d6edd73 100644 --- a/RAW/AliAltroRawStream.h +++ b/RAW/AliAltroRawStream.h @@ -23,53 +23,49 @@ class AliAltroRawStream: public TObject { virtual void Reset(); virtual Bool_t Next(); - inline Int_t GetSector() const { return fSector; } // Provide index of current sector - inline Int_t GetPrevSector() const { return fPrevSector; } // Provide index of previous sector - inline Bool_t IsNewSector() const {return fSector != fPrevSector;}; - inline Int_t GetRow() const { return fRow; } // Provide index of current row - inline Int_t GetPrevRow() const { return fPrevRow; } // Provide index of previous row - inline Bool_t IsNewRow() const {return (fRow != fPrevRow) || IsNewSector();}; - inline Int_t GetPad() const { return fPad; } // Provide index of current pad - inline Int_t GetPrevPad() const { return fPrevPad; } // Provide index of previous pad - inline Bool_t IsNewPad() const {return (fPad != fPrevPad) || IsNewRow();}; + inline Int_t GetDDLNumber() const { return fDDLNumber; } // Provide current DDL number + inline Int_t GetPrevDDLNumber() const { return fPrevDDLNumber; }// Provide previous DDL number + inline Bool_t IsNewDDLNumber() const {return (fDDLNumber != fPrevDDLNumber);}; inline Int_t GetHWAddress() const { return fHWAddress; } // Provide current hardware address inline Int_t GetPrevHWAddress() const { return fPrevHWAddress; } // Provide previous hardware address + inline Bool_t IsNewHWAddress() const {return (fHWAddress != fPrevHWAddress) || IsNewDDLNumber();}; inline Int_t GetTime() const { return fTime; } // Provide index of current time bin + inline Int_t GetPrevTime() const { return fPrevTime; } // Provide index of previous time bin + inline Bool_t IsNewTime() const {return (fTime != fPrevTime) || IsNewHWAddress();}; inline Int_t GetSignal() const { return fSignal; } // Provide signal in ADC counts inline Int_t GetTimeLength() const { return fTimeBunch; } // Provide total length of current time bunch + void SelectRawData(Int_t detId); // Select raw data for specific detector id + protected: AliAltroRawStream(const AliAltroRawStream& stream); AliAltroRawStream& operator = (const AliAltroRawStream& stream); - virtual void ApplyAltroMapping() { fSector = fRow = fPad = -1; } + Bool_t fNoAltroMapping; // temporary flag in case of no altro mapping is provided + Short_t fSegmentation[3]; // temporary container for the dummy trailer, to be removed + + private : - Int_t fSector; // index of current sector - Int_t fPrevSector; // index of previous sector - Int_t fRow; // index of current row - Int_t fPrevRow; // index of previous row - Int_t fPad; // index of current pad - Int_t fPrevPad; // index of previous pad + UShort_t GetNextWord(); + Bool_t ReadTrailer(); + Bool_t ReadDummyTrailer(); + void ReadBunch(); + void ReadAmplitude(); + Int_t GetPosition(); + + Int_t fDDLNumber; // index of current DDL number + Int_t fPrevDDLNumber;// index of current DDL number Short_t fHWAddress; // current hardware address Short_t fPrevHWAddress;// previous hardware address Int_t fTime; // index of current time bin + Int_t fPrevTime; // index of previous time bin Int_t fSignal; // signal in ADC counts Int_t fTimeBunch; // total length of the current time bunch AliRawReader* fRawReader; // object for reading the raw data - UChar_t* fData; // raw data - Bool_t fNoAltroMapping; // temporary flag in case of no altro mapping is provided - - private : - - UShort_t GetNextWord(); - Bool_t ReadTrailer(); - Bool_t ReadDummyTrailer(); - void ReadBunch(); - void ReadAmplitude(); - Int_t GetPosition(); + UChar_t* fData; // raw data Int_t fPosition; // current (10 bit) position in fData Int_t fCount; // counter of words to be read for current trailer -- 2.43.0