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