]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/TPCLib/AliHLTTPCRawDataUnpackerComponent.cxx
Fix compile error in debug mode
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCRawDataUnpackerComponent.cxx
index b0d4a83e0a07bb6c9369b3467a6ae30029a82305..7b914580892256033be6eca2fc94e0d39cdc2ab2 100644 (file)
 //                                                                           //
 // a TPC cluster finder processing component for the HLT                     //
 //                                                                           //
+// see header file for class documentation                                   //
+// or                                                                        //
+// refer to README to build package                                          //
+// or                                                                        //
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt                          //
+//                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 
-#if __GNUC__== 3
+#if __GNUC__>= 3
 using namespace std;
 #endif
 
@@ -33,240 +39,239 @@ using namespace std;
 #include "AliRawReaderMemory.h"
 #include "AliHLTTPCDigitData.h"
 #include "AliHLTTPCTransform.h"
-#include <stdlib.h>
-#include <errno.h>
-
-// this is a global object used for automatic component registration, do not use this
-AliHLTTPCRawDataUnpackerComponent gAliHLTTPCRawDataUnpackerComponent;
+#include "AliHLTTPCDefinitions.h"
+#include <cstdlib>
+#include <cerrno>
 
-ClassImp(AliHLTTPCRawDataUnpackerComponent)
+/** ROOT macro for the implementation of ROOT specific class methods */
+ClassImp(AliHLTTPCRawDataUnpackerComponent);
 
 AliHLTTPCRawDataUnpackerComponent::AliHLTTPCRawDataUnpackerComponent()
   :
   fRawMemoryReader(NULL),
   fTPCRawStream(NULL)
-{
-}
-
-AliHLTTPCRawDataUnpackerComponent::AliHLTTPCRawDataUnpackerComponent(const AliHLTTPCRawDataUnpackerComponent&)
-  :
-  fRawMemoryReader(NULL),
-  fTPCRawStream(NULL)
 {
   // see header file for class documentation
-}
-
-AliHLTTPCRawDataUnpackerComponent& AliHLTTPCRawDataUnpackerComponent::operator=(const AliHLTTPCRawDataUnpackerComponent&)
-{ 
-  // see header file for class documentation
-  return *this;
+  // or
+  // refer to README to build package
+  // or
+  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
 }
 
 AliHLTTPCRawDataUnpackerComponent::~AliHLTTPCRawDataUnpackerComponent()
 {
+  // see header file for class documentation
 }
 
 // Public functions to implement AliHLTComponent's interface.
 // These functions are required for the registration process
 
 const char* AliHLTTPCRawDataUnpackerComponent::GetComponentID()
-    {
-    return "TPCRawDataUnpacker";
-    }
+{
+  // see header file for class documentation
+  return "TPCRawDataUnpacker";
+}
 
 void AliHLTTPCRawDataUnpackerComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
-    {
-    list.clear();
-    list.push_back( AliHLTTPCDefinitions::fgkDDLPackedRawDataType );
-    }
+{
+  // see header file for class documentation
+  list.clear();
+  list.push_back( AliHLTTPCDefinitions::fgkDDLPackedRawDataType );
+}
 
 AliHLTComponentDataType AliHLTTPCRawDataUnpackerComponent::GetOutputDataType()
-    {
-    return AliHLTTPCDefinitions::fgkUnpackedRawDataType;
-    }
+{
+  // see header file for class documentation
+  return AliHLTTPCDefinitions::fgkUnpackedRawDataType;
+}
 
 void AliHLTTPCRawDataUnpackerComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
-    {
-    // XXX TODO: Find more realistic values.
-    constBase = 0;
-    inputMultiplier = 6.0;
-    }
+{
+  // see header file for class documentation
+  // XXX TODO: Find more realistic values.
+  constBase = 0;
+  inputMultiplier = 6.0;
+}
 
 AliHLTComponent* AliHLTTPCRawDataUnpackerComponent::Spawn()
-    {
-    return new AliHLTTPCRawDataUnpackerComponent;
-    }
-       
+{
+  // see header file for class documentation
+  return new AliHLTTPCRawDataUnpackerComponent;
+}
+
 int AliHLTTPCRawDataUnpackerComponent::DoInit( int argc, const char** argv )
