]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDrawFastStream.h
Update by Dariusz
[u/mrichter/AliRoot.git] / TRD / AliTRDrawFastStream.h
1 #ifndef ALITRDRAWFASTSTREAM_H\r
2 #define ALITRDRAWFASTSTREAM_H\r
3 \r
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
5  * See cxx source for full Copyright notice                               */\r
6 \r
7 /* $Id: AliTRDrawFastStream.h 27696 2008-07-31 09:18:53Z cblume $ */\r
8 \r
9 /////////////////////////////////////////////////////////////////////////////////\r
10 //                                                                             //\r
11 // This class provides access to TRD digits in raw data in a way of streaming. //\r
12 //                                                                             //\r
13 /////////////////////////////////////////////////////////////////////////////////\r
14 \r
15 #include "AliTRDrawStreamBase.h"\r
16 #include "AliTRDarrayADC.h"\r
17 #include "AliTRDarrayDictionary.h"\r
18 #include "AliTRDSignalIndex.h"\r
19 \r
20 class AliTRDgeometry;\r
21 class AliRawReader;\r
22 class AliTRDdigitsManager;\r
23 class TTreeSRedirector;\r
24 class AliTRDfeeParam;\r
25 \r
26 \r
27 class AliTRDrawFastStream : public AliTRDrawStreamBase\r
28 { // class def begin\r
29 \r
30  public:\r
31     \r
32   //--------------------------------------------------------\r
33   // THE STRUCTURES\r
34   //--------------------------------------------------------\r
35 \r
36   struct AliTRDrawMCM\r
37   { // mcm struct\r
38     Int_t               fROB;                     // ROB number\r
39     Int_t               fMCM;                     // MCM number\r
40     Int_t               fROW;                     // row number filed during decoding\r
41       \r
42     UInt_t              fEvCounter;               // MCM event counter\r
43     UInt_t              fADCMask;                 // ADC mask\r
44     UInt_t              fADCMaskWord;             // word with ADC mask in\r
45     UInt_t              fADCchannel[TRDMAXADC]; // channels to be decoded accrording to ADC mask\r
46       \r
47     Int_t               fADCmax;                  // number of ADCs fired\r
48     Int_t               fADCcount;                // number of ADCs fired from double checking bit\r
49     Int_t               fMCMADCWords;             // mcm words to expect\r
50     Int_t               fSingleADCwords;          // n of words per ADC\r
51       \r
52     Int_t               fMCMhdCorrupted;          // is mcm header corrupted\r
53     Int_t               fADCmaskCorrupted;        // is mcm adc mask corrupted\r
54     Bool_t              fDataCorrupted;           // true if the corruption is in ADC data level \r
55       \r
56     UInt_t             *fPos;                     //! position of mcm header in the buffer\r
57     UInt_t             *fAdcDataPos;              //! start of ADC data for this mcm\r
58 \r
59     Int_t               fADCcounter;              // count the adcs decoded\r
60       \r
61 \r
62     AliTRDrawMCM()\r
63       : fROB(-1)\r
64       , fMCM(-1)\r
65       , fROW(-1)\r
66       , fEvCounter(0)\r
67       , fADCMask(0)\r
68       , fADCMaskWord(0)\r
69       , fADCchannel()      \r
70       , fADCmax(0)\r
71       , fADCcount(0)\r
72       , fMCMADCWords(0)      \r
73       , fSingleADCwords(0)\r
74       , fMCMhdCorrupted(0)      \r
75       , fADCmaskCorrupted(0)      \r
76       , fDataCorrupted(0)      \r
77       , fPos(0)\r
78       , fAdcDataPos(0)\r
79       , fADCcounter(0)\r
80     {\r
81       // default constructor\r
82     };\r
83 \r
84     AliTRDrawMCM(const AliTRDrawMCM & p):\r
85         fROB(p.fROB)\r
86       , fMCM(p.fMCM)\r
87       , fROW(p.fROW)\r
88       , fEvCounter(p.fEvCounter)\r
89       , fADCMask(p.fADCMask)\r
90       , fADCMaskWord(p.fADCMaskWord)\r
91       , fADCchannel()      \r
92       , fADCmax(p.fADCmax)\r
93       , fADCcount(p.fADCcount)\r
94       , fMCMADCWords(p.fMCMADCWords)      \r
95       , fSingleADCwords(p.fSingleADCwords)\r
96       , fMCMhdCorrupted(p.fMCMhdCorrupted)      \r
97       , fADCmaskCorrupted(p.fADCmaskCorrupted)      \r
98       , fDataCorrupted(p.fDataCorrupted)      \r
99       , fPos(p.fPos)\r
100       , fAdcDataPos(p.fAdcDataPos)\r
101       , fADCcounter(p.fADCcounter)\r
102     {\r
103       // copy constructor\r
104     };\r
105 \r
106     AliTRDrawMCM &operator=(const AliTRDrawMCM &)\r
107     {\r
108       // assignment operator\r
109       // not implemented\r
110       return *this;\r
111     };\r
112 \r
113   };\r
114 \r
115   //--------------------------------------------------------\r
116 \r
117   struct AliTRDrawHC\r
118   { // hc struct\r
119       \r
120     //tacklet words of given HC\r
121     UInt_t              fTrackletWords[MAXTRACKLETSPERHC]; // array to keep tracklet words \r
122     Short_t             fNTracklets;                    // number of tracklet  \r
123 \r
124     // header word 0\r
125     Int_t               fSpecialRawV;       // Raw data version\r
126     Int_t               fRawVMajor;         // Raw data version\r
127     Int_t               fRawVMajorOpt;      // Raw data version\r
128     Int_t               fRawVMinor;         // Raw data version\r
129     Int_t               fNExtraWords;       // N extra HC header words\r
130     Int_t               fDCSboard;          // DCS board number\r
131     Int_t               fSM;                // Super Module number\r
132     Int_t               fSMHCheader;        // Super Module number from HC header\r
133     Int_t               fStack;             // Stack number (some people might call it a chamber)\r
134     Int_t               fStackHCheader;     // Stack number from HC header(some people might call it a chamber)\r
135     Int_t               fLayer;             // Layer number (some people might call it a plane)\r
136     Int_t               fLayerHCheader;     // Layer number from HC header(some people might call it a plane)\r
137     Int_t               fSide;              // Side of HC\r
138     Int_t               fSideHCheader;      // Side of HC from HC header\r
139       \r
140     // header word 1\r
141     Int_t               fTimeBins;          // N of t bins\r
142     UInt_t              fBunchCrossCounter; // Bunch crossing counter\r
143     UInt_t              fPreTriggerCounter; // Pre Trigger counter\r
144     UInt_t              fPreTriggerPhase;   // Pre Trigger phase\r
145       \r
146     // error \r
147     UShort_t            fErrorCodes[1411];  // array to keep encoded errors\r
148     UInt_t              fNErrors;           // number of total errors of given hc \r
149 \r
150     Short_t             fH0Corrupted;       // is hc header 0 corrupted \r
151     Short_t             fH1Corrupted;       // is hc header 1 corrupted\r
152     Short_t             fCorrupted;         // is hc data corrupted \r
153     Bool_t              fEOTECorrupted;     // if the corruption is due to meet END_OF_TRACKLET_MARKERNEW\r
154     Bool_t              fBufferCorrupted;   // if the corruption is due to buffer end\r
155     Bool_t              fDataCorrupted;     // if the corruption is on the MCM data\r
156 \r
157     Short_t             fMCMCorrupted[TRDMAXMCM]; // is hc data corrupted \r
158 \r
159     UInt_t             *fPos[2];            //! position of the header words in buffer\r
160       \r
161     Int_t               fDET;               // filled while decoding\r
162     Int_t               fROC;               // filled while decoding\r
163     Int_t               fRowMax;            // filled while decoding\r
164     Int_t               fColMax;            // filled while decoding\r
165 \r
166     // hc data\r
167     Int_t               fMCMmax;            // number of mcm found\r
168 \r
169     AliTRDrawHC()\r
170       : fTrackletWords() \r
171       , fNTracklets(0)\r
172       , fSpecialRawV(0)\r
173       , fRawVMajor(0)\r
174       , fRawVMajorOpt(0)\r
175       , fRawVMinor(0)\r
176       , fNExtraWords(0)\r
177       , fDCSboard(-1)\r
178       , fSM(-1)\r
179       , fSMHCheader(-1)\r
180       , fStack(-1)\r
181       , fStackHCheader(-1)\r
182       , fLayer(-1)\r
183       , fLayerHCheader(-1)\r
184       , fSide(-1)\r
185       , fSideHCheader(-1)\r
186       , fTimeBins(0)\r
187       , fBunchCrossCounter(0)\r
188       , fPreTriggerCounter(0)\r
189       , fPreTriggerPhase(0)\r
190       , fNErrors(0)\r
191       , fH0Corrupted(0)\r
192       , fH1Corrupted(0)\r
193       , fCorrupted(0)\r
194       , fEOTECorrupted(0)\r
195       , fBufferCorrupted(0)\r
196       , fDataCorrupted(0)\r
197       , fPos()\r
198       , fDET(-1)\r
199       , fROC(-1)\r
200       , fRowMax(-1)\r
201       , fColMax(-1)\r
202       , fMCMmax(0)\r
203     {\r
204       // default constructor hc info \r
205     };\r
206 \r
207     AliTRDrawHC(const AliTRDrawHC & p):\r
208         fTrackletWords() \r
209       , fNTracklets(p.fNTracklets)\r
210       , fSpecialRawV(p.fSpecialRawV)\r
211       , fRawVMajor(p.fRawVMajor)\r
212       , fRawVMajorOpt(p.fRawVMajorOpt)\r
213       , fRawVMinor(p.fRawVMinor)\r
214       , fNExtraWords(p.fNExtraWords)\r
215       , fDCSboard(p.fDCSboard)\r
216       , fSM(p.fSM)\r
217       , fSMHCheader(p.fSMHCheader)\r
218       , fStack(p.fStack)\r
219       , fStackHCheader(p.fStackHCheader)\r
220       , fLayer(p.fLayer)\r
221       , fLayerHCheader(p.fLayerHCheader)\r
222       , fSide(p.fSide)\r
223       , fSideHCheader(p.fSideHCheader)\r
224       , fTimeBins(p.fTimeBins)\r
225       , fBunchCrossCounter(p.fBunchCrossCounter)\r
226       , fPreTriggerCounter(p.fPreTriggerCounter)\r
227       , fPreTriggerPhase(p.fPreTriggerPhase)\r
228       , fNErrors(p.fNErrors)\r
229       , fH0Corrupted(p.fH0Corrupted)\r
230       , fH1Corrupted(p.fH1Corrupted)\r
231       , fCorrupted(p.fCorrupted)\r
232       , fEOTECorrupted(p.fEOTECorrupted)\r
233       , fBufferCorrupted(p.fBufferCorrupted)\r
234       , fDataCorrupted(p.fDataCorrupted)\r
235       , fPos()\r
236       , fDET(p.fDET)\r
237       , fROC(p.fROC)\r
238       , fRowMax(p.fRowMax)\r
239       , fColMax(p.fColMax)\r
240       , fMCMmax(p.fMCMmax)\r
241     {\r
242       // copy constructor\r
243     };\r
244 \r
245     AliTRDrawHC &operator=(const AliTRDrawHC &)\r
246     {\r
247       // assignment operator\r
248       // not implemented\r
249       return *this;\r
250     };\r
251 \r
252   };\r
253 \r
254   //--------------------------------------------------------\r
255     \r
256   struct AliTRDrawStack\r
257   {\r
258     UInt_t           fHeaderSize;            // header size of the stack info\r
259     Bool_t           fLinksActive[12];       // data links active - 1 per half chamber\r
260     Short_t          fLinksDataType[12];     // 0 indicating real data for the front-end electronics \r
261     Short_t          fLinksMonitor[12];      // 0 indicating properly operating link \r
262     Short_t          fLinkMonitorError[12];  // record link monitor error\r
263     Int_t            fActiveLinks;           // number of active links\r
264     UInt_t          *fPos;                   //! position in the buffer\r
265                     \r
266     AliTRDrawHC      fHalfChambers[12];      // 12 half chambers in a stack\r
267       \r
268     AliTRDrawStack()\r
269       : fHeaderSize(0)\r
270       , fLinksActive()\r
271       , fLinksDataType()\r
272       , fLinksMonitor()\r
273       , fLinkMonitorError()\r
274       , fActiveLinks(0)\r
275       , fPos(0)\r
276       , fHalfChambers()\r
277     {\r
278       // default constructor\r
279     };      \r
280 \r
281     AliTRDrawStack(const AliTRDrawStack & p):\r
282         fHeaderSize(p.fHeaderSize)\r
283       , fLinksActive()\r
284       , fLinksDataType()\r
285       , fLinksMonitor()\r
286       , fLinkMonitorError()\r
287       , fActiveLinks(p.fActiveLinks)\r
288       , fPos(p.fPos)\r
289       , fHalfChambers()\r
290     {\r
291       // copy constructor\r
292     };\r
293 \r
294     AliTRDrawStack &operator=(const AliTRDrawStack &)\r
295     {\r
296       // assignment operator\r
297       // not implemented\r
298       return *this;\r
299     };\r
300 \r
301   };\r
302 \r
303   //--------------------------------------------------------\r
304 \r
305   struct AliTRDrawSM\r
306   {\r
307     UInt_t            fHeaderSize;            // size of the header in words\r
308     Bool_t            fTrackletEnable;        // tracklet enable bit\r
309     Bool_t            fStackActive[5];        // map of active/expected stacks\r
310     Int_t             fActiveStacks;          // number of active stacks\r
311     Int_t             fCorrupted;             // is sm info corrupted\r
312     Int_t             fNexpectedHalfChambers; // number of half chambers to be read out in this sm\r
313     UInt_t           *fPos;                   // location of the sm info - should be the first word (after CDH if not DDL buffer)\r
314 \r
315     AliTRDrawStack    fStacks[5];             // 5 stacks\r
316 \r
317     AliTRDrawSM()\r
318       : fHeaderSize(0)\r
319       , fTrackletEnable(0)\r
320       , fStackActive()\r
321       , fActiveStacks(0)\r
322       , fCorrupted(0)\r
323       , fNexpectedHalfChambers(0)\r
324       , fPos(0)\r
325       , fStacks()\r
326       {\r
327         // Default constructor\r
328       };      \r
329 \r
330     AliTRDrawSM(const AliTRDrawSM & p):\r
331         fHeaderSize(p.fHeaderSize)\r
332       , fTrackletEnable(p.fTrackletEnable)\r
333       , fStackActive()\r
334       , fActiveStacks(p.fActiveStacks)\r
335       , fCorrupted(p.fCorrupted)\r
336       , fNexpectedHalfChambers(p.fNexpectedHalfChambers)\r
337       , fPos(p.fPos)\r
338       , fStacks()\r
339     {\r
340       // copy constructor\r
341     };\r
342 \r
343     AliTRDrawSM &operator=(const AliTRDrawSM &)\r
344     {\r
345       // assignment operator\r
346       // not implemented\r
347       return *this;\r
348     };\r
349 \r
350   };\r
351   \r
352   //--------------------------------------------------------\r
353      \r
354   AliTRDrawFastStream();\r
355   AliTRDrawFastStream(AliRawReader *rawReader);\r
356   virtual ~AliTRDrawFastStream();\r
357 \r
358   //--------------------------------------------------------\r
359 \r
360   virtual Bool_t       Next();                           // read the next data in the memory\r
361   virtual Int_t        NextChamber(AliTRDdigitsManager *man, UInt_t **trackletContainer, UShort_t **errorCodeContainer); // read next chamber data in the memory\r
362   virtual Bool_t       Init();                           // initialize some internal variables\r
363 \r
364   Int_t    NextBuffer(); // go and init next buffer if available - check the implementation file for return values\r
365 \r
366   Bool_t   SetRawVersion(Int_t fraw); // set the raw version - used for backward compat.\r
367   \r
368   void     SetSharedPadReadout(Bool_t fv) {fSharedPadsOn = fv;} // set the flag on if the reader should return the shared pads\r
369   \r
370   Bool_t   DecodeSMHeader(void *buffer, UInt_t length); // decode a buffer\r
371   Bool_t   SetReader(AliRawReader *reader); // set the raw reader to use\r
372   void     SetNoErrorWarning() {fWarnError = kFALSE;} // disable warning and error info\r
373            \r
374   // from MCM Header Word\r
375   // rob and mcm ordering\r
376   // 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  \r
377   // 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  \r
378 \r
379 \r
380   UShort_t   *GetErrorCodes() const { return fHC->fErrorCodes;}                       // return error codes pointer per hc \r
381   UInt_t      GetNErrors() const {return fHC ? fHC->fNErrors: 0;}                     // [mj temp]\r
382 \r
383   // info from ADC data words\r
384   // from here, only works with returning ADC channel pointer using Next() \r
385 \r
386   UInt_t   *GetTrackletWords() const { return fHC->fTrackletWords;}                 // return tracklet words pointer per hc \r
387   Int_t     GetNTracklets() const {return fHC ? fHC->fNTracklets : -1;}             // get number of tracklets \r
388 \r
389   Int_t     GetSpecialRawVersion() const {return fHC ? fHC->fSpecialRawV : -1;}     // return special raw version\r
390   Int_t     GetMajorRawVersion() const {return fHC ? fHC->fRawVMajor : -1;}         // major raw version getter\r
391   Int_t     GetRawVersion() const {return fHC ? fHC->fRawVMajor : -1;}              // compatibility see funtion above\r
392   Int_t     GetMinorRawVersion() const {return fHC ? fHC->fRawVMinor : -1;}         // minor raw version\r
393 \r
394   Int_t     GetSM() const {return fHC ? fHC->fSM : -1;}                              //  SM Position of CURRENT half chamber in full TRD\r
395   Int_t     GetLayer() const {return fHC ? fHC->fLayer : -1;}                        //  Layer Position of CURRENT half chamber in full TRD\r
396   Int_t     GetStack() const {return fHC ? fHC->fStack : -1;}                        //  Stack Position of CURRENT half chamber in full TRD\r
397   Int_t     GetSide() const {return fHC ? fHC->fSide : -1;}                          // get side\r
398   Int_t     GetDCS() const { return fHC ? fHC->fDCSboard : -1;}                      //  DCS board number read from data (HC header)\r
399   Int_t     GetROC() const { return fHC ? fHC->fROC : -1;}                           //  ROB Position of CURRENT half chamber in full TRD\r
400   Int_t     GetNumberOfTimeBins() const { return fHC ? fHC->fTimeBins : 0;}          // Get Ntime bins\r
401   UInt_t    GetBunchCrossCounter() const {return fHC ? fHC->fBunchCrossCounter : 0;} // get bunch cross counter\r
402   UInt_t    GetPreTriggerCounter() const {return fHC ? fHC->fPreTriggerCounter : 0;} // get pre trigger info\r
403   UInt_t    GetPreTriggerPhase() const {return fHC ? fHC->fPreTriggerPhase : 0;}     // get trigger phase\r
404 \r
405   Int_t     GetRow() const {return fMCM.fROW;}         // get current row number\r
406   Int_t     GetCol() const {return fCOL;} \r
407   Int_t     GetExtendedCol() const {return fExtendedCOL;} \r
408   Int_t     GetRowMax() const { return fHC ? fHC->fRowMax : -1;}    // Get maximum rows in the current HC\r
409   Int_t     GetColMax() const { return fHC ? fHC->fColMax : -1;}    // Get maximum cols in the current HC\r
410   // compatibility\r
411   Int_t     GetMaxRow() const { return fHC ? fHC->fRowMax : -1;}    // Get maximum rows in the current HC\r
412   Int_t     GetMaxCol() const { return fHC ? fHC->fColMax : -1;}    // Get maximum cols in the current HC\r
413 \r
414   UInt_t    GetHCword0() const {return fHC ? *fHC->fPos[0] : 0;}    // get the HC word 0\r
415   UInt_t    GetHCword1() const {return fHC ? *fHC->fPos[1] : 0;}    // get the HC word 1\r
416             \r
417   Int_t     GetDET() const {return fHC ? fHC->fDET : -1;}           // get current det number\r
418   Int_t     GetDet() const {return fHC ? fHC->fDET : -1;}           // get current det number\r
419             \r
420   Int_t     GetROB() const {return fMCM.fROB;}         // get current ROB number\r
421   Int_t     GetMCM() const {return fMCM.fMCM;}         // get current MCM number\r
422   Int_t     GetEventNumber() const { return fMCM.fEvCounter;}      //  MCM Event number and position of current MCM on TRD chamber\r
423 \r
424   Int_t     GetTimeBin() const { return 0;}                         //  MCM ADC channel and Time Bin of word 1\r
425 \r
426   UInt_t   *GetSMstreamPosition() const {return fSM.fPos;} // get position of the SM index word in the buffer\r
427 \r
428 \r
429   //----------------------------------------------------------\r
430  \r
431   static void    SetNoDebug() {fgDebugFlag = kFALSE;} // allow debug info\r
432   static void    EnableMemoryReset() {fgEnableMemoryReset = kTRUE;} // allow memory reset\r
433   static void    SetForceCleanDataOnly() {fgCleanDataOnly = kTRUE;} // clean data only\r
434   static void    AllowCorruptedData() {fgCleanDataOnly = kFALSE;} // accept corrupted data\r
435 \r
436   static void    SetExtraWordsFix() {fgExtraSkip = kTRUE;} // extra skip of 24 32-bit words \r
437   static void    SetSkipCDH() {fgSkipCDH = kTRUE;} // skip of 8 32-bit words \r
438   static void    SetDumpHead(Int_t iv) {fgDumpHead = iv;}\r
439   static void    DisableStackNumberChecker() {fgStackNumberChecker = kFALSE;}  // set false to cleanroom data \r
440   static void    DisableStackLinkNumberChecker() {fgStackLinkNumberChecker = kFALSE;}  \r
441   static void    DisableSkipData() {fgSkipData = kFALSE;} // keep reading next words even previous words were corrupted - debugging purpose  \r
442 \r
443   static void    EnableDecodeConfigData() {fgEnableDecodeConfigData = kTRUE;} // allow configuration data decoding\r
444   static Bool_t  fgEnableDecodeConfigData; // flag to decode configuration data\r
445 \r
446   Int_t GetGlobalNTimeBins() const {return fGlobalNTimeBins;} // get number of time information for the digit container\r
447 \r
448   //--------------------------------------------------------\r
449   // Decoding functions\r
450   //--------------------------------------------------------\r
451 \r
452   void DecodeSMInfo(const UInt_t *word, struct AliTRDrawSM *sm) const ;\r
453   const char *DumpSMInfo(const struct AliTRDrawSM *sm);\r
454   void DecodeStackInfo(const UInt_t *word, struct AliTRDrawStack *st) const;\r
455   void DecodeStackHeader(const UInt_t *word, struct AliTRDrawStack *st, Int_t iword) const;\r
456   const char *DumpStackInfo(const struct AliTRDrawStack *st);\r
457   Bool_t DecodeHCwordH0(const UInt_t *word, struct AliTRDrawHC *hc) const;\r
458   Bool_t DecodeHCwordH1(const UInt_t *word, struct AliTRDrawHC *hc) const;\r
459   const char *DumpHCinfoH0(const struct AliTRDrawHC *hc);\r
460   const char *DumpHCinfoH1(const struct AliTRDrawHC *hc);\r
461   void DecodeMCMheader(const UInt_t *word, struct AliTRDrawMCM *mcm) const;\r
462   UInt_t GetMCMadcMask(const UInt_t *word, struct AliTRDrawMCM *mcm) const;\r
463   void DecodeMask(const UInt_t *word, struct AliTRDrawMCM *mcm) const;\r
464   void MCMADCwordsWithTbins(UInt_t fTbins, struct AliTRDrawMCM *mcm) const;\r
465   const char *DumpMCMinfo(const struct AliTRDrawMCM *mcm);\r
466   const char *DumpMCMadcMask(const struct AliTRDrawMCM *mcm);\r
467 \r
468 \r
469  protected:\r
470 \r
471   Bool_t InitBuffer(void *buffer, UInt_t length); // init the buffer - called by DecodeSM(void*, UInt_t)\r
472   Bool_t DumpWords(UInt_t *px, UInt_t iw, UInt_t marker = 0); // dump some words onto the screen\r
473 \r
474   void   SwapOnEndian();         // swap if endian is BIG\r
475   Bool_t SkipWords(UInt_t iw);   // skip number of words\r
476   Bool_t DecodeGTUheader();      // decode data in GTU header\r
477   Bool_t DecodeTracklets();      // decode tracklets\r
478   Bool_t DecodeHC(AliTRDdigitsManager *digitsManager, AliTRDarrayADC *digits, AliTRDarrayDictionary *track0, AliTRDarrayDictionary *track1, AliTRDarrayDictionary *track2, AliTRDSignalIndex *indexes);       // decode data in HC\r
479 \r
480   Bool_t DecodeADC(AliTRDdigitsManager *digitsManager, AliTRDarrayADC *digits, AliTRDarrayDictionary *track0, AliTRDarrayDictionary *track1, AliTRDarrayDictionary *track2, AliTRDSignalIndex *indexes);      // decode 10 ADC words\r
481   Bool_t DecodeADCExtended(AliTRDdigitsManager *digitsManager, AliTRDarrayADC *digits, AliTRDarrayDictionary *track0, AliTRDarrayDictionary *track1, AliTRDarrayDictionary *track2, AliTRDSignalIndex *indexes);      // decode 10 ADC words\r
482 \r
483   Bool_t DecodeHCheader();       // decode HC  header\r
484   Bool_t SeekEndOfData();        // go to next end of raw data marker (actually 1 word after)\r
485   Bool_t SkipMCMdata(UInt_t iw);  // skip this mcm data due to mcm header corruption\r
486   Bool_t SeekNextMCMheader();    // go to next mcm header\r
487   Bool_t DecodeMCMheader();      // decode mcm header\r
488 \r
489   Bool_t IsRowValid();       // check if row within the range\r
490   Bool_t IsHCheaderOK();     // check if current hc header data make sense\r
491   Bool_t IsMCMheaderOK();    // check if current mcm header data make sense\r
492     \r
493   Bool_t SetGlobalNTimebins(); // set number of timebin based on the value read from HC header, this value will be used in the digit container\r
494   Bool_t SetNTimebins();       // set number of timebin based on the value read from HC header\r
495 \r
496   void   ResetCounters();    // reset some counters\r
497   void   ResetIterators();   // needed for Next()\r
498   void   ResetPerSM();       // reset every SM \r
499   void   ResetPerStack();    // reset every Stack \r
500   void   ResetPerHC();       // reset every HC \r
501   void   ResetPerMCM();      // reset every MCM  \r
502   void   ResetMemory();      // reset all data members\r
503 \r
504   AliTRDrawFastStream(const AliTRDrawFastStream& st);\r
505   AliTRDrawFastStream &operator=(const AliTRDrawFastStream &);\r
506 \r
507   // ----------------- DATA MEMBERS START\r
508 \r
509   struct AliTRDrawSM       fSM;    //  one SM per buffer\r
510   struct AliTRDrawStack   *fStack; //! pointer to the current stack\r
511   struct AliTRDrawHC      *fHC;    //! current HC\r
512   struct AliTRDrawHC      *fLastHC; //! last HC\r
513   struct AliTRDrawMCM     fMCM;    //! current MCM\r
514   \r
515   UInt_t *fpPos;   // current position in the buffer\r
516   UInt_t *fpBegin; // begin - pointer to the buffer word 0\r
517   UInt_t *fpEnd;   // end of the buffer\r
518 \r
519   UInt_t  fWordLength;  // length of the buffer in 32bit words\r
520 \r
521   UInt_t *fpPosTemp;   // specific position in the buffer \r
522   Int_t   fGlobalNTimeBins; // number of time bin to be used in the digit container\r
523   Bool_t  fIsTimeBinSet; // set true if the global time bin is set to avoid multiple search\r
524   Bool_t  fIsGlobalDigitsParamSet; // set true if the global digit parameters are already set\r
525 \r
526   Int_t   fStackNumber;     // current stack number\r
527   Int_t   fStackLinkNumber; // current link in the stack\r
528 \r
529   Int_t   fLinkTrackletCounter; // count the tracklets in the current HC\r
530   Int_t   fEndOfTrackletCount;  // count link by link (hc by hc) used for debug\r
531   Int_t   fNWordsCounter;       // counts words of given hc having link monitor error\r
532 \r
533   UInt_t  fMaskADCword; // temp mask when decoding adcs\r
534   UInt_t  fTbinADC;     // temp adc \r
535 \r
536   UInt_t  fEventCounter;     // stores the valid/current MCM event counter\r
537   UInt_t  fLastEventCounter; // last known event counter of MCM\r
538 \r
539   Bool_t  fSharedPadsOn; // do we want to output shared pads - default is off\r
540   Int_t   fMaxADCgeom;   // maximum ADC channels per mcm\r
541 \r
542   Short_t fADCnumber;    // number of the ADC 0 .. 20\r
543   Short_t fCOL;          // column - row from MCM\r
544   Short_t fExtendedCOL;  // virtual column for extended digit container\r
545   Bool_t  fIsShared;     // true if the pad is shared pad\r
546   Bool_t  fWarnError;    // no errors no warnings\r
547 \r
548   Bool_t  fBufferRead;   // set true if the buffer for one ddl is read\r
549 \r
550   AliTRDgeometry *fGeometry;  //! TRD geometry\r
551   AliRawReader   *fRawReader; //! raw reader    \r
552 \r
553   AliTRDfeeParam      *fTRDfeeParam; // pointer to the fee params\r
554   Int_t   fCommonAdditive; // baseline value \r
555 \r
556   // STATIC \r
557 \r
558   static Bool_t fgExtraSkip; // whether we should skip the leading 24 words\r
559   static Bool_t fgSkipCDH; // whether we should skip CDH (8 words)\r
560   static Bool_t fgCleanDataOnly; // release only clean events = no errors\r
561   static Bool_t fgDebugFlag; // allow debugging info\r
562   static Bool_t fgEnableMemoryReset; // allow memory reset\r
563   static Bool_t fgStackNumberChecker; // decide if we check stack number insanity - set false to cleanroom data\r
564   static Bool_t fgStackLinkNumberChecker; // decide if we check stack link number insanity - debuging purpose\r
565   static Bool_t fgSkipData; // decide if we skip corrupted data of given HC\r
566   static Int_t fgDumpHead; // number of words to dump (from the start of the buffer) on each Init\r
567   static Short_t  fgMCMordering[16]; // mcm number odering for mcm header corruption check\r
568   static Short_t  fgROBordering[16]; // mcm number odering for mcm header corruption check\r
569   static Int_t  fgLastHC;  // HC number indicator to check HC numbering\r
570   static Int_t  fgLastROB; // ROB number indicator to check ROB numbering \r
571   static Int_t  fgLastIndex; // variable to check mcm number odering\r
572 \r
573   // ----------------- DATA MEMBERS STOP\r
574 \r
575   enum ETRDzRawStreamError \r
576     {\r
577       kDecodeStackInfo          = 1 //\r
578       , kMissingData            = 2 //\r
579       , kLinkDataMissing        = 3 //\r
580       , kHCdataMissing          = 4 //\r
581       , kTrackletOverflow       = 5 //\r
582       , kEOTrackeltsMissing     = 6 //\r
583       , kWrongPadrow            = 7 //\r
584       , kMCMheaderCorrupted     = 8 //\r
585       , kWrongMCMorROB          = 9 //\r
586       , kMCMeventMissmatch      = 10 //\r
587       , kMCMADCMaskMissing      = 11 //\r
588       , kHCHeaderCorrupt        = 12 //\r
589       , kHCHeaderWrongStack     = 13 //\r
590       , kHCHeaderWrongLayer     = 14 //\r
591       , kHCHeaderWrongSide      = 15 //\r
592       , kHCHeaderWrongSM        = 16 //\r
593       , kHCHeaderWrongDet       = 17 //\r
594       , kHCHeaderWrongROC       = 18 //\r
595       , kHCWordMissing          = 19 //\r
596       , kMCMdataMissing         = 20 //\r
597       , kMCMoverflow            = 21 //\r
598       , kADCdataMissing         = 22 //\r
599       , kADCmaskMissmatch       = 23 //\r
600       , kWrongPadcolumn         = 24 //\r
601     };                         \r
602 \r
603   ClassDef(AliTRDrawFastStream, 0)\r
604 }; //clas def end\r
605 \r
606 #endif\r