]>
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 | */ | |
e2662f55 | 44 | #include "AliITSRawStreamSDDBeamTestNov04.h" |
1ba0280f | 45 | #include "AliRawReader.h" |
46 | ||
e2662f55 | 47 | ClassImp(AliITSRawStreamSDDBeamTestNov04) |
1ba0280f | 48 | |
49 | ||
50 | ||
51 | ||
52 | ||
e2662f55 | 53 | AliITSRawStreamSDDBeamTestNov04::AliITSRawStreamSDDBeamTestNov04(AliRawReader* rawReader) : |
54 | AliITSRawStreamSDDBeamTest(rawReader) | |
1ba0280f | 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 | ||
e2662f55 | 64 | Bool_t AliITSRawStreamSDDBeamTestNov04::Next() |
1ba0280f | 65 | { |
66 | // read the next raw digit | |
67 | // returns kFALSE if there is no digit left | |
68 | // skip the first 8 words | |
e2662f55 | 69 | while (fSkip < 9) { |
1ba0280f | 70 | if (!fRawReader->ReadNextInt(fData)) return kFALSE; |
71 | if ((fData >> 30) == 0x01) continue; // JTAG word | |
e2662f55 | 72 | fSkip++; |
1ba0280f | 73 | } |
74 | ||
75 | Int_t countFoot=0; | |
76 | while (kTRUE) { | |
a97b3678 | 77 | if ((fChannel < 0) || (fLastBit[0][fChannel] < fReadBits[0][fChannel])) { |
1ba0280f | 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 | ||
a97b3678 | 88 | if ((fData & 0x00000163) != 0) { |
89 | Error("Next", "error codes = %8.8x",fData); | |
90 | return kFALSE; | |
1ba0280f | 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 | |
a97b3678 | 105 | fChannelData[0][fChannel] += |
106 | (ULong64_t(fData & 0x3FFFFFFF) << fLastBit[0][fChannel]); | |
107 | fLastBit[0][fChannel] += 30; | |
1ba0280f | 108 | } |
109 | ||
110 | } else { // decode data | |
a97b3678 | 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]]; | |
1ba0280f | 115 | |
116 | } else { // read the next data word | |
117 | UInt_t data = ReadBits(); | |
a97b3678 | 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]++; | |
1ba0280f | 125 | } else { // ADC signal data |
a97b3678 | 126 | fSignal = DecompAmbra(data + (1 << fChannelCode[0][fChannel]) + |
1ba0280f | 127 | fLowThreshold[fChannel]); |
a97b3678 | 128 | fCoord1 = fAnode[0][fChannel]; |
129 | fCoord2 = fTimeBin[0][fChannel]; | |
130 | fTimeBin[0][fChannel]++; | |
1ba0280f | 131 | return kTRUE; |
132 | } | |
133 | } | |
134 | } | |
135 | } | |
136 | return kFALSE; | |
137 | } | |
138 | ||
139 | ||
e2662f55 | 140 | Int_t AliITSRawStreamSDDBeamTestNov04::ReadJitter() { |
1ba0280f | 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)){ |
e2662f55 | 146 | Error("ReadJitter","Jitter word not found!!"); |
1ba0280f | 147 | return -1; // read last word |
148 | } | |
149 | if ( (fData&0xff000000) != 0xff000000) { | |
e2662f55 | 150 | Error("ReadJitter","wrong mask on Jitter word (0xffxxxxxx): %8.8x",fData); |
1ba0280f | 151 | return -1; // read last word |
152 | } | |
153 | fJitter = fData&0x000000ff; | |
154 | if (fJitter<0x7 || fJitter>0xe) { | |
e2662f55 | 155 | Warning("ReadJitter","Unexpected jitter value %2.2x (%8.8x)",fJitter,fData); |
1ba0280f | 156 | return fJitter; // read last word |
157 | } | |
158 | ||
159 | if (fRawReader->ReadNextInt(fData)){ | |
e2662f55 | 160 | Error("ReadJitter","The equipment payload contains something after jitter"); |
1ba0280f | 161 | return -1; // read last word |
162 | } | |
163 | return fJitter; | |
164 | } | |
165 | ||
166 |