]>
Commit | Line | Data |
---|---|---|
0eedb47d | 1 | #ifndef ALITRDRAWSTREAMTB_H |
2 | #define ALITRDRAWSTREAMTB_H | |
3 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
4 | * See cxx source for full Copyright notice */ | |
5 | ||
6 | /* $Id$ */ | |
7 | ||
8 | /////////////////////////////////////////////////////////////////////////////// | |
9 | // // | |
10 | // This class provides access to TRD digits in raw data. // | |
11 | // // | |
12 | /////////////////////////////////////////////////////////////////////////////// | |
13 | ||
14 | #include <TObject.h> | |
15 | ||
16 | class AliTRDgeometry; | |
17 | class AliRawReader; | |
18 | class AliTRDdigitsManager; | |
19 | ||
20 | namespace AliTRDrawDataUtilsTB | |
21 | { | |
22 | //-------------------------------------------------------- | |
23 | // Some constants: | |
24 | //static const UInt_t kEndoftrackletmarker = 0xAAAAAAAA; /*This marks the end of tracklet data words*/ | |
25 | //static const UInt_t kEndOfTrackletMarker = 0x10001000; /*This marks the end of tracklet data words*/ | |
26 | static const UInt_t kEndOfTrackletMarker = 0xaaaaaaaa; /*This marks the end of tracklet data words*/ | |
27 | //static const UInt_t kEndofrawdatamarker = 0x00000000; /*This marks the end of half-chamber-data*/ | |
28 | static const UInt_t kEndOfRawDataMarker = 0x00000000; /*This marks the end of half-chamber-data*/ | |
29 | static const UInt_t kSizeWord = sizeof(UInt_t); // size of a word in bytes | |
30 | ||
31 | //-------------------------------------------------------- | |
32 | // SM index word masks | |
33 | static const UInt_t skSMheaderSizeBits = 0xffff0000; | |
34 | static const UInt_t skTrackletsEnableBits = 0x1 << 5; | |
35 | static const UInt_t skStackMasksBits = 0x1f; | |
36 | ||
37 | static UInt_t GetSMheaderSize(UInt_t *word) | |
38 | { | |
39 | return (*word & skSMheaderSizeBits) >> 16; | |
40 | } | |
41 | ||
42 | static UInt_t GetTrackletEnable(UInt_t *word) | |
43 | { | |
44 | return (*word & skTrackletsEnableBits) >> 5; | |
45 | } | |
46 | ||
47 | static UInt_t GetStackMask(UInt_t *word) | |
48 | { | |
49 | return (*word & skStackMasksBits); | |
50 | } | |
51 | ||
52 | /* static UInt_t GetStackStatus(UInt_t *word, Int_t istack) */ | |
53 | /* { */ | |
54 | /* return (*word & (0x1 << istack)); */ | |
55 | /* } */ | |
56 | ||
57 | //-------------------------------------------------------- | |
58 | struct AliTRDrawSMinfo | |
59 | { | |
60 | UInt_t fHeaderSize; | |
61 | Bool_t fTrackletEnable; | |
62 | Bool_t fStackActive[5]; | |
63 | Int_t fActiveStacks; | |
64 | ||
65 | void Decode(UInt_t *word) | |
66 | { | |
67 | fHeaderSize = GetSMheaderSize(word); | |
68 | ||
69 | if (GetTrackletEnable(word) > 0) | |
70 | fTrackletEnable = kTRUE; | |
71 | else | |
72 | fTrackletEnable = kFALSE; | |
73 | ||
74 | UInt_t stackMask = GetStackMask(word); | |
75 | fActiveStacks = 0; | |
76 | for (Int_t i = 0; i < 5; i++) | |
77 | { | |
78 | //if (stackMask & (0x1 << i) > 0) | |
79 | if ((stackMask >> i) & 0x1 > 0) | |
80 | { | |
81 | fStackActive[i] = kTRUE; | |
82 | fActiveStacks++; | |
83 | } | |
84 | else | |
85 | { | |
86 | fStackActive[i] = kFALSE; | |
87 | } | |
88 | } | |
89 | } | |
90 | ||
91 | void Dump() | |
92 | { | |
93 | printf("[I] SM Info is : Hsize %d TrackletEnable %d Stacks %d %d %d %d %d\n", | |
94 | fHeaderSize, fTrackletEnable, | |
95 | fStackActive[0], fStackActive[1], fStackActive[2], | |
96 | fStackActive[3], fStackActive[4]); | |
97 | ||
98 | } | |
99 | }; | |
100 | ||
101 | //-------------------------------------------------------- | |
102 | // Stack word masks | |
103 | static const UInt_t skStackHeaderSizeBits = 0xffff0000; | |
104 | static const UInt_t skStackLinkMaskBits = 0xfff; | |
105 | ||
106 | static UInt_t GetStackHeaderSize(UInt_t *word) | |
107 | { | |
108 | return (*word & skStackHeaderSizeBits) >> 16; | |
109 | } | |
110 | ||
111 | static UInt_t GetStackLinkWord(UInt_t *word) | |
112 | { | |
113 | return (*word & skStackLinkMaskBits); | |
114 | } | |
115 | ||
116 | static UInt_t GetStackHeaderSizeBug(UInt_t *word) | |
117 | { | |
118 | return (*word & 0x0000ffff); | |
119 | } | |
120 | ||
121 | static UInt_t GetStackLinkWordBug(UInt_t *word) | |
122 | { | |
123 | return (*word & 0x0fff) >> 16; | |
124 | } | |
125 | ||
126 | struct AliTRDrawStackInfo | |
127 | { | |
128 | UInt_t fHeaderSize; | |
129 | Bool_t fLinksActive[12]; | |
130 | Int_t fActiveLinks; | |
131 | ||
132 | void Decode(UInt_t *word) | |
133 | { | |
134 | fHeaderSize = GetStackHeaderSize(word); | |
135 | ||
136 | UInt_t linkMask = GetStackLinkWord(word); | |
137 | fActiveLinks = 0; | |
138 | for (Int_t i = 0; i < 12; i++) | |
139 | { | |
140 | if (linkMask & (0x1 << i) > 0) | |
141 | { | |
142 | fLinksActive[i] = kTRUE; | |
143 | fActiveLinks++; | |
144 | } | |
145 | else | |
146 | { | |
147 | fLinksActive[i] = kFALSE; | |
148 | } | |
149 | } | |
150 | } | |
151 | ||
152 | void DecodeBug(UInt_t *word) | |
153 | { | |
154 | fHeaderSize = GetStackHeaderSizeBug(word); | |
155 | ||
156 | UInt_t linkMask = GetStackLinkWordBug(word); | |
157 | for (Int_t i = 0; i < 12; i++) | |
158 | { | |
159 | if (linkMask & (0x1 << i) > 0) | |
160 | fLinksActive[i] = kTRUE; | |
161 | else | |
162 | fLinksActive[i] = kFALSE; | |
163 | } | |
164 | } | |
165 | ||
166 | void Dump() | |
167 | { | |
168 | printf("[I] Stack Info is : Hsize %d Links Active %d %d %d %d %d %d %d %d %d %d %d %d\n", | |
169 | fHeaderSize, | |
170 | fLinksActive[0], fLinksActive[1], fLinksActive[2], fLinksActive[3], | |
171 | fLinksActive[4], fLinksActive[5], fLinksActive[6], fLinksActive[7], | |
172 | fLinksActive[8], fLinksActive[9], fLinksActive[10], fLinksActive[11]); | |
173 | } | |
174 | }; | |
175 | ||
176 | //-------------------------------------------------------- | |
177 | // HC word masks | |
178 | // word 0 | |
179 | static const UInt_t skSpecialRawVBits = 0x1 << 31; | |
180 | static const UInt_t skRawVMajorBits = 0x7f << 24; | |
181 | static const UInt_t skRawVMinorBits = 0x7f << 17; | |
182 | static const UInt_t skHCExtraWordsBits = 0x7 << 14; | |
183 | static const UInt_t skHCSMBits = 0x1f << 9; | |
184 | static const UInt_t skHCLayerBits = 0x7 << 6; | |
185 | static const UInt_t skHCStackBits = 0x7 << 3; | |
186 | static const UInt_t skHCSideBits = 0x1 << 2; | |
187 | ||
188 | static const UInt_t skDCSBoardBits = 0xfff << 20; | |
189 | ||
190 | static UInt_t GetSpecialRawV(UInt_t *word) | |
191 | { | |
192 | return (*word & skSpecialRawVBits) >> 31; | |
193 | } | |
194 | ||
195 | static UInt_t GetRawVMajor(UInt_t *word) | |
196 | { | |
197 | return (*word & skRawVMajorBits) >> 24; | |
198 | } | |
199 | ||
200 | static UInt_t GetRawVMinor(UInt_t *word) | |
201 | { | |
202 | return (*word & skRawVMinorBits) >> 31; | |
203 | } | |
204 | ||
205 | static UInt_t GetDCSBoard(UInt_t *word) | |
206 | { | |
207 | return (*word & skDCSBoardBits) >> 20; | |
208 | } | |
209 | ||
210 | static UInt_t GetSM(UInt_t *word) | |
211 | { | |
212 | return (*word & skHCSMBits) >> 9; | |
213 | } | |
214 | ||
215 | static UInt_t GetStack(UInt_t *word) | |
216 | { | |
217 | return (*word & skHCStackBits) >> 3; | |
218 | } | |
219 | ||
220 | static UInt_t GetLayer(UInt_t *word) | |
221 | { | |
222 | return (*word & skHCLayerBits) >> 6; | |
223 | } | |
224 | ||
225 | static UInt_t GetSide(UInt_t *word) | |
226 | { | |
227 | return (*word & skHCSideBits) >> 2; | |
228 | } | |
229 | ||
230 | static UInt_t GetExtraWords(UInt_t *word) | |
231 | { | |
232 | return (*word & skHCExtraWordsBits) >> 14; | |
233 | //fHCHWords = (*fDataWord >> 14) & 0x7; | |
234 | } | |
235 | ||
236 | // word 1 | |
237 | //static const UInt_t skTimeBinsBits = 0xfc << 26; | |
238 | static const UInt_t skTimeBinsBits = 0x3f << 26; | |
239 | static const UInt_t skBunchCrossCounterBits = 0xffff << 10; | |
240 | static const UInt_t skPreTriggerCounterBits = 0xf << 6; | |
241 | static const UInt_t skPreTriggerPhase = 0xf << 2; | |
242 | ||
243 | static UInt_t GetTimeBins(UInt_t *word) | |
244 | { | |
245 | return (*word & skTimeBinsBits) >> 26; | |
246 | } | |
247 | ||
248 | static UInt_t GetBunchCrossCounter(UInt_t *word) | |
249 | { | |
250 | return (*word & skBunchCrossCounterBits) >> 10; | |
251 | } | |
252 | ||
253 | static UInt_t GetPreTriggerCounter(UInt_t *word) | |
254 | { | |
255 | return (*word & skPreTriggerCounterBits) >> 6; | |
256 | } | |
257 | ||
258 | static UInt_t GetPreTriggerPhase(UInt_t *word) | |
259 | { | |
260 | return (*word & skPreTriggerPhase) >> 2; | |
261 | } | |
262 | ||
263 | struct AliTRDrawHCInfo | |
264 | { | |
265 | UInt_t fSpecialRawV; | |
266 | UInt_t fRawVMajor; | |
267 | UInt_t fRawVMinor; | |
268 | UInt_t fNExtraWords; | |
269 | UInt_t fDCSboard; | |
270 | UInt_t fSM; | |
271 | UInt_t fStack; | |
272 | UInt_t fLayer; | |
273 | UInt_t fSide; | |
274 | ||
275 | /* fBCctr = (*fDataWord >> 16); */ | |
276 | /* fPTctr = (*fDataWord >> 12) & 0xf; */ | |
277 | /* fPTphase = (*fDataWord >> 8) & 0xf; */ | |
278 | /* fTBins = ((*fDataWord >> 2) & 0x3f) + 1; */ | |
279 | /* fTimeWords = (fTBins - 1)/3 + 1; */ | |
280 | ||
281 | UInt_t fTimeBins; | |
282 | UInt_t fBunchCrossCounter; | |
283 | UInt_t fPreTriggerCounter; | |
284 | UInt_t fPreTriggerPhase; | |
285 | ||
286 | void DecodeH0(UInt_t *word) | |
287 | { | |
288 | fSpecialRawV = GetSpecialRawV(word); | |
289 | fRawVMajor = GetRawVMajor(word); | |
290 | fRawVMinor = GetRawVMinor(word); | |
291 | fNExtraWords = GetExtraWords(word); | |
292 | fDCSboard = GetDCSBoard(word); | |
293 | fSM = GetSM(word); | |
294 | fStack = GetStack(word); | |
295 | fLayer = GetLayer(word); | |
296 | fSide = GetSide(word); | |
297 | } | |
298 | ||
299 | void DecodeH1(UInt_t *word) | |
300 | { | |
301 | fTimeBins = GetTimeBins(word); | |
302 | fBunchCrossCounter = GetBunchCrossCounter(word); | |
303 | fPreTriggerCounter = GetPreTriggerCounter(word); | |
304 | fPreTriggerPhase = GetPreTriggerPhase(word); | |
305 | } | |
306 | ||
307 | void Dump() | |
308 | { | |
309 | /* printf("[I] HC Info is : DCSboard %d SM %d Stack %d Layer %d Side %d \n", */ | |
310 | /* fDCSboard, fSM, fStack, fLayer, fSide); */ | |
311 | printf("[I] HC Info is : RawV %d SM %d Stack %d Layer %d Side %d \n", | |
312 | fRawVMajor, fSM, fStack, fLayer, fSide); | |
313 | } | |
314 | }; | |
315 | ||
316 | //-------------------------------------------------------- | |
317 | // MCM word masks | |
318 | static const UInt_t skROBBits = 0x70000000; // 0x7 << 28 | |
319 | static const UInt_t skMCMBits = 0x0f000000; // 0xf << 24 | |
320 | static const UInt_t skHCEvCounterBits = 0x00fffff0; //0x00fffff << 4 | |
321 | ||
322 | static UInt_t GetROB(UInt_t *word) | |
323 | { | |
324 | return (*word & skROBBits) >> 28; | |
325 | } | |
326 | ||
327 | static UInt_t GetMCM(UInt_t *word) | |
328 | { | |
329 | return (*word & skMCMBits) >> 24; | |
330 | } | |
331 | ||
332 | static UInt_t GetEvCounter(UInt_t *word) | |
333 | { | |
334 | return (*word & skHCEvCounterBits) >> 4; | |
335 | } | |
336 | ||
337 | struct AliTRDrawMCMInfo | |
338 | { | |
339 | UInt_t fROB; | |
340 | UInt_t fMCM; | |
341 | UInt_t fEvCounter; | |
342 | ||
343 | void Decode(UInt_t *word) | |
344 | { | |
345 | fROB = GetROB(word); | |
346 | fMCM = GetMCM(word); | |
347 | fEvCounter = GetEvCounter(word); | |
348 | } | |
349 | ||
350 | void Dump() | |
351 | { | |
352 | printf("[I] MCM Info is : ROB %d MCM %d EvCounter %d\n", fROB, fMCM, fEvCounter); | |
353 | } | |
354 | }; | |
355 | ||
356 | } | |
357 | ||
358 | class AliTRDRawStreamTB: public TObject { | |
359 | ||
360 | public : | |
361 | ||
362 | AliTRDRawStreamTB(); | |
363 | AliTRDRawStreamTB(AliRawReader *rawReader); | |
364 | virtual ~AliTRDRawStreamTB(); | |
365 | ||
366 | virtual Bool_t Next(); // Read the next data | |
367 | virtual Int_t NextChamber(AliTRDdigitsManager *man); // read next chamber data | |
368 | virtual Int_t Init(); // Init for the fRawVersion > 1 | |
369 | ||
370 | enum { kDDLOffset = 0x400 }; // Offset for DDL numbers | |
371 | ||
372 | Bool_t SetRawVersion(Int_t rv); | |
373 | Int_t GetRawVersion() const { return fRawVersion; }; | |
374 | void SetRawReader(AliRawReader *rawReader); | |
375 | ||
376 | // Get Filter settings (does not make a lot of sense): | |
377 | Int_t TRAPfilterTCon() const { return fTCon; }; | |
378 | Int_t TRAPfilterPEDon() const { return fPEDon; }; | |
379 | Int_t TRAPfilterGAINon() const { return fGAINon; }; | |
380 | Int_t TRAPsendsUnfilteredData() const { return fBypass; }; | |
381 | ||
382 | // Get Tracklet parameters (does not make a lot of sense): | |
383 | Float_t GetTrackletPID() const { return fTracklPID; }; | |
384 | Float_t GetTrackletDeflLength() const { return fTracklDefL; }; | |
385 | Float_t GetTrackletPadPos() const { return fTracklPadPos; }; | |
386 | Int_t GetTrackletPadRow() const { return fTracklPadRow; }; | |
387 | ||
388 | // Check if the link has optical power (HC sends data) | |
389 | Bool_t IsGTULinkActive(Int_t sm, Int_t la, Int_t sta, Int_t side) | |
390 | { return ( ((fGTUlinkMask[sm][sta]) >> (2*la+side)) & 0x1 ); }; | |
391 | ||
392 | static void SetStackIndexBug(Bool_t val) {fgStackIndexBug = val;} | |
393 | static void SetForceRawVersion(Int_t val) {fgForceRawVersion = val;} | |
394 | static void SupressWarnings(Bool_t val) {fgSupressWarnings = val;} | |
395 | static void ExtraDebug(Bool_t val) {fgExtraDebug = val;} | |
396 | static void RawBufferMissAligned(Bool_t val) {fgRawDataHack = val;} | |
397 | ||
398 | Int_t *GetSignals() { return fSig;} // Signals in the three time bins from Data Word | |
399 | Int_t GetADC() const { return fADC;} // MCM ADC channel and Time Bin of word 1 | |
400 | Int_t GetTimeBin() const { return fTB - 3;} // MCM ADC channel and Time Bin of word 1 | |
401 | Int_t GetEventNumber() const { return fEv;} // MCM Event number and position of current MCM on TRD chamber | |
402 | Int_t GetROB() const { return fROB;} // MCM Event number and position of current MCM on TRD chamber | |
403 | Int_t GetMCM() const { return fMCM;} // MCM Event number and position of current MCM on TRD chamber | |
404 | Int_t GetSM() const { return fSM;} // Position of CURRENT half chamber in full TRD | |
405 | Int_t GetLayer() const { return fLAYER;} // PLANE = Position of CURRENT half chamber in full TRD | |
406 | Int_t GetStack() const { return fSTACK;} // CHAMBER = Position of CURRENT half chamber in full TRD | |
407 | Int_t GetROC() const { return fROC;} // Position of CURRENT half chamber in full TRD | |
408 | Int_t GetSide() const { return fSIDE;} // Position of CURRENT half chamber in full TRD | |
409 | Int_t GetDCS() const { return fDCS;} // DCS board number read from data (HC header) | |
410 | Int_t GetRow() const { return fROW;} | |
411 | Int_t GetCol() const { return fCOL;} // Detector Pad coordinates | |
412 | Int_t GetDet() const { return fDET;} // helper | |
413 | Int_t GetLastDet() const { return fLastDET;} // helper | |
414 | Int_t GetMaxRow() const { return fRowMax;} | |
415 | Int_t GetMaxCol() const { return fColMax;} | |
416 | Int_t GetNumberOfTimeBins() const {return fTBins;} | |
417 | ||
418 | Int_t GetCommonAdditive() const {return fCommonAdditive;} | |
419 | Bool_t IsCurrentPadShared() const {return fIsPadShared;} | |
420 | void SetSharedPadReadout(Bool_t fv) {fSharedPadsOn = fv;} | |
421 | Bool_t IsDataZeroSuppressed() const {return fZeroSuppressed;} | |
422 | ||
423 | private : | |
424 | ||
425 | Int_t fSig[3]; // Signals in the three time bins from Data Word | |
426 | Int_t fADC; // MCM ADC channel and Time Bin of word 1 | |
427 | Int_t fMaxADCgeom; // Max ADC number as returned by AliTRDgeometry::ADCmax() | |
428 | Int_t fTB; // MCM ADC channel and Time Bin of word 1 | |
429 | Int_t fEv; // MCM Event number and position of current MCM on TRD chamber | |
430 | Int_t fROB; // MCM Event number and position of current MCM on TRD chamber | |
431 | Int_t fMCM; // MCM Event number and position of current MCM on TRD chamber | |
432 | Int_t fSM; // Position of CURRENT half chamber in full TRD | |
433 | Int_t fLAYER; // Position of CURRENT half chamber in full TRD | |
434 | Int_t fSTACK; // Position of CURRENT half chamber in full TRD | |
435 | Int_t fROC; // Position of CURRENT half chamber in full TRD | |
436 | Int_t fSIDE; // Position of CURRENT half chamber in full TRD | |
437 | Int_t fDCS; // DCS board number read from data (HC header) | |
438 | Int_t fROW; // Detector Row coordinates | |
439 | Int_t fCOL; // Detector Pad coordinates | |
440 | Int_t fDET; // Current detector - version > 1 | |
441 | Int_t fLastDET; // Previous detector - version > 1 | |
442 | ||
443 | Int_t fBCctr; // Counters from HC header (>=V2) | |
444 | Int_t fPTctr; // Counters from HC header (>=V2) | |
445 | Int_t fPTphase; // Counters from HC header (>=V2) | |
446 | Int_t fRVmajor; // Raw version numbers and number of additional HC headerwords (>=V2) | |
447 | Int_t fRVminor; // Raw version numbers and number of additional HC headerwords (>=V2) | |
448 | Int_t fHCHWords; // Raw version numbers and number of additional HC headerwords (>=V2) | |
449 | Int_t fTBins; // Number of time bins read from HC header (>=V2) | |
450 | Bool_t fTCon; // Filter settings read from HC header (>=V2) | |
451 | Bool_t fPEDon; // Filter settings read from HC header (>=V2) | |
452 | Bool_t fGAINon; // Filter settings read from HC header (>=V2) | |
453 | Bool_t fXTon; // Filter settings read from HC header (>=V2) | |
454 | Bool_t fNonLinOn; // Filter settings read from HC header (>=V2) | |
455 | Bool_t fBypass; // Filter settings read from HC header (>=V2) | |
456 | Int_t fCommonAdditive; // Common baseline additive read from HC header (>=V2) | |
457 | ||
458 | Bool_t fZeroSuppressed; // Data is zero suppressed | |
459 | ||
460 | Int_t fHCHctr1; // HC and MCM Header counter | |
461 | Int_t fHCHctr2; // HC and MCM Header counter | |
462 | Int_t fMCMHctr1; // HC and MCM Header counter | |
463 | Int_t fMCMHctr2; // HC and MCM Header counter | |
464 | Int_t fGTUctr1; // GTU LinkMask Counter | |
465 | Int_t fGTUctr2; // GTU LinkMask Counter | |
466 | Int_t fHCdataCtr; // Data Counter for half chamber | |
467 | ||
468 | Float_t fTracklPID; // Tracklet parameters | |
469 | Float_t fTracklDefL; // Tracklet parameters | |
470 | Float_t fTracklPadPos; // Tracklet parameters | |
471 | Int_t fTracklPadRow; // Tracklet parameters | |
472 | ||
473 | UShort_t fGTUlinkMask[18][5]; // Mask with active links | |
474 | ||
475 | Int_t fMCMWordCrt; // Word Counter for a single MCM | |
476 | Int_t fMCMWordsExpected; // Expected Words from MCM | |
477 | ||
478 | AliTRDRawStreamTB(const AliTRDRawStreamTB &stream); | |
479 | AliTRDRawStreamTB &operator=(const AliTRDRawStreamTB &stream); | |
480 | void SwapOnEndian(); | |
481 | ||
482 | AliRawReader *fRawReader; // Object for reading the raw data | |
483 | ||
484 | Int_t fRawVersion; // Which version of raw data decoding is used | |
485 | Int_t fRawDigitThreshold; // Naive "zero"(threshold) supression. Usefull for Raw Data ver 2. | |
486 | ||
487 | Int_t fNextStatus; // Navigation in raw versions > 1 | |
488 | Int_t fLastStatus; // Navigation in raw versions > 1 | |
489 | UInt_t fTbSwitch; // Time Bin Switch for internal use | |
490 | UInt_t fTbSwitchCtr; // Counter for internal use | |
491 | UInt_t fTimeWords; // Number of Words needed to store the data of 1 ADC ch. | |
492 | UInt_t fWordCtr; // Word Counter | |
493 | ||
494 | Int_t fRowMax; // Maximum number of pad rows and columns | |
495 | Int_t fColMax; // Maximum number of pad rows and columns | |
496 | ||
497 | Bool_t fADCmask[21]; // Mask of active ADCs for zero suppression | |
498 | UInt_t fLastADCmask; // Last ADC read out | |
499 | ||
500 | Int_t fChamberDone[540]; // Chamber was processed already (1=1HC, 2=full chamber) | |
501 | ||
502 | Int_t fRetVal; // Datadecode return | |
503 | Int_t fEqID; // Equipment id | |
504 | UInt_t fDataSize; // Size of the data available in the current buffer | |
505 | Bool_t fSizeOK; // Did we read anything | |
506 | UInt_t fCountBytes; // Bytes traversed in the buffer | |
507 | UInt_t fBufSize; // Size of the current RawReader buffer | |
508 | Bool_t fkBufferSet; // Is the RawReader buffer available | |
509 | UChar_t *fPos; // Position in the buffer of the RawReader | |
510 | UInt_t *fDataWord; // The pointer to the current 32 bit data word | |
511 | UInt_t fTimeBinsCalib; // N of time bins retrieved from calibration | |
512 | ||
513 | Int_t fADClookup[32]; // Lookup for version 3 (1[entries]+1[index]+30[fADC channels] = 32) | |
514 | Int_t fNActiveADCs; // Number of active ADC channels | |
515 | Bool_t fEndOfDataFlag; // End of data flag | |
516 | ||
517 | AliTRDrawDataUtilsTB::AliTRDrawSMinfo fSMinfo[18]; // Super module info | |
518 | AliTRDrawDataUtilsTB::AliTRDrawStackInfo fStackInfo[18][5]; // Stack info | |
519 | AliTRDrawDataUtilsTB::AliTRDrawHCInfo fHCInfo; // Half chamber info | |
520 | AliTRDrawDataUtilsTB::AliTRDrawMCMInfo fMCMInfo; // MCM info | |
521 | ||
522 | Int_t fiSMx; // Position of CURRENT half chamber in full TRD | |
523 | static Bool_t fgStackIndexBug; // Buggy index word flag | |
524 | ||
525 | Bool_t fSharedPadsOn; // Should we return on shared pad readout | |
526 | Bool_t fIsPadShared; // Set if the current pad is shared | |
527 | static Int_t fgForceRawVersion; // Force the raw version specified | |
528 | static Bool_t fgSupressWarnings; // Superss warnings (raw data version and TB missmatch) | |
529 | static Bool_t fgExtraDebug; // Extra info on the screen | |
530 | static Bool_t fgRawDataHack; // skip 23 words - a hack for the DATE raw format | |
531 | enum ETRDzRawStreamError { | |
532 | kHCWordMissing = 1 // | |
533 | ,kMCMADCMaskMissing = 2 // | |
534 | ,kWrongMCMorROB = 3 // | |
535 | ,kGTULinkMaskMissing = 4 // | |
536 | ,kHCHeaderCorrupt = 5 // | |
537 | ,kHCHeaderMissing = 6 // | |
538 | ,kROBSideMismatch = 7 // | |
539 | ,kWrongPadrow = 8 // | |
540 | ,kWrongPadcolumn = 9 // | |
541 | ,kTrackletRowMismatch = 10 // | |
542 | ,kDataMaskError = 11 // | |
543 | ,kADCNumberOverflow = 12 // | |
544 | ,kADCChannelOverflow = 13 // | |
545 | }; | |
546 | ||
547 | protected: | |
548 | ||
549 | AliTRDgeometry *fGeo; // TRD geometry | |
550 | ||
551 | Bool_t DecodeGTUlinkMask(); | |
552 | Bool_t DecodeADCWord(); | |
553 | Bool_t DecodeNextRawWord(); | |
554 | Bool_t DecodeMCM(); | |
555 | Bool_t DecodeHC(); | |
556 | Bool_t DecodeSM(); | |
557 | inline void ChangeStatus(Int_t kstat); | |
558 | ||
559 | void DecodeHCheader(Int_t timeBins = 0); | |
560 | void DecodeMCMheader(); | |
561 | void DecodeTracklet(); | |
562 | ||
563 | void SetRawDigitThreshold (Int_t ith) {fRawDigitThreshold = ith;} // set the naive zero suppression threshold | |
564 | ||
565 | Int_t NextData(); // get the next piece of memory | |
566 | Int_t RewindWord(); //go back one word | |
567 | ||
568 | Int_t ChannelsToRead(Int_t ADCmask); // Get the active ADC channels from the mask (V3 and 2) | |
569 | ||
570 | Int_t SkipWords(UInt_t iw); | |
571 | Int_t DecodeHeadingInfo(); | |
572 | ||
573 | enum { kStart | |
574 | , kStop | |
575 | , kWordOK | |
576 | , kNoMoreData | |
577 | , kNextSM | |
578 | , kNextHC | |
579 | , kSeekNonEoTracklet | |
580 | , kDecodeHC | |
581 | , kNextMCM | |
582 | , kNextData | |
583 | , kReading }; | |
584 | ||
585 | ClassDef(AliTRDRawStreamTB, 1) // Class for reading TRD raw digits | |
586 | ||
587 | }; | |
588 | #endif |