-//_____________________________________________________________________________
-Bool_t AliAltroBuffer::ReadDummyTrailer(Int_t& wordsNumber, Int_t& padNumber,
- Int_t& rowNumber, Int_t& secNumber)
-{
-//Read a dummy trailer of 40 bits in the forward reading mode
-
- wordsNumber = GetNext();
- if (wordsNumber == -1) return kFALSE;
- padNumber = GetNext();
- if (padNumber == -1) return kFALSE;
- rowNumber = GetNext();
- if (rowNumber == -1) return kFALSE;
- secNumber = GetNext();
- if (secNumber == -1) return kFALSE;
- return kTRUE;
-}
-
-//_____________________________________________________________________________
-Bool_t AliAltroBuffer::ReadTrailer(Int_t& wordsNumber, Int_t& padNumber,
- Int_t& rowNumber, Int_t& secNumber)
-{
-//Read a trailer of 40 bits in the forward reading mode
- if (!fMapping) {
- AliError("No ALTRO mapping information is loaded! Reading a dummy trailer!");
- return ReadDummyTrailer(wordsNumber,padNumber,
- rowNumber,secNumber);
- }
-
- Short_t hwAddress;
- if (!ReadTrailer(wordsNumber,hwAddress)) return kFALSE;
- rowNumber = fMapping->GetPadRow(hwAddress);
- padNumber = fMapping->GetPad(hwAddress);
- secNumber = fMapping->GetSector(hwAddress);
-
- return kTRUE;
-}
-
-//_____________________________________________________________________________
-Bool_t AliAltroBuffer::ReadTrailer(Int_t& wordsNumber, Short_t& hwAddress)
-{
-//Read a trailer of 40 bits in the forward reading mode
-
- Int_t temp = GetNext();
- hwAddress = temp;
-
- temp = GetNext();
- wordsNumber = ((temp & 0x3FF) >> 6);
- if (((temp >> 2) & 0xF) != 0xA)
- AliFatal(Form("Incorrect trailer found ! Expecting second 0xA but found %x !",temp >> 6));
- hwAddress |= (temp & 0x3) << 10;
-
- temp = GetNext();
- if ((temp >> 6) != 0xA)
- AliFatal(Form("Incorrect trailer found ! Expecting 0xA but found %x !",temp >> 6));
- wordsNumber |= (temp << 4) & 0x3FF;
-
- temp = GetNext();
- if (temp != 0x2AA)
- AliFatal(Form("Incorrect trailer found ! Expecting 0x2AA but found %x !",temp));
-
- return kTRUE;
-}
-
-//_____________________________________________________________________________
-Bool_t AliAltroBuffer::ReadDummyTrailerBackward(Int_t& wordsNumber, Int_t& padNumber,
- Int_t& rowNumber, Int_t& secNumber)
-{
-//Read a trailer of 40 bits in the backward reading mode
-
- Int_t temp;
- fEndingFillWords = 0;
- do {
- temp = GetNextBackWord();
- fEndingFillWords++;
- if (temp == -1) return kFALSE;
- } while (temp == 0x2AA);
- fEndingFillWords--;
- secNumber = temp;
- rowNumber = GetNextBackWord();
- if (rowNumber == -1) return kFALSE;
- padNumber = GetNextBackWord();
- if (padNumber == -1) return kFALSE;
- wordsNumber = GetNextBackWord();
- if (wordsNumber == -1) return kFALSE;
- return kTRUE;
-}
-
-//_____________________________________________________________________________
-Bool_t AliAltroBuffer::ReadTrailerBackward(Int_t& wordsNumber, Int_t& padNumber,
- Int_t& rowNumber, Int_t& secNumber)
-{
-//Read a trailer of 40 bits in the backward reading mode
- if (!fMapping) {
- AliError("No ALTRO mapping information is loaded! Reading a dummy trailer!");
- return ReadDummyTrailerBackward(wordsNumber,padNumber,
- rowNumber,secNumber);
- }
-
- Short_t hwAddress;
- if (!ReadTrailerBackward(wordsNumber,hwAddress)) return kFALSE;
- rowNumber = fMapping->GetPadRow(hwAddress);
- padNumber = fMapping->GetPad(hwAddress);
- secNumber = fMapping->GetSector(hwAddress);
-
- return kTRUE;
-}
-
-//_____________________________________________________________________________
-Bool_t AliAltroBuffer::ReadTrailerBackward(Int_t& wordsNumber, Short_t& hwAddress)
-{
-//Read a trailer of 40 bits in the backward reading mode
-
- Int_t temp;
- fEndingFillWords = 0;
- while ((temp = GetNextBackWord()) == 0x2AA) {
- fEndingFillWords++;
- if (temp == -1) return kFALSE;
- };
- if (fEndingFillWords == 0)
- AliFatal("Incorrect trailer found ! Expected 0x2AA not found !");
- fEndingFillWords--;
-
- wordsNumber = (temp << 4) & 0x3FF;
- if ((temp >> 6) != 0xA)
- AliFatal(Form("Incorrect trailer found ! Expecting 0xA but found %x !",temp >> 6));
-
- temp = GetNextBackWord();
- hwAddress = (temp & 0x3) << 10;
- if (((temp >> 2) & 0xF) != 0xA)
- AliFatal(Form("Incorrect trailer found ! Expecting second 0xA but found %x !",(temp >> 2) & 0xF));
- wordsNumber |= ((temp & 0x3FF) >> 6);
-
- temp = GetNextBackWord();
- hwAddress |= temp;
-
- return kTRUE;
-}
-