d2e2f542 |
1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * |
3 | * * |
4 | * Author: The ALICE Off-line Project. * |
5 | * Contributors are mentioned in the code where appropriate. * |
6 | * * |
7 | * Permission to use, copy, modify and distribute this software and its * |
8 | * documentation strictly for non-commercial purposes is hereby granted * |
9 | * without fee, provided that the above copyright notice appears in all * |
10 | * copies and that both the copyright notice and this permission notice * |
11 | * appear in the supporting documentation. The authors make no claims * |
12 | * about the suitability of this software for any purpose. It is * |
13 | * provided "as is" without express or implied warranty. * |
14 | **************************************************************************/ |
15 | |
16 | /////////////////////////////////////////////////////////////////////////////// |
17 | /// |
18 | /// This is a class for reading the HMPID raw data |
19 | /// The format of the raw data corresponds to the one |
20 | /// which was documented by Paolo Martinengo. |
21 | /// |
22 | /////////////////////////////////////////////////////////////////////////////// |
23 | |
24 | #include "AliHMPIDRawStream.h" |
25 | #include "AliRawReader.h" |
26 | #include "AliLog.h" |
21f61e25 |
27 | |
e96561a3 |
28 | static Bool_t stDeb = kFALSE; |
29 | //static Bool_t stDeb = kTRUE; |
d2e2f542 |
30 | |
31 | ClassImp(AliHMPIDRawStream) |
32 | |
e96561a3 |
33 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
d2e2f542 |
34 | AliHMPIDRawStream::AliHMPIDRawStream(AliRawReader* rawReader) : |
a66fe5e5 |
35 | fNPads(0), |
36 | fCharge(0x0), |
37 | fPad(0x0), |
d2e2f542 |
38 | fDDLNumber(-1), |
39 | fRawReader(rawReader), |
a66fe5e5 |
40 | fData(0x0), |
41 | fNumOfErr(0x0), |
42 | fPosition(-1), |
43 | fWord(0), |
44 | fZeroSup(kTRUE), |
45 | fPos(0x0), |
46 | iPos(0) |
d2e2f542 |
47 | { |
48 | // Constructor |
d2e2f542 |
49 | |
50 | fRawReader->Reset(); |
51 | fRawReader->Select("HMPID"); |
52 | } |
e96561a3 |
53 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
21f61e25 |
54 | AliHMPIDRawStream::AliHMPIDRawStream() : |
a66fe5e5 |
55 | fNPads(0), |
56 | fCharge(0x0), |
57 | fPad(0x0), |
21f61e25 |
58 | fDDLNumber(-1), |
d3917810 |
59 | fRawReader(0x0), |
a66fe5e5 |
60 | fData(0x0), |
61 | fNumOfErr(0x0), |
62 | fPosition(-1), |
63 | fWord(0), |
64 | fZeroSup(kTRUE), |
65 | fPos(0x0), |
66 | iPos(0) |
21f61e25 |
67 | { |
21f61e25 |
68 | } |
e96561a3 |
69 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
d2e2f542 |
70 | AliHMPIDRawStream::~AliHMPIDRawStream() |
71 | { |
72 | // destructor |
56c73976 |
73 | DelVars(); |
d2e2f542 |
74 | } |
fd8bfa30 |
75 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
d2e2f542 |
76 | void AliHMPIDRawStream::Reset() |
77 | { |
78 | // reset raw stream params |
d2e2f542 |
79 | // Reinitalize the containers |
d2e2f542 |
80 | fDDLNumber = -1; |
81 | fPosition = -1; |
82 | fData = NULL; |
d2e2f542 |
83 | if (fRawReader) fRawReader->Reset(); |
84 | } |
fd8bfa30 |
85 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
d2e2f542 |
86 | Bool_t AliHMPIDRawStream::Next() |
87 | { |
21f61e25 |
88 | // read next DDL raw data from the HMPID raw data stream |
d2e2f542 |
89 | // return kFALSE in case of error or no data left |
21f61e25 |
90 | AliDebug(1,"Start."); |
d2e2f542 |
91 | do { |
92 | if (!fRawReader->ReadNextData(fData)) return kFALSE; |
93 | } while (fRawReader->GetDataSize() == 0); |
21f61e25 |
94 | |
fd8bfa30 |
95 | |
843bde9a |
96 | /* |
97 | Event type is selected as in $ALICE_ROOT/RAW/event.h |
98 | #define START_OF_RUN ((eventTypeType) 1) |
99 | #define END_OF_RUN ((eventTypeType) 2) |
100 | #define START_OF_RUN_FILES ((eventTypeType) 3) |
101 | #define END_OF_RUN_FILES ((eventTypeType) 4) |
102 | #define START_OF_BURST ((eventTypeType) 5) |
103 | #define END_OF_BURST ((eventTypeType) 6) |
104 | #define PHYSICS_EVENT ((eventTypeType) 7) <<--------------- |
105 | #define CALIBRATION_EVENT ((eventTypeType) 8) |
106 | #define EVENT_FORMAT_ERROR ((eventTypeType) 9) |
107 | #define START_OF_DATA ((eventTypeType)10) |
108 | #define END_OF_DATA ((eventTypeType)11) |
109 | #define SYSTEM_SOFTWARE_TRIGGER_EVENT ((eventTypeType)12) |
110 | #define DETECTOR_SOFTWARE_TRIGGER_EVENT ((eventTypeType)13) |
111 | #define EVENT_TYPE_MIN 1 |
112 | #define EVENT_TYPE_MAX 13 |
113 | */ |
fd8bfa30 |
114 | |
115 | fPosition = 0; |
116 | Bool_t status; |
e96561a3 |
117 | |
843bde9a |
118 | if(fRawReader->GetType() == 7) { //New: Select Physics events, Old: Raw data size is not 0 and not 47148 (pedestal) |
21f61e25 |
119 | fDDLNumber = fRawReader->GetDDLID(); |
a66fe5e5 |
120 | if (fDDLNumber<0) { |
121 | AliWarning("Negative DDL number!"); |
122 | return kFALSE; |
123 | } |
124 | |
e96561a3 |
125 | if(stDeb) Printf("DDL %i started to be decoded!.",fDDLNumber); |
56c73976 |
126 | InitVars(fRawReader->GetDataSize()/4); |
fd8bfa30 |
127 | status = ReadHMPIDRawData(); |
e96561a3 |
128 | |
129 | if(stDeb) { |
130 | if(status) Printf("Event DDL %i successfully decoded!.",fDDLNumber); |
131 | else Printf("Event DDL %i ERROR in decoding!.",fDDLNumber); |
132 | // DumpData(fRawReader->GetDataSize()); |
133 | } |
a66fe5e5 |
134 | DelVars(); |
fd8bfa30 |
135 | // stDeb=kFALSE; |
136 | } |
56c73976 |
137 | // return status; |
138 | return kTRUE; |
fd8bfa30 |
139 | } |
56c73976 |
140 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
141 | void AliHMPIDRawStream::InitVars(Int_t n) |
142 | { |
143 | fNPads = 0; |
a66fe5e5 |
144 | if (n>0) fCharge = new Int_t[n]; |
145 | if (n>0) fPad = new Int_t[n]; |
e96561a3 |
146 | fNumOfErr = new Int_t*[kNDDL]; // Store the numner of errors for a given error type and a given DD |
147 | for(Int_t i=0;i<kNDDL;i++) { |
148 | fNumOfErr[i] = new Int_t [kSumErr]; |
a66fe5e5 |
149 | for (Int_t j=0; j<kSumErr; j++) fNumOfErr[i][j] = 0; |
e96561a3 |
150 | } |
56c73976 |
151 | //for debug purpose |
a66fe5e5 |
152 | if (n>0) fPos = new Int_t[4*n]; //reset debug |
56c73976 |
153 | iPos = 0; |
154 | } |
155 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
156 | void AliHMPIDRawStream::DelVars() |
157 | { |
158 | fNPads = 0; |
a66fe5e5 |
159 | if (fCharge) { |
160 | delete [] fCharge; |
161 | fCharge = 0x0; |
162 | } |
163 | if (fPad) { |
164 | delete [] fPad; |
165 | fPad = 0x0; |
166 | } |
167 | if (fNumOfErr) { |
168 | for(Int_t i=0;i<kNDDL;i++) if(fNumOfErr[i]) delete [] fNumOfErr[i]; |
169 | delete [] fNumOfErr; |
170 | fNumOfErr = 0x0; |
171 | } |
172 | if (fPos) { |
173 | delete [] fPos; |
174 | fPos = 0x0; |
175 | } |
56c73976 |
176 | } |
fd8bfa30 |
177 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
178 | Bool_t AliHMPIDRawStream::ReadHMPIDRawData() |
179 | { |
180 | Int_t cntGlob = fRawReader->GetDataSize()/4; |
181 | Int_t cnt = cntGlob; |
fd8bfa30 |
182 | Int_t nwSeg; |
183 | Int_t cntSegment; |
184 | |
56c73976 |
185 | fWord = GetWord(cnt);cnt--; |
fd8bfa30 |
186 | |
187 | |
188 | while (cnt>0) { |
189 | |
56c73976 |
190 | nwSeg = (fWord >> kbit8) & 0xfff; |
191 | if(!CheckSegment()) return kFALSE; |
192 | if(!ReadSegment(cntSegment)) return kFALSE; |
fd8bfa30 |
193 | |
e96561a3 |
194 | if(nwSeg != cntSegment) {if(stDeb){Printf("Error in Segment counters: %i different wrt %i",nwSeg,cntSegment);} return kFALSE;} |
56c73976 |
195 | fWord = GetWord(cntSegment+1,kBwd); |
fd8bfa30 |
196 | cnt-=cntSegment+1; |
197 | } |
21f61e25 |
198 | |
d2e2f542 |
199 | return kTRUE; |
fd8bfa30 |
200 | |
d2e2f542 |
201 | } |
fd8bfa30 |
202 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
56c73976 |
203 | Bool_t AliHMPIDRawStream::ReadSegment(Int_t &cntSegment) |
fd8bfa30 |
204 | { |
56c73976 |
205 | cntSegment = (fWord >> kbit8) & 0xfff; |
fd8bfa30 |
206 | Int_t cnt = cntSegment; |
207 | Int_t cntRow; |
208 | Int_t nwRow; |
d2e2f542 |
209 | |
56c73976 |
210 | fWord = GetWord(cnt,kBwd); |
fd8bfa30 |
211 | |
212 | while (cnt>0) { |
213 | |
56c73976 |
214 | cntRow = (fWord >> kbit16) & 0xfff; |
215 | if(!CheckRowMarker()) return kFALSE; |
216 | if(!ReadRow(nwRow)) return kFALSE; |
fd8bfa30 |
217 | |
e96561a3 |
218 | if(nwRow != cntRow) {if(stDeb){Printf("Error in Row counters: %i different wrt %i",nwRow,cntRow);} return kFALSE;} |
56c73976 |
219 | fWord = GetWord(cntRow+1); |
fd8bfa30 |
220 | cnt -= cntRow+1; |
221 | |
222 | } |
223 | |
224 | cntSegment -= cnt; |
225 | |
226 | return kTRUE; |
227 | |
228 | } |
229 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
56c73976 |
230 | Bool_t AliHMPIDRawStream::ReadRow(Int_t &cntRow) |
fd8bfa30 |
231 | { |
232 | Int_t cnt; |
233 | Int_t cntDilogic; |
234 | Int_t nwDil; |
235 | |
56c73976 |
236 | cntRow = (fWord >> kbit16) & 0xfff; |
fd8bfa30 |
237 | cnt = cntRow; |
238 | |
56c73976 |
239 | fWord = GetWord(cntRow); |
fd8bfa30 |
240 | |
241 | while (cnt>0) { |
242 | |
56c73976 |
243 | if(!CheckEoE(nwDil)) return kFALSE; |
244 | if(!ReadDilogic(cntDilogic)) return kFALSE; |
fd8bfa30 |
245 | |
e96561a3 |
246 | if(nwDil != cntDilogic) {if(stDeb){Printf("Error in Dilogic counters: %i different wrt %i",nwDil,cntDilogic);}return kFALSE;} |
fd8bfa30 |
247 | cnt -= cntDilogic; |
56c73976 |
248 | fWord = GetWord(1,kBwd); // go to next Dilogic bank... |
fd8bfa30 |
249 | cnt--; |
250 | // Printf(" cnt %i cntDilogic %i ",cnt,cntDilogic); |
251 | } |
252 | |
253 | cntRow -= cnt; |
254 | |
255 | return kTRUE; |
256 | |
257 | } |
258 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
56c73976 |
259 | Bool_t AliHMPIDRawStream::ReadDilogic(Int_t &cntDilogic) |
fd8bfa30 |
260 | { |
56c73976 |
261 | cntDilogic = fWord & 0x7f; |
fd8bfa30 |
262 | |
263 | Int_t cnt = cntDilogic; |
56c73976 |
264 | |
265 | // Printf(" cnt DILOGIC %i at %i word %08X",cnt,fPosition,fWord); |
fd8bfa30 |
266 | |
267 | for(Int_t iDil=0;iDil<cntDilogic;iDil++) { |
268 | UInt_t dilogic = 0, row = 0; |
56c73976 |
269 | fWord = GetWord(1,kBwd); |
fd8bfa30 |
270 | //check on row number |
271 | cnt--; |
56c73976 |
272 | row = (fWord >> kbit22) & 0x1f; |
fd8bfa30 |
273 | if(!CheckRow(row)) continue; |
274 | //check dilogic number |
56c73976 |
275 | dilogic = (fWord >> kbit18) & 0xf; //dilogic info in raw word is between bits: 18...21 |
fd8bfa30 |
276 | if(!CheckDilogic(dilogic)) continue; |
277 | //check pad number |
56c73976 |
278 | UInt_t pad = (fWord >> kbit12) & 0x3f; //pad info in raw word is between bits: 12...17 |
fd8bfa30 |
279 | if(!CheckPad(pad)) continue; |
56c73976 |
280 | Int_t charge = fWord & 0xfff; |
281 | fPad[fNPads] = GetPad(fDDLNumber,row,dilogic,pad); |
282 | fCharge[fNPads] = charge; |
283 | fNPads++; |
fd8bfa30 |
284 | } |
285 | |
286 | cntDilogic -= cnt; |
287 | return kTRUE; |
288 | } |
289 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
56c73976 |
290 | Bool_t AliHMPIDRawStream::CheckSegment() |
d2e2f542 |
291 | { |
fd8bfa30 |
292 | UInt_t markSegment = 0xAB0; |
293 | /* |
294 | if (iRow%8 == 0) { |
295 | UInt_t segWord = GetWord(); |
296 | if ((segWord >> 20) != statusSegWord) { |
297 | fRawReader->AddMajorErrorLog(kBadSegWordErr); |
298 | AliWarning(Form("Wrong segment word signature: %x, expected 0xab0!",(segWord >> 20))); |
299 | fNumOfErr[kBadSegWordErr]++; |
300 | return kTRUE; |
301 | } |
302 | */ |
56c73976 |
303 | UInt_t segMarker = (fWord >> kbit20) & 0xfff; |
fd8bfa30 |
304 | if (segMarker != markSegment ) { |
e96561a3 |
305 | //fRawReader->AddMajorErrorLog(kWrongSegErr,Form("Segment marker %0X wrong (expected %0X) at %i in word %0X!",segMarker,markSegment,fPosition,fWord)); |
306 | if(stDeb){ AliWarning(Form("Segment marker %X wrong (expected %0X)! at %i in word %0X!",segMarker,markSegment,fPosition,fWord));} |
307 | fNumOfErr[fDDLNumber][kWrongSegErr]++; |
fd8bfa30 |
308 | return kFALSE; |
309 | } |
310 | |
56c73976 |
311 | UInt_t segAddress = fWord & 0xff; |
fd8bfa30 |
312 | if (segAddress<1 ||segAddress>3) { |
e96561a3 |
313 | //fRawReader->AddMajorErrorLog(kWrongSegErr,Form("Segment address %d not in the valid range [1-3] at %i in word %0X",segAddress,fPosition,fWord)); |
314 | if(stDeb){AliWarning(Form("Segment address %d not in the valid range [1-3]",segAddress));} |
315 | fNumOfErr[fDDLNumber][kWrongSegErr]++; |
fd8bfa30 |
316 | return kFALSE; |
317 | } |
56c73976 |
318 | // Printf("Segment Marker found at %i! Number of segment is %i",fPosition,segAddress); |
fd8bfa30 |
319 | return kTRUE; |
320 | } |
321 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
322 | Bool_t AliHMPIDRawStream::CheckRow(UInt_t row) |
323 | { |
324 | //check on row number |
56c73976 |
325 | // Printf("ROW %i word %0X",row,fWord); |
fd8bfa30 |
326 | if(row>=1 && row <=kNRows) return kTRUE; |
327 | |
e96561a3 |
328 | //fRawReader->AddMajorErrorLog(kWrongRowErr,Form("row %d",row)); |
329 | if(stDeb){AliWarning(Form("Wrong row index: %d, expected (1 -> %d) word %0X at %i...",row,kNRows,fWord,fPosition));} |
330 | fNumOfErr[fDDLNumber][kWrongRowErr]++; |
fd8bfa30 |
331 | return kFALSE; |
332 | } |
333 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
334 | Bool_t AliHMPIDRawStream::CheckDilogic(UInt_t dilogic) |
335 | { |
336 | //check dilogic number |
337 | if (dilogic>= 1 && dilogic <=kNDILOGICAdd) return kTRUE; |
338 | |
e96561a3 |
339 | //fRawReader->AddMajorErrorLog(kWrongDilogicErr,Form("dil %d",dilogic)); |
340 | if(stDeb){AliWarning(Form("Wrong DILOGIC index: %d, expected (1 -> %d)!",dilogic,kNDILOGICAdd));} |
341 | fNumOfErr[fDDLNumber][kWrongDilogicErr]++; |
fd8bfa30 |
342 | //dilogic = iDILOGIC; |
343 | return kFALSE; |
344 | } |
345 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
346 | Bool_t AliHMPIDRawStream::CheckPad(UInt_t pad) |
347 | { |
348 | //check pad number |
349 | if (pad < kNPadAdd) return kTRUE; |
350 | |
e96561a3 |
351 | //fRawReader->AddMajorErrorLog(kWrongPadErr,Form("pad %d",pad)); |
352 | if(stDeb){AliWarning(Form("Wrong pad index: %d, expected (0 -> %d)!",pad,kNPadAdd));} |
353 | fNumOfErr[fDDLNumber][kWrongPadErr]++; |
fd8bfa30 |
354 | return kFALSE; |
355 | } |
356 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
56c73976 |
357 | Bool_t AliHMPIDRawStream::CheckEoE(Int_t &nDil) |
fd8bfa30 |
358 | { |
56c73976 |
359 | if (!((fWord >> kbit27) & 0x1)) { //check 27th bit in EoE. It must be 1! |
e96561a3 |
360 | //fRawReader->AddMajorErrorLog(kEoEFlagErr); |
361 | if(stDeb){AliWarning(Form("Missing end-of-event flag! (%08X) at %i",fWord,fPosition));} |
362 | fNumOfErr[fDDLNumber][kEoEFlagErr]++; |
fd8bfa30 |
363 | return kFALSE; |
364 | } |
e96561a3 |
365 | nDil = fWord & 0x7f; //nDil=EoE word count |
366 | if(nDil < 0 || nDil > 48 ) { |
367 | |
368 | //fRawReader->AddMajorErrorLog(kEoESizeErr,Form("EoE size=%d",nDil)); |
369 | if(stDeb){AliWarning(Form("Wrong end-of-event word-count: %08X",fWord));} |
370 | fNumOfErr[fDDLNumber][kEoESizeErr]++; |
fd8bfa30 |
371 | return kFALSE; |
372 | } |
373 | // UInt_t da = (eOfEvent >> 18) & 0xf; |
374 | // if (cntData!=0 && da != dilogic) { |
375 | // fRawReader->AddMajorErrorLog(kEoEDILOGICErr,Form("eoe dil %d != %d",da,dilogic)); |
376 | // AliWarning(Form("Wrong DILOGIC address found in end-of-event: %d, expected %d!",da,dilogic)); |
377 | // fNumOfErr[kEoEDILOGICErr]++; |
378 | // return kFALSE; AliQAChecker::Instance()->Run(AliQA::kHMPID, task, obj) ; |
379 | |
380 | // } |
381 | // UInt_t ca = (eOfEvent >> 22) & 0x1f; |
382 | // if (cntData!=0 && ca != row) { |
383 | // fRawReader->AddMajorErrorLog(kEoERowErr,Form("eoe row %d != %d",ca,row)); |
384 | // AliWarning(Form("Wrong row index found in end-of-event: %d, expected %d!",ca,row)); |
385 | // fNumOfErr[kEoERowErr]++; |
386 | // return kFALSE; |
387 | // } |
388 | return kTRUE; |
389 | } |
390 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
56c73976 |
391 | Bool_t AliHMPIDRawStream::CheckRowMarker() |
fd8bfa30 |
392 | { |
393 | UInt_t nMAXwordsInRow = 0x1EA; |
394 | UInt_t statusControlRow = 0x32a8; // 0x36a8 for zero suppression |
395 | //First check on row marker |
56c73976 |
396 | UInt_t rowControlWord = fWord >> kbit0 & 0xfbff; |
fd8bfa30 |
397 | |
398 | if(rowControlWord != statusControlRow) { |
e96561a3 |
399 | //fRawReader->AddMajorErrorLog(kRowMarkerErr); |
400 | if(stDeb){AliWarning(Form("Wrong row marker %x expected 0x32a8!",rowControlWord)); |
401 | fNumOfErr[fDDLNumber][kRowMarkerErr]++; |
402 | return kFALSE; } |
403 | } |
fd8bfa30 |
404 | //Second check on row marker |
e96561a3 |
405 | UInt_t wordsInRow = fWord >> kbit16 & 0x0fff; // Number of words after the row marker, bit 10 is skipped in this check |
fd8bfa30 |
406 | |
407 | if (wordsInRow > nMAXwordsInRow) { |
e96561a3 |
408 | //fRawReader->AddMajorErrorLog(kRowMarkerSizeErr); |
409 | if(stDeb){AliWarning(Form(" FATAL: Number of words %x in a row exceeds the expected value: 0x1EA !",wordsInRow));} |
410 | fNumOfErr[fDDLNumber][kRowMarkerSizeErr]++; |
fd8bfa30 |
411 | return kFALSE; |
412 | } |
413 | |
414 | return kTRUE; |
415 | } |
416 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
417 | UInt_t AliHMPIDRawStream::GetWord(Int_t n,EDirection dir) |
418 | { |
419 | // This method returns the n-th 32 bit word |
d2e2f542 |
420 | // inside the raw data payload. |
421 | // The method is supposed to be endian (platform) |
422 | // independent. |
423 | if (!fData || fPosition < 0) AliFatal("Raw data payload buffer is not yet initialized !"); |
21f61e25 |
424 | |
d2e2f542 |
425 | UInt_t word = 0; |
fd8bfa30 |
426 | |
427 | if(dir==kBwd) n = -n; |
428 | fPosition+=4*n-4; |
429 | |
430 | StorePosition(); |
431 | |
d2e2f542 |
432 | word |= fData[fPosition++]; |
433 | word |= fData[fPosition++] << 8; |
434 | word |= fData[fPosition++] << 16; |
435 | word |= fData[fPosition++] << 24; |
fd8bfa30 |
436 | |
d2e2f542 |
437 | return word; |
438 | } |
fd8bfa30 |
439 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
440 | void AliHMPIDRawStream::DumpData(Int_t nw) |
441 | { |
442 | for(Int_t i=0;i<nw;i+=4) { |
443 | if(!(i%16)) printf(" \n %8i) ",i); |
444 | printf("%02X%02X%02X%02X [ %06i ] ",fData[i+3],fData[i+2],fData[i+1],fData[i+0],fPos[i]); |
445 | } |
446 | Printf(" \n -----end of dump ----------- "); |
447 | } |
448 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
449 | void AliHMPIDRawStream::StorePosition() |
450 | { |
56c73976 |
451 | if(fPos[fPosition]!=0) { |
452 | // Printf("Position already stored!!! Value %i at address %i",fPos[fPosition],fPosition); |
453 | return; |
454 | } |
fd8bfa30 |
455 | iPos++; |
456 | fPos[fPosition] = iPos; |
457 | // if(stDeb)Printf("%i - Actual position %i",iPos,fPosition); |
458 | } |
e96561a3 |
459 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |