1 #ifndef ALITRDRAWSTREAMTB_H
2 #define ALITRDRAWSTREAMTB_H
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
7 /* $Id: AliTRDrawStream.h 27696 2008-07-31 09:18:53Z cblume $ */
9 ///////////////////////////////////////////////////////////////////////////////
11 // This class provides access to TRD digits in raw data. //
13 ///////////////////////////////////////////////////////////////////////////////
17 #include "AliTRDrawStreamBase.h"
21 class AliTRDdigitsManager;
22 class TTreeSRedirector;
26 class AliTRDrawStream : public AliTRDrawStreamBase
31 //--------------------------------------------------------
35 //--------------------------------------------------------
40 UInt_t *fPos; //! position of ADC 1st word in the buffer
41 Short_t fADCnumber; // number of the ADC 0 .. 20
42 Short_t fCOL; // column - row from MCM
43 Int_t fSignals[TRD_MAX_TBINS]; // signals for this adc
44 Bool_t fIsShared; // is pad chared between MCMs
45 Short_t fCorrupted; // is adc word corrupted
55 // default constructor
58 AliTRDrawADC(const AliTRDrawADC& p):
60 , fADCnumber(p.fADCnumber)
63 , fIsShared(p.fIsShared)
64 , fCorrupted(p.fCorrupted)
69 AliTRDrawADC &operator=(const AliTRDrawADC &)
71 // assignment operator
78 //--------------------------------------------------------
82 Int_t fROB; // ROB number
83 Int_t fMCM; // MCM number
84 Int_t fROW; // row number filed during decoding
86 UInt_t fEvCounter; // MCM event counter
87 UInt_t fADCMask; // ADC mask
88 UInt_t fADCMaskWord; // word with ADC mask in
89 UInt_t fADCchannel[TRD_MAX_ADC]; // channels to be decoded accrording to ADC mask
91 Int_t fADCmax; // number of ADCs fired
92 Int_t fADCcount; // number of ADCs fired from double checking bit
93 Int_t fMCMADCWords; // mcm words to expect
94 Int_t fSingleADCwords; // n of words per ADC
96 Int_t fMCMhdCorrupted; // is mcm header corrupted
97 Int_t fADCmaskCorrupted; // is mcm adc mask corrupted
98 Int_t fCorrupted; // is mcm data missing
100 UInt_t *fPos; //! position of mcm header in the buffer
101 UInt_t *fAdcDataPos; //! start of ADC data for this mcm
103 Int_t fADCcounter; // count the adcs decoded
104 AliTRDrawADC fADCs[TRD_MAX_ADC]; // 21 adcs
119 , fADCmaskCorrupted(0)
126 // default constructor
129 AliTRDrawMCM(const AliTRDrawMCM & p):
133 , fEvCounter(p.fEvCounter)
134 , fADCMask(p.fADCMask)
135 , fADCMaskWord(p.fADCMaskWord)
138 , fADCcount(p.fADCcount)
139 , fMCMADCWords(p.fMCMADCWords)
140 , fSingleADCwords(p.fSingleADCwords)
141 , fMCMhdCorrupted(p.fMCMhdCorrupted)
142 , fADCmaskCorrupted(p.fADCmaskCorrupted)
143 , fCorrupted(p.fCorrupted)
145 , fAdcDataPos(p.fAdcDataPos)
146 , fADCcounter(p.fADCcounter)
152 AliTRDrawMCM &operator=(const AliTRDrawMCM &)
154 // assignment operator
161 //--------------------------------------------------------
166 //tacklet words of given HC
167 UInt_t fTrackletWords[MAX_TRACKLETS_PERHC]; // array to keep tracklet words [mj]
168 Short_t fTrackletError; // tracklet error
169 Short_t fNTracklets; // number of tracklet
172 Int_t fSpecialRawV; // Raw data version
173 Int_t fRawVMajor; // Raw data version
174 Int_t fRawVMajorOpt; // Raw data version
175 Int_t fRawVMinor; // Raw data version
176 Int_t fNExtraWords; // N extra HC header words
177 Int_t fDCSboard; // DCS board number
178 Int_t fSM; // Super Module number
179 Int_t fStack; // Stack number (some people might call it a chamber)
180 Int_t fLayer; // Layer number (some people might call it a plane)
181 Int_t fSide; // Side of HC
184 Int_t fTimeBins; // N of t bins
185 UInt_t fBunchCrossCounter; // Bunch crossing counter
186 UInt_t fPreTriggerCounter; // Pre Trigger counter
187 UInt_t fPreTriggerPhase; // Pre Trigger phase
190 Int_t fH0Corrupted; // is hc header 0 corrupted
191 Int_t fH1Corrupted; // is hc header 1 corrupted
192 Int_t fCorrupted; // is hc data corrupted
194 UInt_t *fPos[2]; //! position of the header words in buffer
196 Int_t fDET; // filled while decoding
197 Int_t fROC; // filled while decoding
198 Int_t fRowMax; // filled while decoding
199 Int_t fColMax; // filled while decoding
202 Int_t fMCMmax; // number of mcm found
203 AliTRDrawMCM fMCMs[TRD_MAX_MCM]; // 4 ROBS 16 each
206 : fTrackletWords() //[mj]
220 , fBunchCrossCounter(0)
221 , fPreTriggerCounter(0)
222 , fPreTriggerPhase(0)
234 // default constructor hc info
237 AliTRDrawHC(const AliTRDrawHC & p):
238 fTrackletWords() //[mj]
239 , fTrackletError(p.fTrackletError)
240 , fNTracklets(p.fNTracklets)
241 , fSpecialRawV(p.fSpecialRawV)
242 , fRawVMajor(p.fRawVMajor)
243 , fRawVMajorOpt(p.fRawVMajorOpt)
244 , fRawVMinor(p.fRawVMinor)
245 , fNExtraWords(p.fNExtraWords)
246 , fDCSboard(p.fDCSboard)
251 , fTimeBins(p.fTimeBins)
252 , fBunchCrossCounter(p.fBunchCrossCounter)
253 , fPreTriggerCounter(p.fPreTriggerCounter)
254 , fPreTriggerPhase(p.fPreTriggerPhase)
255 , fH0Corrupted(p.fH0Corrupted)
256 , fH1Corrupted(p.fH1Corrupted)
257 , fCorrupted(p.fCorrupted)
269 AliTRDrawHC &operator=(const AliTRDrawHC &)
271 // assignment operator
278 //--------------------------------------------------------
280 struct AliTRDrawStack
282 UInt_t fHeaderSize; // header size of the stack info
283 Bool_t fLinksActive[12]; // data links active - 1 per half chamber
284 Short_t fLinksDataType[12]; // 0 indicating real data for the front-end electronics
285 Short_t fLinksMonitor[12]; // 0 indicating properly operating link
286 Short_t fLinkMonitorError[12]; // record link monitor error
287 Int_t fActiveLinks; // number of active links
288 UInt_t *fPos; //! position in the buffer
290 AliTRDrawHC fHalfChambers[12]; // 12 half chambers in a stack
297 , fLinkMonitorError()
302 // default constructor
305 AliTRDrawStack(const AliTRDrawStack & p):
306 fHeaderSize(p.fHeaderSize)
310 , fLinkMonitorError()
311 , fActiveLinks(p.fActiveLinks)
318 AliTRDrawStack &operator=(const AliTRDrawStack &)
320 // assignment operator
327 //--------------------------------------------------------
331 UInt_t fHeaderSize; // size of the header in words
332 Bool_t fTrackletEnable; // tracklet enable bit
333 Bool_t fStackActive[5]; // map of active/expected stacks
334 Int_t fActiveStacks; // number of active stacks
335 Int_t fCorrupted; // is sm info corrupted
336 Int_t fNexpectedHalfChambers; // number of half chambers to be read out in this sm
337 Bool_t fClean; // true if everything went OK - false is some error occured
338 UInt_t *fPos; // location of the sm info - should be the first word (after CDH if not DDL buffer)
340 AliTRDrawStack fStacks[5];
348 , fNexpectedHalfChambers(0)
353 // Default constructor
356 AliTRDrawSM(const AliTRDrawSM & p):
357 fHeaderSize(p.fHeaderSize)
358 , fTrackletEnable(p.fTrackletEnable)
360 , fActiveStacks(p.fActiveStacks)
361 , fCorrupted(p.fCorrupted)
362 , fNexpectedHalfChambers(p.fNexpectedHalfChambers)
370 AliTRDrawSM &operator=(const AliTRDrawSM &)
372 // assignment operator
379 //--------------------------------------------------------
382 AliTRDrawStream(AliRawReader *rawReader);
383 virtual ~AliTRDrawStream();
385 //--------------------------------------------------------
387 virtual Bool_t Next(); // read the next data in the memory
388 //virtual Int_t NextChamber(AliTRDdigitsManager *man); // read next chamber data in the momory
389 virtual Int_t NextChamber(AliTRDdigitsManager *man, UInt_t **trackletContainer); // read next chamber data in the memory
390 virtual Bool_t Init(); // initialize some internal variables
392 Int_t NextBuffer(); // go and init next buffer if available - check the implementation file for return values
394 Bool_t SetRawVersion(Int_t fraw); // set the raw version - used for backward compat.
396 Bool_t IsCurrentPadShared() const {return fADC->fIsShared;} // is current pad shared between mcms
397 void SetSharedPadReadout(Bool_t fv) {fSharedPadsOn = fv;} // set the flag on if the reader should return the shared pads
399 Bool_t DecodeSM(void *buffer, UInt_t length); // decode a buffer
400 Int_t DecodeSM(); // used with raw reader
401 Int_t DecodeSM(AliRawReader *reader); // used with raw reader
403 Bool_t SetReader(AliRawReader *reader); // set the raw reader to use
405 // info from Supermodule Index Word
406 Bool_t IsTrackletEnableBitSet() const {return fSM.fTrackletEnable;} // get status of tracklet enable bit
407 Bool_t IsStackActive(Int_t is) const {return fSM.fStackActive[is];} // get status of stack enable bit
408 Int_t GetNofActiveStacks() const {return fSM.fActiveStacks;} // get number of active stacks from stack mask
409 UInt_t *GetGTUheaderWords() const {return fSM.fPos;} // get number of active stacks from stack mask
411 // info from Stack Index Word
412 Int_t GetNexpectedHalfChambers() const {return fSM.fNexpectedHalfChambers;} // get number of expected HC in a sm
413 Int_t GetNofActiveLinksInStack(Int_t is) const {return fSM.fStacks[is].fActiveLinks;} // get number of active links in a stack
414 Bool_t IsLinkActiveInStack(Int_t is, Int_t il) const {return fSM.fStacks[is].fLinksActive[il];} // check whether the link is active
416 // info from Stack Header Word
417 Short_t GetLinkMonitorError(Int_t is, Int_t il) const {return fSM.fStacks[is].fLinkMonitorError[il];} // get link monitor error
419 // info from Tracklet Data
420 Int_t GetTrackletErrorCode(Int_t is, Int_t il) const {return fSM.fStacks[is].fHalfChambers[il].fTrackletError;}
421 Int_t GetNTracklets(Int_t is, Int_t il) const {return fSM.fStacks[is].fHalfChambers[il].fNTracklets;} // get number of tracklets
423 // info from HC Header Word
424 Int_t GetSM(Int_t is, Int_t il) const {return fSM.fStacks[is].fHalfChambers[il].fSM;}
425 Int_t GetLayer(Int_t is, Int_t il) const {return fSM.fStacks[is].fHalfChambers[il].fLayer;}
426 Int_t GetStack(Int_t is, Int_t il) const {return fSM.fStacks[is].fHalfChambers[il].fStack;}
427 Int_t GetSide(Int_t is, Int_t il) const {return fSM.fStacks[is].fHalfChambers[il].fSide;}
428 Int_t GetH0ErrorCode(Int_t is, Int_t il) const {return fSM.fStacks[is].fHalfChambers[il].fH0Corrupted;}
429 Int_t GetH1ErrorCode(Int_t is, Int_t il) const {return fSM.fStacks[is].fHalfChambers[il].fH1Corrupted;}
430 Int_t GetNumberOfTimeBins(Int_t is, Int_t il) const { return fSM.fStacks[is].fHalfChambers[il].fTimeBins;}
431 UInt_t *GetTrackletWords(Int_t is, Int_t il) { return fSM.fStacks[is].fHalfChambers[il].fTrackletWords;}
434 Int_t GetHCErrorCode(Int_t is, Int_t il) const {return fSM.fStacks[is].fHalfChambers[il].fCorrupted;}
435 Int_t GetHCMCMmax(Int_t is, Int_t il) const {return fSM.fStacks[is].fHalfChambers[il].fMCMmax;}
437 // from MCM Header Word
438 // rob and mcm ordering
439 // side 0(even link) - ROB: 0 2 4 6 MCM: 12 13 14 15 8 9 10 11 4 5 6 7 0 1 2 3
440 // side 1( odd link) - ROB: 1 3 5 7 MCM: 12 13 14 15 8 9 10 11 4 5 6 7 0 1 2 3
441 Int_t GetMCM(Int_t stack, Int_t link, Int_t mcm) {return fSM.fStacks[stack].fHalfChambers[link].fMCMs[mcm].fMCM;}
442 Int_t GetROB(Int_t stack, Int_t link, Int_t mcm) {return fSM.fStacks[stack].fHalfChambers[link].fMCMs[mcm].fROB;}
443 Int_t GetMCMhdErrorCode(Int_t stack, Int_t link, Int_t mcm) {return fSM.fStacks[stack].fHalfChambers[link].fMCMs[mcm].fMCMhdCorrupted;}
444 Int_t GetMCMADCMaskErrorCode(Int_t stack, Int_t link, Int_t mcm) {return fSM.fStacks[stack].fHalfChambers[link].fMCMs[mcm].fADCmaskCorrupted;}
445 Int_t GetEventNumber(Int_t stack, Int_t link, Int_t mcm) {return fSM.fStacks[stack].fHalfChambers[link].fMCMs[mcm].fEvCounter;}
446 Int_t GetADCcount(Int_t stack, Int_t link, Int_t mcm) {return fSM.fStacks[stack].fHalfChambers[link].fMCMs[mcm].fADCcount;}
448 // info from MCM data words
449 Int_t GetMCMErrorCode(Int_t stack, Int_t link, Int_t mcm) {return fSM.fStacks[stack].fHalfChambers[link].fMCMs[mcm].fCorrupted;} // get MCM data error code
450 Int_t GetADCErrorCode(Int_t stack, Int_t link, Int_t mcm, Int_t adc) {return fSM.fStacks[stack].fHalfChambers[link].fMCMs[mcm].fADCs[adc].fCorrupted;} // get ADC error code
451 Int_t GetADCnumber(Int_t stack, Int_t link, Int_t mcm, Int_t adc) {return fSM.fStacks[stack].fHalfChambers[link].fMCMs[mcm].fADCs[adc].fADCnumber;} // get ADC error code
453 Int_t GetRow(Int_t stack, Int_t link, Int_t mcm) {return fSM.fStacks[stack].fHalfChambers[link].fMCMs[mcm].fROW;} // get current row number
454 Int_t GetCol(Int_t stack, Int_t link, Int_t mcm, Int_t adc) {return fSM.fStacks[stack].fHalfChambers[link].fMCMs[mcm].fADCs[adc].fCOL;} // get current column number
456 // info from ADC data words
457 Int_t *GetSignalDirect(Int_t stack, Int_t link, Int_t mcm, Int_t adc) {return fSM.fStacks[stack].fHalfChambers[link].fMCMs[mcm].fADCs[adc].fSignals;}
460 // from here, only works with returning ADC channel pointer using Next()
461 UInt_t *GetTrackletWords() const { return fHC->fTrackletWords;} // return tracklet words pointer per hc [mj]
462 Int_t GetTrackletErrorCode() const {return fHC ? fHC->fTrackletError : -1;} // get tracklet error code
463 Int_t GetNTracklets() const {return fHC ? fHC->fNTracklets : -1;} // get number of tracklets
465 Int_t GetSpecialRawVersion() const {return fHC ? fHC->fSpecialRawV : -1;} // return special raw version
466 Int_t GetMajorRawVersion() const {return fHC ? fHC->fRawVMajor : -1;} // major raw version getter
467 Int_t GetRawVersion() const {return fHC ? fHC->fRawVMajor : -1;} // compatibility see funtion above
468 Int_t GetMinorRawVersion() const {return fHC ? fHC->fRawVMinor : -1;} // minor raw version
470 Int_t GetSM() const {return fHC ? fHC->fSM : -1;} // SM Position of CURRENT half chamber in full TRD
471 Int_t GetLayer() const {return fHC ? fHC->fLayer : -1;} // Layer Position of CURRENT half chamber in full TRD
472 Int_t GetStack() const {return fHC ? fHC->fStack : -1;} // Stack Position of CURRENT half chamber in full TRD
473 Int_t GetSide() const {return fHC ? fHC->fSide : -1;} // get side
474 Int_t GetDCS() const { return fHC ? fHC->fDCSboard : -1;} // DCS board number read from data (HC header)
475 Int_t GetROC() const { return fHC ? fHC->fROC : -1;} // ROB Position of CURRENT half chamber in full TRD
476 Int_t GetNumberOfTimeBins() const { return fHC ? fHC->fTimeBins : 0;} // Get Ntime bins
477 UInt_t GetBunchCrossCounter() const {return fHC ? fHC->fBunchCrossCounter : 0;} // get bunch cross counter
478 UInt_t GetPreTriggerCounter() const {return fHC ? fHC->fPreTriggerCounter : 0;} // get pre trigger info
479 UInt_t GetPreTriggerPhase() const {return fHC ? fHC->fPreTriggerPhase : 0;} // get trigger phase
481 Int_t GetRow() const {return fMCM ? fMCM->fROW : -1;} // get current row number
482 Int_t GetCol() const {return fADC ? fADC->fCOL : -1;} // get current column number
483 Int_t GetRowMax() const { return fHC ? fHC->fRowMax : -1;} // Get maximum rows in the current HC
484 Int_t GetColMax() const { return fHC ? fHC->fColMax : -1;} // Get maximum cols in the current HC
486 Int_t GetMaxRow() const { return fHC ? fHC->fRowMax : -1;} // Get maximum rows in the current HC
487 Int_t GetMaxCol() const { return fHC ? fHC->fColMax : -1;} // Get maximum cols in the current HC
489 UInt_t GetHCword0() const {return fHC ? *fHC->fPos[0] : 0;} // get the HC word 0
490 UInt_t GetHCword1() const {return fHC ? *fHC->fPos[1] : 0;} // get the HC word 1
492 Int_t GetDET() const {return fHC ? fHC->fDET : -1;} // get current det number
493 Int_t GetDet() const {return fHC ? fHC->fDET : -1;} // get current det number
495 Int_t GetROB() const {return fMCM ? fMCM->fROB : -1;} // get current ROB number
496 Int_t GetMCM() const {return fMCM ? fMCM->fMCM : -1;} // get current MCM number
497 Int_t GetEventNumber() const { return fMCM->fEvCounter;} // MCM Event number and position of current MCM on TRD chamber
499 Int_t GetADC() const { return fADC ? fADC->fADCnumber : -1;} // MCM ADC channel and Time Bin of word 1
500 Int_t GetTimeBin() const { return 0;} // MCM ADC channel and Time Bin of word 1
501 Int_t *GetSignals() const { return fADC ? fADC->fSignals : (Int_t *)fgEmptySignals;} // signals in the n-time bins from data word
503 Int_t GetHCErrorCode() const {return fHC ? fHC->fCorrupted : -1;} // get HC error code
504 Int_t GetH0ErrorCode() const {return fHC ? fHC->fH0Corrupted : -1;} // get HC header word0 error code
505 Int_t GetH1ErrorCode() const {return fHC ? fHC->fH1Corrupted : -1;} // get HC header word1 error code
506 Int_t GetMCMErrorCode() const {return fMCM ? fMCM->fCorrupted : -1;} // get MCM data error code
507 Int_t GetADCErrorCode() const {return fADC ? fADC->fCorrupted : -1;} // get ADC data error code
508 Int_t GetMCMhdErrorCode() const {return fMCM ? fMCM->fMCMhdCorrupted: -1;} // get MCM header word error code
509 Int_t GetMCMADCMaskErrorCode() const {return fMCM ? fMCM->fADCmaskCorrupted: -1;} // get MCM adc mask error code
511 UInt_t *GetSMstreamPosition() const {return fSM.fPos;} // get position of the SM index word in the buffer
513 Bool_t IsSMbufferClean() const {return fSM.fClean;} // is data clean
515 //----------------------------------------------------------
517 static void SetNoDebug() {fgDebugFlag = kFALSE;} // allow debug info
518 static void EnableMemoryReset() {fgEnableMemoryReset = kTRUE;} // allow memory reset
519 static void SetNoErrorWarning() {fgWarnError = kFALSE;} // disable warning and error info
520 static void SetForceCleanDataOnly() {fgCleanDataOnly = kTRUE;} // clean data only
521 static void AllowCorruptedData() {fgCleanDataOnly = kFALSE;} // accept corrupted data
523 static void SetExtraWordsFix() {fgExtraSkip = kTRUE;} // extra skip of 24 32-bit words
524 static void SetSkipCDH() {fgSkipCDH = kTRUE;} // skip of 8 32-bit words
525 static void SetDumpHead(Int_t iv) {fgDumpHead = iv;}
526 static void DisableStackNumberChecker() {fgStackNumberChecker = kFALSE;} // set false to cleanroom data
527 static void DisableStackLinkNumberChecker() {fgStackLinkNumberChecker = kFALSE;}
528 static void DisableSkipData() {fgSkipData = kFALSE;} // keep reading next words even previous words were corrupted - debugging purpose
529 static void SetDumpingEnable() {fDumpingEnable = kTRUE;}
530 static void SetDumpingMCM(Int_t sm, Int_t stack, Int_t layer, Int_t rob, Int_t mcm) {fDumpingSM = sm; fDumpingStack = stack; fDumpingLayer = layer; fDumpingROB = rob; fDumpingMCM = mcm;}
532 // this is a temporary solution!
533 // baseline should come with the HC header word 2 (count from 0!)
534 static void SetSubtractBaseline(Int_t baseline) {fgCommonAdditive = baseline;}
535 Int_t GetCommonAdditive() const {return fgCommonAdditive;} // return the common additive
537 static void EnableDecodeConfigData() {fgEnableDecodeConfigData = kTRUE;} // allow configuration data decoding
538 static Bool_t fgEnableDecodeConfigData;
541 //--------------------------------------------------------
542 // Decoding functions
543 //--------------------------------------------------------
545 void DecodeSMInfo(const UInt_t *word, struct AliTRDrawSM *sm) const ;
546 const char *DumpSMInfo(const struct AliTRDrawSM *sm);
547 void DecodeStackInfo(const UInt_t *word, struct AliTRDrawStack *st) const;
548 void DecodeStackHeader(const UInt_t *word, struct AliTRDrawStack *st, Int_t iword) const;
549 const char *DumpStackInfo(const struct AliTRDrawStack *st);
550 Bool_t DecodeHCwordH0(const UInt_t *word, struct AliTRDrawHC *hc) const;
551 Bool_t DecodeHCwordH1(const UInt_t *word, struct AliTRDrawHC *hc) const;
552 const char *DumpHCinfoH0(const struct AliTRDrawHC *hc);
553 const char *DumpHCinfoH1(const struct AliTRDrawHC *hc);
554 void DecodeMCMheader(const UInt_t *word, struct AliTRDrawMCM *mcm) const;
555 UInt_t GetMCMadcMask(const UInt_t *word, struct AliTRDrawMCM *mcm) const;
556 void DecodeMask(const UInt_t *word, struct AliTRDrawMCM *mcm) const;
557 void MCMADCwordsWithTbins(UInt_t fTbins, struct AliTRDrawMCM *mcm) const;
558 const char *DumpMCMinfo(const struct AliTRDrawMCM *mcm);
559 const char *DumpMCMadcMask(const struct AliTRDrawMCM *mcm);
564 Bool_t InitBuffer(void *buffer, UInt_t length); // init the buffer - called by DecodeSM(void*, UInt_t)
565 Bool_t DumpWords(UInt_t *px, UInt_t iw, UInt_t marker = 0); // dump some words onto the screen
567 void SwapOnEndian(); // swap if endian is BIG
568 Bool_t SkipWords(UInt_t iw); // skip number of words
569 Bool_t DecodeGTUheader(); // decode data in GTU header
570 Bool_t DecodeTracklets(); // decode tracklets
571 Bool_t DecodeHC(); // decode data in HC
573 Bool_t DecodeADC(); // decode 10 ADC words
575 Bool_t DecodeHCheader(); // decode HC header
576 Bool_t SeekEndOfData(); // go to next end of raw data marker (actually 1 word after)
577 Bool_t SkipMCMdata(UInt_t iw); // skip this mcm data due to mcm header corruption
578 Bool_t SeekNextMCMheader(); // go to next mcm header
579 Bool_t DecodeMCMheader(); // decode mcm header
581 Bool_t IsRowValid(); // check if row within the range
582 Bool_t IsHCheaderOK(); // check if current hc header data make sense
583 Bool_t IsMCMheaderOK(); // check if current mcm header data make sense
585 void ResetCounters(); // reset some counters
586 void ResetIterators(); // needed for Next()
587 void ResetPerSM(); // reset every SM
588 void ResetPerStack(); // reset every Stack
589 void ResetPerHC(); // reset every HC
590 void ResetPerMCM(); // reset every MCM
591 void ResetPerADC(); // reset every ADC
592 void ResetMemory(); // reset all data members
594 AliTRDrawStream(const AliTRDrawStream& st);
595 AliTRDrawStream &operator=(const AliTRDrawStream &);
597 // ----------------- DATA MEMBERS START
599 struct AliTRDrawSM fSM; // one SM per buffer
600 struct AliTRDrawStack *fStack; //! pointer to the current stack
601 struct AliTRDrawHC *fHC; //! current HC
602 struct AliTRDrawMCM *fMCM; //! current MCM
603 struct AliTRDrawADC *fADC; //! current ADC
605 UInt_t *fpPos; // current position in the buffer
606 UInt_t *fpBegin; // begin - pointer to the buffer word 0
607 UInt_t *fpEnd; // end of the buffer
609 UInt_t fWordLength; // length of the buffer in 32bit words
611 Int_t fStackNumber; // current stack number
612 Int_t fStackLinkNumber; // current link in the stack
614 Int_t fhcMCMcounter; // mcm counter inside single hc - used in Next()
615 Int_t fmcmADCcounter; // adc counrer inside single adc - used in Next()
617 Int_t fLinkTrackletCounter; // count the tracklets in the current HC
618 Int_t fEndOfTrackletCount; // count link by link (hc by hc) used for debug
619 Int_t fNWordsCounter; // counts words of given hc having link monitor error
621 UInt_t fMaskADCword; // temp mask when decoding adcs
622 UInt_t fTbinADC; // temp adc
623 Int_t fDecodedADCs; // counter of decoded adcs [mj] do we need?
625 UInt_t fEventCounter; // stores the valid/current MCM event counter
626 UInt_t fLastEventCounter; // last known event counter of MCM
628 Bool_t fSharedPadsOn; // do we want to output shared pads - default is off
629 Int_t fMaxADCgeom; // maximum ADC channels per mcm
633 AliTRDgeometry *fGeometry; //! TRD geometry
634 AliRawReader *fRawReader; //! raw reader
636 AliTRDfeeParam *fTRDfeeParam; // pointer to the fee params
640 static Bool_t fgExtraSkip; // whether we should skip the leading 24 words
641 static Bool_t fgSkipCDH; // whether we should skip CDH (8 words)
642 static Bool_t fgWarnError; // no errors no warnings
643 static Bool_t fgCleanDataOnly; // release only clean events = no errors
644 static Bool_t fgDebugFlag; // allow debugging info
645 static Bool_t fgEnableMemoryReset; // allow memory reset
646 static Bool_t fgStackNumberChecker; // decide if we check stack number insanity - set false to cleanroom data
647 static Bool_t fgStackLinkNumberChecker; // decide if we check stack link number insanity - debuging purpose
648 static Bool_t fgSkipData; // decide if we skip corrupted data of given HC
649 static Int_t fgDumpHead; // number of words to dump (from the start of the buffer) on each Init
650 static Int_t fgEmptySignals[30]; // empty signals in case of ADC pointer = NULL
651 static Short_t fgMCMordering[16]; // mcm number odering for mcm header corruption check
652 static Short_t fgROBordering[16]; // mcm number odering for mcm header corruption check
653 static Int_t fgLastHC;
654 static Int_t fgLastROB;
655 static Int_t fgLastIndex;
657 static Bool_t fDumpingEnable;
659 static Int_t fDumpingSM;
660 static Int_t fDumpingStack;
661 static Int_t fDumpingLayer;
662 static Int_t fDumpingROB;
663 static Int_t fDumpingMCM;
665 // this is a temporary solution!
666 // baseline should come with the HC header word 2 (count from 0!)
667 static Int_t fgCommonAdditive; // common additive - should be decoded! from HC word2
669 // ----------------- DATA MEMBERS STOP
671 enum ETRDzRawStreamError
673 kDecodeStackInfo = 1 //
674 , kMissingData = 2 //
675 , kLinkDataMissing = 3 //
676 , kHCdataMissing = 4 //
677 , kTrackletOverflow = 5 //
678 , kEOTrackeltsMissing = 6 //
679 , kWrongPadrow = 7 //
680 , kMCMheaderCorrupted = 8 //
681 , kWrongMCMorROB = 9 //
682 , kMCMeventMissmatch = 10 //
683 , kMCMADCMaskMissing = 11 //
684 , kHCHeaderCorrupt = 12 //
685 , kHCHeaderWrongStack = 13 //
686 , kHCHeaderWrongLayer = 14 //
687 , kHCHeaderWrongSide = 15 //
688 , kHCHeaderWrongSM = 16 //
689 , kHCHeaderWrongDet = 17 //
690 , kHCHeaderWrongROC = 18 //
691 , kHCWordMissing = 19 //
692 , kMCMdataMissing = 20 //
693 , kMCMoverflow = 21 //
694 , kADCdataMissing = 22 //
695 , kADCmaskMissmatch = 23 //
696 , kWrongPadcolumn = 24 //
699 ClassDef(AliTRDrawStream, 0)