]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDrawStreamTB.h
Bug fix
[u/mrichter/AliRoot.git] / TRD / AliTRDrawStreamTB.h
CommitLineData
d4232bb6 1#ifndef ALITRDRAWSTREAMTB_H
2#define ALITRDRAWSTREAMTB_H
3
4/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
6
7/* $Id$ */
8
9///////////////////////////////////////////////////////////////////////////////
10// //
11// This class provides access to TRD digits in raw data. //
12// //
13///////////////////////////////////////////////////////////////////////////////
14
15#include "TObject.h"
16#include "TString.h"
dfbb4bb9 17#include "AliTRDrawStreamBase.h"
d4232bb6 18
19class AliTRDgeometry;
20class AliRawReader;
21class AliTRDdigitsManager;
22class TTreeSRedirector;
23class AliTRDfeeParam;
24
dfbb4bb9 25// definitions in AliTRDrawStreamBase.h:
26/* #define TRD_MAX_TBINS 30 */
27/* #define TRD_MAX_ADC 21 */
28/* #define TRD_MAX_MCM 4 * 16 */
d4232bb6 29
dfbb4bb9 30//class AliTRDrawStreamTB : public TObject
31class AliTRDrawStreamTB : public AliTRDrawStreamBase
d4232bb6 32{ // class def begin
33
34 public:
35
36 //--------------------------------------------------------
37
38 // THE STRUCTURES
39
40 //--------------------------------------------------------
41
42 struct AliTRDrawADC
43 {//adc struct
44
45 UInt_t *fPos; //! position of ADC 1st word in the buffer
46 Short_t fADCnumber; // number of the ADC 0 .. 20
47 Short_t fCOL; // column - row from MCM
48 Int_t fSignals[TRD_MAX_TBINS]; // signals for this adc
49 Bool_t fIsShared; // is pad chared between MCMs
50 Short_t fCorrupted; // is adc word corrupted
51
52 AliTRDrawADC()
53 : fPos(0)
54 , fADCnumber(0)
55 , fCOL(0)
56 , fSignals()
57 , fIsShared(kFALSE)
58 , fCorrupted(0)
59 {
60 // default constructor
61 ;
62 }
63
6bd744d3 64 AliTRDrawADC(const AliTRDrawADC& p):
65 fPos(p.fPos)
66 , fADCnumber(p.fADCnumber)
67 , fCOL(p.fCOL)
68 , fSignals()
69 , fIsShared(p.fIsShared)
70 , fCorrupted(p.fCorrupted)
71 {
72 // copy constructor
73 ;
74 }
75
76 AliTRDrawADC &operator=(const AliTRDrawADC &)
77 {
78 // assignment operator
79 // not implemented
80 return *this;
81 }
82
83
d4232bb6 84 };
85
86 //--------------------------------------------------------
87
88 struct AliTRDrawMCM
89 { // mcm struct
90 Int_t fROB; // ROB number
91 Int_t fMCM; // MCM number
92 Int_t fROW; //filed during decoding!
93
94 UInt_t fEvCounter; // MCM event counter
95 UInt_t fADCMask; // ADC mask
96 UInt_t fADCMaskWord; // word with ADC mask in
97 UInt_t fADCchannel[30]; // channels to be decoded accrording to ADC mask
98
99 Int_t fADCindex; // index of current ADC (comment: 1 ADC is 1 pad)
100 Int_t fADCmax; // number of ADCs fired
bb1009bf 101 Int_t fADCcount; // number of ADCs fired from double checking bit
d4232bb6 102 Int_t fMCMADCWords; // mcm words to expect
103 Int_t fSingleADCwords; // n of words per ADC
104
105 Int_t fCorrupted; // is mcm word corrupted
106
107 UInt_t fErrorCounter; // count the mcm header errors
108 UInt_t fMaskErrorCounter; // count the adc mask errors
109
110 UInt_t *fPos; //! position of mcm header in the buffer
111 UInt_t *fAdcDataPos; //! start of ADC data for this mcm
112
113 Int_t fADCcounter; // count the adcs decoded
114 AliTRDrawADC fADCs[TRD_MAX_ADC]; // 21 adcs
115
116 AliTRDrawMCM()
117 : fROB(-1)
118 , fMCM(-1)
119 , fROW(-1)
120 , fEvCounter(0)
121 , fADCMask(0)
122 , fADCMaskWord(0)
123 , fADCchannel()
124 , fADCindex(0)
125 , fADCmax(0)
bb1009bf 126 , fADCcount(0)
d4232bb6 127 , fMCMADCWords(0)
128 , fSingleADCwords(0)
129 , fCorrupted(0)
130 , fErrorCounter(0)
131 , fMaskErrorCounter(0)
132 , fPos(0)
133 , fAdcDataPos(0)
134 , fADCcounter(0)
135 , fADCs()
136 {
137 // default constructor
138 /* the following violates coding conventions */
139 //for (Int_t i = 0; i < 30; i++) fADCchannel[i] = 0;
140 }
6bd744d3 141
142 AliTRDrawMCM(const AliTRDrawMCM & p):
143 fROB(p.fROB)
144 , fMCM(p.fMCM)
145 , fROW(p.fROW)
146 , fEvCounter(p.fEvCounter)
147 , fADCMask(p.fADCMask)
148 , fADCMaskWord(p.fADCMaskWord)
149 , fADCchannel()
150 , fADCindex(p.fADCindex)
151 , fADCmax(p.fADCmax)
bb1009bf 152 , fADCcount(p.fADCcount)
6bd744d3 153 , fMCMADCWords(p.fMCMADCWords)
154 , fSingleADCwords(p.fSingleADCwords)
155 , fCorrupted(p.fCorrupted)
156 , fErrorCounter(p.fErrorCounter)
157 , fMaskErrorCounter(p.fMaskErrorCounter)
158 , fPos(p.fPos)
159 , fAdcDataPos(p.fAdcDataPos)
160 , fADCcounter(p.fADCcounter)
161 , fADCs()
162 {
163 // copy constructor
164 ;
165 }
166
167 AliTRDrawMCM &operator=(const AliTRDrawMCM &)
168 {
169 // assignment operator
170 // not implemented
171 return *this;
172 }
173
d4232bb6 174 };
175
176 //--------------------------------------------------------
177
178 struct AliTRDrawHC
179 { // hc struct
180 // global
181 Int_t fCorrupted; // Zero if not corrupted
182
183 UInt_t fH0ErrorCounter; // Count the H0 word errors
184 UInt_t fH1ErrorCounter; // Count the H1 word errors
185
186 // word 0
187 Int_t fSpecialRawV; // Raw data version
188 Int_t fRawVMajor; // Raw data version
dc25a859 189 Int_t fRawVMajorOpt; // Raw data version
d4232bb6 190 Int_t fRawVMinor; // Raw data version
191 Int_t fNExtraWords; // N extra HC header words
192 Int_t fDCSboard; // DCS board number
193 Int_t fSM; // Super Module number
194 Int_t fStack; // Stack number (some people might call it a chamber)
195 Int_t fLayer; // Layer number (some people might call it a plane)
196 Int_t fSide; // Side of HC
197
198 //word 1
199 Int_t fTimeBins; // N of t bins
200 UInt_t fBunchCrossCounter; // Bunch crossing counter
201 UInt_t fPreTriggerCounter; // Pre Trigger counter
202 UInt_t fPreTriggerPhase; // Pre Trigger phase
203
204 UInt_t *fPos[2]; //! position of the header words in buffer
205
206 Int_t fDET; // filled while decoding
207 Int_t fROC; // filled while decoding
208 Int_t fRowMax; // filled while decoding
209 Int_t fColMax; // filled while decoding
210
211 //AliTRDrawMCM fMCMs[4][16]; // 4 ROBS 16 each - that is max!
212 Int_t fMCMmax; // number of mcm found
213 AliTRDrawMCM fMCMs[TRD_MAX_MCM]; // 4 ROBS 16 each - that is max!
214
215 AliTRDrawHC()
216 : fCorrupted(0)
217 , fH0ErrorCounter(0)
218 , fH1ErrorCounter(0)
219 , fSpecialRawV(0)
220 , fRawVMajor(0)
dc25a859 221 , fRawVMajorOpt(0)
d4232bb6 222 , fRawVMinor(0)
223 , fNExtraWords(0)
224 , fDCSboard(-1)
225 , fSM(-1)
226 , fStack(-1)
227 , fLayer(-1)
228 , fSide(-1)
229 , fTimeBins(0)
230 , fBunchCrossCounter(0)
231 , fPreTriggerCounter(0)
232 , fPreTriggerPhase(0)
233 , fPos()
234 , fDET(-1)
235 , fROC(-1)
236 , fRowMax(-1)
237 , fColMax(-1)
238 , fMCMmax(0)
239 , fMCMs()
240 {
241 // default constructor hc info
242 /* the following violates coding conventions */
243 //fPos[0] = fPos[0] = 0;
244 }
6bd744d3 245
246 AliTRDrawHC(const AliTRDrawHC & p):
247 fCorrupted(p.fCorrupted)
248 , fH0ErrorCounter(p.fH0ErrorCounter)
249 , fH1ErrorCounter(p.fH1ErrorCounter)
250 , fSpecialRawV(p.fSpecialRawV)
251 , fRawVMajor(p.fRawVMajor)
dc25a859 252 , fRawVMajorOpt(p.fRawVMajorOpt)
6bd744d3 253 , fRawVMinor(p.fRawVMinor)
254 , fNExtraWords(p.fNExtraWords)
255 , fDCSboard(p.fDCSboard)
256 , fSM(p.fSM)
257 , fStack(p.fStack)
258 , fLayer(p.fLayer)
259 , fSide(p.fSide)
260 , fTimeBins(p.fTimeBins)
261 , fBunchCrossCounter(p.fBunchCrossCounter)
262 , fPreTriggerCounter(p.fPreTriggerCounter)
263 , fPreTriggerPhase(p.fPreTriggerPhase)
264 , fPos()
265 , fDET(p.fDET)
266 , fROC(p.fROC)
267 , fRowMax(p.fRowMax)
268 , fColMax(p.fColMax)
269 , fMCMmax(p.fMCMmax)
270 , fMCMs()
271 {
272 // copy constructor
273 ;
274 }
275
276 AliTRDrawHC &operator=(const AliTRDrawHC &)
277 {
278 // assignment operator
279 // not implemented
280 return *this;
281 }
282
d4232bb6 283 };
284
285 //--------------------------------------------------------
286
287 struct AliTRDrawStack
288 {
289 UInt_t fHeaderSize; // header size of the stack info
290 Bool_t fLinksActive[12]; // data links active - 1 per half chamber
291 Bool_t fTrackletDecode[12]; // book keeping while decoding - set false after decoding
292 Bool_t fHCDecode[12]; // book keeping while decoding - set false after HC header decoding
293 Int_t fActiveLinks; // number of active links
294 UInt_t *fPos; //! position in the buffer
295
296 AliTRDrawHC fHalfChambers[12]; // 6 chambers in a stack
297
298 AliTRDrawStack()
299 : fHeaderSize(0)
300 , fLinksActive()
301 , fTrackletDecode() //book keeping while decoding - set false after decoding
302 , fHCDecode() //book keeping while decoding - set false after HC header decoding
303 , fActiveLinks(0)
304 , fPos(0)
305 , fHalfChambers()
306 {
307 // default constructor
308 }
6bd744d3 309
310 AliTRDrawStack(const AliTRDrawStack & p):
311 fHeaderSize(p.fHeaderSize)
312 , fLinksActive()
313 , fTrackletDecode() //book keeping while decoding - set false after decoding
314 , fHCDecode() //book keeping while decoding - set false after HC header decoding
315 , fActiveLinks(p.fActiveLinks)
316 , fPos(p.fPos)
317 , fHalfChambers()
318 {
319 // copy constructor
320 ;
321 }
322
323 AliTRDrawStack &operator=(const AliTRDrawStack &)
324 {
325 // assignment operator
326 // not implemented
327 return *this;
328 }
329
d4232bb6 330 };
331
332 /* the following violates coding conventions */
333/* for (Int_t i = 0; i < 12; i++) */
334/* { */
335/* fLinksActive[i] = fTrackletDecode[i] = fHCDecode[i] = kFALSE; */
336/* } */
337
338 //--------------------------------------------------------
339
340 struct AliTRDrawSM
341 {
342 UInt_t fHeaderSize; // size of the header in words
343 Bool_t fTrackletEnable; // tracklet enable bit
344 Bool_t fStackActive[5]; // map of active/expected stacks
345 Int_t fActiveStacks; // number of active stacks
346 Int_t fCorrupted; // is sm info corrupted
347 Int_t fNexpectedHalfChambers; // number of half chambers to be read out
348 Bool_t fClean; // true if everything went OK - false is some error occured
349 UInt_t *fPos; //! location of the sm info - should be the first word (after CDH if not DDL buffer)
350
351 AliTRDrawStack fStacks[5]; // we do have only five stacks ;)
352
353 AliTRDrawSM()
354 : fHeaderSize(0)
355 , fTrackletEnable(0)
356 , fStackActive()
357 , fActiveStacks(0)
358 , fCorrupted(0)
359 , fNexpectedHalfChambers(0)
360 , fClean(kTRUE)
361 , fPos(0)
362 , fStacks()
363 {
364 // Default constructor
365 // coding rule violation in the next line
366 //for (Int_t i = 0; i < 5; i++) fStackActive[i] = kFALSE;
367 };
6bd744d3 368
369 AliTRDrawSM(const AliTRDrawSM & p):
370 fHeaderSize(p.fHeaderSize)
371 , fTrackletEnable(p.fTrackletEnable)
372 , fStackActive()
373 , fActiveStacks(p.fActiveStacks)
374 , fCorrupted(p.fCorrupted)
375 , fNexpectedHalfChambers(p.fNexpectedHalfChambers)
376 , fClean(p.fClean)
377 , fPos(p.fPos)
378 , fStacks()
379 {
380 // copy constructor
381 ;
382 }
383
384 AliTRDrawSM &operator=(const AliTRDrawSM &)
385 {
386 // assignment operator
387 // not implemented
388 return *this;
389 }
390
d4232bb6 391 };
392
393 //--------------------------------------------------------
394
395 AliTRDrawStreamTB();
396 AliTRDrawStreamTB(AliRawReader *rawReader);
397 virtual ~AliTRDrawStreamTB();
398
399 //--------------------------------------------------------
400
401 virtual Bool_t Next(); // Read the next data
402 virtual Int_t NextChamber(AliTRDdigitsManager *man); // read next chamber data
403 virtual Bool_t Init(); // Init some internal variables
404
dfbb4bb9 405 Bool_t SetRawVersion(Int_t fraw); // set the raw version - used for backward compat.
d4232bb6 406
d4232bb6 407 Bool_t IsCurrentPadShared() const {return fADC->fIsShared;} // is current pad shared between mcms
408 void SetSharedPadReadout(Bool_t fv) {fSharedPadsOn = fv;} // set the flag on if the reader should return the shared pads
409 Bool_t IsDataZeroSuppressed() const {return (fHC->fRawVMajor > 2) ? kTRUE : kFALSE;} // check the version and tell if ZS is on
410
411 Bool_t DecodeSM(void *buffer, UInt_t length); //decode a buffer
412 Int_t DecodeSM(); // used with raw reader
413 Int_t DecodeSM(AliRawReader *reader); // used with raw reader
414
415 Bool_t SetReader(AliRawReader *reader); // set the raw reader to use
416
417 Bool_t IsTrackletEnableBitSet() const {return fSM.fTrackletEnable;} // get status of the tracklets enable bit
418 Bool_t IsStackActive(Int_t is) const {return fSM.fStackActive[is];} // get status of a stack
419 Int_t GetNofActiveStacks() const {return fSM.fActiveStacks;} // get number of active stacks
420 UInt_t *GetSMstreamPosition() const {return fSM.fPos;} // get position of the SM index word in the buffer
421
422 Bool_t IsSMbufferClean() const {return fSM.fClean;} // is data clean
423
424 Bool_t IsLinkActiveInStack(Int_t is, Int_t il) const {return fSM.fStacks[is].fLinksActive[il];} // check whether the link is active
425 Int_t GetActiveLinksInStack(Int_t is) const {return fSM.fStacks[is].fActiveLinks;} //get active links in a stack
426
427 Int_t GetSpecialRawVersion() const {return fHC ? fHC->fSpecialRawV : -1;} // return special raw version
428 Int_t GetMajorRawVersion() const {return fHC ? fHC->fRawVMajor : -1;} // major raw version getter
429 Int_t GetRawVersion() const {return fHC ? fHC->fRawVMajor : -1;} // compatibility see funtion above
430 Int_t GetMinorRawVersion() const {return fHC ? fHC->fRawVMinor : -1;} // minor raw version
431
432 Int_t GetSM() const {return fHC ? fHC->fSM : -1;} // Position of CURRENT half chamber in full TRD
433 Int_t GetLayer() const {return fHC ? fHC->fLayer : -1;} // PLANE = Position of CURRENT half chamber in full TRD
434 Int_t GetStack() const {return fHC ? fHC->fStack : -1;} // CHAMBER = Position of CURRENT half chamber in full TRD
435 Int_t GetSide() const {return fHC ? fHC->fSide : -1;} // get side
436 Int_t GetDCS() const { return fHC ? fHC->fDCSboard : -1;} // DCS board number read from data (HC header)
437 //Int_t GetDCSboard() {return fHC ? fHC->fDCSboard : -1;} // DCS board number read from data (HC header)
438 Int_t GetROC() const { return fHC ? fHC->fROC : -1;} // Position of CURRENT half chamber in full TRD
439 Int_t GetNumberOfTimeBins() const { return fHC ? fHC->fTimeBins : 0;} // Get Ntime bins
440 UInt_t GetBunchCrossCounter() const {return fHC ? fHC->fBunchCrossCounter : 0;} // get bunch cross counter
441 UInt_t GetPreTriggerCounter() const {return fHC ? fHC->fPreTriggerCounter : 0;} // get pre trigger info
442 UInt_t GetPreTriggerPhase() const {return fHC ? fHC->fPreTriggerPhase : 0;} // get trigger phase
443
444 Int_t GetRow() const {return fMCM ? fMCM->fROW : -1;} // get current row number
445 Int_t GetCol() const {return fADC ? fADC->fCOL : -1;} // get current column number
446 Int_t GetRowMax() const { return fHC ? fHC->fRowMax : -1;} // Get maximum rows in the current HC
447 Int_t GetColMax() const { return fHC ? fHC->fColMax : -1;} // Get maximum cols in the current HC
448 // compatibility
449 Int_t GetMaxRow() const { return fHC ? fHC->fRowMax : -1;} // Get maximum rows in the current HC
450 Int_t GetMaxCol() const { return fHC ? fHC->fColMax : -1;} // Get maximum cols in the current HC
451
452 UInt_t GetHCword0() const {return fHC ? *fHC->fPos[0] : 0;} // get the HC word 0
453 UInt_t GetHCword1() const {return fHC ? *fHC->fPos[1] : 0;} // get the HC word 1
454
455 Int_t GetDET() const {return fHC ? fHC->fDET : -1;} // get current det number
456 Int_t GetDet() const {return fHC ? fHC->fDET : -1;} // get current det number
457
458 Int_t GetROB() const {return fMCM ? fMCM->fROB : -1;} // get current ROB number
459 Int_t GetMCM() const {return fMCM ? fMCM->fMCM : -1;} // get current MCM number
460 Int_t GetEventNumber() const { return fMCM->fEvCounter;} // MCM Event number and position of current MCM on TRD chamber
461
dc25a859 462 Int_t GetMCMErrorCode() const {return fMCM ? fMCM->fCorrupted : -1;} // get HC error code
463 //Int_t GetHCErrorCode() const {return fHC ? fHC->fCorrupted : -1;} // get HC error code
464
d4232bb6 465 Int_t IsMCMcorrupted() const {return fMCM ? fMCM->fCorrupted : -1;} // is current MCM header corrupted
466
467 Int_t *GetSignals() const { return fADC ? fADC->fSignals : (Int_t *)fgEmptySignals;}//Signals in the n-time bins from Data Word
468 Int_t GetADC() const { return fADC ? fADC->fADCnumber : -1 ;} // MCM ADC channel and Time Bin of word 1
469 Int_t GetTimeBin() const { return 0;} // MCM ADC channel and Time Bin of word 1
470
471 //----------------------------------------------------------
472
473 static void SetNoDebug() {fgDebugFlag = kFALSE;} // allow debug info
474 static void SetNoErrorWarning() {fgWarnError = kFALSE;} // disable warning and error info
475 static void SetForceCleanDataOnly() {fgCleanDataOnly = kTRUE;} // clean data only
476 static void AllowCorruptedData() {fgCleanDataOnly = kFALSE;} // accept corrupted data
477
478 static void SetExtraWordsFix() {fgExtraSkip = kTRUE;} // extra skip of 24 32-bit words
479 static void SetSkipCDH() {fgSkipCDH = kTRUE;} // skip of 8 32-bit words
480 void EnableDebug(TTreeSRedirector *debugStream = 0); // enable the debug stream - use the paramter if non zero
481 static void EnableDebugStream() {fgDebugStreamFlag = kTRUE;} //global enable of the dbug stream
482 static void DeleteDebugStream(); // helper function to delete the debug streamer
483 static void SetDumpHead(UInt_t iv) {fgDumpHead = iv;}
6bd744d3 484 static void DisableStackNumberChecker() {fgStackNumberChecker = kFALSE;} // set false to cleanroom data
dc25a859 485 static void DisableStackLinkNumberChecker() {fgStackLinkNumberChecker = kFALSE;}
bb1009bf 486 static void DisableSkipData() {fgSkipData = kFALSE;} // keep reading next words even previous words were corrupted - debugging purpose
d4232bb6 487
1ced3838 488 // this is a temporary solution!
489 // baseline should come with the HC header word 2 (count from 0!)
490 static void SetSubtractBaseline(Int_t baseline) {fgCommonAdditive = baseline;}
491 Int_t GetCommonAdditive() const {return fgCommonAdditive;} // return the common additive
492
d4232bb6 493 void DumpErrorCount();
494 void ReSetStreamEventCounter(Int_t ival = 0) {fgStreamEventCounter = ival;} // reset the event counter for the debug streamer
495
496 //--------------------------------------------------------
497 // Decoding functions
498 //--------------------------------------------------------
499
500 void DecodeSMInfo(const UInt_t *word, struct AliTRDrawSM *sm) const ;
501 const char *DumpSMInfo(const struct AliTRDrawSM *sm);
502 void DecodeStackInfo(const UInt_t *word, struct AliTRDrawStack *st) const;
503 const char *DumpStackInfo(const struct AliTRDrawStack *st);
504 void DecodeHCwordH0(const UInt_t *word, struct AliTRDrawHC *hc) const;
505 void DecodeHCwordH1(const UInt_t *word, struct AliTRDrawHC *hc) const;
506 const char *DumpHCinfoH0(const struct AliTRDrawHC *hc);
507 const char *DumpHCinfoH1(const struct AliTRDrawHC *hc);
508 void DecodeMCMheader(const UInt_t *word, struct AliTRDrawMCM *mcm) const;
509 UInt_t GetMCMadcMask(const UInt_t *word, struct AliTRDrawMCM *mcm) const;
510 void DecodeMask(const UInt_t *word, struct AliTRDrawMCM *mcm) const;
511 void MCMADCwordsWithTbins(UInt_t fTbins, struct AliTRDrawMCM *mcm) const;
512 const char *DumpMCMinfo(const struct AliTRDrawMCM *mcm);
513 const char *DumpMCMadcMask(const struct AliTRDrawMCM *mcm);
bb1009bf 514 const unsigned long AdvancePseudoRandom(unsigned long *val) const;
d4232bb6 515
516 protected:
517
518 private:
519
520 Bool_t InitBuffer(void *buffer, UInt_t length); // init the buffer - called by DecodeSM(void*, UInt_t)
521 Bool_t DumpWords(UInt_t *px, UInt_t iw, UInt_t marker = 0); // dump some words onto the screen
522
523 Int_t NextBuffer(); // go and init next buffer if available - check the implementation file for return values
524
525 void SwapOnEndian(); // swap if endian is BIG
526 Bool_t SkipWords(UInt_t iw); // skip number of words
527 Bool_t DecodeTracklets(); // decode tracklets
528 Bool_t DecodeHC(); // decode data in HC
529
530 Bool_t DecodeADC(); // decode 10 ADC words
bb1009bf 531 Bool_t DecodeADCTP1(unsigned long *randVal, Int_t *endbits); // decode TP ADC words
532 Bool_t DecodeADCTP23(unsigned long *expected); // decode TP ADC words
d4232bb6 533
534 Bool_t DecodeHCheader(); // decode HC header
535 Bool_t SeekEndOfData(); // go to next end of raw data marker (actually 1 word after)
536 Bool_t SeekNextMCMheader(); // go to next mcm header
537 Bool_t DecodeMCMheader(); // decode mcm header
538
539 Bool_t IsRowValid(); // check if row within the range
540 Bool_t IsHCheaderOK(); // check if current hc header data make sense
541 Bool_t IsMCMheaderOK(); // check if current mcm header data make sense
bb1009bf 542 Bool_t IsMCMevCounterOK(); // check if event counter matches in current mcm header
d4232bb6 543
544 void ResetCounters(); // reset some counters
545 void ResetIterators(); // needed for Next()
546 AliTRDrawStreamTB(const AliTRDrawStreamTB& st);
547 AliTRDrawStreamTB &operator=(const AliTRDrawStreamTB &);
548
549 // ----------------- DATA MEMBERS START
550
551 struct AliTRDrawSM fSM; // one SM per buffer
552 struct AliTRDrawStack *fStack; //! pointer to the current stack
553 struct AliTRDrawHC *fHC; //! current HC
554 struct AliTRDrawMCM *fMCM; //! current MCM
555 struct AliTRDrawADC *fADC; //! current ADC
556
557 UInt_t *fpPos; // current position in the buffer
558 UInt_t *fpBegin; // begin - pointer to the buffer word 0
559 UInt_t *fpEnd; // end of the buffer
560
561 UInt_t fWordLength; // length of the buffer in 32bit words
7e8f4d17 562 UInt_t fEquipmentID; // equipment ID
d4232bb6 563
564 Int_t fStackNumber; // current stack number
565 Int_t fStackLinkNumber; // current link in the stack
566
567 Int_t fhcMCMcounter; // mcm counter inside single hc - used in Next()
568 Int_t fmcmADCcounter; // adc counrer inside single adc - used in Next()
569
570 Int_t fLinkTrackletCounter; // count the tracklets in the current HC
571 Int_t fEndOfTrackletCount; // count link by link (hc by hc) used for debug
572
573 UInt_t fMaskADCword; // temp mask when decoding adcs
574 UInt_t fTbinADC; // temp adc
575 Int_t fDecodedADCs; // counter of decoded adcs
576
577 UInt_t fEventCounter; // stores the valid/current MCM event counter
578 UInt_t fLastEventCounter; // last known event counter of MCM
579
d4232bb6 580 Bool_t fSharedPadsOn; // do we want to output shared pads - default is off
581 Int_t fMaxADCgeom; // maximum ADC channels per mcm
582
583 AliTRDgeometry *fGeometry; //! TRD geometry
584 AliRawReader *fRawReader; //! raw reader
585
586 AliTRDfeeParam *fTRDfeeParam; // pointer to the fee params
587
588 Bool_t fDebugStreamOwned; // created in this case by this - allowed to delete?
589
590 // STATIC
591
592 static Bool_t fgExtraSkip; // whether we should skip the leading 24 words
593 static Bool_t fgSkipCDH; // whether we should skip CDH (8 words)
594 static Bool_t fgWarnError; // no errors no warnings
595 static Bool_t fgCleanDataOnly; // release only clean events = no errors
596 static Bool_t fgDebugFlag; // allow debugging info
597 static Bool_t fgDebugStreamFlag; // set on debug streamer
6bd744d3 598 static Bool_t fgStackNumberChecker; // decide if we check stack number insanity - set false to cleanroom data
7e8f4d17 599 static Bool_t fgStackLinkNumberChecker; // decide if we check stack link number insanity - debuging purpose
bb1009bf 600 static Bool_t fgSkipData; // decide if we skip corrupted data of given HC
d4232bb6 601 static TTreeSRedirector *fgDebugStreamer; //!Debug streamer
602 static UInt_t fgStreamEventCounter; // event counter for debug streamer
7e8f4d17 603 static UInt_t fgFirstEquipmentID; // first equipmentID for debug streamer
d4232bb6 604 static UInt_t fgDumpHead; // number of words to dump (from the start of the buffer) on each Init
605 static Int_t fgEmptySignals[30]; // empty signals in case of ADC pointer = NULL
606
607
1ced3838 608 // this is a temporary solution!
609 // baseline should come with the HC header word 2 (count from 0!)
610 static Int_t fgCommonAdditive; // common additive - should be decoded! from HC word2
611
d4232bb6 612 // ----------------- DATA MEMBERS STOP
613
614 enum ETRDzRawStreamError
615 {
616 kDecodeStackInfo = 1 //
617 , kMissingData = 2 //
618 , kLinkDataMissing = 3 //
619 , kHCdataMissing = 4 //
620 , kTrackletOverflow = 5 //
621 , kEOTrackeltsMissing = 6 //
622 , kWrongPadrow = 7 //
623 , kMCMheaderCorrupted = 8 //
624 , kWrongMCMorROB = 9 //
625 , kMCMeventMissmatch = 10 //
626 , kMCMADCMaskMissing = 11 //
627 , kHCHeaderCorrupt = 12 //
628 , kHCHeaderWrongStack = 13 //
629 , kHCHeaderWrongLayer = 14 //
630 , kHCHeaderWrongSide = 15 //
631 , kHCHeaderWrongSM = 16 //
632 , kHCHeaderWrongDet = 17 //
633 , kHCHeaderWrongROC = 18 //
634 , kHCWordMissing = 19 //
635 , kMCMdataMissing = 20 //
636 , kMCMoverflow = 21 //
637 , kADCdataMissing = 22 //
638 , kADCmaskMissmatch = 23 //
639 , kWrongPadcolumn = 24 //
640 };
641
642 ClassDef(AliTRDrawStreamTB, 0)
643}; //clas def end
644
645#endif
646
647
648
649
650
651
652
653
654
d4232bb6 655
656
657
658