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