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