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