]>
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 | |
34ab69dd | 114 | // --- Open the mapping file |
a09a2da4 | 115 | |
34ab69dd | 116 | TString fileName(gSystem->Getenv("ALICE_ROOT")); |
117 | if(iddl == 0) | |
118 | { | |
119 | fileName += "/PMD/PMD_Mapping_ddl0.dat"; | |
120 | } | |
121 | else if(iddl == 1) | |
122 | { | |
123 | fileName += "/PMD/PMD_Mapping_ddl1.dat"; | |
124 | } | |
125 | else if(iddl == 2) | |
126 | { | |
127 | fileName += "/PMD/PMD_Mapping_ddl2.dat"; | |
128 | } | |
129 | else if(iddl == 3) | |
130 | { | |
131 | fileName += "/PMD/PMD_Mapping_ddl3.dat"; | |
132 | } | |
133 | else if(iddl == 4) | |
134 | { | |
135 | fileName += "/PMD/PMD_Mapping_ddl4.dat"; | |
136 | } | |
137 | else if(iddl == 5) | |
138 | { | |
139 | fileName += "/PMD/PMD_Mapping_ddl5.dat"; | |
140 | } | |
141 | ||
142 | ifstream infile; | |
143 | infile.open(fileName.Data(), ios::in); // ascii file | |
722ccc67 | 144 | |
608c1f27 | 145 | if(!infile) { |
34ab69dd | 146 | AliError(Form("Could not read the mapping file for DDL No = %d",iddl)); |
608c1f27 | 147 | fRawReader->AddFatalErrorLog(kNoMappingFile,Form("ddl=%d",iddl)); |
148 | } | |
34ab69dd | 149 | |
150 | Int_t modulePerDDL = 0; | |
151 | if (iddl < 4) | |
152 | { | |
153 | modulePerDDL = 6; | |
154 | } | |
155 | else if (iddl == 4 || iddl == 5) | |
156 | { | |
157 | modulePerDDL = 12; | |
158 | } | |
159 | ||
40f4a63f | 160 | const Int_t kNPatchBus = 51; |
34ab69dd | 161 | |
162 | Int_t modno, totPatchBus, bPatchBus, ePatchBus; | |
163 | Int_t ibus, totmcm, rows, rowe, cols, cole; | |
164 | Int_t moduleNo[kNPatchBus], mcmperBus[kNPatchBus]; | |
165 | Int_t startRowBus[kNPatchBus], endRowBus[kNPatchBus]; | |
166 | Int_t startColBus[kNPatchBus], endColBus[kNPatchBus]; | |
167 | ||
78fc1b96 | 168 | for (ibus = 0; ibus < kNPatchBus; ibus++) |
34ab69dd | 169 | { |
170 | mcmperBus[ibus] = -1; | |
171 | startRowBus[ibus] = -1; | |
172 | endRowBus[ibus] = -1; | |
173 | startColBus[ibus] = -1; | |
174 | endColBus[ibus] = -1; | |
175 | } | |
176 | ||
34ab69dd | 177 | for (Int_t im = 0; im < modulePerDDL; im++) |
178 | { | |
179 | infile >> modno; | |
180 | infile >> totPatchBus >> bPatchBus >> ePatchBus; | |
9ac124a2 | 181 | |
34ab69dd | 182 | for(Int_t i=0; i<totPatchBus; i++) |
183 | { | |
184 | infile >> ibus >> totmcm >> rows >> rowe >> cols >> cole; | |
185 | ||
186 | moduleNo[ibus] = modno; | |
187 | mcmperBus[ibus] = totmcm; | |
188 | startRowBus[ibus] = rows; | |
189 | endRowBus[ibus] = rowe; | |
190 | startColBus[ibus] = cols; | |
191 | endColBus[ibus] = cole; | |
192 | } | |
193 | } | |
194 | ||
195 | infile.close(); | |
196 | ||
34ab69dd | 197 | AliPMDBlockHeader blockHeader; |
198 | AliPMDDspHeader dspHeader; | |
199 | AliPMDPatchBusHeader pbusHeader; | |
200 | ||
0a666212 | 201 | const Int_t kblHLen = blockHeader.GetHeaderLength(); |
202 | const Int_t kdspHLen = dspHeader.GetHeaderLength(); | |
203 | const Int_t kpbusHLen = pbusHeader.GetHeaderLength(); | |
204 | ||
a98f9d26 | 205 | Int_t parity; |
34ab69dd | 206 | Int_t idet, ismn; |
207 | Int_t irow = -1; | |
208 | Int_t icol = -1; | |
209 | ||
0a666212 | 210 | Int_t blHeaderWord[8]; |
211 | Int_t dspHeaderWord[10]; | |
212 | Int_t pbusHeaderWord[4]; | |
34ab69dd | 213 | |
722ccc67 | 214 | Int_t ilowLimit = 0; |
215 | Int_t iuppLimit = 0; | |
216 | Int_t blRawDataLength = 0; | |
217 | Int_t dspRawDataLength = 0; | |
218 | Int_t iwordddl = 2; | |
9ac124a2 | 219 | |
34ab69dd | 220 | for (Int_t iblock = 0; iblock < 2; iblock++) |
221 | { | |
222 | ilowLimit = iuppLimit; | |
0a666212 | 223 | iuppLimit = ilowLimit + kblHLen; |
34ab69dd | 224 | |
225 | for (Int_t i = ilowLimit; i < iuppLimit; i++) | |
226 | { | |
722ccc67 | 227 | iwordddl++; |
228 | ||
229 | blHeaderWord[i-ilowLimit] = (Int_t) GetNextWord(); | |
34ab69dd | 230 | } |
9ac124a2 | 231 | |
0a666212 | 232 | blockHeader.SetHeader(blHeaderWord); |
9ac124a2 | 233 | blRawDataLength = blockHeader.GetRawDataLength(); |
234 | ||
722ccc67 | 235 | if (iwordddl == totaldataword) continue; |
236 | ||
237 | Int_t iwordblk = 0; | |
238 | ||
34ab69dd | 239 | for (Int_t idsp = 0; idsp < 5; idsp++) |
240 | { | |
722ccc67 | 241 | |
242 | ||
34ab69dd | 243 | ilowLimit = iuppLimit; |
0a666212 | 244 | iuppLimit = ilowLimit + kdspHLen; |
34ab69dd | 245 | |
246 | for (Int_t i = ilowLimit; i < iuppLimit; i++) | |
247 | { | |
722ccc67 | 248 | iwordddl++; |
249 | iwordblk++; | |
250 | dspHeaderWord[i-ilowLimit] = (Int_t) GetNextWord(); | |
34ab69dd | 251 | } |
0a666212 | 252 | dspHeader.SetHeader(dspHeaderWord); |
722ccc67 | 253 | dspRawDataLength = dspHeader.GetRawDataLength(); |
254 | ||
255 | if (iwordddl == totaldataword) continue; | |
256 | ||
257 | Int_t iworddsp = 0; | |
34ab69dd | 258 | |
78fc1b96 | 259 | for (ibus = 0; ibus < 5; ibus++) |
34ab69dd | 260 | { |
34ab69dd | 261 | ilowLimit = iuppLimit; |
0a666212 | 262 | iuppLimit = ilowLimit + kpbusHLen; |
34ab69dd | 263 | |
264 | for (Int_t i = ilowLimit; i < iuppLimit; i++) | |
265 | { | |
722ccc67 | 266 | iwordddl++; |
267 | iwordblk++; | |
268 | iworddsp++; | |
269 | pbusHeaderWord[i-ilowLimit] = (Int_t) GetNextWord(); | |
34ab69dd | 270 | } |
722ccc67 | 271 | |
0a666212 | 272 | pbusHeader.SetHeader(pbusHeaderWord); |
34ab69dd | 273 | Int_t rawdatalength = pbusHeader.GetRawDataLength(); |
274 | Int_t pbusid = pbusHeader.GetPatchBusId(); | |
275 | ||
276 | ilowLimit = iuppLimit; | |
277 | iuppLimit = ilowLimit + rawdatalength; | |
278 | ||
279 | Int_t imodule = moduleNo[pbusid]; | |
280 | ||
722ccc67 | 281 | if (iwordddl == totaldataword) continue; |
34ab69dd | 282 | |
283 | for (Int_t iword = ilowLimit; iword < iuppLimit; iword++) | |
284 | { | |
722ccc67 | 285 | iwordddl++; |
286 | iwordblk++; | |
287 | iworddsp++; | |
288 | data = 0; | |
289 | data = GetNextWord(); | |
34ab69dd | 290 | |
291 | Int_t isig = data & 0x0FFF; | |
292 | Int_t ich = (data >> 12) & 0x003F; | |
293 | Int_t imcm = (data >> 18) & 0x07FF; | |
294 | Int_t ibit = (data >> 31) & 0x0001; | |
a98f9d26 | 295 | parity = ComputeParity(data); |
296 | if (ibit != parity) | |
297 | { | |
298 | AliWarning("ComputeParity:: Parity Error"); | |
608c1f27 | 299 | fRawReader->AddMajorErrorLog(kParityError); |
a98f9d26 | 300 | } |
40f4a63f | 301 | |
302 | ConvertDDL2SMN(iddl, imodule, ismn, idet); | |
303 | ||
304 | GetRowCol(iddl, ismn, pbusid, imcm, ich, | |
34ab69dd | 305 | startRowBus, endRowBus, |
306 | startColBus, endColBus, | |
307 | irow, icol); | |
308 | ||
34ab69dd | 309 | TransformH2S(ismn, irow, icol); |
310 | ||
311 | pmdddldata = new AliPMDddldata(); | |
312 | ||
313 | pmdddldata->SetDetector(idet); | |
314 | pmdddldata->SetSMN(ismn); | |
315 | pmdddldata->SetModule(imodule); | |
316 | pmdddldata->SetPatchBusId(pbusid); | |
317 | pmdddldata->SetMCM(imcm); | |
318 | pmdddldata->SetChannel(ich); | |
319 | pmdddldata->SetRow(irow); | |
320 | pmdddldata->SetColumn(icol); | |
321 | pmdddldata->SetSignal(isig); | |
322 | pmdddldata->SetParityBit(ibit); | |
323 | ||
324 | pmdddlcont->Add(pmdddldata); | |
325 | ||
0a666212 | 326 | } // data word loop |
9ac124a2 | 327 | |
722ccc67 | 328 | if (iwordddl == totaldataword) break; |
329 | ||
330 | if (iworddsp == dspRawDataLength) break; // raw data | |
9ac124a2 | 331 | |
0a666212 | 332 | } // patch bus loop |
34ab69dd | 333 | |
722ccc67 | 334 | if (dspHeader.GetPaddingWord() == 1) |
335 | { | |
336 | iuppLimit++; | |
337 | iwordddl++; | |
338 | iwordblk++; | |
339 | iworddsp++; | |
340 | data = GetNextWord(); | |
341 | } | |
342 | ||
343 | if (iwordblk == blRawDataLength) break; // for raw data | |
34ab69dd | 344 | |
0a666212 | 345 | } // end of DSP |
34ab69dd | 346 | |
347 | } // end of BLOCK | |
34ab69dd | 348 | |
722ccc67 | 349 | // delete [] buffer; |
a09a2da4 | 350 | |
722ccc67 | 351 | return iddl; |
a09a2da4 | 352 | } |
a09a2da4 | 353 | //_____________________________________________________________________________ |
40f4a63f | 354 | void AliPMDRawStream::GetRowCol(Int_t ddlno, Int_t smn, Int_t pbusid, |
34ab69dd | 355 | UInt_t mcmno, UInt_t chno, |
356 | Int_t startRowBus[], Int_t endRowBus[], | |
357 | Int_t startColBus[], Int_t endColBus[], | |
358 | Int_t &row, Int_t &col) const | |
a09a2da4 | 359 | { |
34ab69dd | 360 | // decode: ddlno, patchbusid, mcmno, chno -> um, row, col |
a09a2da4 | 361 | |
40f4a63f | 362 | UInt_t iCh[64]; |
a09a2da4 | 363 | |
40f4a63f | 364 | static const UInt_t kChDdl01[64] = { 9, 6, 5, 10, 1, 2, 0, 3, |
365 | 13, 7, 4, 11, 8, 14, 12, 15, | |
366 | 16, 19, 17, 23, 20, 27, 24, 18, | |
367 | 28, 31, 29, 30, 21, 26, 25, 22, | |
368 | 41, 38, 37, 42, 33, 34, 32, 35, | |
369 | 45, 39, 36, 43, 40, 46, 44, 47, | |
370 | 48, 51, 49, 55, 52, 59, 56, 50, | |
371 | 60, 63, 61, 62, 53, 58, 57, 54 }; | |
372 | ||
373 | static const UInt_t kChDdl23[64] = { 54, 57, 58, 53, 62, 61, 63, 60, | |
374 | 50, 56, 59, 52, 55, 49, 51, 48, | |
375 | 47, 44, 46, 40, 43, 36, 39, 45, | |
376 | 35, 32, 34, 33, 42, 37, 38, 41, | |
377 | 22, 25, 26, 21, 30, 29, 31, 28, | |
378 | 18, 24, 27, 20, 23, 17, 19, 16, | |
379 | 15, 12, 14, 8, 11, 4, 7, 13, | |
380 | 3, 0, 2, 1, 10, 5, 6, 9 }; | |
381 | ||
382 | static const UInt_t kChDdl41[64] = { 53, 58, 57, 54, 61, 62, 60, 63, | |
383 | 49, 59, 56, 55, 52, 50, 48, 51, | |
384 | 44, 47, 45, 43, 40, 39, 36, 46, | |
385 | 32, 35, 33, 34, 41, 38, 37, 42, | |
386 | 21, 26, 25, 22, 29, 30, 28, 31, | |
387 | 17, 27, 24, 23, 20, 18, 16, 19, | |
388 | 12, 15, 13, 11, 8, 7, 4, 14, | |
389 | 0, 3, 1, 2, 9, 6, 5, 10 }; | |
390 | ||
391 | static const UInt_t kChDdl42[64] = { 10, 5, 6, 9, 2, 1, 3, 0, | |
392 | 14, 4, 7, 8, 11, 13, 15, 12, | |
393 | 19, 16, 18, 20, 23, 24, 27, 17, | |
394 | 31, 28, 30, 29, 22, 25, 26, 21, | |
395 | 42, 37, 38, 41, 34, 33, 35, 32, | |
396 | 46, 36, 39, 40, 43, 45, 47, 44, | |
397 | 51, 48, 50, 52, 55, 56, 59, 49, | |
398 | 63, 60, 62, 61, 54, 57, 58, 53 }; | |
399 | ||
400 | static const UInt_t kChDdl51[64] = { 10, 5, 6, 9, 2, 1, 3, 0, | |
401 | 14, 4, 7, 8, 11, 13, 15, 12, | |
402 | 19, 16, 18, 20, 23, 24, 27, 17, | |
403 | 31, 28, 30, 29, 22, 25, 26, 21, | |
404 | 42, 37, 38, 41, 34, 33, 35, 32, | |
405 | 46, 36, 39, 40, 43, 45, 47, 44, | |
406 | 51, 48, 50, 52, 55, 56, 59, 49, | |
407 | 63, 60, 62, 61, 54, 57, 58, 53 }; | |
408 | ||
409 | static const UInt_t kChDdl52[64] = { 53, 58, 57, 54, 61, 62, 60, 63, | |
410 | 49, 59, 56, 55, 52, 50, 48, 51, | |
411 | 44, 47, 45, 43, 40, 39, 36, 46, | |
412 | 32, 35, 33, 34, 41, 38, 37, 42, | |
413 | 21, 26, 25, 22, 29, 30, 28, 31, | |
414 | 17, 27, 24, 23, 20, 18, 16, 19, | |
415 | 12, 15, 13, 11, 8, 7, 4, 14, | |
416 | 0, 3, 1, 2, 9, 6, 5, 10 }; | |
417 | ||
418 | for (Int_t i = 0; i < 64; i++) | |
419 | { | |
420 | if (ddlno == 0 || ddlno == 1) iCh[i] = kChDdl01[i]; | |
421 | if (ddlno == 2 || ddlno == 3) iCh[i] = kChDdl23[i]; | |
422 | ||
423 | if (ddlno == 4 && smn < 6) iCh[i] = kChDdl41[i]; | |
424 | if (ddlno == 4 && (smn >= 18 && smn < 24))iCh[i] = kChDdl42[i]; | |
425 | if (ddlno == 5 && (smn >= 12 && smn < 18))iCh[i] = kChDdl51[i]; | |
426 | if (ddlno == 5 && (smn >= 6 && smn < 12))iCh[i] = kChDdl52[i]; | |
427 | } | |
428 | ||
429 | ||
430 | Int_t rowcol = iCh[chno]; | |
34ab69dd | 431 | Int_t irownew = rowcol/4; |
432 | Int_t icolnew = rowcol%4; | |
a09a2da4 | 433 | |
a0a6a406 | 434 | if (ddlno == 0 ) |
a09a2da4 | 435 | { |
a0a6a406 | 436 | row = startRowBus[pbusid] + irownew; |
40f4a63f | 437 | col = startColBus[pbusid] + (mcmno-1)*4 + icolnew; |
a09a2da4 | 438 | } |
34ab69dd | 439 | else if (ddlno == 1) |
a09a2da4 | 440 | { |
a0a6a406 | 441 | row = endRowBus[pbusid] - (15 - irownew); |
40f4a63f | 442 | col = startColBus[pbusid] + (mcmno-1)*4 + icolnew; |
a0a6a406 | 443 | |
a09a2da4 | 444 | } |
a0a6a406 | 445 | else if (ddlno == 2 ) |
e54787da | 446 | { |
34ab69dd | 447 | row = startRowBus[pbusid] + irownew; |
40f4a63f | 448 | col = endColBus[pbusid] - (mcmno-1)*4 - (3 - icolnew); |
34ab69dd | 449 | } |
450 | else if (ddlno == 3) | |
451 | { | |
a0a6a406 | 452 | row = endRowBus[pbusid] - (15 - irownew); |
40f4a63f | 453 | col = endColBus[pbusid] - (mcmno-1)*4 - (3 - icolnew); |
e54787da | 454 | } |
a0a6a406 | 455 | else if (ddlno == 4 ) |
e54787da | 456 | { |
40f4a63f | 457 | if (pbusid < 19) |
e54787da | 458 | { |
40f4a63f | 459 | if (mcmno <= 12) |
34ab69dd | 460 | { |
461 | // Add 16 to skip the 1st 15 rows | |
462 | row = startRowBus[pbusid] + irownew + 16; | |
40f4a63f | 463 | col = startColBus[pbusid] + (mcmno-1)*4 + icolnew; |
34ab69dd | 464 | } |
40f4a63f | 465 | else if(mcmno > 12) |
93622f4a | 466 | { |
467 | row = startRowBus[pbusid] + irownew; | |
40f4a63f | 468 | col = startColBus[pbusid] + (mcmno-12-1)*4 + icolnew; |
93622f4a | 469 | } |
e54787da | 470 | } |
40f4a63f | 471 | else if(pbusid > 18) |
e54787da | 472 | { |
40f4a63f | 473 | if (mcmno <= 12) |
a0a6a406 | 474 | { |
40f4a63f | 475 | col = endColBus[pbusid] - (mcmno-1)*4 - (3 - icolnew); |
93622f4a | 476 | |
a0a6a406 | 477 | if(endRowBus[pbusid] - startRowBus[pbusid] > 16) |
478 | row = endRowBus[pbusid] - (15 - irownew) - 16 ; | |
479 | else | |
480 | row = endRowBus[pbusid] - (15 - irownew) ; | |
93622f4a | 481 | } |
40f4a63f | 482 | else if(mcmno > 12) |
93622f4a | 483 | { |
484 | row = endRowBus[pbusid] - (15 - irownew) ; | |
40f4a63f | 485 | col = endColBus[pbusid] - (mcmno - 12 - 1)*4 - (3 - icolnew); |
a0a6a406 | 486 | } |
e54787da | 487 | } |
e54787da | 488 | } |
34ab69dd | 489 | else if (ddlno == 5) |
e54787da | 490 | { |
40f4a63f | 491 | if (pbusid <= 18) |
34ab69dd | 492 | { |
40f4a63f | 493 | if (mcmno > 12) |
34ab69dd | 494 | { |
a0a6a406 | 495 | // Subtract 16 to skip the 1st 15 rows |
496 | row = endRowBus[pbusid] - 16 -(15 - irownew); | |
40f4a63f | 497 | col = startColBus[pbusid] + (mcmno-12 -1)*4 + icolnew; |
34ab69dd | 498 | } |
499 | else | |
500 | { | |
a0a6a406 | 501 | row = endRowBus[pbusid] - (15 - irownew) ; |
40f4a63f | 502 | col = startColBus[pbusid] + (mcmno -1)*4 + icolnew; |
34ab69dd | 503 | } |
40f4a63f | 504 | |
34ab69dd | 505 | } |
a0a6a406 | 506 | |
40f4a63f | 507 | else if (pbusid > 18) |
e54787da | 508 | { |
40f4a63f | 509 | if(mcmno > 12) |
a0a6a406 | 510 | { |
511 | // Add 16 to skip the 1st 15 rows | |
512 | row = startRowBus[pbusid] + irownew + 16; | |
40f4a63f | 513 | col = endColBus[pbusid] - (mcmno - 12 - 1)*4 - (3 - icolnew); |
a0a6a406 | 514 | } |
515 | else | |
516 | { | |
517 | row = startRowBus[pbusid] + irownew ; | |
40f4a63f | 518 | col = endColBus[pbusid] - (mcmno - 1)*4 - (3 - icolnew); |
a0a6a406 | 519 | } |
e54787da | 520 | } |
34ab69dd | 521 | } |
a0a6a406 | 522 | |
34ab69dd | 523 | } |
524 | //_____________________________________________________________________________ | |
525 | void AliPMDRawStream::ConvertDDL2SMN(Int_t iddl, Int_t imodule, | |
526 | Int_t &smn, Int_t &detector) const | |
527 | { | |
528 | // This converts the DDL number (0 to 5), Module Number (0-47) | |
529 | // to Serial module number in one detector (SMN : 0-23) and | |
530 | // detector number (0:PRE plane, 1:CPV plane) | |
531 | if (iddl < 4) | |
532 | { | |
533 | smn = imodule; | |
534 | detector = 0; | |
535 | } | |
536 | else | |
537 | { | |
538 | smn = imodule - 24; | |
e54787da | 539 | detector = 1; |
540 | } | |
541 | } | |
542 | //_____________________________________________________________________________ | |
40f4a63f | 543 | |
e54787da | 544 | void AliPMDRawStream::TransformH2S(Int_t smn, Int_t &row, Int_t &col) const |
545 | { | |
34ab69dd | 546 | // This does the transformation of the hardware coordinate to |
547 | // software | |
548 | // i.e., For SuperModule 0 &1, instead of 96x48(hardware), | |
549 | // it is 48x96 (software) | |
e54787da | 550 | // For Supermodule 3 & 4, 48x96 |
551 | ||
e54787da | 552 | Int_t irownew = 0; |
553 | Int_t icolnew = 0; | |
34ab69dd | 554 | |
e54787da | 555 | if(smn < 12) |
556 | { | |
34ab69dd | 557 | irownew = col; |
558 | icolnew = row; | |
e54787da | 559 | } |
34ab69dd | 560 | else if(smn >= 12 && smn < 24) |
e54787da | 561 | { |
34ab69dd | 562 | irownew = row; |
563 | icolnew = col; | |
e54787da | 564 | } |
565 | ||
566 | row = irownew; | |
567 | col = icolnew; | |
568 | } | |
a98f9d26 | 569 | //_____________________________________________________________________________ |
722ccc67 | 570 | Int_t AliPMDRawStream::ComputeParity(UInt_t data) |
a98f9d26 | 571 | { |
572 | // Calculate the parity bit | |
573 | ||
574 | Int_t count = 0; | |
575 | for(Int_t j = 0; j<29; j++) | |
576 | { | |
577 | if (data & 0x01 ) count++; | |
578 | data >>= 1; | |
579 | } | |
580 | ||
581 | Int_t parity = count%2; | |
582 | ||
583 | return parity; | |
584 | } | |
585 | ||
e54787da | 586 | //_____________________________________________________________________________ |
722ccc67 | 587 | UInt_t AliPMDRawStream::GetNextWord() |
588 | { | |
589 | // Returns the next 32 bit word | |
590 | // inside the raw data payload. | |
591 | ||
592 | if (!fData || fPosition < 0) AliFatal("Raw data payload buffer is not yet initialized !"); | |
593 | ||
594 | UInt_t word = 0; | |
595 | word |= fData[fPosition++]; | |
596 | word |= fData[fPosition++] << 8; | |
597 | word |= fData[fPosition++] << 16; | |
598 | word |= fData[fPosition++] << 24; | |
599 | ||
600 | return word; | |
601 | } | |
602 |