]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONPayloadTracker.cxx
Adding HLTbase to the list of libraries
[u/mrichter/AliRoot.git] / MUON / AliMUONPayloadTracker.cxx
index 34b871db37663ca3f6d565c18afc67f8f57ca887..1868c6ed27e54052c8c3f48c1d8846d7559cf06a 100644 (file)
  **************************************************************************/
 
 
-///////////////////////////////////////////////////////////////////////////////
-///
-/// Class Payload
 ///
+/// \class AliMUONPayloadTracker
 /// Decodes rawdata from buffer and stores in TClonesArray.
-/// 
 /// First version implement for Tracker
 ///
-///////////////////////////////////////////////////////////////////////////////
+/// \author Christian Finck
 
 #include "AliMUONPayloadTracker.h"
 
 #include "AliRawReader.h"
 #include "AliRawDataHeader.h"
+
+#ifndef DATE_SYS
 #include "AliLog.h"
+#endif
 
 #include "AliMUONDspHeader.h"
 #include "AliMUONBlockHeader.h"
 #include "AliMUONBusStruct.h"
 #include "AliMUONDDLTracker.h"
 
+/// \cond CLASSIMP
 ClassImp(AliMUONPayloadTracker)
+/// \endcond
 
 AliMUONPayloadTracker::AliMUONPayloadTracker()
   : TObject(),
+    fBusPatchId(0),
+    fDspId(0),
+    fBlkId(0),
+    fMaxDDL(20),
     fMaxBlock(2),
     fMaxDsp(5),
-    fMaxBus(5)
+    fMaxBus(5),
+    fDDLTracker(new AliMUONDDLTracker()),
+    fBusStruct(new AliMUONBusStruct()),
+    fBlockHeader(new AliMUONBlockHeader()),
+    fDspHeader(new AliMUONDspHeader())
 {
-  //
-  // create an object to decode MUON payload
-  //
-
-  fDDLTracker      = new AliMUONDDLTracker();
-  fBusStruct       = new AliMUONBusStruct();
-  fBlockHeader     = new AliMUONBlockHeader();
-  fDspHeader       = new AliMUONDspHeader();
-}
+  ///
+  /// create an object to decode MUON payload
+  ///
 
-//_________________________________________________________________
-AliMUONPayloadTracker::AliMUONPayloadTracker(const AliMUONPayloadTracker& stream) :
-  TObject(stream)
-{ 
-  //
-  // copy ctor
-  //
-  AliFatal("copy constructor not implemented");
 }
 
-//______________________________________________________________________
-AliMUONPayloadTracker& AliMUONPayloadTracker::operator = (const AliMUONPayloadTracker& 
-                                             /* stream */)
-{
-  // 
-  // assignment operator
-  //
-  AliFatal("assignment operator not implemented");
-  return *this;
-}
-
-
 //___________________________________
 AliMUONPayloadTracker::~AliMUONPayloadTracker()
 {
-  //
-  // clean up
-  //
+  ///
+  /// clean up
+  ///
   delete fDDLTracker;
   delete fBusStruct;
   delete fBlockHeader;
@@ -91,11 +75,11 @@ AliMUONPayloadTracker::~AliMUONPayloadTracker()
 Bool_t AliMUONPayloadTracker::Decode(UInt_t* buffer, Int_t totalDDLSize)
 {
 
-  // Each DDL is made with 2 Blocks each of which consists of 5 DSP's at most 
-  // and each of DSP has at most 5 buspatches.
-  // The different structures, Block (CRT), DSP (FRT) and Buspatch,
-  // are identified by a key word 0xFC0000FC, 0xF000000F and 0xB000000B respectively.
-  // (fBusPatchManager no more needed !)
+  /// Each DDL is made with 2 Blocks each of which consists of 5 DSP's at most 
+  /// and each of DSP has at most 5 buspatches.
+  /// The different structures, Block (CRT), DSP (FRT) and Buspatch,
+  /// are identified by a key word 0xFC0000FC, 0xF000000F and 0xB000000B respectively.
+  /// (fBusPatchManager no more needed !)
 
 
   //Read Header Size of DDL,Block,DSP and BusPatch
@@ -182,6 +166,9 @@ Bool_t AliMUONPayloadTracker::Decode(UInt_t* buffer, Int_t totalDDLSize)
            fBusStruct->SetBlockId(iBlock); // could be usefull in future applications ?
            fBusStruct->SetDspId(iDsp);
 
+           // check parity
+           CheckDataParity();
+
            // copy in TClonesArray
            fDDLTracker->AddBusPatch(*fBusStruct, iBlock, iDsp);
 
@@ -200,8 +187,13 @@ Bool_t AliMUONPayloadTracker::Decode(UInt_t* buffer, Int_t totalDDLSize)
       // skipping additionnal word if padding
       if (fDspHeader->GetPaddingWord() == 1) {
        if (buffer[index++] != fDspHeader->GetDefaultPaddingWord())
+
+#ifndef DATE_SYS
          AliWarning(Form("Error in padding word for iBlock %d, iDsp %d, iBus %d\n", 
                          iBlock, iDsp, iBusPatch));
+#else
+       printf("Error in padding word for iBlock %d, iDsp %d, iBus %d\n", iBlock, iDsp, iBusPatch);
+#endif
       }
 
       index = indexDsp + totalDspSize;
@@ -226,45 +218,50 @@ Bool_t AliMUONPayloadTracker::Decode(UInt_t* buffer, Int_t totalDDLSize)
 //______________________________________________________
 void AliMUONPayloadTracker::ResetDDL()
 {
-  // reseting TClonesArray
-  // after each DDL
-  //
+  /// reseting TClonesArray
+  /// after each DDL
+  ///
   fDDLTracker->GetBlkHeaderArray()->Delete();
 }
 
 //______________________________________________________
 void AliMUONPayloadTracker::SetMaxBlock(Int_t blk) 
 {
-  // set regional card number
+  /// set regional card number
   if (blk > 2) blk = 2;
   fMaxBlock = blk;
 }
 
+//______________________________________________________
 Bool_t AliMUONPayloadTracker::CheckDataParity()
 {
-  // parity check
-  // taken from MuTrkBusPatch.cxx (sotfware test for CROCUS)
-  // A. Baldisseri
+  /// parity check
+  /// taken from MuTrkBusPatch.cxx (sotfware test for CROCUS)
+  /// A. Baldisseri
 
-  Int_t  parity, bit;
+  Int_t  parity;
   UInt_t data;
   
   Int_t dataSize = fBusStruct->GetLength();
   for (int idata = 0; idata < dataSize; idata++) {
 
     data  = fBusStruct->GetData(idata);
-    // Compute the parity for each data word
-    parity = data & 0x1;
 
-    for (Int_t i = 1; i <= 30; i++) {
-      bit = ((data >> i) & 0x1);
-      parity = (parity || bit) && (!(parity && bit));
-    } 
+    // Compute the parity for each data word
+    parity  = data & 0x1;
+    for (Int_t i = 1; i <= 30; i++) 
+      parity ^= ((data >> i) & 0x1);
 
     // Check
     if (parity != fBusStruct->GetParity(idata)) {
+#ifndef DATE_SYS
       AliWarning(Form("Parity error in word %d for manuId %d and channel %d\n", 
                      idata, fBusStruct->GetManuId(idata), fBusStruct->GetChannelId(idata)));
+#else
+      printf("Parity error in word %d for manuId %d and channel %d\n", 
+            idata, fBusStruct->GetManuId(idata), fBusStruct->GetChannelId(idata));
+#endif
+
       return kFALSE;
                     
     }