Suppress HC warning (MinJung)
[u/mrichter/AliRoot.git] / TRD / AliTRDrawFastStream.cxx
CommitLineData
ae069393 1/**************************************************************************\r\r
2* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r\r
3* *\r\r
4* Author: The ALICE Off-line Project. *\r\r
5* Contributors are mentioned in the code where appropriate. *\r\r
6* *\r\r
7* Permission to use, copy, modify and distribute this software and its *\r\r
8* documentation strictly for non-commercial purposes is hereby granted *\r\r
9* without fee, provided that the above copyright notice appears in all *\r\r
10* copies and that both the copyright notice and this permission notice *\r\r
11* appear in the supporting documentation. The authors make no claims *\r\r
12* about the suitability of this software for any purpose. It is *\r\r
13* provided "as is" without express or implied warranty. *\r\r
14**************************************************************************/\r\r
15\r\r
16/* $Id: AliTRDrawFastStream.cxx 27797 2008-08-05 14:37:22Z cblume $ */\r\r
17\r\r
18////////////////////////////////////////////////////////////////////////////////\r\r
19// //\r\r
20// This class provides access to TRD digits in raw data in a way of streaming //\r\r
21// //\r\r
22// It loops over all TRD digits in the raw data given by the AliRawReader. //\r\r
23// The Next method goes to the next digit. If there are no digits left //\r\r
24// it returns kFALSE. //\r\r
25// Several getters provide information about the current digit. //\r\r
26// //\r\r
27// Author: M. Ploskon (ploskon@ikf.uni-frankfurt.de) // \r\r
28// Author: MinJung Kweon (minjung@physi.uni-heidelberg.de) //\r\r
29// //\r\r
30////////////////////////////////////////////////////////////////////////////////\r\r
31\r\r
32#include "TFile.h"\r\r
33\r\r
34#include "AliTRDrawFastStream.h"\r\r
35#include "AliTRDgeometry.h"\r\r
36#include "AliTRDfeeParam.h"\r\r
37#include "AliTRDdigitsManager.h"\r\r
38#include "AliTRDarrayDictionary.h"\r\r
39#include "AliTRDarrayADC.h"\r\r
40#include "AliTRDSignalIndex.h"\r\r
41#include "AliTRDdigitsParam.h"\r\r
42\r\r
43#include "AliRawReader.h"\r\r
44\r\r
45#define END_OF_TRACKLET_MARKEROLD 0xaaaaaaaa\r\r
46#define END_OF_TRACKLET_MARKERNEW 0x10001000\r\r
47#define ENDOFRAWDATAMARKER 0x00000000\r\r
48#define WORD_SIZE sizeof(UInt_t) // size of a word in bytes\r\r
49#define EXTRA_LEAD_WORDS 24\r\r
50#define CDH_WORDS 8\r\r
51\r\r
52#define IS_BIT_SET(w,b) ( ((w) >> (b)) & 0x1 ) // 1 if bit b is set in word w\r\r
53#define GET_VALUE_AT(w,m,s) (( (w) >> (s)) & (m) ) // get value of word w rshifted by s and mask with m\r\r
54\r\r
55// SM index word masks:\r\r
56#define SM_HEADER_SIZE(w) GET_VALUE_AT(w,0xffff,16) \r\r
57#define TRACKLETS_ENABLED(w) IS_BIT_SET(w,5)\r\r
58#define STACK_MASK(w) ((w) & 0x1f)\r\r
59\r\r
60// Stack word masks\r\r
61#define STACK_HEADER_SIZE(w) GET_VALUE_AT(w,0xffff,16)\r\r
62#define STACK_LINK_WORD(w) ((w) & 0xfff)\r\r
63#define LINK0_DATA_TYPE_FLAG(w) (GET_VALUE_AT(w,0x3,4) == (0x0) ? 0 : 1) // 0 if physics data\r\r
64#define LINK1_DATA_TYPE_FLAG(w) (GET_VALUE_AT(w,0x3,20) == (0x0) ? 0 : 1) // 0 if physics data\r\r
65#define LINK0_MONITOR_FLAG(w) (GET_VALUE_AT(w,0xf,0) == (0x0) ? 0 : 1) // 0 if OK\r\r
66#define LINK1_MONITOR_FLAG(w) (GET_VALUE_AT(w,0xf,16) == (0x0) ? 0 : 1) // 0 if OK\r\r
67\r\r
68// HC word masks\r\r
69//#define HC_HEADER_MASK_ERR(w) ( ((w) & (0x80000003)) == (0x80000001) ? 0 : 1) // 0 if OK!!!\r\r
70#define HC_HEADER_MASK_ERR(w) ( ((w) & (0x3)) == (0x1) ? 0 : 1) // 0 if OK!!!\r\r
71\r\r
72// HC word 0\r\r
73#define HC_SPECIAL_RAW_VERSION(w) IS_BIT_SET(w,31)\r\r
74#define HC_MAJOR_RAW_VERSION(w) GET_VALUE_AT(w,0x7f,24)\r\r
75#define HC_MAJOR_RAW_VERSION_OPT(w) GET_VALUE_AT(w,0x7,24)\r\r
76#define HC_MINOR_RAW_VERSION(w) GET_VALUE_AT(w,0x7f,17)\r\r
77#define HC_EXTRA_WORDS(w) GET_VALUE_AT(w,0x7,14)\r\r
78#define HC_DCS_BOARD(w) GET_VALUE_AT(w,0xfff<<20,20)\r\r
79#define HC_SM_NUMBER(w) GET_VALUE_AT(w,0x1f,9)\r\r
80#define HC_LAYER_NUMBER(w) GET_VALUE_AT(w,0x7,6)\r\r
81#define HC_STACK_NUMBER(w) GET_VALUE_AT(w,0x7,3)\r\r
82#define HC_SIDE_NUMBER(w) IS_BIT_SET(w,2)\r\r
83\r\r
84// HC word 1\r\r
85#define HC_NTIMEBINS(w) GET_VALUE_AT(w,0x3f,26)\r\r
86#define HC_BUNCH_CROSS_COUNTER(w) GET_VALUE_AT(w,0xffff,10)\r\r
87#define HC_PRETRIGGER_COUNTER(w) GET_VALUE_AT(w,0xf,6)\r\r
88#define HC_PRETRIGGER_PHASE(w) GET_VALUE_AT(w,0xf,2)\r\r
89\r\r
90// MCM word and ADC mask\r\r
91#define MCM_HEADER_MASK_ERR(w) ( ((w) & (0xf)) == (0xc) ? 0 : 1) // 0 if OK!!!\r\r
92#define MCM_ADCMASK_MASK_ERR(w) ( ((w) & (0xf)) == (0xc) ? 0 : 1) // 0 if OK!!!\r\r
93#define MCM_MCM_NUMBER(w) GET_VALUE_AT(w,0x0f,24)\r\r
94#define MCM_ROB_NUMBER(w) GET_VALUE_AT(w,0x7,28)\r\r
95#define MCM_EVENT_COUNTER(w) GET_VALUE_AT(w,0x00fffff,4)\r\r
96#define MCM_ADCMASK_VAL(w) GET_VALUE_AT(w,0x1fffff,4)\r\r
97#define MCM_ADCMASK_NADC(w) GET_VALUE_AT(w,0x1f,25)\r\r
98\r\r
99#define MCM_DUMMY_ADCMASK_VAL 0x015fffffc // updated \r\r
100#define ADCDATA_VAL1 0x2 // updated \r\r
101#define ADCDATA_VAL2 0x3 // updated \r\r
102\r\r
103//--------------------------------------------------------\r\r
104#define ADC_WORD_MASK(w) ((w) & 0x3)\r\r
105//--------------------------------------------------------\r\r
106ClassImp(AliTRDrawFastStream)\r\r
107\r\r
108Bool_t AliTRDrawFastStream::fgExtraSkip = kFALSE;\r\r
109Bool_t AliTRDrawFastStream::fgSkipCDH = kFALSE;\r\r
110Bool_t AliTRDrawFastStream::fgCleanDataOnly = kFALSE;\r\r
111Bool_t AliTRDrawFastStream::fgDebugFlag = kTRUE;\r\r
112Bool_t AliTRDrawFastStream::fgEnableMemoryReset = kTRUE;\r\r
113Bool_t AliTRDrawFastStream::fgStackNumberChecker = kTRUE;\r\r
114Bool_t AliTRDrawFastStream::fgStackLinkNumberChecker = kFALSE;\r\r
115Bool_t AliTRDrawFastStream::fgSkipData = kTRUE;\r\r
116Bool_t AliTRDrawFastStream::fgEnableDecodeConfigData = kFALSE;\r\r
117Int_t AliTRDrawFastStream::fgDumpHead = -1;\r\r
118Short_t AliTRDrawFastStream::fgMCMordering[] =\r\r
119 {\r\r
120 12, 13, 14, 15, 8, 9, 10, 11, 4, 5, 6, 7, 0, 1, 2, 3 \r\r
121 };\r\r
122Short_t AliTRDrawFastStream::fgROBordering[] =\r\r
123 {\r\r
124 0, 1, 2, 3\r\r
125 };\r\r
126\r\r
127Int_t AliTRDrawFastStream::fgLastHC = -1;\r\r
128Int_t AliTRDrawFastStream::fgLastROB = -1;\r\r
129Int_t AliTRDrawFastStream::fgLastIndex = -1;\r\r
130\r\r
131//--------------------------------------------------------\r\r
132AliTRDrawFastStream::AliTRDrawFastStream()\r\r
133 : AliTRDrawStreamBase()\r\r
134 , fSM()\r\r
135 , fStack(0)\r\r
136 , fHC(0)\r\r
137 , fLastHC(0)\r\r
138 , fMCM()\r\r
139 , fpPos(0)\r\r
140 , fpBegin(0)\r\r
141 , fpEnd(0)\r\r
142 , fWordLength(0)\r\r
143 , fpPosTemp(0)\r\r
144 , fGlobalNTimeBins(0)\r\r
145 , fIsTimeBinSet(kFALSE)\r\r
146 , fStackNumber(-1)\r\r
147 , fStackLinkNumber(-1)\r\r
148 , fLinkTrackletCounter(-1)\r\r
149 , fEndOfTrackletCount(-1)\r\r
150 , fNWordsCounter(-1)\r\r
151 , fMaskADCword(0)\r\r
152 , fTbinADC(0)\r\r
153 , fEventCounter(0)\r\r
154 , fLastEventCounter(0)\r\r
155 , fSharedPadsOn(kTRUE)\r\r
156 , fMaxADCgeom(0)\r\r
157 , fADCnumber(0)\r\r
158 , fCOL(0)\r\r
159 , fExtendedCOL(0)\r\r
160 , fIsShared(0)\r\r
161 , fWarnError(kTRUE)\r\r
162 , fWarnWarning(kFALSE)\r\r
163 , fBufferRead(0)\r\r
164 , fGeometry(0)\r\r
165 , fRawReader(0)\r\r
166 , fTRDfeeParam(0)\r\r
167 , fCommonAdditive(0)\r\r
168{\r\r
169 //\r\r
170 // default constructor\r\r
171 //\r\r
172\r\r
173 if (Init() == kFALSE) {\r\r
174 AliWarning("Unable to Init."); \r\r
175 }\r\r
176}\r\r
177\r\r
178//--------------------------------------------------------\r\r
179AliTRDrawFastStream::AliTRDrawFastStream(AliRawReader *rawReader)\r\r
180 : AliTRDrawStreamBase(rawReader)\r\r
181 , fSM()\r\r
182 , fStack(0)\r\r
183 , fHC(0)\r\r
184 , fLastHC(0)\r\r
185 , fMCM()\r\r
186 , fpPos(0)\r\r
187 , fpBegin(0)\r\r
188 , fpEnd(0)\r\r
189 , fWordLength(0)\r\r
190 , fpPosTemp(0)\r\r
191 , fGlobalNTimeBins(0)\r\r
192 , fIsTimeBinSet(kFALSE)\r\r
193 , fStackNumber(-1)\r\r
194 , fStackLinkNumber(-1)\r\r
195 , fLinkTrackletCounter(-1)\r\r
196 , fEndOfTrackletCount(-1)\r\r
197 , fNWordsCounter(-1)\r\r
198 , fMaskADCword(0)\r\r
199 , fTbinADC(0)\r\r
200 , fEventCounter(0)\r\r
201 , fLastEventCounter(0)\r\r
202 , fSharedPadsOn(kTRUE)\r\r
203 , fMaxADCgeom(0)\r\r
204 , fADCnumber(0)\r\r
205 , fCOL(0)\r\r
206 , fExtendedCOL(0)\r\r
207 , fIsShared(0)\r\r
208 , fWarnError(kTRUE)\r\r
209 , fWarnWarning(kFALSE)\r\r
210 , fBufferRead(0)\r\r
211 , fGeometry(0)\r\r
212 , fRawReader(rawReader)\r\r
213 , fTRDfeeParam(0)\r\r
214 , fCommonAdditive(0)\r\r
215{\r\r
216 //\r\r
217 // default constructor\r\r
218 //\r\r
219 if (fRawReader) {\r\r
220 if (Init() == kFALSE) {\r\r
221 AliWarning("Unable to Init. Try setting up the reader with SetReader or buffer with Init(void *, UInt_t )"); \r\r
222 }\r\r
223 }\r\r
224 else {\r\r
225 AliWarning("Unable to setup reader. Use SetReader(AliRawReader*).");\r\r
226 }\r\r
227}\r\r
228\r\r
229//------------------------------------------------------------\r\r
230AliTRDrawFastStream::AliTRDrawFastStream(const AliTRDrawFastStream& /*st*/)\r\r
231 : AliTRDrawStreamBase()\r\r
232 , fSM()\r\r
233 , fStack(0)\r\r
234 , fHC(0)\r\r
235 , fLastHC(0)\r\r
236 , fMCM()\r\r
237 , fpPos(0)\r\r
238 , fpBegin(0)\r\r
239 , fpEnd(0)\r\r
240 , fWordLength(0)\r\r
241 , fpPosTemp(0)\r\r
242 , fGlobalNTimeBins(0)\r\r
243 , fIsTimeBinSet(kFALSE)\r\r
244 , fStackNumber(-1)\r\r
245 , fStackLinkNumber(-1)\r\r
246 , fLinkTrackletCounter(-1)\r\r
247 , fEndOfTrackletCount(-1)\r\r
248 , fNWordsCounter(-1)\r\r
249 , fMaskADCword(0)\r\r
250 , fTbinADC(0)\r\r
251 , fEventCounter(0)\r\r
252 , fLastEventCounter(0)\r\r
253 , fSharedPadsOn(kTRUE)\r\r
254 , fMaxADCgeom(0)\r\r
255 , fADCnumber(0)\r\r
256 , fCOL(0)\r\r
257 , fExtendedCOL(0)\r\r
258 , fIsShared(0)\r\r
259 , fWarnError(kTRUE)\r\r
260 , fWarnWarning(kFALSE)\r\r
261 , fBufferRead(0)\r\r
262 , fGeometry(0)\r\r
263 , fRawReader(0)\r\r
264 , fTRDfeeParam(0)\r\r
265 , fCommonAdditive(0)\r\r
266{\r\r
267 //\r\r
268 // Copy constructor\r\r
269 // \r\r
270 AliError("Not implemeneted.");\r\r
271}\r\r
272\r\r
273//------------------------------------------------------------\r\r
274Bool_t AliTRDrawFastStream::SetRawVersion(Int_t fraw)\r\r
275{\r\r
276 //\r\r
277 // function provided for backward compatibility\r\r
278 //\r\r
279 AliWarning("Raw data version is read from raw data stream! No point of setting it in here.");\r\r
280 fraw = 0; // avoid warnings\r\r
281 return kFALSE;\r\r
282}\r\r
283\r\r
284//------------------------------------------------------------\r\r
285AliTRDrawFastStream::~AliTRDrawFastStream()\r\r
286{\r\r
287 //\r\r
288 // destructor\r\r
289 //\r\r
290 delete fGeometry;\r\r
291}\r\r
292\r\r
293//------------------------------------------------------------\r\r
294\r\r
295AliTRDrawFastStream &\r\r
296AliTRDrawFastStream::operator=(const AliTRDrawFastStream &)\r\r
297{\r\r
298 //\r\r
299 // we are not using this functionality\r\r
300 //\r\r
301 AliFatal("May not use.");\r\r
302 return *this;\r\r
303}\r\r
304\r\r
305//___________________________________________________________\r\r
306void AliTRDrawFastStream::SwapOnEndian()\r\r
307{\r\r
308 //\r\r
309 // Check the endian and swap if needed\r\r
310 //\r\r
311 int itemp = 1;\r\r
312 char* ptemp = (char*) &itemp;\r\r
313 if (ptemp[0] != 1)\r\r
314 {\r\r
315 if (fgDebugFlag) AliDebug(8, "Swapping.");\r\r
316\r\r
317 fpPos = fpBegin;\r\r
318 UInt_t iutmp = 0;\r\r
319 while (fpPos < fpEnd)\r\r
320 {\r\r
321 fpPos += 1;\r\r
322 iutmp = (((*fpPos & 0x000000ffU) << 24) | ((*fpPos & 0x0000ff00U) << 8) |\r\r
323 ((*fpPos & 0x00ff0000U) >> 8) | ((*fpPos & 0xff000000U) >> 24));\r\r
324 // here we override the value in the buffer!\r\r
325 *fpPos = iutmp; \r\r
326 }\r\r
327 fpPos = fpBegin;\r\r
328 }\r\r
329}\r\r
330\r\r
331//------------------------------------------------------------\r\r
332Bool_t AliTRDrawFastStream::SkipWords(UInt_t iw)\r\r
333{\r\r
334 //\r\r
335 // Skip words corresponding to iw\r\r
336 //\r\r
337 if ( fpPos + iw < fpEnd ) {\r\r
338 fpPos += iw;\r\r
339 return kTRUE;\r\r
340 }\r\r
341 else {\r\r
342 if (fWarnWarning) AliWarning(Form("Skip %d words failed. %d available", iw, fpEnd - fpPos - 1));\r\r
343 return kFALSE;\r\r
344 }\r\r
345\r\r
346 return kTRUE;\r\r
347}\r\r
348\r\r
349//------------------------------------------------------------\r\r
350Bool_t AliTRDrawFastStream::SetReader(AliRawReader *reader)\r\r
351{\r\r
352 // \r\r
353 // set raw reader pointer\r\r
354 // \r\r
355 if (reader != 0) {\r\r
356 fRawReader = reader;\r\r
357 if (fRawReader) {\r\r
358 return Init();\r\r
359 }\r\r
360 else {\r\r
361 AliWarning("Unable to setup reader.");\r\r
362 return kFALSE;\r\r
363 }\r\r
364 }\r\r
365 else {\r\r
366 AliWarning("AliRawReader argument is 0.");\r\r
367 fRawReader = 0;\r\r
368 }\r\r
369\r\r
370 return kFALSE;\r\r
371}\r\r
372\r\r
373//------------------------------------------------------------\r\r
374Int_t AliTRDrawFastStream::NextBuffer()\r\r
375{\r\r
376 //\r\r
377 // return -1 if no more buffers available\r\r
378 // return 0 if SMHeader decoding failed \r\r
379 // return 1 if SMHeader dedoding is OK\r\r
380 // \r\r
381 if (fRawReader != 0) {\r\r
382 UChar_t *buffer = 0;\r\r
383 UInt_t length = 0;\r\r
384 Bool_t kBufferSet = fRawReader->ReadNextData(buffer);\r\r
385 if (kBufferSet == kTRUE) {\r\r
386 if (fgDebugFlag) AliDebug(9, "Buffer is set.");\r\r
387 length = fRawReader->GetDataSize();\r\r
388 if (fgExtraSkip == kTRUE) {\r\r
389 buffer += EXTRA_LEAD_WORDS * WORD_SIZE;\r\r
390 length -= EXTRA_LEAD_WORDS * WORD_SIZE;\r\r
391 }\r\r
392\r\r
393 if (fgSkipCDH == kTRUE) {\r\r
394 buffer += CDH_WORDS * WORD_SIZE;\r\r
395 length -= CDH_WORDS * WORD_SIZE; \r\r
396 }\r\r
397\r\r
398 if (length > 0) {\r\r
399 if (fgDebugFlag) AliDebug(9, Form("Buffer length : %d", length));\r\r
400 if (fgEnableMemoryReset) ResetMemory(); \r\r
401 if (DecodeSMHeader((void*)buffer, length) == kTRUE)\r\r
402 return 1;\r\r
403 else\r\r
404 return 0;\r\r
405 }\r\r
406 }\r\r
407 else {\r\r
408 return -1;\r\r
409 }\r\r
410 }\r\r
411\r\r
412 return -1;\r\r
413}\r\r
414\r\r
415//------------------------------------------------------------\r\r
416void AliTRDrawFastStream::ResetCounters()\r\r
417{\r\r
418 //\r\r
419 // reset some global counters\r\r
420 //\r\r
421 fBufferRead = kFALSE; // kFALSE if no buffer read\r\r
422\r\r
423 fSM.fActiveStacks = 0;\r\r
424 fSM.fNexpectedHalfChambers = 0;\r\r
425\r\r
426 fLastEventCounter = 0;\r\r
427 fEventCounter = 0;\r\r
428\r\r
429 ResetIterators();\r\r
430}\r\r
431\r\r
432//------------------------------------------------------------\r\r
433void AliTRDrawFastStream::ResetIterators()\r\r
434{\r\r
435 //\r\r
436 // reset data which should be reset every sm\r\r
437 //\r\r
438 fStackNumber = 0; \r\r
439 fStackLinkNumber = 0; \r\r
440}\r\r
441\r\r
442//------------------------------------------------------------\r\r
443void AliTRDrawFastStream::ResetPerSM()\r\r
444{\r\r
445 //\r\r
446 // reset every SM\r\r
447 //\r\r
448 fSM.fHeaderSize = 0;\r\r
449 fSM.fTrackletEnable = kFALSE;\r\r
450 fSM.fCorrupted = 0;\r\r
451 fSM.fNexpectedHalfChambers = 0;\r\r
452 fSM.fNexpectedHalfChambers = 0;\r\r
453 fSM.fPos = NULL;\r\r
454 for (Int_t i=0; i<5; i++) {\r\r
455 fSM.fStackActive[i] = kFALSE;\r\r
456 }\r\r
457}\r\r
458\r\r
459//------------------------------------------------------------\r\r
460void AliTRDrawFastStream::ResetPerStack()\r\r
461{\r\r
462 //\r\r
463 // reset every Stack\r\r
464 //\r\r
465 fStack->fHeaderSize = 0;\r\r
466 fStack->fActiveLinks = 0;\r\r
467 fStack->fPos = NULL;\r\r
468 for (Int_t i=0; i<12; i++) {\r\r
469 fStack->fLinksActive[i] = kFALSE;\r\r
470 fStack->fLinksDataType[i] = 0;\r\r
471 fStack->fLinksMonitor[i] = 0;\r\r
472 fStack->fLinkMonitorError[i] = 0;\r\r
473 }\r\r
474}\r\r
475\r\r
476//------------------------------------------------------------\r\r
477void AliTRDrawFastStream::ResetPerHC()\r\r
478{\r\r
479 //\r\r
480 // reset every HC\r\r
481 //\r\r
482 fEventCounter = 0;\r\r
483 fHC->fNTracklets = 0;\r\r
484 fHC->fSpecialRawV = 0;\r\r
485 fHC->fRawVMajor = 0;\r\r
486 fHC->fRawVMajorOpt = 0;\r\r
487 fHC->fRawVMinor = 0;\r\r
488 fHC->fNExtraWords = 0;\r\r
489 fHC->fDCSboard = 0;\r\r
490 fHC->fTimeBins = 0;\r\r
491 fHC->fBunchCrossCounter = 0;\r\r
492 fHC->fPreTriggerCounter = 0;\r\r
493 fHC->fPreTriggerPhase = 0;\r\r
494 fHC->fMCMmax = 0;\r\r
495\r\r
496 fHC->fSM = 0;\r\r
497 fHC->fStack = 0;\r\r
498 fHC->fStackHCheader = 0;\r\r
499 fHC->fLayer = 0;\r\r
500 fHC->fLayerHCheader = 0;\r\r
501 fHC->fSide = 0;\r\r
502 fHC->fSideHCheader = 0;\r\r
503 fHC->fDET = 0;\r\r
504 fHC->fROC = 0;\r\r
505 fHC->fRowMax = 0;\r\r
506 fHC->fColMax = 0;\r\r
507\r\r
508 fHC->fH0Corrupted = 0;\r\r
509 fHC->fH1Corrupted = 0;\r\r
510 fHC->fCorrupted = 0;\r\r
511 fHC->fEOTECorrupted = kFALSE;\r\r
512 fHC->fBufferCorrupted = kFALSE;\r\r
513 fHC->fDataCorrupted = kFALSE;\r\r
514\r\r
515 fHC->fNErrors= 0;\r\r
516 memset(fHC->fErrorCodes, 0, 1411*sizeof(UShort_t)); // initialize error container\r\r
517 memset(fHC->fTrackletWords, 0, MAXTRACKLETSPERHC*sizeof(UInt_t)); // initialize tracklet container\r\r
518}\r\r
519\r\r
520//------------------------------------------------------------\r\r
521void AliTRDrawFastStream::ResetPerMCM()\r\r
522{\r\r
523 //\r\r
524 // reset every MCM\r\r
525 //\r\r
526 fMCM.fROB = 0;\r\r
527 fMCM.fMCM = 0;\r\r
528 fMCM.fROW = 0;\r\r
529 fMCM.fEvCounter = 0;\r\r
530 fMCM.fADCMask = 0;\r\r
531 fMCM.fADCMaskWord = 0;\r\r
532 fMCM.fADCmax = 0;\r\r
533 fMCM.fADCcount = 0;\r\r
534 fMCM.fSingleADCwords = 0;\r\r
535 fMCM.fMCMhdCorrupted = 0;\r\r
536 fMCM.fADCmaskCorrupted = 0;\r\r
537 fMCM.fDataCorrupted = kFALSE;\r\r
538 fMCM.fPos = NULL;\r\r
539 fMCM.fAdcDataPos = NULL;\r\r
540 fMCM.fADCcounter = 0;\r\r
541\r\r
542 memset(fMCM.fADCchannel, 0, TRDMAXADC*sizeof(UInt_t));\r\r
543}\r\r
544\r\r
545//------------------------------------------------------------\r\r
546void AliTRDrawFastStream::ResetMemory()\r\r
547{\r\r
548 //\r\r
549 // initialize all the data members to prevent read data\r\r
550 // from previous buffer\r\r
551 //\r\r
552 ResetPerSM();\r\r
553 for (Int_t istack=0; istack<5; istack++) {\r\r
554 fStack = &fSM.fStacks[istack];\r\r
555 ResetPerStack();\r\r
556 for (Int_t ilink=0; ilink<12; ilink++) {\r\r
557 fHC = &fStack->fHalfChambers[ilink];\r\r
558 ResetPerHC();\r\r
559 }\r\r
560 }\r\r
561}\r\r
562\r\r
563//------------------------------------------------------------\r\r
564Bool_t AliTRDrawFastStream::Next()\r\r
565{\r\r
566 //\r\r
567 // returns with true on next adc read, returns false on errors and end of buffer\r\r
568 // \r\r
569 if (fBufferRead) {\r\r
570 while (fStackNumber < 5 && fSM.fActiveStacks > 0) {\r\r
571 if (fSM.fStackActive[fStackNumber] == kTRUE) {\r\r
572 fStack = &fSM.fStacks[fStackNumber];\r\r
573 while (fStackLinkNumber < 12) {\r\r
574 if (fStack->fLinksActive[fStackLinkNumber] == kTRUE) {\r\r
575 //if (fStack->fLinksActive[fStackLinkNumber] == kTRUE && fStack->fLinksMonitor[fStackLinkNumber] == 0)\r\r
576 fHC = &fStack->fHalfChambers[fStackLinkNumber];\r\r
577 //ResetPerHC(); // [mj - you don't need to do? ]\r\r
578 if (!fHC) {\r\r
579 AliError(Form("HC missing at stack %d link %d", fStackNumber, fStackLinkNumber));\r\r
580 return kFALSE;\r\r
581 }\r\r
582 fStackLinkNumber++;\r\r
583 return kTRUE;\r\r
584 } //link active ?\r\r
585 else fStackLinkNumber++;\r\r
586 } //stack link number loop \r\r
587 } //stack active ?\r\r
588 fStackNumber++;\r\r
589 fStackLinkNumber = 0;\r\r
590 } //stack number loop\r\r
591 } //fBufferRead\r\r
592\r\r
593 // go for the next buffer \r\r
594 if (fRawReader) {\r\r
595 Int_t nextBuff = NextBuffer();\r\r
596 while (nextBuff != -1) {\r\r
597 if (nextBuff > 0) {\r\r
598 fBufferRead = kTRUE;\r\r
599 return Next(); \r\r
600 }\r\r
601 nextBuff = NextBuffer();\r\r
602 }\r\r
603 }\r\r
604\r\r
605 return kFALSE;\r\r
606}\r\r
607\r\r
608//------------------------------------------------------------\r\r
609Int_t AliTRDrawFastStream::NextChamber(AliTRDdigitsManager *digitsManager, UInt_t **trackletContainer, UShort_t **errorCodeContainer) \r\r
610{\r\r
611 \r\r
612 //\r\r
613 // Fills single chamber digit array \r\r
614 // Return value is the detector number\r\r
615 //\r\r
616 // first of all, you do the SM header decoding only at the beginning of the SM data reading\r\r
617 // then, every HC, you call Next() which points next HC. then, there you decode the given HC \r\r
618 // and at the same time, put the digit into digitmanager \r\r
619 //\r\r
620 AliTRDarrayADC *digits = 0;\r\r
621 AliTRDarrayDictionary *track0 = 0;\r\r
622 AliTRDarrayDictionary *track1 = 0;\r\r
623 AliTRDarrayDictionary *track2 = 0; \r\r
624 AliTRDSignalIndex *indexes = 0;\r\r
625 AliTRDdigitsParam *digitsparam = 0;\r\r
626\r\r
627 Int_t lastdet = -1;\r\r
628 Int_t det = -1;\r\r
629 Int_t side = -1;\r\r
630 //Int_t it = 0;\r\r
631 Int_t ntracklets = 0;\r\r
632 Int_t nErrors = 0;\r\r
633\r\r
634 if (trackletContainer){\r\r
635 for (Int_t i = 0; i < 2; i++)\r\r
636 memset(trackletContainer[i], 0, MAXTRACKLETSPERHC*sizeof(UInt_t));\r\r
637 }\r\r
638\r\r
639 if (errorCodeContainer){\r\r
640 for (Int_t i = 0; i < 2; i++)\r\r
641 memset(errorCodeContainer[i], 0, 1411*sizeof(UShort_t));\r\r
642 }\r\r
643\r\r
644 while ( Next() ) { // loop over HC \r\r
645\r\r
646 // get this information from the GTU header\r\r
647 det = GetDet();\r\r
648 side = GetSide();\r\r
649\r\r
650 if (det != lastdet) {\r\r
651 // If new detector found\r\r
652 if (lastdet == -1) {lastdet = det; fLastHC = fHC;}\r\r
653 else {fStackLinkNumber--; fHC = fLastHC ; return lastdet;}\r\r
654\r\r
655 if (det < 0 || det >= AliTRDgeometry::kNdet) continue;\r\r
656\r\r
657 // Add a container for the digits of this detector\r\r
658 digits = (AliTRDarrayADC *) digitsManager->GetDigits(det);\r\r
659\r\r
660 if (digitsManager->UsesDictionaries()) {\r\r
661 track0 = (AliTRDarrayDictionary *) digitsManager->GetDictionary(det,0);\r\r
662 track1 = (AliTRDarrayDictionary *) digitsManager->GetDictionary(det,1);\r\r
663 track2 = (AliTRDarrayDictionary *) digitsManager->GetDictionary(det,2);\r\r
664 }\r\r
665\r\r
666 if (!digits) return -1;\r\r
667\r\r
668 //Int_t rowMax = GetRowMax();\r\r
669 Int_t rowMax = fGeometry->RowmaxC1(); // we use maximum row number among all detectors to reuse memory\r\r
670 Int_t colMax = GetColMax();\r\r
671 Int_t ntbins = GetGlobalNTimeBins(); \r\r
672\r\r
673 // Set digitsparam variables\r\r
674 digitsparam = (AliTRDdigitsParam *) digitsManager->GetDigitsParam();\r\r
675 digitsparam->SetNTimeBins(det,ntbins);\r\r
676 fCommonAdditive=10;\r\r
677 digitsparam->SetADCbaseline(det,fCommonAdditive);\r\r
678\r\r
679 // Allocate memory space for the digits buffer\r\r
680 //if (digits->GetNtime() == 0) {\r\r
681 if (ntbins != digits->GetNtime()) {\r\r
682 digits->Allocate(rowMax, colMax, ntbins);\r\r
683 if (digitsManager->UsesDictionaries()) {\r\r
684 track0->Allocate(rowMax, colMax, ntbins);\r\r
685 track1->Allocate(rowMax, colMax, ntbins);\r\r
686 track2->Allocate(rowMax, colMax, ntbins);\r\r
687 }\r\r
688 }\r\r
689\r\r
690 indexes = digitsManager->GetIndexes(det);\r\r
691 indexes->SetSM(GetSM());\r\r
692 indexes->SetStack(GetStack());\r\r
693 indexes->SetLayer(GetLayer());\r\r
694 indexes->SetDetNumber(det);\r\r
695 if (indexes->GetNtime() != ntbins)\r\r
696 indexes->Allocate(rowMax, colMax, ntbins);\r\r
697 }\r\r
698\r\r
699 if (fSM.fTrackletEnable == kTRUE) { \r\r
700 if (DecodeTracklets() == kFALSE) {\r\r
701 SeekEndOfData();\r\r
702\r\r
703 if (fWarnWarning) AliWarning(Form("Tracklet decoding failed stack %d link %d", GetStack(), fStackLinkNumber));\r\r
704\r\r
705 // copy error codes in memory into error container\r\r
706 if (errorCodeContainer) {\r\r
707 nErrors = GetNErrors();\r\r
708 if(nErrors > 0) memcpy(errorCodeContainer[side], GetErrorCodes(), sizeof(UShort_t) * 1411); // [mj temp - optimize] \r\r
709 }\r\r
710 \r\r
711 continue; // if it fails to decode tracklets of this HC, it skips further decoding and goes to next HC \r\r
712 } \r\r
713 } \r\r
714\r\r
715 // decode hc data\r\r
716 fgLastROB = -1; // to check mcm number odering \r\r
717 fgLastIndex = -1 ; // to check mcm number odering \r\r
718 if (DecodeHC(digitsManager, digits, track0, track1, track2, indexes) == kFALSE) {\r\r
719 // encode HC error code\r\r
720 fHC->fErrorCodes[2] += fHC->fH0Corrupted;\r\r
721 fHC->fErrorCodes[2] += (fHC->fH1Corrupted << 2);\r\r
722 fHC->fErrorCodes[2] += (fHC->fCorrupted << 3);\r\r
723 fHC->fErrorCodes[2] += ((fHC->fBufferCorrupted & 1) << 6); \r\r
724 fHC->fErrorCodes[2] += ((fHC->fEOTECorrupted & 1) << 7); \r\r
725 fHC->fErrorCodes[2] += ((fHC->fDataCorrupted & 1) << 8); \r\r
726\r\r
727 if (fHC->fEOTECorrupted != kTRUE) SeekEndOfData();\r\r
728\r\r
729/*\r\r
730 if (fWarnError) {\r\r
731 AliError(Form("Failed HC : %s", DumpHCinfoH0(fHC)));\r\r
732 AliError(Form("Failed HC : %s", DumpHCinfoH1(fHC)));\r\r
733 }\r\r
734*/ // [mj temp]\r\r
735 }\r\r
736 else SeekEndOfData(); // make sure that finish off with the end of data markers\r\r
737\r\r
738 // set pretrigger phase since it is only avaliable after decoding HC header \r\r
739 digitsparam->SetPretriggerPhase(det,GetPreTriggerPhase());\r\r
740\r\r
741 // copy tracklets in memory into tracklet container\r\r
742 if (trackletContainer) {\r\r
743 ntracklets = GetNTracklets();\r\r
744 // copy tracklet words to trackletContainer array \r\r
745 if(ntracklets > 0) memcpy(trackletContainer[side], GetTrackletWords(), sizeof(UInt_t) * ntracklets); \r\r
746 }\r\r
747\r\r
748 // copy error codes in memory into error container\r\r
749 if (errorCodeContainer) {\r\r
750 nErrors = GetNErrors();\r\r
751 if(nErrors > 0) memcpy(errorCodeContainer[side], GetErrorCodes(), sizeof(UShort_t) * 1411); \r\r
752 }\r\r
753\r\r
754 }// end of while \r\r
755\r\r
756 return det;\r\r
757}\r\r
758\r\r
759//------------------------------------------------------------\r\r
760Bool_t AliTRDrawFastStream::Init()\r\r
761{\r\r
762 //\r\r
763 // Initialize geometry and fee parameters \r\r
764 //\r\r
765 TDirectory *saveDir = gDirectory; \r\r
766 \r\r
767 if (!fGeometry) {\r\r
768 fGeometry = new AliTRDgeometry();\r\r
769 }\r\r
770 \r\r
771 if (!fGeometry) {\r\r
772 AliError("Geometry FAILED!");\r\r
773 return kFALSE;\r\r
774 }\r\r
775\r\r
776 fTRDfeeParam = AliTRDfeeParam::Instance();\r\r
777 if (!fTRDfeeParam) {\r\r
778 AliError("AliTRDfeeParam FAILED!");\r\r
779 return kFALSE;\r\r
780 }\r\r
781\r\r
782 fMaxADCgeom = (Int_t)fGeometry->ADCmax();\r\r
783\r\r
784 ResetCounters(); // fBufferRead is set to kFALSE - important\r\r
785\r\r
786 saveDir->cd();\r\r
787\r\r
788 return kTRUE;\r\r
789}\r\r
790\r\r
791//------------------------------------------------------------\r\r
792Bool_t AliTRDrawFastStream::InitBuffer(void *buffer, UInt_t length)\r\r
793{\r\r
794 // \r\r
795 // set initial information about the buffer\r\r
796 //\r\r
797 if (fgDebugFlag) AliDebug(5, Form("Equipment ID: %d",fRawReader->GetEquipmentId()));\r\r
798 if (fRawReader->GetEquipmentId()<1024 || fRawReader->GetEquipmentId()>1041) \r\r
799 return kFALSE; \r\r
800\r\r
801 ResetCounters();\r\r
802\r\r
803 fpBegin = (UInt_t *)buffer;\r\r
804\r\r
805 if (WORD_SIZE == 0) {\r\r
806 AliFatal("Strange word size. size of UInt_t == 0");\r\r
807 return kFALSE;\r\r
808 }\r\r
809\r\r
810 fWordLength = length/WORD_SIZE;\r\r
811 fpEnd = fpBegin + fWordLength;\r\r
812 fpPos = fpBegin;\r\r
813\r\r
814 if (fpBegin == 0 || length <= 0) {\r\r
815 AliError(Form("Buffer size or pointer is strange. pointer to the buffer is 0x%08x of size %d", fpBegin, length));\r\r
816 return kFALSE;\r\r
817 }\r\r
818\r\r
819 SwapOnEndian();\r\r
820\r\r
821 if (fgDumpHead >= 0) {\r\r
822 if ( fgDumpHead == 0 ) { // dump all words\r\r
823 AliInfo(Form("---------- Dumping all words from the beginnig of the buffer ----------"));\r\r
824 if (DumpWords(fpBegin, fWordLength) == kFALSE) AliError("Dump failed. Not enough data.");\r\r
825 } \r\r
826 else { \r\r
827 AliInfo(Form("---------- Dumping %u words from the beginnig of the buffer ----------",fgDumpHead));\r\r
828 if (DumpWords(fpBegin, fgDumpHead) == kFALSE) AliError("Dump failed. Not enough data.");\r\r
829 }\r\r
830 AliInfo(Form("---------- Dumping ended ----------------------------------------------"));\r\r
831 }\r\r
832\r\r
833 return kTRUE;\r\r
834}\r\r
835\r\r
836//------------------------------------------------------------\r\r
837Bool_t AliTRDrawFastStream::DecodeSMHeader(void *buffer, UInt_t length)\r\r
838{\r\r
839 // \r\r
840 // decode one sm data in buffer\r\r
841 // \r\r
842 ResetIterators(); \r\r
843\r\r
844 if (InitBuffer(buffer, length) == kFALSE) {\r\r
845 if (fWarnError) AliError("InitBuffer failed."); \r\r
846 return kFALSE;\r\r
847 }\r\r
848\r\r
849 if (DecodeGTUheader()== kFALSE)\r\r
850 return kFALSE;\r\r
851\r\r
852 Int_t nLinkErrors=0;\r\r
853 for (Int_t istack = 0; istack < 5; istack++) {\r\r
854 fStackNumber = istack; \r\r
855 if (fSM.fStackActive[istack] == kFALSE) continue;\r\r
856 \r\r
857 fStack = &fSM.fStacks[istack];\r\r
858 \r\r
859 fgLastHC = -1; // to check rob number odering \r\r
860 for (Int_t ilink = 0; ilink < 12; ilink++) {\r\r
861 fStackLinkNumber = ilink; \r\r
862 if (fStack->fLinksActive[ilink] == kFALSE) continue;\r\r
863 \r\r
864 // check GTU link monitor \r\r
865 if (!(fStack->fLinksDataType[ilink] == 0 && fStack->fLinksMonitor[ilink] == 0)) {\r\r
866 fStack->fLinkMonitorError[ilink] = 1;\r\r
867 fStack->fLinkMonitorError[ilink] += fNWordsCounter; // counts words of given hc having link monitor error\r\r
868 nLinkErrors++;\r\r
869 //continue;\r\r
870 }\r\r
871\r\r
872 if (fpPos >= fpEnd) {\r\r
873 if (fRawReader) fRawReader->AddMajorErrorLog(kLinkDataMissing, "Link data missing"); \r\r
874 if (fWarnWarning) AliWarning("Link data missing.");\r\r
875 break;\r\r
876 }\r\r
877\r\r
878 // set det number using SM header \r\r
879 fHC = &fStack->fHalfChambers[ilink];\r\r
880 fHC->fSM = fRawReader->GetEquipmentId() - 1024;\r\r
881 fHC->fStack = fStackNumber;\r\r
882 fHC->fLayer = Int_t(fStackLinkNumber/2.);\r\r
883 fHC->fSide = fStackLinkNumber%2;\r\r
884 fHC->fDET = fGeometry->GetDetector(fHC->fLayer, fHC->fStack, fHC->fSM);\r\r
885 fHC->fRowMax = fGeometry->GetRowMax(fHC->fLayer, fHC->fStack, fHC->fSM);\r\r
886 fHC->fROC = fGeometry->GetDetectorSec(fHC->fLayer, fHC->fStack);\r\r
887 fHC->fColMax = fGeometry->GetColMax(fHC->fROC);\r\r
888 }\r\r
889 } \r\r
890\r\r
891 // set number of timebin to be used in the digit container \r\r
892 if (nLinkErrors>30) fGlobalNTimeBins=30;\r\r
893 else if (!fIsTimeBinSet) {\r\r
894 fpPosTemp = fpPos;\r\r
895 SetGlobalNTimebins();\r\r
896 fIsTimeBinSet = kTRUE;\r\r
897 }\r\r
898\r\r
899 ResetIterators(); // need to do it again for Next() function\r\r
900\r\r
901 return kTRUE;\r\r
902}\r\r
903\r\r
904//------------------------------------------------------------\r\r
905Bool_t AliTRDrawFastStream::DecodeGTUheader()\r\r
906{\r\r
907 //\r\r
908 // decode Supermodule Index Word\r\r
909 //\r\r
910 DecodeSMInfo(fpPos, &fSM);\r\r
911\r\r
912 if (fgDebugFlag) AliDebug(5, DumpSMInfo(&fSM));\r\r
913\r\r
914 fpPos++;\r\r
915 if (fpPos < fpEnd) {\r\r
916 // fSM.fHeaderSize represent additional Supermodule header size which contains additional information regarding hardware design.\r\r
917 // For the moment, we skip decoding these words \r\r
918 if (SkipWords(fSM.fHeaderSize) == kTRUE) {\r\r
919 for (Int_t istack = 0; istack < 5; istack++) {\r\r
920 if (fSM.fStackActive[istack] == kFALSE)\r\r
921 continue;\r\r
922\r\r
923 fStack = &fSM.fStacks[istack];\r\r
924\r\r
925 // Decode Stack Index Word of given stack\r\r
926 DecodeStackInfo(fpPos, fStack);\r\r
927 fpPos++;\r\r
928\r\r
929 fSM.fNexpectedHalfChambers += fStack->fActiveLinks;\r\r
930 \r\r
931 if (fgDebugFlag) AliDebug(5, DumpStackInfo(fStack));\r\r
932 \r\r
933 if (SkipWords(fStack->fHeaderSize-6) == kFALSE) { // 6 is the 6 stack header words for 12 links \r\r
934 if (fRawReader) fRawReader->AddMajorErrorLog(kDecodeStackInfo, "Stack header words missing");\r\r
935 return kFALSE;\r\r
936 }\r\r
937 for (Int_t iword=0; iword<6; iword++) { // decode 6 stack header words\r\r
938 // Decode Stack Header Word of given stack\r\r
939 DecodeStackHeader(fpPos, fStack, iword); \r\r
940 fpPos++;\r\r
941 } // iword\r\r
942 } // istack\r\r
943 }\r\r
944 else {\r\r
945 return kFALSE;\r\r
946 }\r\r
947 }\r\r
948 else {\r\r
949 if (fWarnWarning) AliWarning("No additional sm headers and stack index words present.");\r\r
950 if (fRawReader) fRawReader->AddMajorErrorLog(kDecodeStackInfo, "Stack info missing");\r\r
951 return kFALSE;\r\r
952 }\r\r
953\r\r
954 if (fpPos < fpEnd) {\r\r
955 if (fgDebugFlag) AliDebug(5, "GTU headers are OK.");\r\r
956 }\r\r
957 else {\r\r
958 if (fWarnError) AliError("No data just after GTU headers.");\r\r
959 if (fRawReader) fRawReader->AddMajorErrorLog(kMissingData, "Missing sm data");\r\r
960 return kFALSE;\r\r
961 }\r\r
962\r\r
963 if (fgDebugFlag) AliDebug(5, Form("Expected half chambers from GTU header: %d", fSM.fNexpectedHalfChambers));\r\r
964\r\r
965 return kTRUE;\r\r
966}\r\r
967\r\r
968//--------------------------------------------------------\r\r
969void AliTRDrawFastStream::DecodeStackInfo(const UInt_t *word, struct AliTRDrawStack *st) const\r\r
970{\r\r
971 //\r\r
972 // decode Stack #i Index Word\r\r
973 // The Stack #i Index Word is a 32-Bit word with following structure\r\r
974 // ssssssss ssssssss vvvv mmmm mmmmmmmm\r\r
975 // s: Size of the Stack #i Header, v: Supermodule Header Version, m: Link Mask\r\r
976 //\r\r
977 st->fPos = (UInt_t*)word;\r\r
978\r\r
979 UInt_t vword = *word;\r\r
980 st->fHeaderSize = STACK_HEADER_SIZE(vword);\r\r
981\r\r
982 UInt_t linkMask = STACK_LINK_WORD(vword);\r\r
983 st->fActiveLinks = 0;\r\r
984 for (Int_t i = 0; i < 12; i++) {\r\r
985 if (IS_BIT_SET(linkMask,i) > 0) {\r\r
986 st->fLinksActive[i] = kTRUE;\r\r
987 st->fActiveLinks++;\r\r
988 }\r\r
989 else {\r\r
990 st->fLinksActive[i] = kFALSE;\r\r
991 }\r\r
992 }\r\r
993}\r\r
994\r\r
995//--------------------------------------------------------\r\r
996void AliTRDrawFastStream::DecodeStackHeader(const UInt_t *word, struct AliTRDrawStack *st, Int_t iword) const\r\r
997{\r\r
998 //\r\r
999 // decode stack header\r\r
1000 //\r\r
1001 st->fPos = (UInt_t*)word;\r\r
1002\r\r
1003 UInt_t vword = *word;\r\r
1004 st->fLinksDataType[2*iword] = LINK0_DATA_TYPE_FLAG(vword);\r\r
1005 st->fLinksMonitor[2*iword] = LINK0_MONITOR_FLAG(vword);\r\r
1006 st->fLinksDataType[2*iword+1] = LINK1_DATA_TYPE_FLAG(vword);\r\r
1007 st->fLinksMonitor[2*iword+1] = LINK1_MONITOR_FLAG(vword);\r\r
1008}\r\r
1009\r\r
1010//------------------------------------------------------------\r\r
1011Bool_t AliTRDrawFastStream::DecodeTracklets()\r\r
1012{\r\r
1013 //\r\r
1014 // decode tracklets\r\r
1015 //\r\r
1016 fLinkTrackletCounter = 0; // tracklet counter of this link \r\r
1017 fEndOfTrackletCount = 0; // tracklet endmarker counter of this link\r\r
1018 fHC->fNTracklets = 0; // number of tracklet of this link, should be less than 256\r\r
1019\r\r
1020 if (fgDebugFlag) AliDebug(10, Form("Decode tracklets at 0x%08x : 0x%08x", fpPos, *fpPos));\r\r
1021\r\r
1022 while (!(*fpPos == END_OF_TRACKLET_MARKEROLD || *fpPos == END_OF_TRACKLET_MARKERNEW) && fpPos < fpEnd) {\r\r
1023 if (fgDebugFlag) AliDebug(10, Form("Tracklet found at 0x%08x : 0x%08x", fpPos, *fpPos));\r\r
1024\r\r
1025 fLinkTrackletCounter++;\r\r
1026\r\r
1027 if (fLinkTrackletCounter > MAXTRACKLETSPERHC) {\r\r
1028 if (fgDebugFlag) AliDebug(11,Form("Max number of tracklets exceeded %d > %d. Tracklets are wrong either GTU header has problem",\r\r
1029 fLinkTrackletCounter, MAXTRACKLETSPERHC));\r\r
1030 if (fRawReader) fRawReader->AddMajorErrorLog(kTrackletOverflow,"Too many tracklets"); \r\r
1031 fHC->fErrorCodes[1] = 1; \r\r
1032 return kFALSE;\r\r
1033 }\r\r
1034\r\r
1035 fHC->fTrackletWords[fLinkTrackletCounter-1] = UInt_t(*fpPos); //store tracklet words into memory \r\r
1036 fpPos++;\r\r
1037 }\r\r
1038\r\r
1039 fHC->fNTracklets = fLinkTrackletCounter;\r\r
1040\r\r
1041 while ((*fpPos == END_OF_TRACKLET_MARKEROLD || *fpPos == END_OF_TRACKLET_MARKERNEW) && fpPos < fpEnd) {\r\r
1042 if (fgDebugFlag) AliDebug(10, Form("EoTracklets found at 0x%08x : 0x%08x", fpPos, *fpPos));\r\r
1043\r\r
1044 fEndOfTrackletCount++;\r\r
1045 fpPos++;\r\r
1046 }\r\r
1047\r\r
1048 if (fEndOfTrackletCount < 2) {\r\r
1049 if (fgDebugFlag) AliDebug(11,"End of tracklets word missing"); \r\r
1050 if (fRawReader) fRawReader->AddMajorErrorLog(kEOTrackeltsMissing, "End of tracklets word missing"); \r\r
1051 fHC->fErrorCodes[1] += 2; \r\r
1052 return kFALSE;\r\r
1053 }\r\r
1054\r\r
1055 return kTRUE;\r\r
1056}\r\r
1057\r\r
1058//--------------------------------------------------------\r\r
1059void AliTRDrawFastStream::DecodeSMInfo(const UInt_t *word, struct AliTRDrawSM *sm) const\r\r
1060{\r\r
1061 //\r\r
1062 // decode Supermodule Index Word\r\r
1063 // The Supermodule Index Word is a 32-Bit word wit following structure\r\r
1064 // ssssssss ssssssss vvvv rrrr r d t mmmm\r\r
1065 // s: Size of the Supermodule Header, v: Supermodule Header Version, r: Reserved for future use\r\r
1066 // d: Track Data Enabled Bit, t: Tracklet Data Enabled Bit, m: Stack Mask \r\r
1067 //\r\r
1068 sm->fPos = (UInt_t*)word; \r\r
1069\r\r
1070 UInt_t vword = *word;\r\r
1071 sm->fHeaderSize = SM_HEADER_SIZE(vword);\r\r
1072 \r\r
1073 if (TRACKLETS_ENABLED(vword) > 0)\r\r
1074 sm->fTrackletEnable = kTRUE;\r\r
1075 else\r\r
1076 sm->fTrackletEnable = kFALSE;\r\r
1077 \r\r
1078 UInt_t stackMask = STACK_MASK(vword);\r\r
1079 sm->fActiveStacks = 0;\r\r
1080 for (Int_t i = 0; i < 5; i++)\r\r
1081 {\r\r
1082 if (IS_BIT_SET(stackMask,i) > 0)\r\r
1083 {\r\r
1084 sm->fStackActive[i] = kTRUE;\r\r
1085 sm->fActiveStacks++;\r\r
1086 }\r\r
1087 else\r\r
1088 {\r\r
1089 sm->fStackActive[i] = kFALSE;\r\r
1090 }\r\r
1091 }\r\r
1092}\r\r
1093\r\r
1094//------------------------------------------------------------\r\r
1095Bool_t AliTRDrawFastStream::DecodeHC(AliTRDdigitsManager *digitsManager, AliTRDarrayADC *digits, \r\r
1096 AliTRDarrayDictionary *track0, AliTRDarrayDictionary *track1, AliTRDarrayDictionary *track2, \r\r
1097 AliTRDSignalIndex *indexes)\r\r
1098{\r\r
1099 //\r\r
1100 // decode hc header and data\r\r
1101 //\r\r
1102 if (fpPos >= fpEnd) {\r\r
1103 fHC->fCorrupted += 1; \r\r
1104 if (fWarnError) AliError("No data(including HC header) in the buffer");\r\r
1105 return kFALSE;;\r\r
1106 }\r\r
1107\r\r
1108 if (DecodeHCheader() == kFALSE) {\r\r
1109 if (fWarnWarning) AliWarning(Form("HC Header decode failed. H0 Error: %d H1 Error: %d",fHC->fH0Corrupted,fHC->fH1Corrupted));\r\r
1110 return kFALSE;\r\r
1111 }\r\r
1112 else {\r\r
1113 fpPos++;\r\r
1114 if (fpPos >= fpEnd) {\r\r
1115 fHC->fCorrupted += 2; \r\r
1116 if (fWarnError) AliError("No data right after HC header in the buffer");\r\r
1117 return kFALSE;\r\r
1118 }\r\r
1119 }\r\r
1120\r\r
1121// if ((fHC->fRawVMajor & 64) == 64) { // test pattern data\r\r
1122// AliTRDrawTPStream *tpStream = new AliTRDrawTPStream(fHC->fRawVMajorOpt, fpPos);\r\r
1123// if (tpStream->DecodeTPdata() == kFALSE) {\r\r
1124// if (fWarnError) AliError("Failed to decode test pattern data");\r\r
1125// return kFALSE;\r\r
1126// }\r\r
1127// return kTRUE;\r\r
1128// }\r\r
1129\r\r
1130 fHC->fMCMmax = 0; // count number of mcms in a hc \r\r
1131 while (*fpPos != ENDOFRAWDATAMARKER && fpPos < fpEnd) {\r\r
1132\r\r
1133 ResetPerMCM(); // reset for every mcm \r\r
1134\r\r
1135 if (fHC->fMCMmax > TRDMAXMCM) {\r\r
1136 fHC->fCorrupted += 4; \r\r
1137 if (fgDebugFlag) AliDebug(11,"More mcm data than expected");\r\r
1138 return kFALSE;\r\r
1139 }\r\r
1140\r\r
1141 if (DecodeMCMheader() == kFALSE) {\r\r
1142\r\r
1143 // encode mcm level error codes\r\r
1144 fHC->fErrorCodes[fHC->fMCMmax+2] += fMCM.fMCMhdCorrupted;\r\r
1145 fHC->fErrorCodes[fHC->fMCMmax+2] += (fMCM.fADCmaskCorrupted << 4);\r\r
1146 fHC->fErrorCodes[fHC->fMCMmax+2] += ((fMCM.fDataCorrupted & 1) << 6);\r\r
1147 fHC->fErrorCodes[fHC->fMCMmax+2] += (fMCM.fMCM << 7); // encode MCM number\r\r
1148 fHC->fErrorCodes[fHC->fMCMmax+2] += (fMCM.fROB << 11); // encode ROB number\r\r
1149\r\r
1150 fHC->fMCMmax++; // increase mcm counter to match with expected rob/mcm number\r\r
1151\r\r
1152 // in case we decide to keep reading data, skip this mcm data and find next mcm header\r\r
1153 if (fMCM.fADCmaskCorrupted < 2) {\r\r
1154 if (SkipMCMdata(fMCM.fADCcount*fMCM.fSingleADCwords) == kFALSE)\r\r
1155 return kFALSE;\r\r
1156 continue;\r\r
1157 }\r\r
1158 else {\r\r
1159 if (SeekNextMCMheader() == kFALSE)\r\r
1160 return kFALSE;\r\r
1161 continue;\r\r
1162 }\r\r
1163 }\r\r
1164\r\r
1165 fHC->fMCMmax++;\r\r
1166\r\r
1167 if (fMCM.fADCmax > 0) {\r\r
1168 fpPos++;\r\r
1169 if (fpPos >= fpEnd) {\r\r
1170 fHC->fBufferCorrupted = kTRUE; \r\r
1171 if (fgDebugFlag) AliDebug(11, Form("Buffer ends in the middle of data"));\r\r
1172 return kFALSE;\r\r
1173 }\r\r
1174\r\r
1175 fADCnumber = 0;\r\r
1176 for (Int_t iadc = 0; iadc < fMCM.fADCmax; iadc++) {\r\r
1177 fADCnumber = fMCM.fADCchannel[iadc];\r\r
1178 fExtendedCOL = fTRDfeeParam->GetExtendedPadColFromADC(fMCM.fROB, fMCM.fMCM, fADCnumber);\r\r
1179 fCOL = fTRDfeeParam->GetPadColFromADC(fMCM.fROB, fMCM.fMCM, fADCnumber);\r\r
1180\r\r
1181 if (fADCnumber <= 1 || fADCnumber == fMaxADCgeom - 1) // if adc number = 0, 1, 20\r\r
1182 fIsShared = kTRUE;\r\r
1183 else \r\r
1184 fIsShared = kFALSE;\r\r
1185\r\r
1186 if (fpPos + fMCM.fSingleADCwords >= fpEnd) {\r\r
1187 fHC->fBufferCorrupted = kTRUE;\r\r
1188 if (fgDebugFlag) AliDebug(11,"ADC (10 words) expected. Not enough data in the buffer.");\r\r
1189 return kFALSE;\r\r
1190 }\r\r
1191\r\r
1192 //if (GetGlobalNTimeBins() < 31){\r\r
1193 if (fHC->fTimeBins < 31){\r\r
1194 if (DecodeADC(digitsManager, digits, track0, track1, track2, indexes) == kFALSE) {\r\r
1195 return kFALSE;\r\r
1196 }\r\r
1197 }\r\r
1198 //else if (GetGlobalNTimeBins() > 32) {\r\r
1199 else if (fHC->fTimeBins > 32) {\r\r
1200 if (DecodeADCExtended(digitsManager, digits, track0, track1, track2, indexes) == kFALSE) {\r\r
1201 return kFALSE;\r\r
1202 }\r\r
1203 }\r\r
1204 else { // nsamples = 31, 32 are not implemented in the TRAP and should never happen \r\r
1205 if (fWarnError) AliError("nsamples are 31 or 32. These are not implemented in the TRAP and should never happen!");\r\r
1206 }\r\r
1207\r\r
1208 } // iadc\r\r
1209 }\r\r
1210 else { // if there is no adc activated\r\r
1211 fpPos++;\r\r
1212 }\r\r
1213 } // mcm loop\r\r
1214\r\r
1215 if (fpPos >= fpEnd) {\r\r
1216 fHC->fBufferCorrupted = kTRUE; \r\r
1217 if (fgDebugFlag) AliDebug(11,"We are at the end of buffer. Not enough data in the buffer.");\r\r
1218 return kFALSE;\r\r
1219 }\r\r
1220\r\r
1221 return kTRUE;\r\r
1222}\r\r
1223\r\r
1224//------------------------------------------------------------\r\r
1225Bool_t AliTRDrawFastStream::DecodeHCheader()\r\r
1226{\r\r
1227 //\r\r
1228 // decode the half chamber header\r\r
1229 // if it fails to decode HC header for both H0 and H1, return kFALSE\r\r
1230 //\r\r
1231 if (DecodeHCwordH0(fpPos, fHC) == kFALSE)\r\r
1232 return kFALSE;\r\r
1233\r\r
1234 if (fHC->fNExtraWords > 0) {\r\r
1235 fpPos++;\r\r
1236 if (fpPos < fpEnd) {\r\r
1237 if (DecodeHCwordH1(fpPos, fHC) == kFALSE)\r\r
1238 return kFALSE;\r\r
1239 }\r\r
1240 else {\r\r
1241 fHC->fBufferCorrupted = kTRUE;\r\r
1242 if (fgDebugFlag) AliDebug(11,"Expected HC header word H1. Fail due to buffer END.");\r\r
1243 return kFALSE;\r\r
1244 }\r\r
1245 }\r\r
1246\r\r
1247 if (fgDebugFlag) AliDebug(5, DumpHCinfoH0(fHC));\r\r
1248 if (fgDebugFlag) AliDebug(5, DumpHCinfoH1(fHC));\r\r
1249\r\r
1250 if (IsHCheaderOK() == kFALSE) {\r\r
1251 fHC->fH0Corrupted += 2;\r\r
1252 if (fgDebugFlag) AliDebug(11,Form("H0 Header Insane. Word 0x%08x", *fHC->fPos));\r\r
1253 return kFALSE;\r\r
1254 }\r\r
1255\r\r
1256 return kTRUE;\r\r
1257}\r\r
1258\r\r
1259//--------------------------------------------------------\r\r
1260Bool_t AliTRDrawFastStream::DecodeHCwordH0(const UInt_t *word, struct AliTRDrawHC *hc) const\r\r
1261{\r\r
1262 //\r\r
1263 // decode the hc header word 0\r\r
1264 //\r\r
1265 UInt_t vword = *word;\r\r
1266 hc->fPos[0] = (UInt_t*)word;\r\r
1267\r\r
1268 hc->fH0Corrupted = HC_HEADER_MASK_ERR(vword);\r\r
1269 if (hc->fH0Corrupted > 0) {\r\r
1270 if (fgDebugFlag) AliDebug(11,Form("H0 Header Mask Error. Word 0x%08x",*fHC->fPos ));\r\r
1271 return kFALSE;\r\r
1272 }\r\r
1273 hc->fSpecialRawV = HC_SPECIAL_RAW_VERSION(vword);\r\r
1274 hc->fRawVMajor = HC_MAJOR_RAW_VERSION(vword);\r\r
1275 hc->fRawVMajorOpt = HC_MAJOR_RAW_VERSION_OPT(vword);\r\r
1276 hc->fRawVMinor = HC_MINOR_RAW_VERSION(vword);\r\r
1277 hc->fNExtraWords = HC_EXTRA_WORDS(vword);\r\r
1278 hc->fDCSboard = HC_DCS_BOARD(vword);\r\r
1279 hc->fSMHCheader = HC_SM_NUMBER(vword);\r\r
1280 hc->fStackHCheader = HC_STACK_NUMBER(vword);\r\r
1281 hc->fLayerHCheader = HC_LAYER_NUMBER(vword);\r\r
1282 hc->fSideHCheader = HC_SIDE_NUMBER(vword);\r\r
1283\r\r
1284 return kTRUE;\r\r
1285}\r\r
1286\r\r
1287//--------------------------------------------------------\r\r
1288Bool_t AliTRDrawFastStream::DecodeHCwordH1(const UInt_t *word, struct AliTRDrawHC *hc) const\r\r
1289{\r\r
1290 //\r\r
1291 // decode the hc header word 1\r\r
1292 //\r\r
1293 UInt_t vword = *word;\r\r
1294 hc->fPos[1] = (UInt_t*)word;\r\r
1295\r\r
1296 hc->fH1Corrupted = HC_HEADER_MASK_ERR(vword);\r\r
1297 if (hc->fH1Corrupted > 0) {\r\r
1298 if (fgDebugFlag) AliDebug(11,Form("H1 Header Mask Error. Word 0x%08x", *(fHC->fPos+1) ));\r\r
1299 return kFALSE;\r\r
1300 }\r\r
1301 hc->fTimeBins = HC_NTIMEBINS(vword);\r\r
1302 hc->fBunchCrossCounter = HC_BUNCH_CROSS_COUNTER(vword);\r\r
1303 hc->fPreTriggerCounter = HC_PRETRIGGER_COUNTER(vword);\r\r
1304 hc->fPreTriggerPhase = HC_PRETRIGGER_PHASE(vword);\r\r
1305\r\r
1306 return kTRUE;\r\r
1307}\r\r
1308\r\r
1309//------------------------------------------------------------\r\r
1310Bool_t AliTRDrawFastStream::IsHCheaderOK()\r\r
1311{\r\r
1312 //\r\r
1313 // check insanity of half chamber header\r\r
1314 //\r\r
1315 if (fHC->fStackHCheader < 0 || fHC->fStackHCheader > 4) {\r\r
1316 if (fgDebugFlag) AliDebug(11,Form("Wrong Stack %d", fHC->fStackHCheader));\r\r
1317 return kFALSE;\r\r
1318 }\r\r
1319\r\r
1320 if (fHC->fLayerHCheader < 0 || fHC->fLayerHCheader >= AliTRDgeometry::kNlayer) {\r\r
1321 if (fgDebugFlag) AliDebug(11,Form("Wrong layer %d", fHC->fLayerHCheader));\r\r
1322 return kFALSE;\r\r
1323 }\r\r
1324\r\r
1325 if (fHC->fSideHCheader < 0 || fHC->fSideHCheader > 1) {\r\r
1326 if (fgDebugFlag) AliDebug(11,Form("Wrong Side %d", fHC->fSideHCheader));\r\r
1327 return kFALSE;\r\r
1328 } \r\r
1329 \r\r
1330 if (fHC->fSMHCheader != fHC->fSM) {\r\r
1331 if (fgDebugFlag) AliDebug(11,Form("Missmatch: SM number between HC header %d and GTU link mask %d",\r\r
1332 fHC->fSMHCheader, fHC->fSM));\r\r
1333 return kFALSE;\r\r
1334 }\r\r
1335\r\r
1336 if (fgStackNumberChecker) {\r\r
1337 if (fHC->fStackHCheader != fHC->fStack) {\r\r
1338 if (fgDebugFlag) AliDebug(11,Form("Missmatch: Stack number between HC header %d and GTU link mask %d",\r\r
1339 fHC->fStackHCheader, fHC->fStack));\r\r
1340 return kFALSE;\r\r
1341 }\r\r
1342 }\r\r
1343\r\r
1344 if (fgStackLinkNumberChecker) {\r\r
1345 if (fHC->fLayerHCheader * 2 + fHC->fSideHCheader != fHC->fLayer * 2 + fHC->fSide) {\r\r
1346 if (fgDebugFlag) AliDebug(11,Form("Missmatch: Layer number between HC header %d and GTU link mask %d | %s",\r\r
1347 fHC->fLayerHCheader, fHC->fLayer, DumpStackInfo(fStack)));\r\r
1348 return kFALSE;\r\r
1349 }\r\r
1350 }\r\r
1351\r\r
1352 // SLOW GEOM : consistancy check with geometry\r\r
1353 if (fHC->fDET < 0 || fHC->fDET >= AliTRDgeometry::kNdet) {\r\r
1354 if (fgDebugFlag) AliDebug(11,Form("Wrong detector %d", fHC->fDET));\r\r
1355 if (fRawReader) fRawReader->AddMajorErrorLog(kHCHeaderWrongDet, "Wrong Det");\r\r
1356 return kFALSE;\r\r
1357 }\r\r
1358\r\r
1359 if (fHC->fSM != fGeometry->GetSector(fHC->fDET) || fHC->fSM <0 || fHC->fSM >= AliTRDgeometry::kNsector) {\r\r
1360 if (fgDebugFlag) AliDebug(11,Form("Wrong SM(sector) %d (Geometry says: %d) Stack=%d Layer=%d Det=%d",\r\r
1361 fHC->fSM, fGeometry->GetSector(fHC->fDET), fHC->fStack, fHC->fLayer, fHC->fDET));\r\r
1362 if (fRawReader) fRawReader->AddMajorErrorLog(kHCHeaderWrongSM, "Wrong SM");\r\r
1363 return kFALSE;\r\r
1364 }\r\r
1365\r\r
1366 if (fHC->fROC < 0) {\r\r
1367 if (fRawReader) fRawReader->AddMajorErrorLog(kHCHeaderWrongROC, "Wrong ROC");\r\r
1368 return kFALSE;\r\r
1369 }\r\r
1370\r\r
1371 if (fHC->fRowMax < 1) {\r\r
1372 if (fRawReader) fRawReader->AddMajorErrorLog(kHCHeaderWrongROC, "Wrong ROC Row Max");\r\r
1373 return kFALSE;\r\r
1374 }\r\r
1375\r\r
1376 if (fHC->fColMax < 1) {\r\r
1377 if (fRawReader) fRawReader->AddMajorErrorLog(kHCHeaderWrongROC, "Wrong ROC Col Max");\r\r
1378 return kFALSE;\r\r
1379 }\r\r
1380\r\r
1381 return kTRUE;\r\r
1382}\r\r
1383\r\r
1384//------------------------------------------------------------\r\r
1385Bool_t AliTRDrawFastStream::DecodeMCMheader()\r\r
1386{ \r\r
1387 //\r\r
1388 // decode the mcm header\r\r
1389 //\r\r
1390 DecodeMCMheader(fpPos, &fMCM);\r\r
1391\r\r
1392 if (fHC->fEOTECorrupted == kTRUE) {\r\r
1393 fpPos--;\r\r
1394 return kFALSE;\r\r
1395 }\r\r
1396\r\r
1397 fMCM.fROW = fTRDfeeParam->GetPadRowFromMCM(fMCM.fROB, fMCM.fMCM);\r\r
1398\r\r
1399 if ((fHC->fRawVMajor > 2 && fHC->fRawVMajor <5) || ((fHC->fRawVMajor & 32) == 32)) { //cover old and new version definition of ZS data\r\r
1400 fpPos++;\r\r
1401 if ( fpPos < fpEnd ) {\r\r
1402 DecodeMask(fpPos, &fMCM);\r\r
1403 if (fHC->fEOTECorrupted == kTRUE) {\r\r
1404 fpPos--;\r\r
1405 return kFALSE;\r\r
1406 }\r\r
1407 MCMADCwordsWithTbins(fHC->fTimeBins, &fMCM);\r\r
1408 fMCM.fAdcDataPos = fpPos + 1;\r\r
1409 }\r\r
1410 else {\r\r
1411 if (fgDebugFlag) AliDebug(11,"Expected ADC mask word. Fail due to buffer END.");\r\r
1412 if (fRawReader) fRawReader->AddMajorErrorLog(kMCMADCMaskMissing,"Missing");\r\r
1413 fHC->fBufferCorrupted = kTRUE;\r\r
1414 return kFALSE;\r\r
1415 }\r\r
1416 }\r\r
1417 else {\r\r
1418 UInt_t dummyMask = MCM_DUMMY_ADCMASK_VAL;\r\r
1419 DecodeMask(&dummyMask, &fMCM);\r\r
1420 MCMADCwordsWithTbins(fHC->fTimeBins, &fMCM);\r\r
1421 fMCM.fAdcDataPos = fpPos + 1;\r\r
1422 }\r\r
1423 if (IsMCMheaderOK() == kFALSE)\r\r
1424 return kFALSE;\r\r
1425\r\r
1426 return kTRUE;\r\r
1427}\r\r
1428\r\r
1429//--------------------------------------------------------\r\r
1430void AliTRDrawFastStream::DecodeMCMheader(const UInt_t *word, struct AliTRDrawMCM *mcm) const\r\r
1431{\r\r
1432 //\r\r
1433 // decode the mcm header\r\r
1434 //\r\r
1435 UInt_t vword = *word;\r\r
1436\r\r
1437 if (vword == END_OF_TRACKLET_MARKERNEW) {\r\r
1438 if (fWarnError) AliError(Form("There should be MCM header. We meet END_OF_TRACKLET_MARKER 0x%08x",vword));\r\r
1439 fHC->fEOTECorrupted = kTRUE; //to finish data reading of this HC\r\r
1440 }\r\r
1441\r\r
1442 mcm->fMCMhdCorrupted = MCM_HEADER_MASK_ERR(vword); //if MCM header mask has error\r\r
1443 if (fgDebugFlag && mcm->fMCMhdCorrupted != 0) { \r\r
1444 fHC->fDataCorrupted = kTRUE;\r\r
1445 AliDebug(11,Form("Wrong MCM header mask 0x%08x.\n", *fpPos));\r\r
1446 }\r\r
1447\r\r
1448 mcm->fROB = MCM_ROB_NUMBER(vword);\r\r
1449 mcm->fMCM = MCM_MCM_NUMBER(vword);\r\r
1450 mcm->fEvCounter = MCM_EVENT_COUNTER(vword);\r\r
1451 mcm->fPos = (UInt_t*)word;\r\r
1452}\r\r
1453\r\r
1454//--------------------------------------------------------\r\r
1455UInt_t AliTRDrawFastStream::GetMCMadcMask(const UInt_t *word, struct AliTRDrawMCM *mcm) const\r\r
1456{\r\r
1457 //\r\r
1458 // get the adc mask\r\r
1459 //\r\r
1460 UInt_t vword = *word;\r\r
1461\r\r
1462 mcm->fADCMask = 0;\r\r
1463 mcm->fADCcount = 0;\r\r
1464 mcm->fADCMaskWord = vword;\r\r
1465\r\r
1466 if (vword == END_OF_TRACKLET_MARKERNEW) {\r\r
1467 if (fWarnError) AliError(Form("There should be MCMadcMask. We meet END_OF_TRACKLET_MARKER 0x%08x",vword));\r\r
1468 fHC->fEOTECorrupted = kTRUE; //to finish data reading of this HC\r\r
1469 }\r\r
1470\r\r
1471 if ( MCM_ADCMASK_MASK_ERR(vword) == 0 ) {\r\r
1472 mcm->fADCMask = MCM_ADCMASK_VAL(vword);\r\r
1473 mcm->fADCcount = MCM_ADCMASK_NADC(~vword);\r\r
1474 }\r\r
1475 else {\r\r
1476 mcm->fADCMask = 0xffffffff;\r\r
1477 mcm->fADCmaskCorrupted = 1; // mcm adc mask error\r\r
1478 fHC->fDataCorrupted = kTRUE;\r\r
1479 if (fgDebugFlag) AliDebug(11,Form("Wrong ADC Mask word 0x%08x.\n", *fpPos));\r\r
1480 }\r\r
1481\r\r
1482 return mcm->fADCMask;\r\r
1483}\r\r
1484\r\r
1485//--------------------------------------------------------\r\r
1486void AliTRDrawFastStream::DecodeMask(const UInt_t *word, struct AliTRDrawMCM *mcm) const\r\r
1487{\r\r
1488 //\r\r
1489 // decode the adc mask - adcs to be read out\r\r
1490 //\r\r
1491 mcm->fSingleADCwords = 0;\r\r
1492 mcm->fADCmax = 0;\r\r
1493 mcm->fADCMask = GetMCMadcMask(word, mcm);\r\r
1494\r\r
1495 if (mcm->fADCMask > 0) {\r\r
1496 for (Int_t i = 0; i < TRDMAXADC; i++) {\r\r
1497 mcm->fADCchannel[mcm->fADCmax] = 0;\r\r
1498 if ( IS_BIT_SET(mcm->fADCMask,i) ) {\r\r
1499 mcm->fADCchannel[mcm->fADCmax] = i;\r\r
1500 mcm->fADCmax++;\r\r
1501 }\r\r
1502 }\r\r
1503 }\r\r
1504 if (mcm->fADCcount != mcm->fADCmax && fHC->fRawVMajor >= 32) { // backward compatibility\r\r
1505 mcm->fADCmaskCorrupted += 2;\r\r
1506 fHC->fDataCorrupted = kTRUE;\r\r
1507 if (fgDebugFlag) AliDebug(11,Form("ADC counts from ADCMask are different %d %d : ADCMask word 0x%08x\n", \r\r
1508 mcm->fADCcount, mcm->fADCmax, *fMCM.fPos));\r\r
1509 }\r\r
1510}\r\r
1511\r\r
1512//--------------------------------------------------------\r\r
1513void AliTRDrawFastStream::MCMADCwordsWithTbins(UInt_t fTbins, struct AliTRDrawMCM *mcm) const\r\r
1514{\r\r
1515 //\r\r
1516 // count the expected mcm words for a given tbins\r\r
1517 //\r\r
1518 mcm->fSingleADCwords = 0;\r\r
1519 mcm->fSingleADCwords = (fTbins-1)/3+1;\r\r
1520 if (fTbins > 32) mcm->fSingleADCwords = 10; // if the timebin is more than 30, then fix the number of adc words to 10\r\r
1521}\r\r
1522\r\r
1523//------------------------------------------------------------\r\r
1524Bool_t AliTRDrawFastStream::IsMCMheaderOK()\r\r
1525{\r\r
1526 //\r\r
1527 // check the mcm header\r\r
1528 //\r\r
1529 if (fgLastROB != fMCM.fROB) {\r\r
1530 fgLastIndex = 0;\r\r
1531 if (fgLastROB== -1) fgLastROB = fMCM.fROB;\r\r
1532 }\r\r
1533 else {\r\r
1534 Int_t matchingcounter = 0; \r\r
1535 for (Int_t i=fgLastIndex+1; i<16; i++) {\r\r
1536 if ( fMCM.fMCM == fgMCMordering[i] ) {\r\r
1537 fgLastIndex = i;\r\r
1538 matchingcounter++;\r\r
1539 break;\r\r
1540 }\r\r
1541 }\r\r
1542 if (matchingcounter == 0) {\r\r
1543 fMCM.fMCMhdCorrupted += 2;\r\r
1544 AliDebug(11,Form("MCM number from last MCM is larger: MCM # from current MCM %d \n", fMCM.fMCM));\r\r
1545 }\r\r
1546 } \r\r
1547 \r\r
1548 if ( fgLastHC == fHC->fLayer*2 + fHC->fSide ) {\r\r
1549 if ( fMCM.fROB < fgLastROB ) {\r\r
1550 if((fMCM.fMCMhdCorrupted & 2) == 0) fMCM.fMCMhdCorrupted += 2;\r\r
1551 AliDebug(11,Form("ROB number from last MCM is larger: ROB # from current MCM %d \n", fMCM.fROB));\r\r
1552 }\r\r
1553 else fgLastROB = fMCM.fROB;\r\r
1554 }\r\r
1555\r\r
1556 fgLastHC = fHC->fLayer*2 + fHC->fSide;\r\r
1557\r\r
1558 if (fEventCounter == 0) {\r\r
1559 fEventCounter = fMCM.fEvCounter;\r\r
1560 }\r\r
1561\r\r
1562 if (fEventCounter != fMCM.fEvCounter) {\r\r
1563 fMCM.fMCMhdCorrupted += 4;\r\r
1564 if (fgDebugFlag) AliDebug(11,Form("Event number(%d) of current MCM is different from that(%d) of reference MCM %s.\n"\r\r
1565 , fMCM.fEvCounter, fEventCounter, DumpMCMinfo(&fMCM)));\r\r
1566 }\r\r
1567\r\r
1568 if (fEventCounter < fLastEventCounter) {\r\r
1569 fMCM.fMCMhdCorrupted += 8;\r\r
1570 if (fgDebugFlag) AliDebug(11,Form("Event from the past? Current %d Last %d %s.\n", fEventCounter, fLastEventCounter, DumpMCMinfo(&fMCM)));\r\r
1571 }\r\r
1572\r\r
1573 if ( fMCM.fADCmaskCorrupted > 0 )\r\r
1574 return kFALSE;\r\r
1575\r\r
1576 if ( fMCM.fMCMhdCorrupted > 0 )\r\r
1577 return kFALSE;\r\r
1578\r\r
1579 return kTRUE;\r\r
1580}\r\r
1581\r\r
1582//------------------------------------------------------------\r\r
1583Bool_t AliTRDrawFastStream::DecodeADC(AliTRDdigitsManager *digitsManager, AliTRDarrayADC *digits, \r\r
1584 AliTRDarrayDictionary *track0, AliTRDarrayDictionary *track1, AliTRDarrayDictionary *track2, \r\r
1585 AliTRDSignalIndex *indexes)\r\r
1586{\r\r
1587 //\r\r
1588 // decode single ADC channel\r\r
1589 //\r\r
1590 if(fADCnumber%2==1) fMaskADCword = ADC_WORD_MASK(ADCDATA_VAL1);\r\r
1591 if(fADCnumber%2==0) fMaskADCword = ADC_WORD_MASK(ADCDATA_VAL2);\r\r
1592\r\r
1593 fTbinADC = 0;\r\r
1594 Bool_t isWritten = kFALSE;\r\r
1595\r\r
1596 for (Int_t iw = 0; iw < fMCM.fSingleADCwords; iw++) {\r\r
1597 if (HC_HEADER_MASK_ERR(*fpPos) == 0 || *fpPos == END_OF_TRACKLET_MARKERNEW) {\r\r
1598 if (fWarnError) AliError(Form("There should be ADC data. We meet HC header or END_OF_TRACKLET_MARKER 0x%08x",*fpPos));\r\r
1599 fHC->fEOTECorrupted = kTRUE; \r\r
1600 fpPos--;\r\r
1601 return kFALSE;\r\r
1602 }\r\r
1603 if (fMaskADCword != ADC_WORD_MASK(*fpPos)) {\r\r
1604 if (fgDebugFlag) AliDebug(11,Form("Wrong ADC data mask! [Expected mask: 0x%08x Current mask: 0x%08x] ADC channel number: %02d MCM= %s ",\r\r
1605 fMaskADCword, ADC_WORD_MASK(*fpPos), fADCnumber, DumpMCMinfo(&fMCM)));\r\r
1606 // encode adc level error codes\r\r
1607 Int_t index = 21*(fMCM.fMCM + 16*int(fMCM.fROB/2)) + fADCnumber;\r\r
1608 fHC->fErrorCodes[index+66] += 1; \r\r
1609 if (!isWritten) { \r\r
1610 fHC->fErrorCodes[index+66] += (fADCnumber << 4);; \r\r
1611 fHC->fErrorCodes[index+66] += (fMCM.fMCM << 9);; \r\r
1612 fHC->fErrorCodes[index+66] += (fMCM.fROB << 13);; \r\r
1613 isWritten = kTRUE; \r\r
1614 }\r\r
1615 fMCM.fDataCorrupted = kTRUE;\r\r
1616 fHC->fDataCorrupted = kTRUE;\r\r
1617 fpPos++;\r\r
1618 continue;\r\r
1619 }\r\r
1620 // decode and put into the digit container\r\r
1621 Int_t adcSignals[3];\r\r
1622 adcSignals[0] = ((*fpPos & 0x00000ffc) >> 2);\r\r
1623 adcSignals[1] = ((*fpPos & 0x003ff000) >> 12);\r\r
1624 adcSignals[2] = ((*fpPos & 0xffc00000) >> 22);\r\r
1625\r\r
1626 if(GetCol() < 0 || (!fSharedPadsOn & fIsShared)) {fpPos++; continue;}; \r\r
1627\r\r
1628 for (Int_t i = 0; i < 3; i++) {\r\r
1629 digits->SetDataByAdcCol(GetRow(), GetExtendedCol(), fTbinADC + i, adcSignals[i]);\r\r
1630 indexes->AddIndexRC(GetRow(), GetCol());\r\r
1631 if (digitsManager->UsesDictionaries()) {\r\r
1632 track0->SetData(GetRow(), GetCol(), fTbinADC + i, 0);\r\r
1633 track1->SetData(GetRow(), GetCol(), fTbinADC + i, 0);\r\r
1634 track2->SetData(GetRow(), GetCol(), fTbinADC + i, 0);\r\r
1635 }\r\r
1636 } // i\r\r
1637 fTbinADC += 3;\r\r
1638 fpPos++;\r\r
1639 } // iw\r\r
1640\r\r
1641 return kTRUE;\r\r
1642}\r\r
1643\r\r
1644//------------------------------------------------------------\r\r
1645Bool_t AliTRDrawFastStream::DecodeADCExtended(AliTRDdigitsManager *digitsManager, AliTRDarrayADC *digits, \r\r
1646 AliTRDarrayDictionary *track0, AliTRDarrayDictionary *track1, AliTRDarrayDictionary *track2, \r\r
1647 AliTRDSignalIndex *indexes)\r\r
1648{\r\r
1649 //\r\r
1650 // decode single ADC channel\r\r
1651 //\r\r
1652 if(fADCnumber%2==1) fMaskADCword = ADC_WORD_MASK(ADCDATA_VAL1);\r\r
1653 if(fADCnumber%2==0) fMaskADCword = ADC_WORD_MASK(ADCDATA_VAL2);\r\r
1654\r\r
1655 Bool_t isWritten = kFALSE; //for error code recording\r\r
1656\r\r
1657 fTbinADC = ((*fpPos & 0x000000fc) >> 2);\r\r
1658 fMCM.fSingleADCwords = ((*fpPos & 0x00000f00) >> 8);\r\r
1659 \r\r
1660 Int_t adcFirst2Signals[2];\r\r
1661 adcFirst2Signals[0] = ((*fpPos & 0x003ff000) >> 12);\r\r
1662 adcFirst2Signals[1] = ((*fpPos & 0xffc00000) >> 22);\r\r
1663\r\r
1664 for (Int_t i = 0; i < 2; i++) {\r\r
1665 digits->SetDataByAdcCol(GetRow(), GetExtendedCol(), fTbinADC + i, adcFirst2Signals[i]);\r\r
1666 indexes->AddIndexRC(GetRow(), GetCol());\r\r
1667 if (digitsManager->UsesDictionaries()) {\r\r
1668 track0->SetData(GetRow(), GetCol(), fTbinADC + i, 0);\r\r
1669 track1->SetData(GetRow(), GetCol(), fTbinADC + i, 0);\r\r
1670 track2->SetData(GetRow(), GetCol(), fTbinADC + i, 0);\r\r
1671 }\r\r
1672 } // i\r\r
1673\r\r
1674 fpPos++;\r\r
1675 for (Int_t iw = 0; iw < fMCM.fSingleADCwords-1; iw++) {\r\r
1676 if (HC_HEADER_MASK_ERR(*fpPos) == 0 || *fpPos == END_OF_TRACKLET_MARKERNEW) {\r\r
1677 if (fWarnError) AliError(Form("There should be ADC data. We meet HC header or END_OF_TRACKLET_MARKER 0x%08x",*fpPos));\r\r
1678 fHC->fEOTECorrupted = kTRUE; \r\r
1679 fpPos--;\r\r
1680 return kFALSE;\r\r
1681 }\r\r
1682 if (fMaskADCword != ADC_WORD_MASK(*fpPos)) {\r\r
1683 if (fgDebugFlag) AliDebug(11,Form("Wrong ADC data mask! [Expected mask: 0x%08x Current mask: 0x%08x] ADC channel number: %02d MCM= %s ",\r\r
1684 fMaskADCword, ADC_WORD_MASK(*fpPos), fADCnumber, DumpMCMinfo(&fMCM)));\r\r
1685 // encode adc level error codes\r\r
1686 Int_t index = 21*(fMCM.fMCM + 16*int(fMCM.fROB/2)) + fADCnumber;\r\r
1687 fHC->fErrorCodes[index+66] += 1; \r\r
1688 if (!isWritten) { \r\r
1689 fHC->fErrorCodes[index+66] += (fADCnumber << 4);; \r\r
1690 fHC->fErrorCodes[index+66] += (fMCM.fMCM << 9);; \r\r
1691 fHC->fErrorCodes[index+66] += (fMCM.fROB << 13);; \r\r
1692 isWritten = kTRUE; \r\r
1693 }\r\r
1694 fMCM.fDataCorrupted = kTRUE;\r\r
1695 fHC->fDataCorrupted = kTRUE;\r\r
1696 fpPos++;\r\r
1697 continue;\r\r
1698 }\r\r
1699 // decode and put into the digit container\r\r
1700 Int_t adcSignals[3];\r\r
1701 adcSignals[0] = ((*fpPos & 0x00000ffc) >> 2);\r\r
1702 adcSignals[1] = ((*fpPos & 0x003ff000) >> 12);\r\r
1703 adcSignals[2] = ((*fpPos & 0xffc00000) >> 22);\r\r
1704\r\r
1705 if(GetCol() < 0 || (!fSharedPadsOn & fIsShared)) {fpPos++; continue;}; \r\r
1706 for (Int_t i = 0; i < 3; i++) {\r\r
1707 digits->SetDataByAdcCol(GetRow(), GetExtendedCol(), fTbinADC + 2 + i, adcSignals[i]);\r\r
1708 indexes->AddIndexRC(GetRow(), GetCol());\r\r
1709 if (digitsManager->UsesDictionaries()) {\r\r
1710 track0->SetData(GetRow(), GetCol(), fTbinADC + 2 + i, 0);\r\r
1711 track1->SetData(GetRow(), GetCol(), fTbinADC + 2 + i, 0);\r\r
1712 track2->SetData(GetRow(), GetCol(), fTbinADC + 2 + i, 0);\r\r
1713 }\r\r
1714 } // i\r\r
1715 fTbinADC += 3;\r\r
1716 fpPos++;\r\r
1717 } // iw\r\r
1718\r\r
1719 return kTRUE;\r\r
1720}\r\r
1721\r\r
1722//------------------------------------------------------------\r\r
1723Bool_t AliTRDrawFastStream::SeekEndOfData()\r\r
1724{\r\r
1725 //\r\r
1726 // go to end of data marker\r\r
1727 //\r\r
1728 Int_t fEndOfDataCount = 0;\r\r
1729 fNWordsCounter = 0;\r\r
1730\r\r
1731 while ( *fpPos != ENDOFRAWDATAMARKER && fpPos < fpEnd ) {\r\r
1732 fpPos++;\r\r
1733 fNWordsCounter++;\r\r
1734 }\r\r
1735 while (*fpPos == ENDOFRAWDATAMARKER && fpPos < fpEnd ) {\r\r
1736 fEndOfDataCount++;\r\r
1737 fpPos++;\r\r
1738 }\r\r
1739\r\r
1740 return kTRUE;\r\r
1741}\r\r
1742\r\r
1743//------------------------------------------------------------\r\r
1744Bool_t AliTRDrawFastStream::SeekNextMCMheader()\r\r
1745{\r\r
1746 //\r\r
1747 // go to mcm marker\r\r
1748 //\r\r
1749 fpPos++;\r\r
1750\r\r
1751 while ( *fpPos != ENDOFRAWDATAMARKER && fpPos < fpEnd ) {\r\r
1752 if (MCM_HEADER_MASK_ERR(*fpPos) == 0 && MCM_HEADER_MASK_ERR(*(fpPos+1)) == 0) {\r\r
1753 if (fgDebugFlag) AliDebug(11,Form("Found : Pos 0x%08x : Val 0x%08x", fpPos, *fpPos));\r\r
1754 return kTRUE;\r\r
1755 }\r\r
1756 if ( *fpPos == END_OF_TRACKLET_MARKERNEW) {\r\r
1757 fHC->fEOTECorrupted = kTRUE;\r\r
1758 return kFALSE;\r\r
1759 }\r\r
1760 fpPos++;\r\r
1761 }\r\r
1762\r\r
1763 SeekEndOfData();\r\r
1764 return kFALSE;\r\r
1765}\r\r
1766\r\r
1767//------------------------------------------------------------\r\r
1768Bool_t AliTRDrawFastStream::SkipMCMdata(UInt_t iw)\r\r
1769{\r\r
1770 //\r\r
1771 // skip mcm data words due to corruption\r\r
1772 //\r\r
1773 if (fgDebugFlag) AliDebug(11,Form("Skip %d words due to MCM header corruption.",iw));\r\r
1774 UInt_t iwcounter = 0;\r\r
1775 while ( *fpPos != ENDOFRAWDATAMARKER && iwcounter < iw) {\r\r
1776 if ( *fpPos == END_OF_TRACKLET_MARKERNEW) {\r\r
1777 if (fgDebugFlag) AliDebug(11,"Met END_OF_TRACKLET_MARKERNEW");\r\r
1778 fHC->fEOTECorrupted = kTRUE;\r\r
1779 return kFALSE;\r\r
1780 }\r\r
1781 fpPos++;\r\r
1782 iwcounter++;\r\r
1783 } // while\r\r
1784\r\r
1785 if (iwcounter == iw) {\r\r
1786 fpPos++;\r\r
1787 return kTRUE;\r\r
1788 }\r\r
1789\r\r
1790 if (fgDebugFlag) AliDebug(11,"Met ENDOFRAWDATAMARKER");\r\r
1791 return kFALSE;\r\r
1792}\r\r
1793\r\r
1794//------------------------------------------------------------\r\r
1795Bool_t AliTRDrawFastStream::SetGlobalNTimebins()\r\r
1796{\r\r
1797 // get number of time bin info from HC headers then set \r\r
1798 Int_t nHCs=0;\r\r
1799 while (SetNTimebins()==kFALSE){\r\r
1800 if (fgDebugFlag) AliDebug(11,Form("Failed to get number of time bin information from the %sth HC",nHCs));\r\r
1801 nHCs++;\r\r
1802 }\r\r
1803\r\r
1804 return kTRUE;\r\r
1805}\r\r
1806\r\r
1807//------------------------------------------------------------\r\r
1808Bool_t AliTRDrawFastStream::SetNTimebins()\r\r
1809{\r\r
1810 // goes to the HC header position\r\r
1811 while (!(*fpPosTemp == END_OF_TRACKLET_MARKERNEW) && fpPosTemp < fpEnd) {\r\r
1812 fpPosTemp++;\r\r
1813 }\r\r
1814 while (*fpPosTemp == END_OF_TRACKLET_MARKERNEW) {\r\r
1815 fpPosTemp++;\r\r
1816 }\r\r
1817 // skip H0 \r\r
1818 fpPosTemp++;\r\r
1819\r\r
1820 UInt_t vword = 0;\r\r
1821 if (!(vword = *fpPosTemp)) {\r\r
1822 fGlobalNTimeBins = 30; // default number of timebins \r\r
1823 return kFALSE;\r\r
1824 }\r\r
1825\r\r
1826 // get the number of time bins \r\r
1827 if (HC_HEADER_MASK_ERR(vword) == 0) {\r\r
1828 fGlobalNTimeBins = HC_NTIMEBINS(vword);\r\r
1829 if (fGlobalNTimeBins > 64 || fGlobalNTimeBins < 10) return kFALSE; // minimal protection\r\r
1830 }\r\r
1831 else\r\r
1832 return kFALSE;\r\r
1833\r\r
1834 return kTRUE;\r\r
1835}\r\r
1836\r\r
1837//------------------------------------------------------------\r\r
1838Bool_t AliTRDrawFastStream::DumpWords(UInt_t *px, UInt_t iw, UInt_t marker)\r\r
1839{\r\r
1840 //\r\r
1841 // dump given number of words for debugging\r\r
1842 //\r\r
1843 TString tsreturn = Form("\n[ Dump Sequence at 0x%08x ] : ", px);\r\r
1844 for (UInt_t i = 0; i < iw; i++) {\r\r
1845 if ( iw != 0 && px + iw > fpEnd) \r\r
1846 return kFALSE;\r\r
1847 if (i % 8 == 0) tsreturn += "\n ";\r\r
1848 if (marker != 0 && marker == px[i]) tsreturn += Form(" *>0x%08x<* ", px[i]);\r\r
1849 else tsreturn += Form("0x%08x ", px[i]);\r\r
1850 }\r\r
1851 tsreturn += "\n";\r\r
1852\r\r
1853 AliInfo(tsreturn.Data());\r\r
1854\r\r
1855 return kTRUE;\r\r
1856}\r\r
1857\r\r
1858//--------------------------------------------------------\r\r
1859const char *AliTRDrawFastStream::DumpSMInfo(const struct AliTRDrawSM *sm)\r\r
1860{\r\r
1861 //\r\r
1862 // format the string with the sm info\r\r
1863 //\r\r
1864 return Form("[ SM Info 0x%08x] : Hsize %d TrackletEnable %d Stacks %d %d %d %d %d",\r\r
1865 *sm->fPos, sm->fHeaderSize, sm->fTrackletEnable,\r\r
1866 sm->fStackActive[0], sm->fStackActive[1], sm->fStackActive[2],\r\r
1867 sm->fStackActive[3], sm->fStackActive[4]); \r\r
1868}\r\r
1869\r\r
1870//--------------------------------------------------------\r\r
1871const char *AliTRDrawFastStream::DumpStackInfo(const struct AliTRDrawStack *st)\r\r
1872{\r\r
1873 //\r\r
1874 // format the string with the stack info\r\r
1875 //\r\r
1876 return Form("[ Stack Info 0x%08x ] : Hsize %d Links Active %d %d %d %d %d %d %d %d %d %d %d %d",\r\r
1877 *st->fPos, st->fHeaderSize,\r\r
1878 st->fLinksActive[0], st->fLinksActive[1], st->fLinksActive[2], st->fLinksActive[3],\r\r
1879 st->fLinksActive[4], st->fLinksActive[5], st->fLinksActive[6], st->fLinksActive[7],\r\r
1880 st->fLinksActive[8], st->fLinksActive[9], st->fLinksActive[10], st->fLinksActive[11]);\r\r
1881\r\r
1882}\r\r
1883//--------------------------------------------------------\r\r
1884const char *AliTRDrawFastStream::DumpHCinfoH0(const struct AliTRDrawHC *hc)\r\r
1885{\r\r
1886 //\r\r
1887 // dump the hc header word 0 in strings\r\r
1888 //\r\r
1889 if (!hc)\r\r
1890 return Form("Unable to dump. Null received as parameter!?!");\r\r
1891 else\r\r
1892 return Form("[ HC[0] at 0x%08x ] : 0x%08x Info is : RawV %d SM %d Stack %d Layer %d Side %d DCSboard %d",\r\r
1893 hc->fPos[0], *(hc->fPos[0]), hc->fRawVMajor, fRawReader->GetEquipmentId()-1024, \r\r
1894 hc->fStack, hc->fLayer, hc->fSide, hc->fDCSboard);\r\r
1895}\r\r
1896\r\r
1897//--------------------------------------------------------\r\r
1898const char *AliTRDrawFastStream::DumpHCinfoH1(const struct AliTRDrawHC *hc)\r\r
1899{\r\r
1900 //\r\r
1901 // dump the hc header word 1 in strings\r\r
1902 //\r\r
1903 if (!hc)\r\r
1904 return Form("Unable to dump. Null received as parameter!?!");\r\r
1905 else\r\r
1906 return Form("[ HC[1] at 0x%08x ] : 0x%08x Info is : TBins %d BCcount %d PreTrigCount %d PreTrigPhase %d",\r\r
1907 hc->fPos[1], *(hc->fPos[1]), hc->fTimeBins, hc->fBunchCrossCounter, hc->fPreTriggerCounter, hc->fPreTriggerPhase);\r\r
1908}\r\r
1909\r\r
1910//--------------------------------------------------------\r\r
1911const char *AliTRDrawFastStream::DumpMCMinfo(const struct AliTRDrawMCM *mcm)\r\r
1912{\r\r
1913 //\r\r
1914 // dump mcm info in strings\r\r
1915 //\r\r
1916 if (!mcm)\r\r
1917 return Form("Unable to dump. Null received as parameter!?!");\r\r
1918 else\r\r
1919 return Form("[ MCM 0x%08x ] : ROB %d MCM %d EvCounter %d", *(mcm->fPos), mcm->fROB, mcm->fMCM, mcm->fEvCounter);\r\r
1920}\r\r
1921\r\r
1922//--------------------------------------------------------\r\r
1923const char *AliTRDrawFastStream::DumpMCMadcMask(const struct AliTRDrawMCM *mcm)\r\r
1924{\r\r
1925 //\r\r
1926 // mcm adc mask in strings\r\r
1927 //\r\r
1928 if (!mcm)\r\r
1929 return Form("Unable to dump. Null received as parameter!?!");\r\r
1930\r\r
1931 TString tsreturn = Form("[Word] : 0x%08x => [Mask] : 0x%08x : ", mcm->fADCMaskWord, mcm->fADCMask);\r\r
1932 for (Int_t i = 0; i < TRDMAXADC; i++) {\r\r
1933 tsreturn += Form("%d ", mcm->fADCchannel[i]);\r\r
1934 }\r\r
1935 tsreturn += "";\r\r
1936 return tsreturn.Data();\r\r
1937}\r\r
1938\r\r
1939\r\r