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 November 2004
22 ///////////////////////////////////////////////////////////////////////////////
25 Error Flag words: (http://www.bo.infn.it/~falchier/alice.html)
26 with multi-event buffer
30 bit 12 : L1 reject ack
31 bit 11 : L2 reject ack
36 bit 6 : flag error ch 1
37 bit 5 : flag error ch 0
38 bit 4 : disable trigger mismatch ack
39 bit 3 : parity error right hybrid
40 bit 2 : parity error left hybrid
41 bit 1 : parity error CARLOS ch 1
42 bit 0 : parity error CARLOS ch 2
44 #include "AliITSRawStreamSDDBeamTestNov04.h"
45 #include "AliRawReader.h"
47 ClassImp(AliITSRawStreamSDDBeamTestNov04)
53 AliITSRawStreamSDDBeamTestNov04::AliITSRawStreamSDDBeamTestNov04(AliRawReader* rawReader) :
54 AliITSRawStreamSDDBeamTest(rawReader)
56 // create an object to read ITS SDD raw digits
60 fRawReader->SelectEquipment(17, 204, 204);
64 Bool_t AliITSRawStreamSDDBeamTestNov04::Next()
66 // read the next raw digit
67 // returns kFALSE if there is no digit left
68 // skip the first 8 words
70 if (!fRawReader->ReadNextInt(fData)) return kFALSE;
71 if ((fData >> 30) == 0x01) continue; // JTAG word
77 if ((fChannel < 0) || (fLastBit[0][fChannel] < fReadBits[0][fChannel])) {
78 if (!fRawReader->ReadNextInt(fData)) return kFALSE; // read next word
80 if ((fData >> 28) == 0x02) { // header
81 fEventId = (fData >> 3) & 0x07FF;
82 fCarlosId = (fData >> 1) & 0x03;
83 } else if ((fData >> 28) == 0x03) { // footer
84 countFoot++; // stop before the last word (last word=jitter)
85 if(countFoot==3) return kFALSE;
86 } else if ((fData >> 29) == 0x00) { // error
88 if ((fData & 0x00000163) != 0) {
89 Error("Next", "error codes = %8.8x",fData);
92 } else if ((fData >> 30) == 0x01) { // JTAG word
94 } else if ((fData >> 30) == 0x02) { // channel 0 data
96 } else if ((fData >> 30) == 0x03) { // channel 1 data
98 } else { // unknown data format
99 Error("Next", "invalid data: %8.8x\n", fData);
104 if (fChannel >= 0) { // add read word to the data
105 fChannelData[0][fChannel] +=
106 (ULong64_t(fData & 0x3FFFFFFF) << fLastBit[0][fChannel]);
107 fLastBit[0][fChannel] += 30;
110 } else { // decode data
111 if (fReadCode[0][fChannel]) { // read the next code word
112 fChannelCode[0][fChannel] = ReadBits();
113 fReadCode[0][fChannel] = kFALSE;
114 fReadBits[0][fChannel] = fgkCodeLength[fChannelCode[0][fChannel]];
116 } else { // read the next data word
117 UInt_t data = ReadBits();
118 fReadCode[0][fChannel] = kTRUE;
119 fReadBits[0][fChannel] = 3;
120 if (fChannelCode[0][fChannel] == 0) { // set the time bin
121 fTimeBin[0][fChannel] = data;
122 } else if (fChannelCode[0][fChannel] == 1) { // next anode
123 fTimeBin[0][fChannel] = 0;
124 fAnode[0][fChannel]++;
125 } else { // ADC signal data
126 fSignal = DecompAmbra(data + (1 << fChannelCode[0][fChannel]) +
127 fLowThreshold[fChannel]);
128 fCoord1 = fAnode[0][fChannel];
129 fCoord2 = fTimeBin[0][fChannel];
130 fTimeBin[0][fChannel]++;
140 Int_t AliITSRawStreamSDDBeamTestNov04::ReadJitter() {
142 // Reads the value of the jitter between L0 and pascal stop
143 // written in the last word of the buffer
145 if (!fRawReader->ReadNextInt(fData)){
146 Error("ReadJitter","Jitter word not found!!");
147 return -1; // read last word
149 if ( (fData&0xff000000) != 0xff000000) {
150 Error("ReadJitter","wrong mask on Jitter word (0xffxxxxxx): %8.8x",fData);
151 return -1; // read last word
153 fJitter = fData&0x000000ff;
154 if (fJitter<0x7 || fJitter>0xe) {
155 Warning("ReadJitter","Unexpected jitter value %2.2x (%8.8x)",fJitter,fData);
156 return fJitter; // read last word
159 if (fRawReader->ReadNextInt(fData)){
160 Error("ReadJitter","The equipment payload contains something after jitter");
161 return -1; // read last word