-    {
-    if ( fRawMemoryReader || fTPCRawStream )
-       return EINPROGRESS;
+{
+  // see header file for class documentation
+  if ( fRawMemoryReader || fTPCRawStream )
+    return EINPROGRESS;
 
-    int i = 0;
-//     const char* tableFileBaseDir = NULL;
-    while ( i < argc )
-       {
-//     if ( !strcmp( argv[i], "table-dir" ) )
-//         {
-//         if ( i+1>=argc )
-//             {
-//             Logging(kHLTLogError, "HLT::TPCRawDataUnpacker::DoInit", "Missing Argument", "Missing -table-dir parameter");
-//             return ENOTSUP;
-//             }
-//         tableFileBaseDir = argv[i+1];
-//         i += 2;
-//         continue;
-//         }
-       Logging(kHLTLogError, "HLT::TPCRawDataUnpacker::DoInit", "Unknown Option", "Unknown option '%s'", argv[i] );
-       return EINVAL;
-       }
+  int i = 0;
+  //     const char* tableFileBaseDir = NULL;
+  while ( i < argc )
+    {
+      //       if ( !strcmp( argv[i], "table-dir" ) )
+      //           {
+      //           if ( i+1>=argc )
+      //               {
+      //               Logging(kHLTLogError, "HLT::TPCRawDataUnpacker::DoInit", "Missing Argument", "Missing -table-dir parameter");
+      //               return ENOTSUP;
+      //               }
+      //           tableFileBaseDir = argv[i+1];
+      //           i += 2;
+      //           continue;
+      //           }
+      Logging(kHLTLogError, "HLT::TPCRawDataUnpacker::DoInit", "Unknown Option", "Unknown option '%s'", argv[i] );
+      return EINVAL;
+    }
 
-//     if ( !tableFileBaseDir )
-//     {
-//     Logging(kHLTLogError, "HLT::TPCRawDataUnpacker::DoInit", "Table file directory missing ", 
-//             "Table file base directory has to be set using the -table-dir component parameter." );
-//     return EINVAL;
-//     }
+  //     if ( !tableFileBaseDir )
+  //   {
+  //   Logging(kHLTLogError, "HLT::TPCRawDataUnpacker::DoInit", "Table file directory missing ", 
+  //           "Table file base directory has to be set using the -table-dir component parameter." );
+  //   return EINVAL;
+  //   }
 
-    fRawMemoryReader = new AliRawReaderMemory;
-    //fTPCRawStream = new AliTPCRawStream( fRawMemoryReader, tableFileBaseDir );
-    fTPCRawStream = new AliTPCRawStream( fRawMemoryReader );
+  fRawMemoryReader = new AliRawReaderMemory;
+  //fTPCRawStream = new AliTPCRawStream( fRawMemoryReader, tableFileBaseDir );
+  fTPCRawStream = new AliTPCRawStream( fRawMemoryReader );
     
-    return 0;
-    }
+  return 0;
+}
 
 int AliHLTTPCRawDataUnpackerComponent::DoDeinit()
-    {
-    if ( fRawMemoryReader )
-       delete fRawMemoryReader;
-    fRawMemoryReader = NULL;
-    if ( fTPCRawStream )
-       delete fTPCRawStream;
-    fTPCRawStream = NULL;
-    return 0;
-    }
+{
+  // see header file for class documentation
+  if ( fRawMemoryReader )
+    delete fRawMemoryReader;
+  fRawMemoryReader = NULL;
+  if ( fTPCRawStream )
+    delete fTPCRawStream;
+  fTPCRawStream = NULL;
+  return 0;
+}
 
 int AliHLTTPCRawDataUnpackerComponent::DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, 
-                                             AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr, 
+                                             AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* outputPtr, 
                                              AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks )
