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