]>
Commit | Line | Data |
---|---|---|
1ba0280f | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
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 | **************************************************************************/ | |
15 | ||
16 | ||
17 | /////////////////////////////////////////////////////////////////////////////// | |
18 | /// | |
19 | /// This class provides access to ITS SDD digits in test beam raw data. | |
20 | // for beam test of November 2004 | |
21 | /// | |
22 | /////////////////////////////////////////////////////////////////////////////// | |
23 | ||
24 | /* | |
25 | Error Flag words: (http://www.bo.infn.it/~falchier/alice.html) | |
26 | with multi-event buffer | |
27 | ||
28 | bits 31-14: all zeros | |
29 | bit 13 : L0 ack | |
30 | bit 12 : L1 reject ack | |
31 | bit 11 : L2 reject ack | |
32 | bit 10 : prepulse ack | |
33 | bit 9 : testpulse ack | |
34 | bit 8 : flush | |
35 | bit 7 : busy | |
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 | |
43 | */ | |
44 | #include "AliITSRawStreamSDDv3.h" | |
45 | #include "AliRawReader.h" | |
46 | ||
47 | ClassImp(AliITSRawStreamSDDv3) | |
48 | ||
49 | ||
50 | ||
51 | ||
52 | ||
53 | AliITSRawStreamSDDv3::AliITSRawStreamSDDv3(AliRawReader* rawReader) : | |
54 | AliITSRawStreamSDD(rawReader) | |
55 | { | |
56 | // create an object to read ITS SDD raw digits | |
57 | ||
58 | ||
59 | fRawReader->Reset(); | |
60 | fRawReader->SelectEquipment(17, 204, 204); | |
61 | } | |
62 | ||
63 | ||
64 | Bool_t AliITSRawStreamSDDv3::Next() | |
65 | { | |
66 | // read the next raw digit | |
67 | // returns kFALSE if there is no digit left | |
68 | // skip the first 8 words | |
69 | while (fSkip < 9) { | |
70 | if (!fRawReader->ReadNextInt(fData)) return kFALSE; | |
71 | if ((fData >> 30) == 0x01) continue; // JTAG word | |
72 | fSkip++; | |
73 | } | |
74 | ||
75 | Int_t countFoot=0; | |
76 | while (kTRUE) { | |
77 | if ((fChannel < 0) || (fLastBit[fChannel] < fReadBits[fChannel])) { | |
78 | if (!fRawReader->ReadNextInt(fData)) return kFALSE; // read next word | |
79 | fChannel = -1; | |
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 | |
87 | ||
88 | if ((fData & 0x00000163) != 0) { | |
89 | Error("Next", "error codes = %8.8x",fData); | |
90 | return kFALSE; | |
91 | } | |
92 | } else if ((fData >> 30) == 0x01) { // JTAG word | |
93 | // ignored | |
94 | } else if ((fData >> 30) == 0x02) { // channel 0 data | |
95 | fChannel = 0; | |
96 | } else if ((fData >> 30) == 0x03) { // channel 1 data | |
97 | fChannel = 1; | |
98 | } else { // unknown data format | |
99 | Error("Next", "invalid data: %8.8x\n", fData); | |
100 | return kFALSE; | |
101 | } | |
102 | ||
103 | ||
104 | if (fChannel >= 0) { // add read word to the data | |
105 | fChannelData[fChannel] += | |
106 | (ULong64_t(fData & 0x3FFFFFFF) << fLastBit[fChannel]); | |
107 | fLastBit[fChannel] += 30; | |
108 | } | |
109 | ||
110 | } else { // decode data | |
111 | if (fReadCode[fChannel]) { // read the next code word | |
112 | fChannelCode[fChannel] = ReadBits(); | |
113 | fReadCode[fChannel] = kFALSE; | |
114 | fReadBits[fChannel] = fgkCodeLength[fChannelCode[fChannel]]; | |
115 | ||
116 | } else { // read the next data word | |
117 | UInt_t data = ReadBits(); | |
118 | fReadCode[fChannel] = kTRUE; | |
119 | fReadBits[fChannel] = 3; | |
120 | if (fChannelCode[fChannel] == 0) { // set the time bin | |
121 | fTimeBin[fChannel] = data; | |
122 | } else if (fChannelCode[fChannel] == 1) { // next anode | |
123 | fTimeBin[fChannel] = 0; | |
124 | fAnode[fChannel]++; | |
125 | } else { // ADC signal data | |
126 | fSignal = DecompAmbra(data + (1 << fChannelCode[fChannel]) + | |
127 | fLowThreshold[fChannel]); | |
128 | fCoord1 = fAnode[fChannel]; | |
129 | fCoord2 = fTimeBin[fChannel]; | |
130 | fTimeBin[fChannel]++; | |
131 | return kTRUE; | |
132 | } | |
133 | } | |
134 | } | |
135 | } | |
136 | return kFALSE; | |
137 | } | |
138 | ||
139 | ||
140 | Int_t AliITSRawStreamSDDv3::GetJitter() { | |
141 | ||
38300302 | 142 | // Reads the value of the jitter between L0 and pascal stop |
143 | // written in the last word of the buffer | |
144 | ||
1ba0280f | 145 | if (!fRawReader->ReadNextInt(fData)){ |
146 | Error("GetJitter","Jitter word not found!!"); | |
147 | return -1; // read last word | |
148 | } | |
149 | if ( (fData&0xff000000) != 0xff000000) { | |
150 | Error("GetJitter","wrong mask on Jitter word (0xffxxxxxx): %8.8x",fData); | |
151 | return -1; // read last word | |
152 | } | |
153 | fJitter = fData&0x000000ff; | |
154 | if (fJitter<0x7 || fJitter>0xe) { | |
155 | Warning("GetJitter","Unexpected jitter value %2.2x (%8.8x)",fJitter,fData); | |
156 | return fJitter; // read last word | |
157 | } | |
158 | ||
159 | if (fRawReader->ReadNextInt(fData)){ | |
160 | Error("GetJitter","The equipment payload contains something after jitter"); | |
161 | return -1; // read last word | |
162 | } | |
163 | return fJitter; | |
164 | } | |
165 | ||
166 |