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