]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PMD/AliPMDRawStream.cxx
bug fixed
[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"
3d8b8ac5 40#include "AliPMDMappingData.h"
a09a2da4 41#include "AliRawReader.h"
3d8b8ac5 42#include "AliCDBManager.h"
43#include "AliCDBStorage.h"
44#include "AliCDBEntry.h"
a09a2da4 45
46ClassImp(AliPMDRawStream)
47
48
49//_____________________________________________________________________________
50AliPMDRawStream::AliPMDRawStream(AliRawReader* rawReader) :
722ccc67 51 fRawReader(rawReader),
52 fData(NULL),
3d8b8ac5 53 fPosition(-1),
54 fMapData(GetMappingData())
a09a2da4 55{
56// create an object to read PMD raw digits
57
722ccc67 58 fRawReader->Reset();
362c9d61 59 fRawReader->Select("PMD");
a09a2da4 60}
61
62//_____________________________________________________________________________
63AliPMDRawStream::AliPMDRawStream(const AliPMDRawStream& stream) :
64 TObject(stream),
722ccc67 65 fRawReader(NULL),
66 fData(NULL),
3d8b8ac5 67 fPosition(-1),
68 fMapData(GetMappingData())
a09a2da4 69{
70// copy constructor
71
ecee2a1a 72 AliFatal("Copy constructor not implemented");
a09a2da4 73}
74
75//_____________________________________________________________________________
76AliPMDRawStream& AliPMDRawStream::operator = (const AliPMDRawStream&
77 /* stream */)
78{
79// assignment operator
80
ecee2a1a 81 AliFatal("operator = assignment operator not implemented");
a09a2da4 82 return *this;
83}
84
85//_____________________________________________________________________________
86AliPMDRawStream::~AliPMDRawStream()
87{
88// destructor
89
90}
91
92
93//_____________________________________________________________________________
34ab69dd 94
722ccc67 95Int_t AliPMDRawStream::DdlData(TObjArray *pmdddlcont)
a09a2da4 96{
08cf9354 97 // read the next raw digit
98 // returns kFALSE if there is no digit left
99
6b1a10fc 100 Int_t iddl = -1;
40f4a63f 101
34ab69dd 102 AliPMDddldata *pmdddldata;
103
8c89425f 104 if (!fRawReader->ReadHeader()) return -1;
722ccc67 105
106 iddl = fRawReader->GetDDLID();
34ab69dd 107 Int_t dataSize = fRawReader->GetDataSize();
108 Int_t totaldataword = dataSize/4;
9ac124a2 109
08cf9354 110
8c89425f 111 if (dataSize <= 0) return -1;
a09a2da4 112
be8b7039 113 UInt_t data = 0;
722ccc67 114
4e2efa25 115 // PMD raw data does not contain CDH
722ccc67 116
08c741ba 117 if (!fRawReader->ReadNextData(fData))
118 {
119 return kFALSE;
120 }
4e2efa25 121
a09a2da4 122
4e2efa25 123 fPosition = 0;
a09a2da4 124
be8b7039 125 Int_t ibus = 0;
34ab69dd 126
40f4a63f 127 const Int_t kNPatchBus = 51;
89f0ae35 128
34ab69dd 129 Int_t moduleNo[kNPatchBus], mcmperBus[kNPatchBus];
130 Int_t startRowBus[kNPatchBus], endRowBus[kNPatchBus];
131 Int_t startColBus[kNPatchBus], endColBus[kNPatchBus];
132
78fc1b96 133 for (ibus = 0; ibus < kNPatchBus; ibus++)
34ab69dd 134 {
89f0ae35 135 moduleNo[ibus] = -1;
34ab69dd 136 mcmperBus[ibus] = -1;
137 startRowBus[ibus] = -1;
138 endRowBus[ibus] = -1;
139 startColBus[ibus] = -1;
140 endColBus[ibus] = -1;
141 }
3d8b8ac5 142
89f0ae35 143 if (iddl == 0)
08cf9354 144 {
3d8b8ac5 145 Ddl0Mapping(moduleNo, mcmperBus, startRowBus,
89f0ae35 146 endRowBus, startColBus, endColBus);
08cf9354 147
148 }
89f0ae35 149 else if (iddl == 1)
08cf9354 150 {
3d8b8ac5 151 Ddl1Mapping(moduleNo, mcmperBus, startRowBus,
89f0ae35 152 endRowBus, startColBus, endColBus);
08cf9354 153
154 }
89f0ae35 155 else if (iddl == 2)
08cf9354 156 {
3d8b8ac5 157 Ddl2Mapping(moduleNo, mcmperBus, startRowBus,
89f0ae35 158 endRowBus, startColBus, endColBus);
08cf9354 159 }
89f0ae35 160 else if (iddl == 3)
08cf9354 161 {
3d8b8ac5 162 Ddl3Mapping(moduleNo, mcmperBus, startRowBus,
89f0ae35 163 endRowBus, startColBus, endColBus);
08cf9354 164 }
89f0ae35 165 else if (iddl == 4)
08cf9354 166 {
3d8b8ac5 167 Ddl4Mapping(moduleNo, mcmperBus, startRowBus,
89f0ae35 168 endRowBus, startColBus, endColBus);
08cf9354 169 }
89f0ae35 170 else if (iddl == 5)
08cf9354 171 {
3d8b8ac5 172 Ddl5Mapping(moduleNo, mcmperBus, startRowBus,
89f0ae35 173 endRowBus, startColBus, endColBus);
174 }
34ab69dd 175
34ab69dd 176
34ab69dd 177 AliPMDBlockHeader blockHeader;
178 AliPMDDspHeader dspHeader;
179 AliPMDPatchBusHeader pbusHeader;
180
0a666212 181 const Int_t kblHLen = blockHeader.GetHeaderLength();
182 const Int_t kdspHLen = dspHeader.GetHeaderLength();
183 const Int_t kpbusHLen = pbusHeader.GetHeaderLength();
184
be8b7039 185 Int_t parity = 0;
186 Int_t idet = 0, ismn = 0;
34ab69dd 187 Int_t irow = -1;
188 Int_t icol = -1;
189
0a666212 190 Int_t blHeaderWord[8];
191 Int_t dspHeaderWord[10];
192 Int_t pbusHeaderWord[4];
34ab69dd 193
722ccc67 194 Int_t blRawDataLength = 0;
195 Int_t dspRawDataLength = 0;
196 Int_t iwordddl = 2;
9ac124a2 197
91e6e2a0 198
199
34ab69dd 200 for (Int_t iblock = 0; iblock < 2; iblock++)
201 {
8c89425f 202 for (Int_t i = 0; i < kblHLen; i++)
34ab69dd 203 {
722ccc67 204 iwordddl++;
205
8c89425f 206 blHeaderWord[i] = (Int_t) GetNextWord();
34ab69dd 207 }
9ac124a2 208
0a666212 209 blockHeader.SetHeader(blHeaderWord);
9ac124a2 210 blRawDataLength = blockHeader.GetRawDataLength();
211
8c89425f 212 if (iwordddl == totaldataword) break;
722ccc67 213
214 Int_t iwordblk = 0;
215
34ab69dd 216 for (Int_t idsp = 0; idsp < 5; idsp++)
217 {
8c89425f 218 for (Int_t i = 0; i < kdspHLen; i++)
34ab69dd 219 {
722ccc67 220 iwordddl++;
221 iwordblk++;
8c89425f 222 dspHeaderWord[i] = (Int_t) GetNextWord();
34ab69dd 223 }
0a666212 224 dspHeader.SetHeader(dspHeaderWord);
722ccc67 225 dspRawDataLength = dspHeader.GetRawDataLength();
226
8c89425f 227 if (iwordddl == totaldataword) break;
722ccc67 228
229 Int_t iworddsp = 0;
34ab69dd 230
78fc1b96 231 for (ibus = 0; ibus < 5; ibus++)
34ab69dd 232 {
8c89425f 233 for (Int_t i = 0; i < kpbusHLen; i++)
34ab69dd 234 {
722ccc67 235 iwordddl++;
236 iwordblk++;
237 iworddsp++;
8c89425f 238 pbusHeaderWord[i] = (Int_t) GetNextWord();
34ab69dd 239 }
722ccc67 240
0a666212 241 pbusHeader.SetHeader(pbusHeaderWord);
34ab69dd 242 Int_t rawdatalength = pbusHeader.GetRawDataLength();
243 Int_t pbusid = pbusHeader.GetPatchBusId();
244
8c89425f 245 if (pbusid < 0 || pbusid > 50) return -1;
34ab69dd 246
247 Int_t imodule = moduleNo[pbusid];
248
8c89425f 249 if (iwordddl == totaldataword) break;
34ab69dd 250
8c89425f 251 for (Int_t iword = 0; iword < rawdatalength; iword++)
34ab69dd 252 {
722ccc67 253 iwordddl++;
254 iwordblk++;
255 iworddsp++;
256 data = 0;
257 data = GetNextWord();
34ab69dd 258
259 Int_t isig = data & 0x0FFF;
260 Int_t ich = (data >> 12) & 0x003F;
261 Int_t imcm = (data >> 18) & 0x07FF;
262 Int_t ibit = (data >> 31) & 0x0001;
8c89425f 263
264 if (imcm == 0)
265 {
266 AliWarning(Form("FEE address WRONG:: Module %d Patch Bus %d MCM %d",imodule,pbusid,imcm));
267 return -1;
268 }
269
a98f9d26 270 parity = ComputeParity(data);
8c89425f 271
a98f9d26 272 if (ibit != parity)
273 {
2c1131dd 274 AliWarning(Form("Parity Error:: Patch Bus %d Module %d",pbusid,imodule));
608c1f27 275 fRawReader->AddMajorErrorLog(kParityError);
8c89425f 276 return -1;
a98f9d26 277 }
40f4a63f 278
279 ConvertDDL2SMN(iddl, imodule, ismn, idet);
280
08cf9354 281 GetRowCol(imodule, pbusid, imcm, ich,
34ab69dd 282 startRowBus, endRowBus,
283 startColBus, endColBus,
284 irow, icol);
285
08cf9354 286
34ab69dd 287 TransformH2S(ismn, irow, icol);
288
289 pmdddldata = new AliPMDddldata();
290
291 pmdddldata->SetDetector(idet);
292 pmdddldata->SetSMN(ismn);
293 pmdddldata->SetModule(imodule);
294 pmdddldata->SetPatchBusId(pbusid);
295 pmdddldata->SetMCM(imcm);
296 pmdddldata->SetChannel(ich);
297 pmdddldata->SetRow(irow);
298 pmdddldata->SetColumn(icol);
299 pmdddldata->SetSignal(isig);
300 pmdddldata->SetParityBit(ibit);
301
302 pmdddlcont->Add(pmdddldata);
08cf9354 303
0a666212 304 } // data word loop
9ac124a2 305
08cf9354 306
722ccc67 307 if (iwordddl == totaldataword) break;
308
8c89425f 309 if (dspHeader.GetPaddingWord() == 1)
310 {
311 if (iworddsp == dspRawDataLength-1) break; // raw data
312 }
313 else
314 {
315 if (iworddsp == dspRawDataLength) break; // raw data
316 }
08cf9354 317
318
0a666212 319 } // patch bus loop
34ab69dd 320
08cf9354 321
722ccc67 322 if (dspHeader.GetPaddingWord() == 1)
323 {
722ccc67 324 iwordddl++;
325 iwordblk++;
326 iworddsp++;
327 data = GetNextWord();
328 }
8c89425f 329 if (iwordddl == totaldataword) break;
722ccc67 330
331 if (iwordblk == blRawDataLength) break; // for raw data
34ab69dd 332
08cf9354 333
0a666212 334 } // end of DSP
34ab69dd 335
336 } // end of BLOCK
34ab69dd 337
722ccc67 338 return iddl;
a09a2da4 339}
a09a2da4 340//_____________________________________________________________________________
08cf9354 341void AliPMDRawStream::GetRowCol(Int_t imodule, Int_t pbusid,
34ab69dd 342 UInt_t mcmno, UInt_t chno,
343 Int_t startRowBus[], Int_t endRowBus[],
344 Int_t startColBus[], Int_t endColBus[],
345 Int_t &row, Int_t &col) const
a09a2da4 346{
08cf9354 347 // decode: ddlno, patchbusid, mcmno, chno -> um, row, col
a09a2da4 348
40f4a63f 349 UInt_t iCh[64];
a09a2da4 350
40f4a63f 351 static const UInt_t kChDdl01[64] = { 9, 6, 5, 10, 1, 2, 0, 3,
352 13, 7, 4, 11, 8, 14, 12, 15,
353 16, 19, 17, 23, 20, 27, 24, 18,
354 28, 31, 29, 30, 21, 26, 25, 22,
355 41, 38, 37, 42, 33, 34, 32, 35,
356 45, 39, 36, 43, 40, 46, 44, 47,
357 48, 51, 49, 55, 52, 59, 56, 50,
358 60, 63, 61, 62, 53, 58, 57, 54 };
359
360 static const UInt_t kChDdl23[64] = { 54, 57, 58, 53, 62, 61, 63, 60,
361 50, 56, 59, 52, 55, 49, 51, 48,
362 47, 44, 46, 40, 43, 36, 39, 45,
363 35, 32, 34, 33, 42, 37, 38, 41,
364 22, 25, 26, 21, 30, 29, 31, 28,
365 18, 24, 27, 20, 23, 17, 19, 16,
366 15, 12, 14, 8, 11, 4, 7, 13,
367 3, 0, 2, 1, 10, 5, 6, 9 };
368
369 static const UInt_t kChDdl41[64] = { 53, 58, 57, 54, 61, 62, 60, 63,
370 49, 59, 56, 55, 52, 50, 48, 51,
371 44, 47, 45, 43, 40, 39, 36, 46,
372 32, 35, 33, 34, 41, 38, 37, 42,
373 21, 26, 25, 22, 29, 30, 28, 31,
374 17, 27, 24, 23, 20, 18, 16, 19,
375 12, 15, 13, 11, 8, 7, 4, 14,
376 0, 3, 1, 2, 9, 6, 5, 10 };
377
378 static const UInt_t kChDdl42[64] = { 10, 5, 6, 9, 2, 1, 3, 0,
379 14, 4, 7, 8, 11, 13, 15, 12,
380 19, 16, 18, 20, 23, 24, 27, 17,
381 31, 28, 30, 29, 22, 25, 26, 21,
382 42, 37, 38, 41, 34, 33, 35, 32,
383 46, 36, 39, 40, 43, 45, 47, 44,
384 51, 48, 50, 52, 55, 56, 59, 49,
385 63, 60, 62, 61, 54, 57, 58, 53 };
386
387 static const UInt_t kChDdl51[64] = { 10, 5, 6, 9, 2, 1, 3, 0,
388 14, 4, 7, 8, 11, 13, 15, 12,
389 19, 16, 18, 20, 23, 24, 27, 17,
390 31, 28, 30, 29, 22, 25, 26, 21,
391 42, 37, 38, 41, 34, 33, 35, 32,
392 46, 36, 39, 40, 43, 45, 47, 44,
393 51, 48, 50, 52, 55, 56, 59, 49,
394 63, 60, 62, 61, 54, 57, 58, 53 };
395
396 static const UInt_t kChDdl52[64] = { 53, 58, 57, 54, 61, 62, 60, 63,
397 49, 59, 56, 55, 52, 50, 48, 51,
398 44, 47, 45, 43, 40, 39, 36, 46,
399 32, 35, 33, 34, 41, 38, 37, 42,
400 21, 26, 25, 22, 29, 30, 28, 31,
401 17, 27, 24, 23, 20, 18, 16, 19,
402 12, 15, 13, 11, 8, 7, 4, 14,
403 0, 3, 1, 2, 9, 6, 5, 10 };
404
405 for (Int_t i = 0; i < 64; i++)
08cf9354 406 {
407 if(imodule < 6) iCh[i] = kChDdl01[i];
408 if(imodule >= 6 && imodule <= 11) iCh[i] = kChDdl01[i];
409 if(imodule >= 12 && imodule <= 17) iCh[i] = kChDdl23[i];
410 if(imodule >= 18 && imodule <= 23) iCh[i] = kChDdl23[i];
411 if(imodule >= 24 && imodule <= 29) iCh[i] = kChDdl41[i];
412 if(imodule >= 42 && imodule <= 47) iCh[i] = kChDdl42[i];
413 if(imodule >= 36 && imodule <= 41) iCh[i] = kChDdl51[i];
414 if(imodule >= 30 && imodule <= 35) iCh[i] = kChDdl52[i];
415 }
40f4a63f 416
417
418 Int_t rowcol = iCh[chno];
34ab69dd 419 Int_t irownew = rowcol/4;
420 Int_t icolnew = rowcol%4;
a09a2da4 421
08cf9354 422
423 if (imodule < 6 )
a09a2da4 424 {
a0a6a406 425 row = startRowBus[pbusid] + irownew;
40f4a63f 426 col = startColBus[pbusid] + (mcmno-1)*4 + icolnew;
a09a2da4 427 }
08cf9354 428 else if (imodule >= 6 && imodule < 12)
a09a2da4 429 {
08cf9354 430 row = endRowBus[pbusid] - (15 - irownew);
431 col = startColBus[pbusid] + (mcmno-1)*4 + icolnew;
432
a09a2da4 433 }
08cf9354 434 else if (imodule >= 12 && imodule < 18 )
e54787da 435 {
34ab69dd 436 row = startRowBus[pbusid] + irownew;
40f4a63f 437 col = endColBus[pbusid] - (mcmno-1)*4 - (3 - icolnew);
34ab69dd 438 }
08cf9354 439 else if (imodule >= 18 && imodule < 24)
34ab69dd 440 {
08cf9354 441 row = endRowBus[pbusid] - (15 - irownew);
442 col = endColBus[pbusid] - (mcmno-1)*4 - (3 - icolnew);
e54787da 443 }
08cf9354 444 else if (imodule >= 24 && imodule < 30)
e54787da 445 {
08cf9354 446 Int_t rowdiff = endRowBus[pbusid] - startRowBus[pbusid];
447 if(rowdiff > 16)
e54787da 448 {
40f4a63f 449 if (mcmno <= 12)
34ab69dd 450 {
451 // Add 16 to skip the 1st 15 rows
452 row = startRowBus[pbusid] + irownew + 16;
40f4a63f 453 col = startColBus[pbusid] + (mcmno-1)*4 + icolnew;
34ab69dd 454 }
40f4a63f 455 else if(mcmno > 12)
93622f4a 456 {
457 row = startRowBus[pbusid] + irownew;
40f4a63f 458 col = startColBus[pbusid] + (mcmno-12-1)*4 + icolnew;
93622f4a 459 }
e54787da 460 }
08cf9354 461 else if (rowdiff < 16)
e54787da 462 {
08cf9354 463 row = startRowBus[pbusid] + irownew;
464 col = startColBus[pbusid] + (mcmno-1)*4 + icolnew;
e54787da 465 }
e54787da 466 }
08cf9354 467 else if (imodule >= 42 && imodule < 48)
e54787da 468 {
08cf9354 469 Int_t rowdiff = endRowBus[pbusid] - startRowBus[pbusid];
470
471 if (mcmno <= 12)
34ab69dd 472 {
08cf9354 473 col = endColBus[pbusid] - (mcmno-1)*4 - (3 - icolnew);
474
475 if(rowdiff > 16)
476 row = endRowBus[pbusid] - (15 - irownew) - 16 ;
34ab69dd 477 else
08cf9354 478 row = endRowBus[pbusid] - (15 - irownew) ;
479 }
480 else if(mcmno > 12)
481 {
482 row = endRowBus[pbusid] - (15 - irownew) ;
483 col = endColBus[pbusid] - (mcmno - 12 - 1)*4 - (3 - icolnew);
484 }
485 }
486
487
40f4a63f 488
08cf9354 489 else if (imodule >= 30 && imodule < 36)
490 {
491 if (mcmno > 12)
492 {
493 // Subtract 16 to skip the 1st 15 rows
494 row = endRowBus[pbusid] - 16 -(15 - irownew);
495 col = startColBus[pbusid] + (mcmno-12 -1)*4 + icolnew;
34ab69dd 496 }
08cf9354 497 else
498 {
499 row = endRowBus[pbusid] - (15 - irownew) ;
500 col = startColBus[pbusid] + (mcmno -1)*4 + icolnew;
501 }
502
503 }
a0a6a406 504
08cf9354 505 else if (imodule >= 36 && imodule < 42)
506 {
507 if(mcmno > 12)
e54787da 508 {
08cf9354 509 // Add 16 to skip the 1st 15 rows
510 row = startRowBus[pbusid] + irownew + 16;
511 col = endColBus[pbusid] - (mcmno - 12 - 1)*4 - (3 - icolnew);
512 }
513 else
514 {
515 row = startRowBus[pbusid] + irownew ;
516 col = endColBus[pbusid] - (mcmno - 1)*4 - (3 - icolnew);
e54787da 517 }
34ab69dd 518 }
08cf9354 519
520
34ab69dd 521}
522//_____________________________________________________________________________
523void AliPMDRawStream::ConvertDDL2SMN(Int_t iddl, Int_t imodule,
524 Int_t &smn, Int_t &detector) const
525{
526 // This converts the DDL number (0 to 5), Module Number (0-47)
527 // to Serial module number in one detector (SMN : 0-23) and
528 // detector number (0:PRE plane, 1:CPV plane)
529 if (iddl < 4)
530 {
531 smn = imodule;
532 detector = 0;
533 }
534 else
535 {
536 smn = imodule - 24;
e54787da 537 detector = 1;
538 }
539}
540//_____________________________________________________________________________
40f4a63f 541
e54787da 542void AliPMDRawStream::TransformH2S(Int_t smn, Int_t &row, Int_t &col) const
543{
34ab69dd 544 // This does the transformation of the hardware coordinate to
545 // software
546 // i.e., For SuperModule 0 &1, instead of 96x48(hardware),
547 // it is 48x96 (software)
e54787da 548 // For Supermodule 3 & 4, 48x96
549
e54787da 550 Int_t irownew = 0;
551 Int_t icolnew = 0;
34ab69dd 552
e54787da 553 if(smn < 12)
554 {
34ab69dd 555 irownew = col;
556 icolnew = row;
e54787da 557 }
34ab69dd 558 else if(smn >= 12 && smn < 24)
e54787da 559 {
34ab69dd 560 irownew = row;
561 icolnew = col;
e54787da 562 }
563
564 row = irownew;
565 col = icolnew;
566}
a98f9d26 567//_____________________________________________________________________________
722ccc67 568Int_t AliPMDRawStream::ComputeParity(UInt_t data)
a98f9d26 569{
570// Calculate the parity bit
571
572 Int_t count = 0;
573 for(Int_t j = 0; j<29; j++)
574 {
575 if (data & 0x01 ) count++;
576 data >>= 1;
577 }
578
579 Int_t parity = count%2;
580
581 return parity;
582}
583
e54787da 584//_____________________________________________________________________________
722ccc67 585UInt_t AliPMDRawStream::GetNextWord()
586{
587 // Returns the next 32 bit word
588 // inside the raw data payload.
589
590 if (!fData || fPosition < 0) AliFatal("Raw data payload buffer is not yet initialized !");
591
592 UInt_t word = 0;
593 word |= fData[fPosition++];
594 word |= fData[fPosition++] << 8;
595 word |= fData[fPosition++] << 16;
596 word |= fData[fPosition++] << 24;
597
598 return word;
599}
600
89f0ae35 601//_____________________________________________________________________________
3d8b8ac5 602void AliPMDRawStream::Ddl0Mapping(Int_t moduleNo[], Int_t mcmperBus[],
89f0ae35 603 Int_t startRowBus[], Int_t endRowBus[],
604 Int_t startColBus[], Int_t endColBus[])
605{
08cf9354 606 // DDL0 Mapping
89f0ae35 607
3d8b8ac5 608 Int_t iddl = 0;
89f0ae35 609
3d8b8ac5 610 for(Int_t ibus = 1; ibus < 51; ibus++)
89f0ae35 611 {
3d8b8ac5 612 moduleNo[ibus] = fMapData->GetModuleNo(iddl,ibus);
613 mcmperBus[ibus] = fMapData->GetMcmperBus(iddl,ibus);
614 startRowBus[ibus] = fMapData->GetStartRowBus(iddl,ibus);
615 startColBus[ibus] = fMapData->GetStartColBus(iddl,ibus);
616 endRowBus[ibus] = fMapData->GetEndRowBus(iddl,ibus);
617 endColBus[ibus] = fMapData->GetEndColBus(iddl,ibus);
89f0ae35 618 }
08cf9354 619
89f0ae35 620}
621
622//_____________________________________________________________________________
3d8b8ac5 623void AliPMDRawStream::Ddl1Mapping(Int_t moduleNo[], Int_t mcmperBus[],
89f0ae35 624 Int_t startRowBus[], Int_t endRowBus[],
625 Int_t startColBus[], Int_t endColBus[])
626{
08cf9354 627 // DDL1 Mapping
89f0ae35 628
3d8b8ac5 629 Int_t iddl = 1;
89f0ae35 630
3d8b8ac5 631 for(Int_t ibus = 1; ibus < 51; ibus++)
89f0ae35 632 {
3d8b8ac5 633 moduleNo[ibus] = fMapData->GetModuleNo(iddl,ibus);
634 mcmperBus[ibus] = fMapData->GetMcmperBus(iddl,ibus);
635 startRowBus[ibus] = fMapData->GetStartRowBus(iddl,ibus);
636 startColBus[ibus] = fMapData->GetStartColBus(iddl,ibus);
637 endRowBus[ibus] = fMapData->GetEndRowBus(iddl,ibus);
638 endColBus[ibus] = fMapData->GetEndColBus(iddl,ibus);
08cf9354 639
89f0ae35 640 }
3d8b8ac5 641
08cf9354 642
89f0ae35 643}
644
645//_____________________________________________________________________________
3d8b8ac5 646void AliPMDRawStream::Ddl2Mapping(Int_t moduleNo[], Int_t mcmperBus[],
89f0ae35 647 Int_t startRowBus[], Int_t endRowBus[],
648 Int_t startColBus[], Int_t endColBus[])
649{
08cf9354 650 // DDL2 Mapping
89f0ae35 651
3d8b8ac5 652 Int_t iddl = 2;
08cf9354 653
3d8b8ac5 654 for(Int_t ibus = 1; ibus < 51; ibus++)
89f0ae35 655 {
3d8b8ac5 656 moduleNo[ibus] = fMapData->GetModuleNo(iddl,ibus);
657 mcmperBus[ibus] = fMapData->GetMcmperBus(iddl,ibus);
658 startRowBus[ibus] = fMapData->GetStartRowBus(iddl,ibus);
659 startColBus[ibus] = fMapData->GetStartColBus(iddl,ibus);
660 endRowBus[ibus] = fMapData->GetEndRowBus(iddl,ibus);
661 endColBus[ibus] = fMapData->GetEndColBus(iddl,ibus);
08cf9354 662
89f0ae35 663 }
08cf9354 664
89f0ae35 665}
666
667//_____________________________________________________________________________
3d8b8ac5 668void AliPMDRawStream::Ddl3Mapping(Int_t moduleNo[], Int_t mcmperBus[],
89f0ae35 669 Int_t startRowBus[], Int_t endRowBus[],
670 Int_t startColBus[], Int_t endColBus[])
671{
08cf9354 672 // DDL3 Mapping
89f0ae35 673
3d8b8ac5 674 Int_t iddl = 3;
08cf9354 675
3d8b8ac5 676 for(Int_t ibus = 1; ibus < 51; ibus++)
89f0ae35 677 {
3d8b8ac5 678 moduleNo[ibus] = fMapData->GetModuleNo(iddl,ibus);
679 mcmperBus[ibus] = fMapData->GetMcmperBus(iddl,ibus);
680 startRowBus[ibus] = fMapData->GetStartRowBus(iddl,ibus);
681 startColBus[ibus] = fMapData->GetStartColBus(iddl,ibus);
682 endRowBus[ibus] = fMapData->GetEndRowBus(iddl,ibus);
683 endColBus[ibus] = fMapData->GetEndColBus(iddl,ibus);
08cf9354 684
89f0ae35 685 }
08cf9354 686
89f0ae35 687}
688
689//_____________________________________________________________________________
3d8b8ac5 690void AliPMDRawStream::Ddl4Mapping(Int_t moduleNo[], Int_t mcmperBus[],
89f0ae35 691 Int_t startRowBus[], Int_t endRowBus[],
692 Int_t startColBus[], Int_t endColBus[])
693{
08cf9354 694 // DDL4 Mapping
89f0ae35 695
3d8b8ac5 696 Int_t iddl = 4;
89f0ae35 697
3d8b8ac5 698 for(Int_t ibus = 1; ibus < 51; ibus++)
08cf9354 699 {
3d8b8ac5 700 moduleNo[ibus] = fMapData->GetModuleNo(iddl,ibus);
701 mcmperBus[ibus] = fMapData->GetMcmperBus(iddl,ibus);
702 startRowBus[ibus] = fMapData->GetStartRowBus(iddl,ibus);
703 startColBus[ibus] = fMapData->GetStartColBus(iddl,ibus);
704 endRowBus[ibus] = fMapData->GetEndRowBus(iddl,ibus);
705 endColBus[ibus] = fMapData->GetEndColBus(iddl,ibus);
08cf9354 706
89f0ae35 707 }
3d8b8ac5 708
08cf9354 709
89f0ae35 710}
711
712//_____________________________________________________________________________
3d8b8ac5 713void AliPMDRawStream::Ddl5Mapping(Int_t moduleNo[], Int_t mcmperBus[],
89f0ae35 714 Int_t startRowBus[], Int_t endRowBus[],
715 Int_t startColBus[], Int_t endColBus[])
716{
08cf9354 717 // DDL5 Mapping
89f0ae35 718
3d8b8ac5 719 Int_t iddl = 5;
89f0ae35 720
3d8b8ac5 721 for(Int_t ibus = 1; ibus < 51; ibus++)
08cf9354 722 {
3d8b8ac5 723 moduleNo[ibus] = fMapData->GetModuleNo(iddl,ibus);
724 mcmperBus[ibus] = fMapData->GetMcmperBus(iddl,ibus);
725 startRowBus[ibus] = fMapData->GetStartRowBus(iddl,ibus);
726 startColBus[ibus] = fMapData->GetStartColBus(iddl,ibus);
727 endRowBus[ibus] = fMapData->GetEndRowBus(iddl,ibus);
728 endColBus[ibus] = fMapData->GetEndColBus(iddl,ibus);
08cf9354 729
89f0ae35 730 }
3d8b8ac5 731
732}
733//_____________________________________________________________________________
734
735AliPMDMappingData* AliPMDRawStream::GetMappingData() const
736{
737 // Fetching the mapping data from CDB
738
739 AliCDBEntry *entry = AliCDBManager::Instance()->Get("PMD/Calib/Mapping");
740
741 if(!entry) AliFatal("Mapping object retrieval failed!");
08cf9354 742
3d8b8ac5 743 AliPMDMappingData *mapdata=0;
744 if (entry) mapdata = (AliPMDMappingData*) entry->GetObject();
745
746 if (!mapdata) AliFatal("No Mapping data from CDB !");
747
748 return mapdata;
89f0ae35 749}
750
751
3d8b8ac5 752
753//_____________________________________________________________________________
754