]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PMD/AliPMDRawStream.cxx
correcting doxygen warning
[u/mrichter/AliRoot.git] / PMD / AliPMDRawStream.cxx
index 3a6a058da2fb6088bcee5ac68e8face802d9f421..5a90f142c291c59e97389ebb389a21345bd7ac91 100644 (file)
 #include "AliPMDPatchBusHeader.h"
 #include "AliPMDddldata.h"
 #include "AliPMDRawStream.h"
+#include "AliPMDMappingData.h"
 #include "AliRawReader.h"
+#include "AliCDBManager.h"
+#include "AliCDBStorage.h"
+#include "AliCDBEntry.h"
 
 ClassImp(AliPMDRawStream)
 
@@ -46,7 +50,8 @@ ClassImp(AliPMDRawStream)
 AliPMDRawStream::AliPMDRawStream(AliRawReader* rawReader) :
     fRawReader(rawReader),
     fData(NULL),
-    fPosition(-1)
+    fPosition(-1),
+    fMapData(GetMappingData())
 {
 // create an object to read PMD raw digits
 
@@ -59,7 +64,8 @@ AliPMDRawStream::AliPMDRawStream(const AliPMDRawStream& stream) :
   TObject(stream),
   fRawReader(NULL),
   fData(NULL),
-  fPosition(-1)
+  fPosition(-1),
+  fMapData(GetMappingData())
 {
 // copy constructor
 
@@ -88,21 +94,20 @@ AliPMDRawStream::~AliPMDRawStream()
 
 Int_t AliPMDRawStream::DdlData(TObjArray *pmdddlcont)
 {
-// read the next raw digit
-// returns kFALSE if there is no digit left
-
-    
-
-    Int_t iddl = -1;
+  // read the next raw digit
+  // returns kFALSE if there is no digit left
+  
+  Int_t iddl = -1;
 
   AliPMDddldata *pmdddldata;
 
-  if (!fRawReader->ReadHeader()) return iddl;
+  if (!fRawReader->ReadHeader()) return -1;
 
   iddl           = fRawReader->GetDDLID();
   Int_t dataSize = fRawReader->GetDataSize();
   Int_t totaldataword = dataSize/4;
 
+
   if (dataSize <= 0) return -1;
 
   UInt_t data;
@@ -111,88 +116,58 @@ Int_t AliPMDRawStream::DdlData(TObjArray *pmdddlcont)
 
   fPosition = 0;
 
-  // --- Open the mapping file
 
-  TString fileName(gSystem->Getenv("ALICE_ROOT"));
-  if(iddl == 0)
-    {
-      fileName += "/PMD/PMD_Mapping_ddl0.dat";
-    }
-  else if(iddl == 1)
-    {
-      fileName += "/PMD/PMD_Mapping_ddl1.dat";
-    }
-  else if(iddl == 2)
-    {
-      fileName += "/PMD/PMD_Mapping_ddl2.dat";
-    }
-  else if(iddl == 3)
-    {
-      fileName += "/PMD/PMD_Mapping_ddl3.dat";
-    }
-  else if(iddl == 4)
-    {
-      fileName += "/PMD/PMD_Mapping_ddl4.dat";
-    }
-  else if(iddl == 5)
-    {
-      fileName += "/PMD/PMD_Mapping_ddl5.dat";
-    }
-
-  ifstream infile;
-  infile.open(fileName.Data(), ios::in); // ascii file
-
-  if(!infile) {
-    AliError(Form("Could not read the mapping file for DDL No = %d",iddl));
-    fRawReader->AddFatalErrorLog(kNoMappingFile,Form("ddl=%d",iddl));
-  }
-  
-  Int_t modulePerDDL = 0;
-  if (iddl < 4)
-    {
-      modulePerDDL = 6;
-    }
-  else if (iddl == 4 || iddl == 5)
-    {
-      modulePerDDL = 12;
-    }
+  Int_t ibus;
 
   const Int_t kNPatchBus = 51;
-  
-  Int_t modno, totPatchBus, bPatchBus, ePatchBus;
-  Int_t ibus, totmcm, rows, rowe, cols, cole;
+
   Int_t moduleNo[kNPatchBus], mcmperBus[kNPatchBus];
   Int_t startRowBus[kNPatchBus], endRowBus[kNPatchBus];
   Int_t startColBus[kNPatchBus], endColBus[kNPatchBus];
 
   for (ibus = 0; ibus < kNPatchBus; ibus++)
     {
+      moduleNo[ibus]    = -1;
       mcmperBus[ibus]   = -1;
       startRowBus[ibus] = -1;
       endRowBus[ibus]   = -1;
       startColBus[ibus] = -1;
       endColBus[ibus]   = -1;
     }
+  
+  if (iddl == 0)
+    {
+      Ddl0Mapping(moduleNo, mcmperBus, startRowBus, 
+                 endRowBus, startColBus, endColBus);
 
-  for (Int_t im = 0; im < modulePerDDL; im++)
+    }
+  else if (iddl == 1)
     {
-      infile >> modno;
-      infile >> totPatchBus >> bPatchBus >> ePatchBus;
+      Ddl1Mapping(moduleNo, mcmperBus, startRowBus, 
+                 endRowBus, startColBus, endColBus);
       
-      for(Int_t i=0; i<totPatchBus; i++)
-       {
-         infile >> ibus >> totmcm >> rows >> rowe >> cols >> cole;
-
-         moduleNo[ibus]     = modno;
-         mcmperBus[ibus]    = totmcm;
-         startRowBus[ibus]  = rows;
-         endRowBus[ibus]    = rowe;
-         startColBus[ibus]  = cols;
-         endColBus[ibus]    = cole;
-       }
     }
+  else if (iddl == 2)
+    {
+      Ddl2Mapping(moduleNo, mcmperBus, startRowBus, 
+                 endRowBus, startColBus, endColBus);
+    }
+  else if (iddl == 3)
+    {
+      Ddl3Mapping(moduleNo, mcmperBus, startRowBus, 
+                 endRowBus, startColBus, endColBus);
+    }
+  else if (iddl == 4)
+    {
+      Ddl4Mapping(moduleNo, mcmperBus, startRowBus, 
+                 endRowBus, startColBus, endColBus);
+    }
+  else if (iddl == 5)
+    {
+      Ddl5Mapping(moduleNo, mcmperBus, startRowBus, 
+                 endRowBus, startColBus, endColBus);
+  }
 
-  infile.close();
 
   AliPMDBlockHeader    blockHeader;
   AliPMDDspHeader      dspHeader;
@@ -211,76 +186,64 @@ Int_t AliPMDRawStream::DdlData(TObjArray *pmdddlcont)
   Int_t dspHeaderWord[10];
   Int_t pbusHeaderWord[4];
 
-  Int_t ilowLimit        = 0;
-  Int_t iuppLimit        = 0;
   Int_t blRawDataLength  = 0;
   Int_t dspRawDataLength = 0;
   Int_t iwordddl         = 2;
 
+
+
   for (Int_t iblock = 0; iblock < 2; iblock++)
     {
-      ilowLimit = iuppLimit;
-      iuppLimit = ilowLimit + kblHLen;
-
-      for (Int_t i = ilowLimit; i < iuppLimit; i++)
+      for (Int_t i = 0; i < kblHLen; i++)
        {
            iwordddl++;
 
-           blHeaderWord[i-ilowLimit] = (Int_t) GetNextWord();
+           blHeaderWord[i] = (Int_t) GetNextWord();
        }
 
       blockHeader.SetHeader(blHeaderWord);
       blRawDataLength = blockHeader.GetRawDataLength();
 
-      if (iwordddl == totaldataword) continue;
+      if (iwordddl == totaldataword) break;
 
       Int_t iwordblk = 0;
 
       for (Int_t idsp = 0; idsp < 5; idsp++)
        {
-
-
-         ilowLimit = iuppLimit;
-         iuppLimit = ilowLimit + kdspHLen;
-
-         for (Int_t i = ilowLimit; i < iuppLimit; i++)
+         for (Int_t i = 0; i < kdspHLen; i++)
            {
                iwordddl++;
                iwordblk++;
-               dspHeaderWord[i-ilowLimit] = (Int_t) GetNextWord();
+               dspHeaderWord[i] = (Int_t) GetNextWord();
            }
          dspHeader.SetHeader(dspHeaderWord);
          dspRawDataLength = dspHeader.GetRawDataLength();
 
-         if (iwordddl == totaldataword) continue;
+         if (iwordddl == totaldataword) break;
 
          Int_t iworddsp = 0;
 
          for (ibus = 0; ibus < 5; ibus++)
            {
-             ilowLimit = iuppLimit;
-             iuppLimit = ilowLimit + kpbusHLen;
-
-             for (Int_t i = ilowLimit; i < iuppLimit; i++)
+             for (Int_t i = 0; i < kpbusHLen; i++)
                {
                    iwordddl++;
                    iwordblk++;
                    iworddsp++;
-                 pbusHeaderWord[i-ilowLimit] = (Int_t) GetNextWord();
+                   pbusHeaderWord[i] = (Int_t) GetNextWord();
                }
 
              pbusHeader.SetHeader(pbusHeaderWord);
              Int_t rawdatalength = pbusHeader.GetRawDataLength();
              Int_t pbusid = pbusHeader.GetPatchBusId();
 
-             ilowLimit = iuppLimit;
-             iuppLimit = ilowLimit + rawdatalength;
+             if (pbusid < 0 || pbusid > 50) return -1;
 
              Int_t imodule = moduleNo[pbusid];
 
-             if (iwordddl == totaldataword) continue;
+             if (iwordddl == totaldataword) break;
 
-             for (Int_t iword = ilowLimit; iword < iuppLimit; iword++)
+             for (Int_t iword = 0; iword < rawdatalength; iword++)
                {
                    iwordddl++;
                    iwordblk++;
@@ -292,20 +255,30 @@ Int_t AliPMDRawStream::DdlData(TObjArray *pmdddlcont)
                  Int_t ich  = (data >> 12) & 0x003F;
                  Int_t imcm = (data >> 18) & 0x07FF;
                  Int_t ibit = (data >> 31) & 0x0001;
+
+                 if (imcm == 0)
+                   {
+                     AliWarning(Form("FEE address WRONG:: Module %d Patch Bus %d MCM %d",imodule,pbusid,imcm));
+                     return -1;
+                   }
+
                  parity = ComputeParity(data);
+
                  if (ibit != parity)
                    {
-                     AliWarning("ComputeParity:: Parity Error");
+                     AliWarning(Form("Parity Error:: Patch Bus %d Module %d",pbusid,imodule));
                      fRawReader->AddMajorErrorLog(kParityError);
+                     return -1;
                    }
 
                  ConvertDDL2SMN(iddl, imodule, ismn, idet);
 
-                 GetRowCol(iddl, ismn, pbusid, imcm, ich, 
+                 GetRowCol(imodule, pbusid, imcm, ich, 
                            startRowBus, endRowBus,
                            startColBus, endColBus,
                            irow, icol);
 
+
                  TransformH2S(ismn, irow, icol);
 
                  pmdddldata = new AliPMDddldata();
@@ -322,42 +295,51 @@ Int_t AliPMDRawStream::DdlData(TObjArray *pmdddlcont)
                  pmdddldata->SetParityBit(ibit);
                  
                  pmdddlcont->Add(pmdddldata);
-                 
+
                } // data word loop
 
+
              if (iwordddl == totaldataword) break;
 
-             if (iworddsp == dspRawDataLength) break; // raw data
+             if (dspHeader.GetPaddingWord() == 1)
+             {
+                 if (iworddsp == dspRawDataLength-1) break; // raw data
+             }
+             else
+             {
+                 if (iworddsp == dspRawDataLength) break; // raw data
+             }
+
 
            } // patch bus loop
 
+
          if (dspHeader.GetPaddingWord() == 1)
          {
-             iuppLimit++;
              iwordddl++;
              iwordblk++;
              iworddsp++;
              data = GetNextWord();
          }
+         if (iwordddl == totaldataword) break;
 
          if (iwordblk == blRawDataLength) break; // for raw data
 
+
        } // end of DSP
 
     } // end of BLOCK
   
-//  delete [] buffer;
-
   return iddl;
 }
 //_____________________________________________________________________________
-void AliPMDRawStream::GetRowCol(Int_t ddlno, Int_t smn, Int_t pbusid,
+void AliPMDRawStream::GetRowCol(Int_t imodule, Int_t pbusid,
                                UInt_t mcmno, UInt_t chno,
                                Int_t startRowBus[], Int_t endRowBus[],
                                Int_t startColBus[], Int_t endColBus[],
                                Int_t &row, Int_t &col) const
 {
-// decode: ddlno, patchbusid, mcmno, chno -> um, row, col
+  // decode: ddlno, patchbusid, mcmno, chno -> um, row, col
 
   UInt_t iCh[64];
 
@@ -416,45 +398,48 @@ void AliPMDRawStream::GetRowCol(Int_t ddlno, Int_t smn, Int_t pbusid,
                                       0, 3, 1, 2, 9, 6, 5, 10 };
   
   for (Int_t i = 0; i < 64; i++)
-  {
-      if (ddlno == 0 || ddlno == 1) iCh[i] = kChDdl01[i];
-      if (ddlno == 2 || ddlno == 3) iCh[i] = kChDdl23[i];
-      
-      if (ddlno == 4 && smn < 6)                iCh[i] = kChDdl41[i];
-      if (ddlno == 4 && (smn >= 18 && smn < 24))iCh[i] = kChDdl42[i];
-      if (ddlno == 5 && (smn >= 12 && smn < 18))iCh[i] = kChDdl51[i];
-      if (ddlno == 5 && (smn >=  6 && smn < 12))iCh[i] = kChDdl52[i];
-  }
+    {
+      if(imodule < 6)                    iCh[i] = kChDdl01[i];
+      if(imodule >= 6 && imodule <= 11)  iCh[i] = kChDdl01[i];
+      if(imodule >= 12 && imodule <= 17) iCh[i] = kChDdl23[i];
+      if(imodule >= 18 && imodule <= 23) iCh[i] = kChDdl23[i];
+      if(imodule >= 24 && imodule <= 29) iCh[i] = kChDdl41[i];
+      if(imodule >= 42 && imodule <= 47) iCh[i] = kChDdl42[i];
+      if(imodule >= 36 && imodule <= 41) iCh[i] = kChDdl51[i];
+      if(imodule >= 30 && imodule <= 35) iCh[i] = kChDdl52[i];
+    }
   
   
   Int_t rowcol  = iCh[chno];
   Int_t irownew = rowcol/4;
   Int_t icolnew = rowcol%4;
 
-  if (ddlno == 0 )
+
+  if (imodule < 6 )
     {
       row = startRowBus[pbusid] + irownew;
       col = startColBus[pbusid] + (mcmno-1)*4 + icolnew;
     }
-  else if (ddlno == 1)
+  else if (imodule >= 6 && imodule < 12)
     {
-    row = endRowBus[pbusid] - (15 - irownew);
-    col = startColBus[pbusid] + (mcmno-1)*4 + icolnew;
-    
+      row = endRowBus[pbusid] - (15 - irownew);
+      col = startColBus[pbusid] + (mcmno-1)*4 + icolnew;
+      
     }
-  else if (ddlno == 2 )
+  else if (imodule >= 12 && imodule < 18 )
     {
       row = startRowBus[pbusid] + irownew;
       col = endColBus[pbusid] - (mcmno-1)*4 - (3 - icolnew);
     }
-  else if (ddlno == 3)
+  else if (imodule >= 18 && imodule < 24)
     {
-    row = endRowBus[pbusid] - (15 - irownew);
-    col = endColBus[pbusid] - (mcmno-1)*4 - (3 - icolnew);
+      row = endRowBus[pbusid] - (15 - irownew);
+      col = endColBus[pbusid] - (mcmno-1)*4 - (3 - icolnew);
     }
-  else if (ddlno == 4 )
+  else if (imodule >= 24 && imodule < 30)
     {
-      if (pbusid  < 19)
+      Int_t rowdiff = endRowBus[pbusid] - startRowBus[pbusid];
+      if(rowdiff > 16)
        {
          if (mcmno <= 12)
            {
@@ -468,58 +453,66 @@ void AliPMDRawStream::GetRowCol(Int_t ddlno, Int_t smn, Int_t pbusid,
              col = startColBus[pbusid] + (mcmno-12-1)*4 + icolnew;
            }
        }
-      else if(pbusid > 18)
+      else if (rowdiff < 16)
        {
-         if (mcmno <= 12)
-           {
-             col = endColBus[pbusid] - (mcmno-1)*4 - (3 - icolnew); 
-
-             if(endRowBus[pbusid] - startRowBus[pbusid] > 16)
-               row = endRowBus[pbusid] - (15 - irownew) - 16 ;
-             else
-               row = endRowBus[pbusid] - (15 - irownew) ;
-           }
-         else if(mcmno > 12)
-           {
-             row = endRowBus[pbusid] - (15 - irownew)  ;
-             col = endColBus[pbusid] - (mcmno - 12 - 1)*4 - (3 - icolnew);
-           }
+         row = startRowBus[pbusid] + irownew;
+         col = startColBus[pbusid] + (mcmno-1)*4 + icolnew;
        }
     }
-  else if (ddlno == 5)
+  else if (imodule >= 42 && imodule < 48)
     {
-      if (pbusid  <= 18)
+      Int_t rowdiff = endRowBus[pbusid] - startRowBus[pbusid];
+
+      if (mcmno <= 12)
        {
-         if (mcmno > 12)
-           {
-             // Subtract 16 to skip the 1st 15 rows
-             row = endRowBus[pbusid] - 16 -(15 - irownew);
-             col = startColBus[pbusid] + (mcmno-12 -1)*4 + icolnew;
-           }
+         col = endColBus[pbusid] - (mcmno-1)*4 - (3 - icolnew); 
+         
+         if(rowdiff > 16)
+           row = endRowBus[pbusid] - (15 - irownew) - 16 ;
          else
-           {
-             row = endRowBus[pbusid]  - (15 - irownew) ;
-             col = startColBus[pbusid] + (mcmno -1)*4 + icolnew;
-           }
+           row = endRowBus[pbusid] - (15 - irownew) ;
+       }
+      else if(mcmno > 12)
+       {
+         row = endRowBus[pbusid] - (15 - irownew)  ;
+         col = endColBus[pbusid] - (mcmno - 12 - 1)*4 - (3 - icolnew);
+       }
+    }
 
+
+
+  else if (imodule >= 30 && imodule < 36)
+    {
+      if (mcmno > 12)
+       {
+         // Subtract 16 to skip the 1st 15 rows
+         row = endRowBus[pbusid] - 16 -(15 - irownew);
+         col = startColBus[pbusid] + (mcmno-12 -1)*4 + icolnew;
+       }
+      else
+       {
+         row = endRowBus[pbusid]  - (15 - irownew) ;
+         col = startColBus[pbusid] + (mcmno -1)*4 + icolnew;
        }
+
+    }
       
-      else if (pbusid > 18)
+  else if (imodule >= 36 && imodule < 42)
+    {
+      if(mcmno > 12)
        {
-         if(mcmno > 12)
-           {
-             // Add 16 to skip the 1st 15 rows
-             row = startRowBus[pbusid] + irownew + 16;
-             col = endColBus[pbusid] - (mcmno - 12 - 1)*4 - (3 - icolnew);
-           }
-         else 
-           {
-             row = startRowBus[pbusid] + irownew ;
-             col = endColBus[pbusid] - (mcmno - 1)*4 - (3 - icolnew); 
-           }
+         // Add 16 to skip the 1st 15 rows
+         row = startRowBus[pbusid] + irownew + 16;
+         col = endColBus[pbusid] - (mcmno - 12 - 1)*4 - (3 - icolnew);
+       }
+      else 
+       {
+         row = startRowBus[pbusid] + irownew ;
+         col = endColBus[pbusid] - (mcmno - 1)*4 - (3 - icolnew); 
        }
     }
-  
+
+
 }
 //_____________________________________________________________________________
 void AliPMDRawStream::ConvertDDL2SMN(Int_t iddl, Int_t imodule,
@@ -600,3 +593,157 @@ UInt_t AliPMDRawStream::GetNextWord()
     return word;
 }
 
+//_____________________________________________________________________________
+void AliPMDRawStream::Ddl0Mapping(Int_t moduleNo[],    Int_t mcmperBus[],
+                                 Int_t startRowBus[], Int_t endRowBus[],
+                                 Int_t startColBus[], Int_t endColBus[])
+{
+  // DDL0 Mapping 
+
+  Int_t iddl = 0;
+
+  for(Int_t ibus = 1; ibus < 51; ibus++)
+    {
+      moduleNo[ibus]     = fMapData->GetModuleNo(iddl,ibus);
+      mcmperBus[ibus]    = fMapData->GetMcmperBus(iddl,ibus);
+      startRowBus[ibus]  = fMapData->GetStartRowBus(iddl,ibus);
+      startColBus[ibus]  = fMapData->GetStartColBus(iddl,ibus);
+      endRowBus[ibus]    = fMapData->GetEndRowBus(iddl,ibus);
+      endColBus[ibus]    = fMapData->GetEndColBus(iddl,ibus);
+    }
+
+}
+
+//_____________________________________________________________________________
+void AliPMDRawStream::Ddl1Mapping(Int_t moduleNo[],    Int_t mcmperBus[],
+                                 Int_t startRowBus[], Int_t endRowBus[],
+                                 Int_t startColBus[], Int_t endColBus[])
+{
+  // DDL1 Mapping 
+
+  Int_t iddl = 1;
+
+  for(Int_t ibus = 1; ibus < 51; ibus++)
+    {
+      moduleNo[ibus]     = fMapData->GetModuleNo(iddl,ibus);
+      mcmperBus[ibus]    = fMapData->GetMcmperBus(iddl,ibus);
+      startRowBus[ibus]  = fMapData->GetStartRowBus(iddl,ibus);
+      startColBus[ibus]  = fMapData->GetStartColBus(iddl,ibus);
+      endRowBus[ibus]    = fMapData->GetEndRowBus(iddl,ibus);
+      endColBus[ibus]    = fMapData->GetEndColBus(iddl,ibus);
+         
+    }
+
+
+}
+
+//_____________________________________________________________________________
+void AliPMDRawStream::Ddl2Mapping(Int_t moduleNo[],    Int_t mcmperBus[],
+                                 Int_t startRowBus[], Int_t endRowBus[],
+                                 Int_t startColBus[], Int_t endColBus[])
+{
+  // DDL2 Mapping 
+
+  Int_t iddl = 2;
+
+  for(Int_t ibus = 1; ibus < 51; ibus++)
+    {
+      moduleNo[ibus]     = fMapData->GetModuleNo(iddl,ibus);
+      mcmperBus[ibus]    = fMapData->GetMcmperBus(iddl,ibus);
+      startRowBus[ibus]  = fMapData->GetStartRowBus(iddl,ibus);
+      startColBus[ibus]  = fMapData->GetStartColBus(iddl,ibus);
+      endRowBus[ibus]    = fMapData->GetEndRowBus(iddl,ibus);
+      endColBus[ibus]    = fMapData->GetEndColBus(iddl,ibus);
+         
+    }
+
+}
+
+//_____________________________________________________________________________
+void AliPMDRawStream::Ddl3Mapping(Int_t moduleNo[],    Int_t mcmperBus[],
+                                 Int_t startRowBus[], Int_t endRowBus[],
+                                 Int_t startColBus[], Int_t endColBus[])
+{
+  // DDL3 Mapping 
+
+  Int_t iddl = 3;
+
+  for(Int_t ibus = 1; ibus < 51; ibus++)
+    {
+      moduleNo[ibus]     = fMapData->GetModuleNo(iddl,ibus);
+      mcmperBus[ibus]    = fMapData->GetMcmperBus(iddl,ibus);
+      startRowBus[ibus]  = fMapData->GetStartRowBus(iddl,ibus);
+      startColBus[ibus]  = fMapData->GetStartColBus(iddl,ibus);
+      endRowBus[ibus]    = fMapData->GetEndRowBus(iddl,ibus);
+      endColBus[ibus]    = fMapData->GetEndColBus(iddl,ibus);
+         
+    }
+
+}
+
+//_____________________________________________________________________________
+void AliPMDRawStream::Ddl4Mapping(Int_t moduleNo[],    Int_t mcmperBus[],
+                                 Int_t startRowBus[], Int_t endRowBus[],
+                                 Int_t startColBus[], Int_t endColBus[])
+{
+  // DDL4 Mapping 
+
+  Int_t iddl = 4;
+
+  for(Int_t ibus = 1; ibus < 51; ibus++)
+    {
+      moduleNo[ibus]     = fMapData->GetModuleNo(iddl,ibus);
+      mcmperBus[ibus]    = fMapData->GetMcmperBus(iddl,ibus);
+      startRowBus[ibus]  = fMapData->GetStartRowBus(iddl,ibus);
+      startColBus[ibus]  = fMapData->GetStartColBus(iddl,ibus);
+      endRowBus[ibus]    = fMapData->GetEndRowBus(iddl,ibus);
+      endColBus[ibus]    = fMapData->GetEndColBus(iddl,ibus);
+         
+    }
+
+  
+}
+
+//_____________________________________________________________________________
+void AliPMDRawStream::Ddl5Mapping(Int_t moduleNo[],    Int_t mcmperBus[],
+                                 Int_t startRowBus[], Int_t endRowBus[],
+                                 Int_t startColBus[], Int_t endColBus[])
+{
+  // DDL5 Mapping 
+
+  Int_t iddl = 5;
+
+  for(Int_t ibus = 1; ibus < 51; ibus++)
+    {
+      moduleNo[ibus]     = fMapData->GetModuleNo(iddl,ibus);
+      mcmperBus[ibus]    = fMapData->GetMcmperBus(iddl,ibus);
+      startRowBus[ibus]  = fMapData->GetStartRowBus(iddl,ibus);
+      startColBus[ibus]  = fMapData->GetStartColBus(iddl,ibus);
+      endRowBus[ibus]    = fMapData->GetEndRowBus(iddl,ibus);
+      endColBus[ibus]    = fMapData->GetEndColBus(iddl,ibus);
+         
+    }
+
+}
+//_____________________________________________________________________________
+
+AliPMDMappingData* AliPMDRawStream::GetMappingData() const
+{
+  // Fetching the mapping data from CDB
+
+  AliCDBEntry  *entry = AliCDBManager::Instance()->Get("PMD/Calib/Mapping");
+  
+  if(!entry) AliFatal("Mapping object retrieval failed!");
+  
+  AliPMDMappingData *mapdata=0;
+  if (entry) mapdata = (AliPMDMappingData*) entry->GetObject();
+  
+  if (!mapdata)  AliFatal("No Mapping data from CDB !");
+  
+  return mapdata;
+}
+
+
+
+//_____________________________________________________________________________
+