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