parity bit is introduced
authorbnandi <bnandi@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 10 Feb 2007 07:26:12 +0000 (07:26 +0000)
committerbnandi <bnandi@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 10 Feb 2007 07:26:12 +0000 (07:26 +0000)
PMD/AliPMDDDLRawData.cxx
PMD/AliPMDDDLRawData.h
PMD/AliPMDRawStream.cxx
PMD/AliPMDRawStream.h
PMD/PMDrecLinkDef.h
PMD/libPMDrec.pkg

index 2a59aef..83fe314 100644 (file)
@@ -359,6 +359,7 @@ void AliPMDDDLRawData::GetUMDigitsData(TTree *treeD, Int_t imodule,
   UInt_t mcmno, chno;
   UInt_t adc;
   Int_t  det, smn, irow, icol;
+  Int_t  parity;
 
   const Int_t kMaxBus = 50;
   Int_t totPatchBus, bPatchBus, ePatchBus;
@@ -483,7 +484,8 @@ void AliPMDDDLRawData::GetUMDigitsData(TTree *treeD, Int_t imodule,
       AliBitPacking::PackWord(chno,baseword,12,17);
       AliBitPacking::PackWord(mcmno,baseword,18,28);
       AliBitPacking::PackWord(0,baseword,29,30);
-      AliBitPacking::PackWord(1,baseword,31,31);
+      parity = ComputeParity(baseword);      // generate the parity bit
+      AliBitPacking::PackWord(parity,baseword,31,31);
 
       Int_t jj = contentsBus[busno];
       busPatch[busno][jj] = baseword;
@@ -676,3 +678,19 @@ void AliPMDDDLRawData::GetMCMCh(Int_t ddlno, Int_t row, Int_t col,
 }
 //____________________________________________________________________________
 
+Int_t AliPMDDDLRawData::ComputeParity(UInt_t baseword)
+{
+  // Generate the parity bit
+
+  Int_t count = 0;
+  for(Int_t j=0; j<29; j++)
+    {
+      if (baseword & 0x01 ) count++;
+      baseword >>= 1;
+    }
+  Int_t parity = count%2;
+  return parity;
+}
+
+//____________________________________________________________________________
+
index 1cf705d..f6c651b 100644 (file)
@@ -38,12 +38,14 @@ class AliPMDDDLRawData:public TObject
                Int_t *endRowBus, Int_t *endColBus,
                Int_t & busno, UInt_t &mcmno, UInt_t &chno);
 
+
  protected:
 
+  Int_t ComputeParity(UInt_t baseword);
+
   TClonesArray *fDigits;    //! List of digits
-  //  AliPMDdigit  *fPMDdigit;  //! Pointer to digits
 
-  ClassDef(AliPMDDDLRawData,6)    // To make RAW Data
+  ClassDef(AliPMDDDLRawData,7)    // To make RAW Data
 };
 #endif
 
index d8db2b1..e53298b 100644 (file)
@@ -92,7 +92,6 @@ Bool_t AliPMDRawStream::DdlData(Int_t indexDDL, TObjArray *pmdddlcont)
   Int_t  iddl  = fRawReader->GetDDLID();
   Int_t dataSize = fRawReader->GetDataSize();
   Int_t totaldataword = dataSize/4;
-  Int_t equipId = fRawReader->GetEquipmentId();
 
   if (dataSize <= 0) return kFALSE;
   if (indexDDL != iddl)
@@ -203,7 +202,7 @@ Bool_t AliPMDRawStream::DdlData(Int_t indexDDL, TObjArray *pmdddlcont)
   const Int_t kdspHLen  = dspHeader.GetHeaderLength();
   const Int_t kpbusHLen = pbusHeader.GetHeaderLength();
   
-
+  Int_t parity;
   Int_t idet, ismn;
   Int_t irow = -1;
   Int_t icol = -1;
@@ -277,6 +276,11 @@ Bool_t AliPMDRawStream::DdlData(Int_t indexDDL, TObjArray *pmdddlcont)
                  Int_t imcm = (data >> 18) & 0x07FF;
                  Int_t ibit = (data >> 31) & 0x0001;
 
+                 parity = ComputeParity(data);
+                 if (ibit != parity)
+                   {
+                     AliWarning("ComputeParity:: Parity Error");
+                   }
                  GetRowCol(iddl, pbusid, imcm, ich, 
                            startRowBus, endRowBus,
                            startColBus, endColBus,
@@ -498,4 +502,23 @@ void AliPMDRawStream::TransformH2S(Int_t smn, Int_t &row, Int_t &col) const
   row = irownew;
   col = icolnew;
 }
+
+//_____________________________________________________________________________
+
+int AliPMDRawStream::ComputeParity(Int_t data)
+{
+// Calculate the parity bit
+
+  Int_t count = 0;
+  for(Int_t j = 0; j<29; j++)
+    {
+      if (data & 0x01 ) count++;
+      data >>= 1;
+    }
+  
+  Int_t parity = count%2;
+
+  return parity;
+}
+
 //_____________________________________________________________________________
index 38aea85..0bb5b0b 100644 (file)
@@ -37,6 +37,7 @@ class AliPMDRawStream: public TObject {
     void             ConvertDDL2SMN(Int_t iddl, Int_t imodule,
                                    Int_t &smn, Int_t &detector) const;
     void             TransformH2S(Int_t smn, Int_t &row, Int_t &col) const;
+    int              ComputeParity(Int_t data);
 
     AliRawReader*    fRawReader;    // object for reading the raw data
 
index b49aa7d..4c21899 100644 (file)
@@ -17,6 +17,7 @@
 #pragma link C++ class  AliPMDClusteringV1+;
 #pragma link C++ class  AliPMDClusteringV2+;
 #pragma link C++ class  AliPMDclupid+;
+#pragma link C++ class  AliPMDcludata+;
 #pragma link C++ class  AliPMDDiscriminator+;
 #pragma link C++ class  AliPMDEmpDiscriminator+;
 #pragma link C++ class  AliPMDClusterFinder+;
index ac6d806..5ee6713 100644 (file)
@@ -1,9 +1,9 @@
 #-*- Mode: Makefile -*-
 # $Id$
 
-SRCS:= AliPMDRecPoint.cxx AliPMDUtility.cxx AliPMDrecpoint1.cxx AliPMDrechit.cxx AliPMDcluster.cxx AliPMDClusteringV1.cxx AliPMDClusteringV2.cxx AliPMDclupid.cxx AliPMDEmpDiscriminator.cxx AliPMDClusterFinder.cxx AliPMDtracker.cxx AliPMDReconstructor.cxx
+SRCS:= AliPMDRecPoint.cxx AliPMDUtility.cxx AliPMDrecpoint1.cxx AliPMDrechit.cxx AliPMDcluster.cxx AliPMDClusteringV1.cxx AliPMDClusteringV2.cxx AliPMDclupid.cxx AliPMDEmpDiscriminator.cxx AliPMDClusterFinder.cxx AliPMDtracker.cxx AliPMDReconstructor.cxx AliPMDcludata.cxx
 
-HDRS:= $(SRCS:.cxx=.h) AliPMDClustering.h AliPMDDiscriminator.h
+HDRS:= $(SRCS:.cxx=.h) AliPMDClustering.h AliPMDDiscriminator.h AliPMDcludata.h
 
 DHDR:=PMDrecLinkDef.h