1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
17 ///////////////////////////////////////////////////////////////////////////////
19 /// This class provides access to ITS SDD digits in test beam raw data,
20 /// for beam test of August 2004
22 ///////////////////////////////////////////////////////////////////////////////
24 #include "AliITSRawStreamSDDv2.h"
25 #include "AliRawReader.h"
27 ClassImp(AliITSRawStreamSDDv2)
30 AliITSRawStreamSDDv2::AliITSRawStreamSDDv2(AliRawReader* rawReader) :
31 AliITSRawStreamSDD(rawReader)
34 // create an object to read ITS SDD raw digits
38 fRawReader->SelectEquipment(17, 204, 204);
42 Bool_t AliITSRawStreamSDDv2::Next()
44 // read the next raw digit
45 // returns kFALSE if there is no digit left
47 // skip the first 8 words
49 if (!fRawReader->ReadNextInt(fData)) return kFALSE;
50 if ((fData >> 30) == 0x01) continue; // JTAG word
53 Error("Next", "data not valid: %8.8d", fData);
61 if ((fChannel < 0) || (fLastBit[fChannel] < fReadBits[fChannel])) {
62 if (!fRawReader->ReadNextInt(fData)) return kFALSE; // read next word
65 if ((fData >> 28) == 0x02) { // header
66 fEventId = (fData >> 3) & 0x07FF;
67 fCarlosId = (fData >> 1) & 0x03;
68 } else if ((fData >> 28) == 0x03) { // footer
70 } else if ((fData >> 29) == 0x00) { // error
71 if ((fData & 0x1FFFFFFF) != 0) {
72 Error("Next", "error codes = %x, %x\n",
73 (fData >> 0) & 0x3FFF, (fData >> 14) & 0x3FFF);
76 } else if ((fData >> 30) == 0x01) { // JTAG word
78 } else if ((fData >> 30) == 0x02) { // channel 0 data
80 } else if ((fData >> 30) == 0x03) { // channel 1 data
82 } else { // unknown data format
83 Error("Next", "invalid data: %8.8x\n", fData);
87 if (fChannel >= 0) { // add read word to the data
88 fChannelData[fChannel] +=
89 (ULong64_t(fData & 0x3FFFFFFF) << fLastBit[fChannel]);
90 fLastBit[fChannel] += 30;
93 } else { // decode data
94 if (fReadCode[fChannel]) { // read the next code word
95 fChannelCode[fChannel] = ReadBits();
96 fReadCode[fChannel] = kFALSE;
97 fReadBits[fChannel] = fgkCodeLength[fChannelCode[fChannel]];
99 } else { // read the next data word
100 UInt_t data = ReadBits();
101 fReadCode[fChannel] = kTRUE;
102 fReadBits[fChannel] = 3;
103 if (fChannelCode[fChannel] == 0) { // set the time bin
104 fTimeBin[fChannel] = data;
105 } else if (fChannelCode[fChannel] == 1) { // next anode
106 fTimeBin[fChannel] = 0;
108 } else { // ADC signal data
109 fSignal = DecompAmbra(data + (1 << fChannelCode[fChannel]) +
110 fLowThreshold[fChannel]);
111 fCoord1 = fAnode[fChannel];
112 fCoord2 = fTimeBin[fChannel];
113 fTimeBin[fChannel]++;