]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSRawStreamSDDv2.cxx
Possibility to specify event selection criteria within the raw-data input URI. The...
[u/mrichter/AliRoot.git] / ITS / AliITSRawStreamSDDv2.cxx
index 32a463dbaa68b6cc3c89a50893b895acbb71523a..efc54485fb2d3548a68d4ca1deb8c7e6dd95ba46 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/* $Id$ */
 
 ///////////////////////////////////////////////////////////////////////////////
 ///
-/// This class provides access to ITS SDD digits in test beam raw data.
+/// This class provides access to ITS SDD digits in test beam raw data,
+/// for beam test of August 2004
 ///
 ///////////////////////////////////////////////////////////////////////////////
 
 ClassImp(AliITSRawStreamSDDv2)
 
 
-
-const UInt_t AliITSRawStreamSDDv2::fgkCodeLength[8] = 
-  {8, 18, 2, 3, 4, 5, 6, 7};
-
-
 AliITSRawStreamSDDv2::AliITSRawStreamSDDv2(AliRawReader* rawReader) :
-  AliITSRawStream(rawReader),
-  fSkip(0),
-  fEventId(-1),
-  fCarlosId(-1),
-  fChannel(-1)
+  AliITSRawStreamSDD(rawReader)
+    
 {
 // create an object to read ITS SDD raw digits
 
-  for (Int_t iChannel = 0; iChannel < 2; iChannel++) {
-    fChannelData[iChannel] = 0;
-    fLastBit[iChannel] = 0;
-    fChannelCode[iChannel] = 0;
-    fReadCode[iChannel] = kTRUE;
-    fReadBits[iChannel] = 3;
-    fTimeBin[iChannel] = 0;
-    fAnode[iChannel] = 0;
-    fLowThreshold[iChannel] = 0;
-  }
 
   fRawReader->Reset();
-  fRawReader->SelectEquipment(17, 1, 1);
+  fRawReader->SelectEquipment(17, 204, 204);
 }
 
 
@@ -63,20 +45,20 @@ Bool_t AliITSRawStreamSDDv2::Next()
 // returns kFALSE if there is no digit left
 
   // skip the first 8 words
-  while (fSkip < 8) {
+  while (fSkip[0] < 8) {
     if (!fRawReader->ReadNextInt(fData)) return kFALSE;
     if ((fData >> 30) == 0x01) continue;  // JTAG word
-    if (fSkip == 4) {
+    if (fSkip[0] == 4) {
       if (fData != 0) {
        Error("Next", "data not valid: %8.8d", fData);
        return kFALSE;
       }
     }
-    fSkip++;
+    fSkip[0]++;
   }
 
   while (kTRUE) {
-    if ((fChannel < 0) || (fLastBit[fChannel] < fReadBits[fChannel])) {
+    if ((fChannel < 0) || (fLastBit[0][fChannel] < fReadBits[0][fChannel])) {
       if (!fRawReader->ReadNextInt(fData)) return kFALSE;  // read next word
 
       fChannel = -1;
@@ -103,32 +85,32 @@ Bool_t AliITSRawStreamSDDv2::Next()
       }
 
       if (fChannel >= 0) {          // add read word to the data
-       fChannelData[fChannel] += 
-         (ULong64_t(fData & 0x3FFFFFFF) << fLastBit[fChannel]);
-       fLastBit[fChannel] += 30;
+       fChannelData[0][fChannel] += 
+         (ULong64_t(fData & 0x3FFFFFFF) << fLastBit[0][fChannel]);
+       fLastBit[0][fChannel] += 30;
       }
 
     } else {  // decode data
-      if (fReadCode[fChannel]) {    // read the next code word
-       fChannelCode[fChannel] = ReadBits();
-       fReadCode[fChannel] = kFALSE;
-       fReadBits[fChannel] = fgkCodeLength[fChannelCode[fChannel]];
+      if (fReadCode[0][fChannel]) {    // read the next code word
+       fChannelCode[0][fChannel] = ReadBits();
+       fReadCode[0][fChannel] = kFALSE;
+       fReadBits[0][fChannel] = fgkCodeLength[fChannelCode[0][fChannel]];
 
       } else {                      // read the next data word
        UInt_t data = ReadBits();
-       fReadCode[fChannel] = kTRUE;
-       fReadBits[fChannel] = 3;
-       if (fChannelCode[fChannel] == 0) {         // set the time bin
-         fTimeBin[fChannel] = data;
-       } else if (fChannelCode[fChannel] == 1) {  // next anode
-         fTimeBin[fChannel] = 0;
-         fAnode[fChannel]++;
+       fReadCode[0][fChannel] = kTRUE;
+       fReadBits[0][fChannel] = 3;
+       if (fChannelCode[0][fChannel] == 0) {         // set the time bin
+         fTimeBin[0][fChannel] = data;
+       } else if (fChannelCode[0][fChannel] == 1) {  // next anode
+         fTimeBin[0][fChannel] = 0;
+         fAnode[0][fChannel]++;
        } else {                                   // ADC signal data
-         fSignal = DecompAmbra(data + (1 << fChannelCode[fChannel]) + 
+         fSignal = DecompAmbra(data + (1 << fChannelCode[0][fChannel]) + 
            fLowThreshold[fChannel]);
-         fCoord1 = fAnode[fChannel];
-         fCoord2 = fTimeBin[fChannel];
-         fTimeBin[fChannel]++;
+         fCoord1 = fAnode[0][fChannel];
+         fCoord2 = fTimeBin[0][fChannel];
+         fTimeBin[0][fChannel]++;
          return kTRUE;
        }
       }
@@ -139,27 +121,3 @@ Bool_t AliITSRawStreamSDDv2::Next()
 }
 
 
-UInt_t AliITSRawStreamSDDv2::ReadBits()
-{
-// read bits from the given channel
-
-  UInt_t result = (fChannelData[fChannel] & ((1<<fReadBits[fChannel]) - 1));
-  fChannelData[fChannel] >>= fReadBits[fChannel]; 
-  fLastBit[fChannel] -= fReadBits[fChannel];
-  return result;
-}
-
-Int_t AliITSRawStreamSDDv2::DecompAmbra(Int_t value) const
-{
-// AMBRA decompression
-
-  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);
-  }
-}