/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
* *
* Author: The ALICE Off-line Project. *
* Contributors are mentioned in the code where appropriate. *
* provided "as is" without express or implied warranty. *
**************************************************************************/
+/* $Id: $*/
///////////////////////////////////////////////////////////////////////////////
///
-/// This class provides access to ITS SDD digits in test beam raw data,
-/// for beam test of August 2004
+/// This class provides access to ITS SDD digits in beam test raw data
///
///////////////////////////////////////////////////////////////////////////////
-#include "AliITSRawStreamSDDv2.h"
+#include "AliLog.h"
+#include "AliITSRawStreamSDDBeamTest.h"
#include "AliRawReader.h"
-ClassImp(AliITSRawStreamSDDv2)
+ClassImp(AliITSRawStreamSDDBeamTest)
+
+const UInt_t AliITSRawStreamSDDBeamTest::fgkCodeLength[8] = {8, 18, 2, 3, 4, 5, 6, 7};
-AliITSRawStreamSDDv2::AliITSRawStreamSDDv2(AliRawReader* rawReader) :
- AliITSRawStreamSDD(rawReader)
-
+//______________________________________________________________________
+AliITSRawStreamSDDBeamTest::AliITSRawStreamSDDBeamTest(AliRawReader* rawReader) :
+ AliITSRawStream(rawReader),
+fData(0),
+fSkip(0),
+fEventId(0),
+fCarlosId(-1),
+fChannel(0),
+fJitter(0)
{
// create an object to read ITS SDD raw digits
-
-
fRawReader->Reset();
fRawReader->SelectEquipment(17, 204, 204);
+
+
+}
+
+//______________________________________________________________________
+UInt_t AliITSRawStreamSDDBeamTest::ReadBits()
+{
+// read bits from the given channel
+ UInt_t result = (fChannelData[fCarlosId][fChannel] & ((1<<fReadBits[fCarlosId][fChannel]) - 1));
+ fChannelData[fCarlosId][fChannel] >>= fReadBits[fCarlosId][fChannel];
+ fLastBit[fCarlosId][fChannel] -= fReadBits[fCarlosId][fChannel];
+ return result;
}
+//______________________________________________________________________
+Int_t AliITSRawStreamSDDBeamTest::DecompAmbra(Int_t value) const
+{
+ // AMBRA decompression (from 8 to 10 bit)
+
+ if ((value & 0x80) == 0) {
+ return value & 0x7f;
+ } else if ((value & 0x40) == 0) {
+ return 0x081 + ((value & 0x3f) << 1);
+ } else if ((value & 0x20) == 0) {
+ return 0x104 + ((value & 0x1f) << 3);
+ } else {
+ return 0x208 + ((value & 0x1f) << 4);
+ }
+
+}
-Bool_t AliITSRawStreamSDDv2::Next()
+//______________________________________________________________________
+Bool_t AliITSRawStreamSDDBeamTest::Next()
{
// read the next raw digit
// returns kFALSE if there is no digit left
// skip the first 8 words
- while (fSkip[0] < 8) {
+ while (fSkip < 8) {
if (!fRawReader->ReadNextInt(fData)) return kFALSE;
if ((fData >> 30) == 0x01) continue; // JTAG word
- if (fSkip[0] == 4) {
+ if (fSkip == 4) {
if (fData != 0) {
Error("Next", "data not valid: %8.8d", fData);
return kFALSE;
}
}
- fSkip[0]++;
+ fSkip++;
}
while (kTRUE) {
}
+
+