-    {
-    const AliHLTComponentBlockData* iter = NULL;
-    unsigned long ndx;
+{
+  // see header file for class documentation
+  const AliHLTComponentBlockData* iter = NULL;
+  unsigned long ndx;
 
-    AliHLTUInt8_t* outBPtr;
-    AliHLTTPCUnpackedRawData* outPtr;
-    AliHLTTPCDigitRowData* currentRow;
-    AliHLTTPCDigitData* currentDigit;
-    unsigned long long outputSize = 0;
-    unsigned long blockOutputSize = 0;
-    unsigned long rowSize = 0;
-    Int_t slice, patch, rows[2];
-    outBPtr = outputPtr;
-    outPtr = (AliHLTTPCUnpackedRawData*)outputPtr;
-    currentRow = outPtr->fDigits;
-    currentDigit = currentRow->fDigitData;
+  AliHLTUInt8_t* outBPtr;
+  AliHLTTPCUnpackedRawData* outPtr;
+  AliHLTTPCDigitRowData* currentRow;
+  AliHLTTPCDigitData* currentDigit;
+  unsigned long long outputSize = 0;
+  unsigned long blockOutputSize = 0;
+  unsigned long rowSize = 0;
+  Int_t slice, patch, rows[2];
+  outBPtr = outputPtr;
+  outPtr = (AliHLTTPCUnpackedRawData*)outputPtr;
+  currentRow = outPtr->fDigits;
+  currentDigit = currentRow->fDigitData;
     
-    Logging( kHLTLogDebug, "HLT::TPCRawDataUnpackerSubscriber::DoEvent", "Event received", 
-            "Event 0x%08LX (%Lu) received with %lu blocks. Output data size: %lu",
-            evtData.fEventID, evtData.fEventID, evtData.fBlockCnt, size);
-    for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
+  Logging( kHLTLogDebug, "HLT::TPCRawDataUnpackerSubscriber::DoEvent", "Event received", 
+          "Event 0x%08LX (%Lu) received with %lu blocks. Output data size: %lu",
+          evtData.fEventID, evtData.fEventID, evtData.fBlockCnt, size);
+  for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
+    {
+      iter = blocks+ndx;
+      char tmp1[14], tmp2[14];
+      DataType2Text( iter->fDataType, tmp1 );
+      DataType2Text( AliHLTTPCDefinitions::fgkDDLPackedRawDataType, tmp2 );
+      Logging( kHLTLogDebug, "HLT::TPCRawDataUnpackerSubscriber::DoEvent", "Event received", 
+              "Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s",
+              evtData.fEventID, evtData.fEventID, tmp1, tmp2 );
+      if ( iter->fDataType != AliHLTTPCDefinitions::fgkDDLPackedRawDataType )
        {
-       iter = blocks+ndx;
-       char tmp1[14], tmp2[14];
-       DataType2Text( iter->fDataType, tmp1 );
-       DataType2Text( AliHLTTPCDefinitions::fgkDDLPackedRawDataType, tmp2 );
-       Logging( kHLTLogDebug, "HLT::TPCRawDataUnpackerSubscriber::DoEvent", "Event received", 
-                "Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s",
-                evtData.fEventID, evtData.fEventID, tmp1, tmp2 );
-       if ( iter->fDataType != AliHLTTPCDefinitions::fgkDDLPackedRawDataType )
-           {
-           continue;
-           }
-       slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter );
-       patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
-       rows[0] = AliHLTTPCTransform::GetFirstRow( patch );
-       rows[1] = AliHLTTPCTransform::GetLastRow( patch );
-       blockOutputSize = 0;
+         continue;
+       }
+      slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter );
+      patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
+      rows[0] = AliHLTTPCTransform::GetFirstRow( patch );
+      rows[1] = AliHLTTPCTransform::GetLastRow( patch );
+      blockOutputSize = 0;
 
-       Logging( kHLTLogDebug, "HLT::TPCRawDataUnpackerSubscriber::DoEvent", "Input Raw Packed Data", 
-                "Input: Slice/Patch/RowMin/RowMax: %d/%d/%d/%d.",
-                slice, patch, rows[0], rows[1] );
+      Logging( kHLTLogDebug, "HLT::TPCRawDataUnpackerSubscriber::DoEvent", "Input Raw Packed Data", 
+              "Input: Slice/Patch/RowMin/RowMax: %d/%d/%d/%d.",
+              slice, patch, rows[0], rows[1] );
 
-       fRawMemoryReader->SetMemory( reinterpret_cast<UChar_t*>( iter->fPtr ), iter->fSize );
-       bool readValue = true;
-       readValue = fTPCRawStream->Next();
-       int row = -1, oldRow = -1;
-       Int_t rowOffset = 0;
-       if ( patch >= 2 ) // Outer sector, patches 2, 3, 4, 5
-           rowOffset = AliHLTTPCTransform::GetFirstRow( 2 );
+      fRawMemoryReader->SetMemory( reinterpret_cast<UChar_t*>( iter->fPtr ), iter->fSize );
+      bool readValue = true;
+      readValue = fTPCRawStream->Next();
+      int row = -1, oldRow = -1;
+      Int_t rowOffset = 0;
+      if ( patch >= 2 ) // Outer sector, patches 2, 3, 4, 5
+       rowOffset = AliHLTTPCTransform::GetFirstRow( 2 );
 
-       while ( readValue )
+      while ( readValue )
+       {
+         row = fTPCRawStream->GetRow();
+         if ( row != oldRow )
            {
-           row = fTPCRawStream->GetRow();
-           if ( row != oldRow )
+             if ( oldRow!=-1 && rowSize != sizeof(AliHLTTPCDigitRowData)+currentRow->fNDigit*sizeof(AliHLTTPCDigitData) )
                {
-               if ( oldRow!=-1 && rowSize != sizeof(AliHLTTPCDigitRowData)+currentRow->fNDigit*sizeof(AliHLTTPCDigitData) )
-                   {
-                   Logging( kHLTLogFatal, "HLT::TPCRawDataUnpackerSubscriber::DoEvent", "Size inconsistency", 
-                            "Size inconsistency for row %d data: %lu != %lu (%lu digits).", oldRow, rowSize, 
-                            sizeof(AliHLTTPCDigitRowData)+currentRow->fNDigit*sizeof(AliHLTTPCDigitData), currentRow->fNDigit );
-                   }
-               rowSize = 0;
-               if ( size < outputSize+sizeof(AliHLTTPCDigitRowData) )
-                   {
-                   Logging( kHLTLogFatal, "HLT::TPCRawDataUnpackerSubscriber::DoEvent", "Too much data", 
-                            "Output data too big, output memory full. Aborting event 0x%08lX (%lu)" , 
-                            evtData.fEventID, evtData.fEventID );
-                   return 0;
-                   }
-               currentRow = (AliHLTTPCDigitRowData*)(outBPtr+outputSize);
-               currentDigit = currentRow->fDigitData;
-               currentRow->fRow = row+rowOffset;
-               currentRow->fNDigit = 0;
-               oldRow = row;
-               outputSize += sizeof(AliHLTTPCDigitRowData);
-               blockOutputSize += sizeof(AliHLTTPCDigitRowData);
-               rowSize += sizeof(AliHLTTPCDigitRowData);
+                 Logging( kHLTLogFatal, "HLT::TPCRawDataUnpackerSubscriber::DoEvent", "Size inconsistency", 
+                          "Size inconsistency for row %d data: %lu != %lu (%lu digits).", oldRow, rowSize, 
+                          sizeof(AliHLTTPCDigitRowData)+currentRow->fNDigit*sizeof(AliHLTTPCDigitData), currentRow->fNDigit );
                }
-           if ( size < outputSize+sizeof(AliHLTTPCDigitData) )
+             rowSize = 0;
+             if ( size < outputSize+sizeof(AliHLTTPCDigitRowData) )
                {
-               Logging( kHLTLogFatal, "HLT::TPCRawDataUnpackerSubscriber::DoEvent", "Too much data", 
-                        "Output data too big, output memory full. Aborting event 0x%08lX (%lu)" , 
-                        evtData.fEventID, evtData.fEventID );
-               return 0;
+                 Logging( kHLTLogFatal, "HLT::TPCRawDataUnpackerSubscriber::DoEvent", "Too much data", 
+                          "Output data too big, output memory full. Aborting event 0x%08lX (%lu)" , 
+                          evtData.fEventID, evtData.fEventID );
+                 return 0;
                }
-           currentDigit->fCharge = fTPCRawStream->GetSignal();
-           currentDigit->fPad = fTPCRawStream->GetPad();
-           currentDigit->fTime = fTPCRawStream->GetTime();
-           currentRow->fNDigit++;
-           currentDigit++;
-           outputSize += sizeof(AliHLTTPCDigitData);
-           blockOutputSize += sizeof(AliHLTTPCDigitData);
-           rowSize += sizeof(AliHLTTPCDigitData);
-           readValue = fTPCRawStream->Next();
+             currentRow = (AliHLTTPCDigitRowData*)(outBPtr+outputSize);
+             currentDigit = currentRow->fDigitData;
+             currentRow->fRow = row+rowOffset;
+             currentRow->fNDigit = 0;
+             oldRow = row;
+             outputSize += sizeof(AliHLTTPCDigitRowData);
+             blockOutputSize += sizeof(AliHLTTPCDigitRowData);
+             rowSize += sizeof(AliHLTTPCDigitRowData);
            }
-       if ( oldRow!=-1 && rowSize != sizeof(AliHLTTPCDigitRowData)+currentRow->fNDigit*sizeof(AliHLTTPCDigitData) )
+         if ( size < outputSize+sizeof(AliHLTTPCDigitData) )
            {
-           Logging( kHLTLogFatal, "HLT::TPCRawDataUnpackerSubscriber::DoEvent", "Size inconsistency", 
-                    "Size inconsistency for row %d data: %lu != %lu (%lu digits).", oldRow, rowSize, 
-                    sizeof(AliHLTTPCDigitRowData)+currentRow->fNDigit*sizeof(AliHLTTPCDigitData), currentRow->fNDigit );
+             Logging( kHLTLogFatal, "HLT::TPCRawDataUnpackerSubscriber::DoEvent", "Too much data", 
+                      "Output data too big, output memory full. Aborting event 0x%08lX (%lu)" , 
+                      evtData.fEventID, evtData.fEventID );
+             return 0;
            }
-
-       AliHLTComponentBlockData bd;
-       FillBlockData( bd );
-       bd.fOffset = outputSize-blockOutputSize;
-       bd.fSize = blockOutputSize;
-       bd.fSpecification = iter->fSpecification;
-       Logging( kHLTLogDebug, "HLT::TPCRawDataUnpackerSubscriber::DoEvent", "Event received", 
-                "Event 0x%08LX (%Lu) output data block %lu of %lu bytes at offset %lu",
-                evtData.fEventID, evtData.fEventID, ndx, blockOutputSize, outputSize-blockOutputSize );
-       //AliHLTSubEventDescriptor::FillBlockAttributes( bd.fAttributes );
-       outputBlocks.push_back( bd );
+         currentDigit->fCharge = fTPCRawStream->GetSignal();
+         currentDigit->fPad = fTPCRawStream->GetPad();
+         currentDigit->fTime = fTPCRawStream->GetTime();
+         currentRow->fNDigit++;
+         currentDigit++;
+         outputSize += sizeof(AliHLTTPCDigitData);
+         blockOutputSize += sizeof(AliHLTTPCDigitData);
+         rowSize += sizeof(AliHLTTPCDigitData);
+         readValue = fTPCRawStream->Next();
+       }
+      if ( oldRow!=-1 && rowSize != sizeof(AliHLTTPCDigitRowData)+currentRow->fNDigit*sizeof(AliHLTTPCDigitData) )
+       {
+         Logging( kHLTLogFatal, "HLT::TPCRawDataUnpackerSubscriber::DoEvent", "Size inconsistency", 
+                  "Size inconsistency for row %d data: %lu != %lu (%lu digits).", oldRow, rowSize, 
+                  sizeof(AliHLTTPCDigitRowData)+currentRow->fNDigit*sizeof(AliHLTTPCDigitData), currentRow->fNDigit );
        }
 
-    
-    size = outputSize;
-    return 0;
+      AliHLTComponentBlockData bd;
+      FillBlockData( bd );
+      bd.fOffset = outputSize-blockOutputSize;
+      bd.fSize = blockOutputSize;
+      bd.fSpecification = iter->fSpecification;
+      Logging( kHLTLogDebug, "HLT::TPCRawDataUnpackerSubscriber::DoEvent", "Event received", 
+              "Event 0x%08LX (%Lu) output data block %lu of %lu bytes at offset %lu",
+              evtData.fEventID, evtData.fEventID, ndx, blockOutputSize, outputSize-blockOutputSize );
+      //AliHLTSubEventDescriptor::FillBlockAttributes( bd.fAttributes );
+      outputBlocks.push_back( bd );
     }
 
+    
+  size = outputSize;
+  return 0;
+}
+