]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
used AliBitPacking
authorbnandi <bnandi@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 2 Jul 2004 15:51:31 +0000 (15:51 +0000)
committerbnandi <bnandi@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 2 Jul 2004 15:51:31 +0000 (15:51 +0000)
PMD/AliPMDDDLRawData.cxx
PMD/AliPMDDDLRawData.h

index de121d57bccb88e10b17765077f37cec6feadd20..ccdd34a459318d94c47393a528369d64fd465d4f 100644 (file)
@@ -20,6 +20,7 @@
 #include <TMath.h>
 
 #include "AliRawDataHeader.h"
+#include "AliBitPacking.h"
 #include "AliPMDdigit.h"
 #include "AliPMDRawStream.h"
 #include "AliPMDDDLRawData.h"
@@ -147,7 +148,7 @@ void AliPMDDDLRawData::GetUMDigitsData(TTree *treeD, Int_t imodule, Int_t ium,
                                       UInt_t *buffer)
 {
 
-  UInt_t dataword, baseword;
+  UInt_t baseword;
 
   UInt_t mcmno, chno;
   UInt_t adc;
@@ -211,18 +212,11 @@ void AliPMDDDLRawData::GetUMDigitsData(TTree *treeD, Int_t imodule, Int_t ium,
       GetMCMCh(ddlno, ium, irownew, icolnew, mcmno, chno);
 
       baseword = 0;
-      dataword = adc;
-      PackWord(0, 11,dataword,baseword);
-      dataword = chno;
-      PackWord(12,17,dataword,baseword);
-      dataword = mcmno;
-      PackWord(18,28,dataword,baseword);
-      dataword = 0;
-      PackWord(29,29,dataword,baseword);
-      dataword = 0;
-      PackWord(30,30,dataword,baseword);
-      dataword = 1;
-      PackWord(31,31,dataword,baseword);
+      AliBitPacking::PackWord(adc,baseword,0,11);
+      AliBitPacking::PackWord(chno,baseword,12,17);
+      AliBitPacking::PackWord(mcmno,baseword,18,28);
+      AliBitPacking::PackWord(0,baseword,29,30);
+      AliBitPacking::PackWord(1,baseword,31,31);
       
       buffer[ient] = baseword;
       
@@ -301,47 +295,3 @@ void AliPMDDDLRawData::GetMCMCh(Int_t ddlno, Int_t um,
 }
 //____________________________________________________________________________
 
-void AliPMDDDLRawData::PackWord(UInt_t startbit, UInt_t stopbit, 
-                               UInt_t dataword, UInt_t &packedword)
-{
-  UInt_t bitLength  = stopbit - startbit + 1;
-  UInt_t bitContent = (UInt_t) (TMath::Power(2,bitLength) - 1);
-  if(bitContent < dataword)
-    {
-      cout << " *** ERROR *** bitContent is less than the dataword" << endl;
-      return;
-    }
-  UInt_t packedBits = 0;
-  if (packedword != 0)
-    packedBits = (UInt_t) (TMath::Log(packedword)/TMath::Log(2));
-
-  UInt_t counter;
-  if (packedBits <= stopbit)
-    {
-      counter   = 31 - stopbit;
-    }
-  else
-    {
-      counter   = 31 - packedBits;
-    }
-  UInt_t dummyword = 0xFFFFFFFF;
-  dummyword >>= counter;
-  UInt_t lword = dataword << startbit;
-  UInt_t nword = lword | packedword;
-  packedword = dummyword & nword;
-
-
-}
-//____________________________________________________________________________
-void AliPMDDDLRawData::UnpackWord(UInt_t startbit, UInt_t stopbit, 
-                               UInt_t &dataword, UInt_t packedword)
-{
-  UInt_t bitLength  = stopbit - startbit + 1;
-  UInt_t bitContent = (UInt_t) (TMath::Power(2,bitLength) - 1);
-  bitContent <<= startbit;
-  dataword = packedword & bitContent;
-  dataword >>= startbit;
-
-}
-//____________________________________________________________________________
-
index 26ff0e3ad82f8a9c16304418b03f3074c90ce168..51f86a6dfe15ae32a7db5e2b5b554393e89a8c1f 100644 (file)
@@ -34,10 +34,6 @@ class AliPMDDDLRawData:public TObject
                       Int_t & totword, UInt_t *buffer);
   void GetMCMCh(Int_t ddlno, Int_t um, Int_t row, Int_t col,
                UInt_t &mcmno, UInt_t &chno);
-  void PackWord(UInt_t startbit, UInt_t stopbit, UInt_t dataword, 
-               UInt_t &packedword);
-  void UnpackWord(UInt_t startbit, UInt_t stopbit, UInt_t &dataword, 
-                 UInt_t packedword);
 
 
  protected: