]>
Commit | Line | Data |
---|---|---|
a09a2da4 | 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 | /* $Id$ */ | |
17 | ||
18 | /////////////////////////////////////////////////////////////////////////////// | |
19 | /// | |
20 | /// This class provides access to PMD digits in raw data. | |
21 | /// | |
22 | /// It loops over all PMD digits in the raw data given by the AliRawReader. | |
23 | /// The Next method goes to the next digit. If there are no digits left | |
24 | /// it returns kFALSE. | |
25 | /// Several getters provide information about the current digit. | |
26 | /// | |
27 | /////////////////////////////////////////////////////////////////////////////// | |
28 | ||
34ab69dd | 29 | #include <Riostream.h> |
30 | #include <TObjArray.h> | |
31 | #include <TString.h> | |
32 | #include <TSystem.h> | |
33 | ||
ecee2a1a | 34 | #include "AliLog.h" |
34ab69dd | 35 | #include "AliPMDBlockHeader.h" |
36 | #include "AliPMDDspHeader.h" | |
37 | #include "AliPMDPatchBusHeader.h" | |
38 | #include "AliPMDddldata.h" | |
a09a2da4 | 39 | #include "AliPMDRawStream.h" |
40 | #include "AliRawReader.h" | |
41 | ||
42 | ClassImp(AliPMDRawStream) | |
43 | ||
44 | ||
45 | //_____________________________________________________________________________ | |
46 | AliPMDRawStream::AliPMDRawStream(AliRawReader* rawReader) : | |
722ccc67 | 47 | fRawReader(rawReader), |
48 | fData(NULL), | |
49 | fPosition(-1) | |
a09a2da4 | 50 | { |
51 | // create an object to read PMD raw digits | |
52 | ||
722ccc67 | 53 | fRawReader->Reset(); |
362c9d61 | 54 | fRawReader->Select("PMD"); |
a09a2da4 | 55 | } |
56 | ||
57 | //_____________________________________________________________________________ | |
58 | AliPMDRawStream::AliPMDRawStream(const AliPMDRawStream& stream) : | |
59 | TObject(stream), | |
722ccc67 | 60 | fRawReader(NULL), |
61 | fData(NULL), | |
62 | fPosition(-1) | |
a09a2da4 | 63 | { |
64 | // copy constructor | |
65 | ||
ecee2a1a | 66 | AliFatal("Copy constructor not implemented"); |
a09a2da4 | 67 | } |
68 | ||
69 | //_____________________________________________________________________________ | |
70 | AliPMDRawStream& AliPMDRawStream::operator = (const AliPMDRawStream& | |
71 | /* stream */) | |
72 | { | |
73 | // assignment operator | |
74 | ||
ecee2a1a | 75 | AliFatal("operator = assignment operator not implemented"); |
a09a2da4 | 76 | return *this; |
77 | } | |
78 | ||
79 | //_____________________________________________________________________________ | |
80 | AliPMDRawStream::~AliPMDRawStream() | |
81 | { | |
82 | // destructor | |
83 | ||
84 | } | |
85 | ||
86 | ||
87 | //_____________________________________________________________________________ | |
34ab69dd | 88 | |
722ccc67 | 89 | Int_t AliPMDRawStream::DdlData(TObjArray *pmdddlcont) |
a09a2da4 | 90 | { |
91 | // read the next raw digit | |
92 | // returns kFALSE if there is no digit left | |
93 | ||
722ccc67 | 94 | |
95 | ||
96 | Int_t iddl = -1; | |
40f4a63f | 97 | |
34ab69dd | 98 | AliPMDddldata *pmdddldata; |
99 | ||
722ccc67 | 100 | if (!fRawReader->ReadHeader()) return iddl; |
101 | ||
102 | iddl = fRawReader->GetDDLID(); | |
34ab69dd | 103 | Int_t dataSize = fRawReader->GetDataSize(); |
104 | Int_t totaldataword = dataSize/4; | |
9ac124a2 | 105 | |
722ccc67 | 106 | if (dataSize <= 0) return -1; |
a09a2da4 | 107 | |
108 | UInt_t data; | |
722ccc67 | 109 | |
110 | fRawReader->ReadNextData(fData); | |
111 | ||
112 | fPosition = 0; | |
a09a2da4 | 113 | |
a09a2da4 | 114 | |
89f0ae35 | 115 | Int_t ibus; |
34ab69dd | 116 | |
40f4a63f | 117 | const Int_t kNPatchBus = 51; |
89f0ae35 | 118 | |
34ab69dd | 119 | Int_t moduleNo[kNPatchBus], mcmperBus[kNPatchBus]; |
120 | Int_t startRowBus[kNPatchBus], endRowBus[kNPatchBus]; | |
121 | Int_t startColBus[kNPatchBus], endColBus[kNPatchBus]; | |
122 | ||
78fc1b96 | 123 | for (ibus = 0; ibus < kNPatchBus; ibus++) |
34ab69dd | 124 | { |
89f0ae35 | 125 | moduleNo[ibus] = -1; |
34ab69dd | 126 | mcmperBus[ibus] = -1; |
127 | startRowBus[ibus] = -1; | |
128 | endRowBus[ibus] = -1; | |
129 | startColBus[ibus] = -1; | |
130 | endColBus[ibus] = -1; | |
131 | } | |
132 | ||
89f0ae35 | 133 | // Call the Mapping methods - hard coded |
134 | ||
135 | ||
136 | if (iddl == 0) | |
137 | { | |
138 | Ddl0Mapping(moduleNo, mcmperBus, startRowBus, | |
139 | endRowBus, startColBus, endColBus); | |
140 | } | |
141 | else if (iddl == 1) | |
142 | { | |
143 | Ddl1Mapping(moduleNo, mcmperBus, startRowBus, | |
144 | endRowBus, startColBus, endColBus); | |
145 | } | |
146 | else if (iddl == 2) | |
147 | { | |
148 | Ddl2Mapping(moduleNo, mcmperBus, startRowBus, | |
149 | endRowBus, startColBus, endColBus); | |
150 | } | |
151 | else if (iddl == 3) | |
152 | { | |
153 | Ddl3Mapping(moduleNo, mcmperBus, startRowBus, | |
154 | endRowBus, startColBus, endColBus); | |
155 | } | |
156 | else if (iddl == 4) | |
157 | { | |
158 | Ddl4Mapping(moduleNo, mcmperBus, startRowBus, | |
159 | endRowBus, startColBus, endColBus); | |
160 | } | |
161 | else if (iddl == 5) | |
162 | { | |
163 | Ddl5Mapping(moduleNo, mcmperBus, startRowBus, | |
164 | endRowBus, startColBus, endColBus); | |
165 | } | |
34ab69dd | 166 | |
34ab69dd | 167 | |
34ab69dd | 168 | AliPMDBlockHeader blockHeader; |
169 | AliPMDDspHeader dspHeader; | |
170 | AliPMDPatchBusHeader pbusHeader; | |
171 | ||
0a666212 | 172 | const Int_t kblHLen = blockHeader.GetHeaderLength(); |
173 | const Int_t kdspHLen = dspHeader.GetHeaderLength(); | |
174 | const Int_t kpbusHLen = pbusHeader.GetHeaderLength(); | |
175 | ||
a98f9d26 | 176 | Int_t parity; |
34ab69dd | 177 | Int_t idet, ismn; |
178 | Int_t irow = -1; | |
179 | Int_t icol = -1; | |
180 | ||
0a666212 | 181 | Int_t blHeaderWord[8]; |
182 | Int_t dspHeaderWord[10]; | |
183 | Int_t pbusHeaderWord[4]; | |
34ab69dd | 184 | |
722ccc67 | 185 | Int_t ilowLimit = 0; |
186 | Int_t iuppLimit = 0; | |
187 | Int_t blRawDataLength = 0; | |
188 | Int_t dspRawDataLength = 0; | |
189 | Int_t iwordddl = 2; | |
9ac124a2 | 190 | |
34ab69dd | 191 | for (Int_t iblock = 0; iblock < 2; iblock++) |
192 | { | |
193 | ilowLimit = iuppLimit; | |
0a666212 | 194 | iuppLimit = ilowLimit + kblHLen; |
34ab69dd | 195 | |
196 | for (Int_t i = ilowLimit; i < iuppLimit; i++) | |
197 | { | |
722ccc67 | 198 | iwordddl++; |
199 | ||
200 | blHeaderWord[i-ilowLimit] = (Int_t) GetNextWord(); | |
34ab69dd | 201 | } |
9ac124a2 | 202 | |
0a666212 | 203 | blockHeader.SetHeader(blHeaderWord); |
9ac124a2 | 204 | blRawDataLength = blockHeader.GetRawDataLength(); |
205 | ||
722ccc67 | 206 | if (iwordddl == totaldataword) continue; |
207 | ||
208 | Int_t iwordblk = 0; | |
209 | ||
34ab69dd | 210 | for (Int_t idsp = 0; idsp < 5; idsp++) |
211 | { | |
722ccc67 | 212 | |
213 | ||
34ab69dd | 214 | ilowLimit = iuppLimit; |
0a666212 | 215 | iuppLimit = ilowLimit + kdspHLen; |
34ab69dd | 216 | |
217 | for (Int_t i = ilowLimit; i < iuppLimit; i++) | |
218 | { | |
722ccc67 | 219 | iwordddl++; |
220 | iwordblk++; | |
221 | dspHeaderWord[i-ilowLimit] = (Int_t) GetNextWord(); | |
34ab69dd | 222 | } |
0a666212 | 223 | dspHeader.SetHeader(dspHeaderWord); |
722ccc67 | 224 | dspRawDataLength = dspHeader.GetRawDataLength(); |
225 | ||
226 | if (iwordddl == totaldataword) continue; | |
227 | ||
228 | Int_t iworddsp = 0; | |
34ab69dd | 229 | |
78fc1b96 | 230 | for (ibus = 0; ibus < 5; ibus++) |
34ab69dd | 231 | { |
34ab69dd | 232 | ilowLimit = iuppLimit; |
0a666212 | 233 | iuppLimit = ilowLimit + kpbusHLen; |
34ab69dd | 234 | |
235 | for (Int_t i = ilowLimit; i < iuppLimit; i++) | |
236 | { | |
722ccc67 | 237 | iwordddl++; |
238 | iwordblk++; | |
239 | iworddsp++; | |
240 | pbusHeaderWord[i-ilowLimit] = (Int_t) GetNextWord(); | |
34ab69dd | 241 | } |
722ccc67 | 242 | |
0a666212 | 243 | pbusHeader.SetHeader(pbusHeaderWord); |
34ab69dd | 244 | Int_t rawdatalength = pbusHeader.GetRawDataLength(); |
245 | Int_t pbusid = pbusHeader.GetPatchBusId(); | |
246 | ||
247 | ilowLimit = iuppLimit; | |
248 | iuppLimit = ilowLimit + rawdatalength; | |
249 | ||
250 | Int_t imodule = moduleNo[pbusid]; | |
251 | ||
722ccc67 | 252 | if (iwordddl == totaldataword) continue; |
34ab69dd | 253 | |
254 | for (Int_t iword = ilowLimit; iword < iuppLimit; iword++) | |
255 | { | |
722ccc67 | 256 | iwordddl++; |
257 | iwordblk++; | |
258 | iworddsp++; | |
259 | data = 0; | |
260 | data = GetNextWord(); | |
34ab69dd | 261 | |
262 | Int_t isig = data & 0x0FFF; | |
263 | Int_t ich = (data >> 12) & 0x003F; | |
264 | Int_t imcm = (data >> 18) & 0x07FF; | |
265 | Int_t ibit = (data >> 31) & 0x0001; | |
a98f9d26 | 266 | parity = ComputeParity(data); |
267 | if (ibit != parity) | |
268 | { | |
269 | AliWarning("ComputeParity:: Parity Error"); | |
608c1f27 | 270 | fRawReader->AddMajorErrorLog(kParityError); |
a98f9d26 | 271 | } |
40f4a63f | 272 | |
273 | ConvertDDL2SMN(iddl, imodule, ismn, idet); | |
274 | ||
275 | GetRowCol(iddl, ismn, pbusid, imcm, ich, | |
34ab69dd | 276 | startRowBus, endRowBus, |
277 | startColBus, endColBus, | |
278 | irow, icol); | |
279 | ||
34ab69dd | 280 | TransformH2S(ismn, irow, icol); |
281 | ||
282 | pmdddldata = new AliPMDddldata(); | |
283 | ||
284 | pmdddldata->SetDetector(idet); | |
285 | pmdddldata->SetSMN(ismn); | |
286 | pmdddldata->SetModule(imodule); | |
287 | pmdddldata->SetPatchBusId(pbusid); | |
288 | pmdddldata->SetMCM(imcm); | |
289 | pmdddldata->SetChannel(ich); | |
290 | pmdddldata->SetRow(irow); | |
291 | pmdddldata->SetColumn(icol); | |
292 | pmdddldata->SetSignal(isig); | |
293 | pmdddldata->SetParityBit(ibit); | |
294 | ||
295 | pmdddlcont->Add(pmdddldata); | |
296 | ||
0a666212 | 297 | } // data word loop |
9ac124a2 | 298 | |
722ccc67 | 299 | if (iwordddl == totaldataword) break; |
300 | ||
301 | if (iworddsp == dspRawDataLength) break; // raw data | |
9ac124a2 | 302 | |
0a666212 | 303 | } // patch bus loop |
34ab69dd | 304 | |
722ccc67 | 305 | if (dspHeader.GetPaddingWord() == 1) |
306 | { | |
307 | iuppLimit++; | |
308 | iwordddl++; | |
309 | iwordblk++; | |
310 | iworddsp++; | |
311 | data = GetNextWord(); | |
312 | } | |
313 | ||
314 | if (iwordblk == blRawDataLength) break; // for raw data | |
34ab69dd | 315 | |
0a666212 | 316 | } // end of DSP |
34ab69dd | 317 | |
318 | } // end of BLOCK | |
34ab69dd | 319 | |
722ccc67 | 320 | return iddl; |
a09a2da4 | 321 | } |
a09a2da4 | 322 | //_____________________________________________________________________________ |
40f4a63f | 323 | void AliPMDRawStream::GetRowCol(Int_t ddlno, Int_t smn, Int_t pbusid, |
34ab69dd | 324 | UInt_t mcmno, UInt_t chno, |
325 | Int_t startRowBus[], Int_t endRowBus[], | |
326 | Int_t startColBus[], Int_t endColBus[], | |
327 | Int_t &row, Int_t &col) const | |
a09a2da4 | 328 | { |
34ab69dd | 329 | // decode: ddlno, patchbusid, mcmno, chno -> um, row, col |
a09a2da4 | 330 | |
40f4a63f | 331 | UInt_t iCh[64]; |
a09a2da4 | 332 | |
40f4a63f | 333 | static const UInt_t kChDdl01[64] = { 9, 6, 5, 10, 1, 2, 0, 3, |
334 | 13, 7, 4, 11, 8, 14, 12, 15, | |
335 | 16, 19, 17, 23, 20, 27, 24, 18, | |
336 | 28, 31, 29, 30, 21, 26, 25, 22, | |
337 | 41, 38, 37, 42, 33, 34, 32, 35, | |
338 | 45, 39, 36, 43, 40, 46, 44, 47, | |
339 | 48, 51, 49, 55, 52, 59, 56, 50, | |
340 | 60, 63, 61, 62, 53, 58, 57, 54 }; | |
341 | ||
342 | static const UInt_t kChDdl23[64] = { 54, 57, 58, 53, 62, 61, 63, 60, | |
343 | 50, 56, 59, 52, 55, 49, 51, 48, | |
344 | 47, 44, 46, 40, 43, 36, 39, 45, | |
345 | 35, 32, 34, 33, 42, 37, 38, 41, | |
346 | 22, 25, 26, 21, 30, 29, 31, 28, | |
347 | 18, 24, 27, 20, 23, 17, 19, 16, | |
348 | 15, 12, 14, 8, 11, 4, 7, 13, | |
349 | 3, 0, 2, 1, 10, 5, 6, 9 }; | |
350 | ||
351 | static const UInt_t kChDdl41[64] = { 53, 58, 57, 54, 61, 62, 60, 63, | |
352 | 49, 59, 56, 55, 52, 50, 48, 51, | |
353 | 44, 47, 45, 43, 40, 39, 36, 46, | |
354 | 32, 35, 33, 34, 41, 38, 37, 42, | |
355 | 21, 26, 25, 22, 29, 30, 28, 31, | |
356 | 17, 27, 24, 23, 20, 18, 16, 19, | |
357 | 12, 15, 13, 11, 8, 7, 4, 14, | |
358 | 0, 3, 1, 2, 9, 6, 5, 10 }; | |
359 | ||
360 | static const UInt_t kChDdl42[64] = { 10, 5, 6, 9, 2, 1, 3, 0, | |
361 | 14, 4, 7, 8, 11, 13, 15, 12, | |
362 | 19, 16, 18, 20, 23, 24, 27, 17, | |
363 | 31, 28, 30, 29, 22, 25, 26, 21, | |
364 | 42, 37, 38, 41, 34, 33, 35, 32, | |
365 | 46, 36, 39, 40, 43, 45, 47, 44, | |
366 | 51, 48, 50, 52, 55, 56, 59, 49, | |
367 | 63, 60, 62, 61, 54, 57, 58, 53 }; | |
368 | ||
369 | static const UInt_t kChDdl51[64] = { 10, 5, 6, 9, 2, 1, 3, 0, | |
370 | 14, 4, 7, 8, 11, 13, 15, 12, | |
371 | 19, 16, 18, 20, 23, 24, 27, 17, | |
372 | 31, 28, 30, 29, 22, 25, 26, 21, | |
373 | 42, 37, 38, 41, 34, 33, 35, 32, | |
374 | 46, 36, 39, 40, 43, 45, 47, 44, | |
375 | 51, 48, 50, 52, 55, 56, 59, 49, | |
376 | 63, 60, 62, 61, 54, 57, 58, 53 }; | |
377 | ||
378 | static const UInt_t kChDdl52[64] = { 53, 58, 57, 54, 61, 62, 60, 63, | |
379 | 49, 59, 56, 55, 52, 50, 48, 51, | |
380 | 44, 47, 45, 43, 40, 39, 36, 46, | |
381 | 32, 35, 33, 34, 41, 38, 37, 42, | |
382 | 21, 26, 25, 22, 29, 30, 28, 31, | |
383 | 17, 27, 24, 23, 20, 18, 16, 19, | |
384 | 12, 15, 13, 11, 8, 7, 4, 14, | |
385 | 0, 3, 1, 2, 9, 6, 5, 10 }; | |
386 | ||
387 | for (Int_t i = 0; i < 64; i++) | |
388 | { | |
389 | if (ddlno == 0 || ddlno == 1) iCh[i] = kChDdl01[i]; | |
390 | if (ddlno == 2 || ddlno == 3) iCh[i] = kChDdl23[i]; | |
391 | ||
392 | if (ddlno == 4 && smn < 6) iCh[i] = kChDdl41[i]; | |
393 | if (ddlno == 4 && (smn >= 18 && smn < 24))iCh[i] = kChDdl42[i]; | |
394 | if (ddlno == 5 && (smn >= 12 && smn < 18))iCh[i] = kChDdl51[i]; | |
395 | if (ddlno == 5 && (smn >= 6 && smn < 12))iCh[i] = kChDdl52[i]; | |
396 | } | |
397 | ||
398 | ||
399 | Int_t rowcol = iCh[chno]; | |
34ab69dd | 400 | Int_t irownew = rowcol/4; |
401 | Int_t icolnew = rowcol%4; | |
a09a2da4 | 402 | |
a0a6a406 | 403 | if (ddlno == 0 ) |
a09a2da4 | 404 | { |
a0a6a406 | 405 | row = startRowBus[pbusid] + irownew; |
40f4a63f | 406 | col = startColBus[pbusid] + (mcmno-1)*4 + icolnew; |
a09a2da4 | 407 | } |
34ab69dd | 408 | else if (ddlno == 1) |
a09a2da4 | 409 | { |
a0a6a406 | 410 | row = endRowBus[pbusid] - (15 - irownew); |
40f4a63f | 411 | col = startColBus[pbusid] + (mcmno-1)*4 + icolnew; |
a0a6a406 | 412 | |
a09a2da4 | 413 | } |
a0a6a406 | 414 | else if (ddlno == 2 ) |
e54787da | 415 | { |
34ab69dd | 416 | row = startRowBus[pbusid] + irownew; |
40f4a63f | 417 | col = endColBus[pbusid] - (mcmno-1)*4 - (3 - icolnew); |
34ab69dd | 418 | } |
419 | else if (ddlno == 3) | |
420 | { | |
a0a6a406 | 421 | row = endRowBus[pbusid] - (15 - irownew); |
40f4a63f | 422 | col = endColBus[pbusid] - (mcmno-1)*4 - (3 - icolnew); |
e54787da | 423 | } |
a0a6a406 | 424 | else if (ddlno == 4 ) |
e54787da | 425 | { |
40f4a63f | 426 | if (pbusid < 19) |
e54787da | 427 | { |
40f4a63f | 428 | if (mcmno <= 12) |
34ab69dd | 429 | { |
430 | // Add 16 to skip the 1st 15 rows | |
431 | row = startRowBus[pbusid] + irownew + 16; | |
40f4a63f | 432 | col = startColBus[pbusid] + (mcmno-1)*4 + icolnew; |
34ab69dd | 433 | } |
40f4a63f | 434 | else if(mcmno > 12) |
93622f4a | 435 | { |
436 | row = startRowBus[pbusid] + irownew; | |
40f4a63f | 437 | col = startColBus[pbusid] + (mcmno-12-1)*4 + icolnew; |
93622f4a | 438 | } |
e54787da | 439 | } |
40f4a63f | 440 | else if(pbusid > 18) |
e54787da | 441 | { |
40f4a63f | 442 | if (mcmno <= 12) |
a0a6a406 | 443 | { |
40f4a63f | 444 | col = endColBus[pbusid] - (mcmno-1)*4 - (3 - icolnew); |
93622f4a | 445 | |
a0a6a406 | 446 | if(endRowBus[pbusid] - startRowBus[pbusid] > 16) |
447 | row = endRowBus[pbusid] - (15 - irownew) - 16 ; | |
448 | else | |
449 | row = endRowBus[pbusid] - (15 - irownew) ; | |
93622f4a | 450 | } |
40f4a63f | 451 | else if(mcmno > 12) |
93622f4a | 452 | { |
453 | row = endRowBus[pbusid] - (15 - irownew) ; | |
40f4a63f | 454 | col = endColBus[pbusid] - (mcmno - 12 - 1)*4 - (3 - icolnew); |
a0a6a406 | 455 | } |
e54787da | 456 | } |
e54787da | 457 | } |
34ab69dd | 458 | else if (ddlno == 5) |
e54787da | 459 | { |
40f4a63f | 460 | if (pbusid <= 18) |
34ab69dd | 461 | { |
40f4a63f | 462 | if (mcmno > 12) |
34ab69dd | 463 | { |
a0a6a406 | 464 | // Subtract 16 to skip the 1st 15 rows |
465 | row = endRowBus[pbusid] - 16 -(15 - irownew); | |
40f4a63f | 466 | col = startColBus[pbusid] + (mcmno-12 -1)*4 + icolnew; |
34ab69dd | 467 | } |
468 | else | |
469 | { | |
a0a6a406 | 470 | row = endRowBus[pbusid] - (15 - irownew) ; |
40f4a63f | 471 | col = startColBus[pbusid] + (mcmno -1)*4 + icolnew; |
34ab69dd | 472 | } |
40f4a63f | 473 | |
34ab69dd | 474 | } |
a0a6a406 | 475 | |
40f4a63f | 476 | else if (pbusid > 18) |
e54787da | 477 | { |
40f4a63f | 478 | if(mcmno > 12) |
a0a6a406 | 479 | { |
480 | // Add 16 to skip the 1st 15 rows | |
481 | row = startRowBus[pbusid] + irownew + 16; | |
40f4a63f | 482 | col = endColBus[pbusid] - (mcmno - 12 - 1)*4 - (3 - icolnew); |
a0a6a406 | 483 | } |
484 | else | |
485 | { | |
486 | row = startRowBus[pbusid] + irownew ; | |
40f4a63f | 487 | col = endColBus[pbusid] - (mcmno - 1)*4 - (3 - icolnew); |
a0a6a406 | 488 | } |
e54787da | 489 | } |
34ab69dd | 490 | } |
a0a6a406 | 491 | |
34ab69dd | 492 | } |
493 | //_____________________________________________________________________________ | |
494 | void AliPMDRawStream::ConvertDDL2SMN(Int_t iddl, Int_t imodule, | |
495 | Int_t &smn, Int_t &detector) const | |
496 | { | |
497 | // This converts the DDL number (0 to 5), Module Number (0-47) | |
498 | // to Serial module number in one detector (SMN : 0-23) and | |
499 | // detector number (0:PRE plane, 1:CPV plane) | |
500 | if (iddl < 4) | |
501 | { | |
502 | smn = imodule; | |
503 | detector = 0; | |
504 | } | |
505 | else | |
506 | { | |
507 | smn = imodule - 24; | |
e54787da | 508 | detector = 1; |
509 | } | |
510 | } | |
511 | //_____________________________________________________________________________ | |
40f4a63f | 512 | |
e54787da | 513 | void AliPMDRawStream::TransformH2S(Int_t smn, Int_t &row, Int_t &col) const |
514 | { | |
34ab69dd | 515 | // This does the transformation of the hardware coordinate to |
516 | // software | |
517 | // i.e., For SuperModule 0 &1, instead of 96x48(hardware), | |
518 | // it is 48x96 (software) | |
e54787da | 519 | // For Supermodule 3 & 4, 48x96 |
520 | ||
e54787da | 521 | Int_t irownew = 0; |
522 | Int_t icolnew = 0; | |
34ab69dd | 523 | |
e54787da | 524 | if(smn < 12) |
525 | { | |
34ab69dd | 526 | irownew = col; |
527 | icolnew = row; | |
e54787da | 528 | } |
34ab69dd | 529 | else if(smn >= 12 && smn < 24) |
e54787da | 530 | { |
34ab69dd | 531 | irownew = row; |
532 | icolnew = col; | |
e54787da | 533 | } |
534 | ||
535 | row = irownew; | |
536 | col = icolnew; | |
537 | } | |
a98f9d26 | 538 | //_____________________________________________________________________________ |
722ccc67 | 539 | Int_t AliPMDRawStream::ComputeParity(UInt_t data) |
a98f9d26 | 540 | { |
541 | // Calculate the parity bit | |
542 | ||
543 | Int_t count = 0; | |
544 | for(Int_t j = 0; j<29; j++) | |
545 | { | |
546 | if (data & 0x01 ) count++; | |
547 | data >>= 1; | |
548 | } | |
549 | ||
550 | Int_t parity = count%2; | |
551 | ||
552 | return parity; | |
553 | } | |
554 | ||
e54787da | 555 | //_____________________________________________________________________________ |
722ccc67 | 556 | UInt_t AliPMDRawStream::GetNextWord() |
557 | { | |
558 | // Returns the next 32 bit word | |
559 | // inside the raw data payload. | |
560 | ||
561 | if (!fData || fPosition < 0) AliFatal("Raw data payload buffer is not yet initialized !"); | |
562 | ||
563 | UInt_t word = 0; | |
564 | word |= fData[fPosition++]; | |
565 | word |= fData[fPosition++] << 8; | |
566 | word |= fData[fPosition++] << 16; | |
567 | word |= fData[fPosition++] << 24; | |
568 | ||
569 | return word; | |
570 | } | |
571 | ||
89f0ae35 | 572 | //_____________________________________________________________________________ |
573 | void AliPMDRawStream::Ddl0Mapping(Int_t moduleNo[], Int_t mcmperBus[], | |
574 | Int_t startRowBus[], Int_t endRowBus[], | |
575 | Int_t startColBus[], Int_t endColBus[]) | |
576 | { | |
577 | // DDL0 Mapping | |
578 | ||
579 | const Int_t ktotpbus = 36; | |
580 | static const Int_t modno0[ktotpbus] = {0, 0, 0, 0, 0, 0, | |
581 | 1, 1, 1, 1, 1, 1, | |
582 | 2, 2, 2, 2, 2, 2, | |
583 | 3, 3, 3, 3, 3, 3, | |
584 | 4, 4, 4, 4, 4, 4, | |
585 | 5, 5, 5, 5, 5, 5,}; | |
586 | ||
587 | ||
588 | ||
589 | static const Int_t srbus0[ktotpbus] = {0, 16, 32, 48, 64, 80, | |
590 | 0, 16, 32, 48, 64, 80, | |
591 | 0, 16, 32, 48, 64, 80, | |
592 | 0, 16, 32, 48, 64, 80, | |
593 | 0, 16, 32, 48, 64, 80, | |
594 | 0, 16, 32, 48, 64, 80}; | |
595 | ||
596 | ||
597 | ||
598 | static const Int_t erbus0[ktotpbus] = {15, 31, 47, 63, 79, 95, | |
599 | 15, 31, 47, 63, 79, 95, | |
600 | 15, 31, 47, 63, 79, 95, | |
601 | 15, 31, 47, 63, 79, 95, | |
602 | 15, 31, 47, 63, 79, 95, | |
603 | 15, 31, 47, 63, 79, 95}; | |
604 | ||
605 | ||
606 | for (Int_t ibus = 1; ibus <= ktotpbus; ibus++) | |
607 | { | |
608 | moduleNo[ibus] = modno0[ibus-1]; | |
609 | mcmperBus[ibus] = 12; | |
610 | startRowBus[ibus] = srbus0[ibus-1]; | |
611 | endRowBus[ibus] = erbus0[ibus-1]; | |
612 | startColBus[ibus] = 0; | |
613 | endColBus[ibus] = 47; | |
614 | } | |
615 | ||
616 | } | |
617 | ||
618 | //_____________________________________________________________________________ | |
619 | void AliPMDRawStream::Ddl1Mapping(Int_t moduleNo[], Int_t mcmperBus[], | |
620 | Int_t startRowBus[], Int_t endRowBus[], | |
621 | Int_t startColBus[], Int_t endColBus[]) | |
622 | { | |
623 | // DDL1 Mapping | |
624 | ||
625 | const Int_t ktotpbus = 36; | |
626 | static const Int_t kmodno1[ktotpbus] = {6, 6, 6, 6, 6, 6, | |
627 | 7, 7, 7, 7, 7, 7, | |
628 | 8, 8, 8, 8, 8, 8, | |
629 | 9, 9, 9, 9, 9, 9, | |
630 | 10, 10, 10, 10, 10, 10, | |
631 | 11, 11, 11, 11, 11, 11}; | |
632 | ||
633 | ||
634 | static const Int_t ksrbus1[ktotpbus] = {0, 16, 32, 48, 64, 80, | |
635 | 0, 16, 32, 48, 64, 80, | |
636 | 0, 16, 32, 48, 64, 80, | |
637 | 0, 16, 32, 48, 64, 80, | |
638 | 0, 16, 32, 48, 64, 80, | |
639 | 0, 16, 32, 48, 64, 80}; | |
640 | ||
641 | ||
642 | ||
643 | static const Int_t kerbus1[ktotpbus] = {15, 31, 47, 63, 79, 95, | |
644 | 15, 31, 47, 63, 79, 95, | |
645 | 15, 31, 47, 63, 79, 95, | |
646 | 15, 31, 47, 63, 79, 95, | |
647 | 15, 31, 47, 63, 79, 95, | |
648 | 15, 31, 47, 63, 79, 95}; | |
649 | ||
650 | ||
651 | for (Int_t ibus = 1; ibus <= ktotpbus; ibus++) | |
652 | { | |
653 | moduleNo[ibus] = kmodno1[ibus-1]; | |
654 | mcmperBus[ibus] = 12; | |
655 | startRowBus[ibus] = ksrbus1[ibus-1]; | |
656 | endRowBus[ibus] = kerbus1[ibus-1]; | |
657 | startColBus[ibus] = 0; | |
658 | endColBus[ibus] = 47; | |
659 | } | |
660 | ||
661 | } | |
662 | ||
663 | //_____________________________________________________________________________ | |
664 | void AliPMDRawStream::Ddl2Mapping(Int_t moduleNo[], Int_t mcmperBus[], | |
665 | Int_t startRowBus[], Int_t endRowBus[], | |
666 | Int_t startColBus[], Int_t endColBus[]) | |
667 | { | |
668 | // DDL2 Mapping | |
669 | ||
670 | const Int_t ktotpbus = 36; | |
671 | static const Int_t kmodno2[ktotpbus] = {12, 12, 12, 12, 12, 12, | |
672 | 13, 13, 13, 13, 13, 13, | |
673 | 14, 14, 14, 14, 14, 14, | |
674 | 15, 15, 15, 15, 15, 15, | |
675 | 16, 16, 16, 16, 16, 16, | |
676 | 17, 17, 17, 17, 17, 17}; | |
677 | ||
678 | static const Int_t ksrbus2[ktotpbus] = {32, 32, 16, 16, 0, 0, | |
679 | 32, 32, 16, 16, 0, 0, | |
680 | 32, 32, 16, 16, 0, 0, | |
681 | 32, 32, 16, 16, 0, 0, | |
682 | 32, 32, 16, 16, 0, 0, | |
683 | 32, 32, 16, 16, 0, 0}; | |
684 | ||
685 | ||
686 | static const Int_t kerbus2[ktotpbus] = {47, 47, 31, 31, 15, 15, | |
687 | 47, 47, 31, 31, 15, 15, | |
688 | 47, 47, 31, 31, 15, 15, | |
689 | 47, 47, 31, 31, 15, 15, | |
690 | 47, 47, 31, 31, 15, 15, | |
691 | 47, 47, 31, 31, 15, 15}; | |
692 | ||
693 | static const Int_t kscbus2[ktotpbus] = {48, 0, 48, 0, 48, 0, | |
694 | 48, 0, 48, 0, 48, 0, | |
695 | 48, 0, 48, 0, 48, 0, | |
696 | 48, 0, 48, 0, 48, 0, | |
697 | 48, 0, 48, 0, 48, 0, | |
698 | 48, 0, 48, 0, 48, 0}; | |
699 | ||
700 | static const Int_t kecbus2[ktotpbus] = {95, 47, 95, 47, 95, 47, | |
701 | 95, 47, 95, 47, 95, 47, | |
702 | 95, 47, 95, 47, 95, 47, | |
703 | 95, 47, 95, 47, 95, 47, | |
704 | 95, 47, 95, 47, 95, 47, | |
705 | 95, 47, 95, 47, 95, 47}; | |
706 | ||
707 | ||
708 | ||
709 | for (Int_t ibus = 1; ibus <= ktotpbus; ibus++) | |
710 | { | |
711 | moduleNo[ibus] = kmodno2[ibus-1]; | |
712 | mcmperBus[ibus] = 12; | |
713 | startRowBus[ibus] = ksrbus2[ibus-1]; | |
714 | endRowBus[ibus] = kerbus2[ibus-1]; | |
715 | startColBus[ibus] = kscbus2[ibus-1]; | |
716 | endColBus[ibus] = kecbus2[ibus-1]; | |
717 | } | |
718 | ||
719 | } | |
720 | ||
721 | //_____________________________________________________________________________ | |
722 | void AliPMDRawStream::Ddl3Mapping(Int_t moduleNo[], Int_t mcmperBus[], | |
723 | Int_t startRowBus[], Int_t endRowBus[], | |
724 | Int_t startColBus[], Int_t endColBus[]) | |
725 | { | |
726 | // DDL3 Mapping | |
727 | ||
728 | const Int_t ktotpbus = 36; | |
729 | static const Int_t kmodno3[ktotpbus] = {18, 18, 18, 18, 18, 18, | |
730 | 19, 19, 19, 19, 19, 19, | |
731 | 20, 20, 20, 20, 20, 20, | |
732 | 21, 21, 21, 21, 21, 21, | |
733 | 22, 22, 22, 22, 22, 22, | |
734 | 23, 23, 23, 23, 23, 23}; | |
735 | ||
736 | ||
737 | ||
738 | static const Int_t ksrbus3[ktotpbus] = {32, 32, 16, 16, 0, 0, | |
739 | 32, 32, 16, 16, 0, 0, | |
740 | 32, 32, 16, 16, 0, 0, | |
741 | 32, 32, 16, 16, 0, 0, | |
742 | 32, 32, 16, 16, 0, 0, | |
743 | 32, 32, 16, 16, 0, 0}; | |
744 | ||
745 | ||
746 | static const Int_t kerbus3[ktotpbus] = {47, 47, 31, 31, 15, 15, | |
747 | 47, 47, 31, 31, 15, 15, | |
748 | 47, 47, 31, 31, 15, 15, | |
749 | 47, 47, 31, 31, 15, 15, | |
750 | 47, 47, 31, 31, 15, 15, | |
751 | 47, 47, 31, 31, 15, 15}; | |
752 | ||
753 | static const Int_t kscbus3[ktotpbus] = {48, 0, 48, 0, 48, 0, | |
754 | 48, 0, 48, 0, 48, 0, | |
755 | 48, 0, 48, 0, 48, 0, | |
756 | 48, 0, 48, 0, 48, 0, | |
757 | 48, 0, 48, 0, 48, 0, | |
758 | 48, 0, 48, 0, 48, 0}; | |
759 | ||
760 | static const Int_t kecbus3[ktotpbus] = {95, 47, 95, 47, 95, 47, | |
761 | 95, 47, 95, 47, 95, 47, | |
762 | 95, 47, 95, 47, 95, 47, | |
763 | 95, 47, 95, 47, 95, 47, | |
764 | 95, 47, 95, 47, 95, 47, | |
765 | 95, 47, 95, 47, 95, 47}; | |
766 | ||
767 | for (Int_t ibus = 1; ibus <= ktotpbus; ibus++) | |
768 | { | |
769 | moduleNo[ibus] = kmodno3[ibus-1]; | |
770 | mcmperBus[ibus] = 12; | |
771 | startRowBus[ibus] = ksrbus3[ibus-1]; | |
772 | endRowBus[ibus] = kerbus3[ibus-1]; | |
773 | startColBus[ibus] = kscbus3[ibus-1]; | |
774 | endColBus[ibus] = kecbus3[ibus-1]; | |
775 | } | |
776 | ||
777 | } | |
778 | ||
779 | //_____________________________________________________________________________ | |
780 | void AliPMDRawStream::Ddl4Mapping(Int_t moduleNo[], Int_t mcmperBus[], | |
781 | Int_t startRowBus[], Int_t endRowBus[], | |
782 | Int_t startColBus[], Int_t endColBus[]) | |
783 | { | |
784 | // DDL4 Mapping | |
785 | ||
786 | const Int_t ktotpbus = 42; | |
787 | static const Int_t kmodno4[ktotpbus] = {24, 24, 24, 25, 25, 25, | |
788 | 26, 26, 26, 27, 27, 27, | |
789 | 28, 28, 28, 29, 29, 29, | |
790 | 42, 42, 42, 42, 43, 43, 43, 43, | |
791 | 44, 44, 44, 44, 45, 45, 45, 45, | |
792 | 46, 46, 46, 46, 47, 47, 47, 47}; | |
793 | ||
794 | ||
795 | static const Int_t kmcbus4[ktotpbus] = {24, 24, 24, 24, 24, 24, | |
796 | 24, 24, 24, 24, 24, 24, | |
797 | 24, 24, 24, 24, 24, 24, | |
798 | 12, 12, 24, 24, 12, 12, 24, 24, | |
799 | 12, 12, 24, 24, 12, 12, 24, 24, | |
800 | 12, 12, 24, 24, 12, 12, 24, 24}; | |
801 | ||
802 | ||
803 | static const Int_t ksrbus4[ktotpbus] = {0, 32, 64, 0, 32, 64, | |
804 | 0, 32, 64, 0, 32, 64, | |
805 | 0, 32, 64, 0, 32, 64, | |
806 | 32, 32, 0, 0, 32, 32, 0, 0, | |
807 | 32, 32, 0, 0, 32, 32, 0, 0, | |
808 | 32, 32, 0, 0, 32, 32, 0, 0}; | |
809 | ||
810 | ||
811 | ||
812 | ||
813 | static const Int_t kerbus4[ktotpbus] = {31, 63, 95, 31, 63, 95, | |
814 | 31, 63, 95, 31, 63, 95, | |
815 | 31, 63, 95, 31, 63, 95, | |
816 | 47, 47, 31, 31, 47, 47, 31, 31, | |
817 | 47, 47, 31, 31, 47, 47, 31, 31, | |
818 | 47, 47, 31, 31, 47, 47, 31, 31}; | |
819 | ||
820 | ||
821 | ||
822 | static const Int_t kscbus4[ktotpbus] = {0, 0, 0, 0, 0, 0, | |
823 | 0, 0, 0, 0, 0, 0, | |
824 | 0, 0, 0, 0, 0, 0, | |
825 | 48, 0, 48, 0, 48, 0, 48, 0, | |
826 | 48, 0, 48, 0, 48, 0, 48, 0, | |
827 | 48, 0, 48, 0, 48, 0, 48, 0}; | |
828 | ||
829 | ||
830 | ||
831 | static const Int_t kecbus4[ktotpbus] = {47, 47, 47, 47, 47, 47, | |
832 | 47, 47, 47, 47, 47, 47, | |
833 | 47, 47, 47, 47, 47, 47, | |
834 | 95, 47, 95, 47, 95, 47, 95, 47, | |
835 | 95, 47, 95, 47, 95, 47, 95, 47, | |
836 | 95, 47, 95, 47, 95, 47, 95, 47}; | |
837 | ||
838 | ||
839 | for (Int_t ibus = 1; ibus <= ktotpbus; ibus++) | |
840 | { | |
841 | moduleNo[ibus] = kmodno4[ibus-1]; | |
842 | mcmperBus[ibus] = kmcbus4[ibus-1]; | |
843 | startRowBus[ibus] = ksrbus4[ibus-1]; | |
844 | endRowBus[ibus] = kerbus4[ibus-1]; | |
845 | startColBus[ibus] = kscbus4[ibus-1]; | |
846 | endColBus[ibus] = kecbus4[ibus-1]; | |
847 | } | |
848 | ||
849 | } | |
850 | ||
851 | //_____________________________________________________________________________ | |
852 | void AliPMDRawStream::Ddl5Mapping(Int_t moduleNo[], Int_t mcmperBus[], | |
853 | Int_t startRowBus[], Int_t endRowBus[], | |
854 | Int_t startColBus[], Int_t endColBus[]) | |
855 | { | |
856 | // DDL5 Mapping | |
857 | ||
858 | const Int_t ktotpbus = 42; | |
859 | static const Int_t kmodno5[ktotpbus] = {30, 30, 30, 31, 31, 31, | |
860 | 32, 32, 32, 33, 33, 33, | |
861 | 34, 34, 34, 35, 35, 35, | |
862 | 36, 36, 36, 36, 37, 37, 37, 37, | |
863 | 38, 38, 38, 38, 39, 39, 39, 39, | |
864 | 40, 40, 40, 40, 41, 41, 41, 41}; | |
865 | ||
866 | ||
867 | static const Int_t kmcbus5[ktotpbus] = {24, 24, 24, 24, 24, 24, | |
868 | 24, 24, 24, 24, 24, 24, | |
869 | 24, 24, 24, 24, 24, 24, | |
870 | 12, 12, 24, 24, 12, 12, 24, 24, | |
871 | 12, 12, 24, 24, 12, 12, 24, 24, | |
872 | 12, 12, 24, 24, 12, 12, 24, 24}; | |
873 | ||
874 | ||
875 | ||
876 | static const Int_t ksrbus5[ktotpbus] = {0, 32, 64, 0, 32, 64, | |
877 | 0, 32, 64, 0, 32, 64, | |
878 | 0, 32, 64, 0, 32, 64, | |
879 | 32, 32, 0, 0, 32, 32, 0, 0, | |
880 | 32, 32, 0, 0, 32, 32, 0, 0, | |
881 | 32, 32, 0, 0, 32, 32, 0, 0}; | |
882 | ||
883 | ||
884 | ||
885 | ||
886 | static const Int_t kerbus5[ktotpbus] = {31, 63, 95, 31, 63, 95, | |
887 | 31, 63, 95, 31, 63, 95, | |
888 | 31, 63, 95, 31, 63, 95, | |
889 | 47, 47, 31, 31, 47, 47, 31, 31, | |
890 | 47, 47, 31, 31, 47, 47, 31, 31, | |
891 | 47, 47, 31, 31, 47, 47, 31, 31}; | |
892 | ||
893 | ||
894 | ||
895 | static const Int_t kscbus5[ktotpbus] = {0, 0, 0, 0, 0, 0, | |
896 | 0, 0, 0, 0, 0, 0, | |
897 | 0, 0, 0, 0, 0, 0, | |
898 | 48, 0, 48, 0, 48, 0, 48, 0, | |
899 | 48, 0, 48, 0, 48, 0, 48, 0, | |
900 | 48, 0, 48, 0, 48, 0, 48, 0}; | |
901 | ||
902 | ||
903 | ||
904 | static const Int_t kecbus5[ktotpbus] = {47, 47, 47, 47, 47, 47, | |
905 | 47, 47, 47, 47, 47, 47, | |
906 | 47, 47, 47, 47, 47, 47, | |
907 | 95, 47, 95, 47, 95, 47, 95, 47, | |
908 | 95, 47, 95, 47, 95, 47, 95, 47, | |
909 | 95, 47, 95, 47, 95, 47, 95, 47}; | |
910 | ||
911 | ||
912 | for (Int_t ibus = 1; ibus <= ktotpbus; ibus++) | |
913 | { | |
914 | moduleNo[ibus] = kmodno5[ibus-1]; | |
915 | mcmperBus[ibus] = kmcbus5[ibus-1]; | |
916 | startRowBus[ibus] = ksrbus5[ibus-1]; | |
917 | endRowBus[ibus] = kerbus5[ibus-1]; | |
918 | startColBus[ibus] = kscbus5[ibus-1]; | |
919 | endColBus[ibus] = kecbus5[ibus-1]; | |
920 | } | |
921 | ||
922 | } | |
923 | ||
924 |