]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
AliHLTTPCCAInputDataCompressorComponent created
authorsgorbuno <sgorbuno@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 21 Oct 2009 21:42:03 +0000 (21:42 +0000)
committersgorbuno <sgorbuno@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 21 Oct 2009 21:42:03 +0000 (21:42 +0000)
The component compressed the information from the clusterfinder and send it to the slice tracker
It can be optionally used after the clusterfinder on the same machine in order to reduce the data transfer.
The data compression ratio is about 4.5(pp)/5.5(Centr.Pb)
The speed is about 600kHz/patch (pp) and 1.6kHz/patch (Centr.Pb)

HLT/TPCLib/AliHLTTPCAgent.cxx
HLT/TPCLib/tracking-ca/AliHLTTPCCACompressedInputData.h [new file with mode: 0644]
HLT/TPCLib/tracking-ca/AliHLTTPCCADef.h
HLT/TPCLib/tracking-ca/AliHLTTPCCAInputDataCompressorComponent.cxx [new file with mode: 0644]
HLT/TPCLib/tracking-ca/AliHLTTPCCAInputDataCompressorComponent.h [new file with mode: 0644]
HLT/TPCLib/tracking-ca/AliHLTTPCCATrackerComponent.cxx
HLT/libAliHLTTPC.pkg

index 02567d749a3547464c9e16bc838638317eb4c959..775640ebeafc7868cdaed57ddb3b9ffdaf1f0b11 100644 (file)
@@ -46,6 +46,7 @@ AliHLTTPCAgent gAliHLTTPCAgent;
 //#include "AliHLTTPCCalibCEComponent.h"
 //#include "AliHLTTPCCalibPulserComponent.h"
 //#include "AliHLTTPCCalibPedestalComponent.h"
+#include "AliHLTTPCCAInputDataCompressorComponent.h"
 #include "AliHLTTPCCATrackerComponent.h"
 #include "AliHLTTPCTrackMCMarkerComponent.h"
 #include "AliHLTTPCCAGlobalMergerComponent.h"
@@ -266,6 +267,7 @@ int AliHLTTPCAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const
   pHandler->AddComponent(new AliHLTTPCCompModelDeconverterComponent);
   pHandler->AddComponent(new AliHLTTPCCompModelConverterComponent);
   pHandler->AddComponent(new AliHLTTPCCompDumpComponent);
+  pHandler->AddComponent(new AliHLTTPCCAInputDataCompressorComponent);
   pHandler->AddComponent(new AliHLTTPCCATrackerComponent);
   pHandler->AddComponent(new AliHLTTPCCAGlobalMergerComponent);
   pHandler->AddComponent(new AliHLTTPCTrackMCMarkerComponent);
diff --git a/HLT/TPCLib/tracking-ca/AliHLTTPCCACompressedInputData.h b/HLT/TPCLib/tracking-ca/AliHLTTPCCACompressedInputData.h
new file mode 100644 (file)
index 0000000..4f89dec
--- /dev/null
@@ -0,0 +1,45 @@
+#ifndef ALIHLTTPCCACOMPRESSEDINPUTDATA_H
+#define ALIHLTTPCCACOMPRESSEDINPUTDATA_H
+
+#include "AliHLTTPCRootTypes.h"
+
+
+/**
+ * @struct AliHLTTPCCACompressedCluster
+ * Data structure to pack the TPC clusters
+ * before send them to the TPCCASliceTracker component.
+ * Data is packed in 8 bytes: fP0={p03,..,p00}, fP1={p13,..,p10} 
+ * X cluster(    p13,p03) = rowX+( ((fP1&0xF000)>>16)+(fP0>>24)-32768. )*1.e-4
+ * Y cluster(p02,p01,p00) = ( (fP0&0xFFF) - 8388608. )*1.e-4
+ * Z cluster(p12,p11,p10) = ( (fP1&0xFFF) - 8388608. )*1.e-4
+ */
+struct AliHLTTPCCACompressedCluster{
+  UInt_t fP0;       // First  4 bytes of the packed data
+  UInt_t fP1;       // Second 4 bytes of the packed data
+};
+typedef struct AliHLTTPCCACompressedCluster AliHLTTPCCACompressedCluster;
+
+
+/**
+ * @struct AliHLTTPCCACompressedClusterRow
+ * Data structure to pack the TPC clusters
+ * before send them to the TPCCASliceTracker component.
+ * contains the PadRow information
+ */
+struct AliHLTTPCCACompressedClusterRow
+{
+  UShort_t fSlicePatchRowID; // packed slice, patch and row number 
+                             // ((slice<<10)+(patch<<6)+row)
+                             // the row number is local withing the patch
+  UShort_t fNClusters;  // number of clusters in the row
+
+#if defined(__HP_aCC) || defined(__DECCXX) || defined(__SUNPRO_CC)
+  AliHLTTPCCACompressedCluster  fClusters[1]; // array of assigned clusters  
+#else
+  AliHLTTPCCACompressedCluster  fClusters[0]; // array of assigned clusters 
+#endif
+};
+typedef struct AliHLTTPCCACompressedClusterRow AliHLTTPCCACompressedClusterRow;
+
+
+#endif
index 9903e792baa88effa2896118ca52626dbabe04a3..c55a4b646bd9b76231c1a758013051c2b640d015 100644 (file)
@@ -100,6 +100,7 @@ typedef float          Size_t;      //Attribute size (float)
 namespace AliHLTTPCCADefinitions
 {
   extern const AliHLTComponentDataType fgkTrackletsDataType;
+  extern const AliHLTComponentDataType fgkCompressedInputDataType;
 }
 
 #endif
diff --git a/HLT/TPCLib/tracking-ca/AliHLTTPCCAInputDataCompressorComponent.cxx b/HLT/TPCLib/tracking-ca/AliHLTTPCCAInputDataCompressorComponent.cxx
new file mode 100644 (file)
index 0000000..6b64aa3
--- /dev/null
@@ -0,0 +1,287 @@
+// **************************************************************************
+// This file is property of and copyright by the ALICE HLT Project          *
+// ALICE Experiment at CERN, All rights reserved.                           *
+//                                                                          *
+// Primary Authors: Sergey Gorbunov <sergey.gorbunov@kip.uni-heidelberg.de> *
+//                  Ivan Kisel <kisel@kip.uni-heidelberg.de>                *
+//                  for The ALICE HLT Project.                              *
+//                                                                          *
+// Permission to use, copy, modify and distribute this software and its     *
+// documentation strictly for non-commercial purposes is hereby granted     *
+// without fee, provided that the above copyright notice appears in all     *
+// copies and that both the copyright notice and this permission notice     *
+// appear in the supporting documentation. The authors make no claims       *
+// about the suitability of this software for any purpose. It is            *
+// provided "as is" without express or implied warranty.                    *
+//                                                                          *
+//***************************************************************************
+
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+// a TPC tracker processing component for the HLT based on CA by Ivan Kisel  //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#if __GNUC__>= 3
+using namespace std;
+#endif
+
+#include "AliHLTTPCCAInputDataCompressorComponent.h"
+#include "AliHLTTPCCACompressedInputData.h"
+#include "AliHLTTPCTransform.h"
+#include "AliHLTTPCClusterDataFormat.h"
+#include "AliHLTTPCSpacePointData.h"
+#include "AliHLTTPCDefinitions.h"
+#include "AliHLTTPCCADef.h"
+#include "TStopwatch.h"
+
+
+const AliHLTComponentDataType AliHLTTPCCADefinitions::fgkCompressedInputDataType = AliHLTComponentDataTypeInitializer( "CAINPACK", kAliHLTDataOriginTPC );
+
+/** ROOT macro for the implementation of ROOT specific class methods */
+ClassImp( AliHLTTPCCAInputDataCompressorComponent )
+
+AliHLTTPCCAInputDataCompressorComponent::AliHLTTPCCAInputDataCompressorComponent()
+  :
+  AliHLTProcessor(),
+  fTotalTime( 0 ),
+  fTotalInputSize( 0 ),
+  fTotalOutputSize( 0 ),
+  fNEvents( 0 )
+{
+  // see header file for class documentation
+  // or
+  // refer to README to build package
+  // or
+  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+}
+
+AliHLTTPCCAInputDataCompressorComponent::AliHLTTPCCAInputDataCompressorComponent( const AliHLTTPCCAInputDataCompressorComponent& )
+  :
+  AliHLTProcessor(),
+  fTotalTime( 0 ),
+  fTotalInputSize( 0 ),
+  fTotalOutputSize( 0 ),
+  fNEvents( 0 )
+{
+  // see header file for class documentation
+  HLTFatal( "copy constructor untested" );
+}
+
+AliHLTTPCCAInputDataCompressorComponent& AliHLTTPCCAInputDataCompressorComponent::operator=( const AliHLTTPCCAInputDataCompressorComponent& )
+{
+  // see header file for class documentation
+  HLTFatal( "assignment operator untested" );
+  return *this;
+}
+
+AliHLTTPCCAInputDataCompressorComponent::~AliHLTTPCCAInputDataCompressorComponent()
+{
+  // see header file for class documentation  
+}
+
+//
+// Public functions to implement AliHLTComponent's interface.
+// These functions are required for the registration process
+//
+
+const char* AliHLTTPCCAInputDataCompressorComponent::GetComponentID()
+{
+  // see header file for class documentation
+  return "TPCCAInputDataCompressor";
+}
+
+void AliHLTTPCCAInputDataCompressorComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list )
+{
+  // see header file for class documentation
+  list.clear();
+  list.push_back( AliHLTTPCDefinitions::fgkClustersDataType );
+}
+
+AliHLTComponentDataType AliHLTTPCCAInputDataCompressorComponent::GetOutputDataType()
+{
+  // see header file for class documentation
+  return AliHLTTPCCADefinitions::fgkCompressedInputDataType;
+}
+
+void AliHLTTPCCAInputDataCompressorComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
+{
+  // define guess for the output data size
+  constBase = 200;       // minimum size
+  inputMultiplier = 0.25; // size relative to input
+}
+
+AliHLTComponent* AliHLTTPCCAInputDataCompressorComponent::Spawn()
+{
+  // see header file for class documentation
+  return new AliHLTTPCCAInputDataCompressorComponent;
+}
+
+
+
+
+int AliHLTTPCCAInputDataCompressorComponent::DoInit( int /*argc*/, const char** /*argv*/ )
+{
+  // Configure the CA tracker component
+  fTotalTime = 0;
+  fTotalInputSize = 0;
+  fTotalOutputSize = 0; 
+  fNEvents = 0;
+  return 0;
+}
+
+
+int AliHLTTPCCAInputDataCompressorComponent::DoDeinit()
+{
+  // see header file for class documentation
+  return 0;
+}
+
+
+
+int AliHLTTPCCAInputDataCompressorComponent::Reconfigure( const char* /*cdbEntry*/, const char* /*chainId*/ )
+{
+  // Reconfigure the component from OCDB .
+  return 0;
+}
+
+
+
+int AliHLTTPCCAInputDataCompressorComponent::DoEvent
+(
+  const AliHLTComponentEventData& evtData,
+  const AliHLTComponentBlockData* blocks,
+  AliHLTComponentTriggerData& /*trigData*/,
+  AliHLTUInt8_t* outputPtr,
+  AliHLTUInt32_t& size,
+  vector<AliHLTComponentBlockData>& outputBlocks )
+{
+  //* process event
+
+  AliHLTUInt32_t maxBufferSize = size;
+  size = 0; // output size
+
+  if ( GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR ) ) {
+    return 0;
+  }
+
+  TStopwatch timer;
+
+  // Preprocess the data for CA Slice Tracker
+
+  if ( evtData.fBlockCnt <= 0 ) {
+    HLTWarning( "no blocks in event" );
+    return 0;
+  }
+
+  Int_t ret = 0;
+
+  Int_t inTotalSize = 0;    
+  Int_t outTotalSize = 0;
+  Int_t minSlice = 100;
+  Int_t maxSlice = -1;
+
+  for ( unsigned long ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) {
+    const AliHLTComponentBlockData* iter = blocks + ndx;
+    if ( iter->fDataType != AliHLTTPCDefinitions::fgkClustersDataType ) continue;    
+
+    if( minSlice>AliHLTTPCDefinitions::GetMinSliceNr( *iter ) ) minSlice = AliHLTTPCDefinitions::GetMinSliceNr( *iter ) ;
+    if( maxSlice<AliHLTTPCDefinitions::GetMaxSliceNr( *iter ) ) maxSlice = AliHLTTPCDefinitions::GetMaxSliceNr( *iter ) ;
+   
+   
+    inTotalSize += iter->fSize;
+
+    AliHLTTPCClusterData* inPtrSP = ( AliHLTTPCClusterData* )( iter->fPtr );    
+
+    AliHLTTPCCACompressedCluster *outCluster = (AliHLTTPCCACompressedCluster*)( outputPtr+outTotalSize );
+    AliHLTTPCCACompressedClusterRow *outRow = 0;
+
+    Int_t dSize = 0;
+    UShort_t oldId = 0;
+    for ( unsigned int i = 0; i < inPtrSP->fSpacePointCnt; i++ ){ 
+      AliHLTTPCSpacePointData *cluster = &( inPtrSP->fSpacePoints[i] );
+      UInt_t origId = cluster->fID;
+      UInt_t patch = (origId>>22)&0x7;
+      UInt_t slice = origId>>25;
+      UInt_t row = cluster->fPadRow;
+      Double_t rowX = AliHLTTPCTransform::Row2X( row );
+      row = row - AliHLTTPCTransform::GetFirstRow( patch );
+      UShort_t id = (UShort_t)( (slice<<10) +(patch<<6) + row );
+      if( i==0 || id!= oldId ){ 
+       // fill new row header  
+       outRow = (AliHLTTPCCACompressedClusterRow*) outCluster;
+       outCluster = outRow->fClusters;  
+       dSize+= ( ( AliHLTUInt8_t * )outCluster ) -  (( AliHLTUInt8_t * )outRow);
+       if ( outTotalSize + dSize > (int) maxBufferSize ) break;
+       outRow->fSlicePatchRowID = id;  
+       outRow->fNClusters = 0;
+       oldId = id;
+       //cout<<"Fill row: s "<<slice<<" p "<<patch<<" r "<<row<<" x "<<outRow->fX<<":"<<endl;
+      }
+    
+      // pack the cluster
+      {
+       // get coordinates in [um]
+       
+       Double_t x = (cluster->fX - rowX )*1.e4 + 32768.;
+       Double_t y = (cluster->fY)*1.e4 + 8388608.;
+       Double_t z = (cluster->fZ)*1.e4 + 8388608.;
+       
+       // truncate if necessary
+       if( x<0 ) x = 0; else if( x > 0x0000FFFF ) x = 0x0000FFFF;
+       if( y<0 ) y = 0; else if( y > 0x00FFFFFF ) y = 0x00FFFFFF;
+       if( z<0 ) z = 0; else if( z > 0x00FFFFFF ) z = 0x00FFFFFF;
+       
+       UInt_t ix0 =  ( (UInt_t) x )&0x000000FF;
+       UInt_t ix1 = (( (UInt_t) x )&0x0000FF00 )>>8;
+       UInt_t iy = ( (UInt_t) y )&0x00FFFFFF;
+       UInt_t iz = ( (UInt_t) z )&0x00FFFFFF;
+       
+       dSize+= sizeof( AliHLTTPCCACompressedCluster );
+       if ( outTotalSize + dSize > (int) maxBufferSize ) break;      
+       outCluster->fP0 = (ix0<<24) + iy;
+       outCluster->fP1 = (ix1<<24) + iz;      
+       outCluster++;
+       outRow->fNClusters++;
+       //cout<<"clu "<<outRow->fNClusters-1<<": "<<cluster->fX<<" "<<cluster->fY<<" "<<cluster->fZ<<" "<<cluster->fID<<endl;
+      }
+    }
+    
+    if ( outTotalSize + dSize > (int) maxBufferSize ) {
+      HLTWarning( "Output buffer size exceed (buffer size %d, current size %d)", maxBufferSize, outTotalSize+ dSize );
+      ret = -ENOSPC;
+      break;
+    }    
+    AliHLTComponentBlockData bd;
+    FillBlockData( bd );
+    bd.fOffset = outTotalSize;
+    bd.fSize = dSize;
+    bd.fSpecification = iter->fSpecification;
+    bd.fDataType = GetOutputDataType();
+    outputBlocks.push_back( bd );
+    outTotalSize+=dSize;    
+  }
+
+  size = outTotalSize;
+  
+  timer.Stop();
+  
+  fTotalTime += timer.RealTime();
+  fTotalInputSize+= inTotalSize;
+  fTotalOutputSize+= outTotalSize;
+  fNEvents++;
+
+  if( maxSlice<0 ) minSlice = -1;
+  Int_t hz = ( int ) ( fTotalTime > 1.e-10 ? fNEvents / fTotalTime : 100000 );
+  Float_t ratio = 0;
+  if( fTotalOutputSize>0 ) ratio = (Float_t ) (fTotalInputSize/fTotalOutputSize);
+
+  // Set log level to "Warning" for on-line system monitoring
+  
+  HLTInfo( "CAInputDataCompressor, slices %d-%d: speed %d Hz, ratio %f, %d events", minSlice, maxSlice, hz, ratio, fNEvents );
+
+  return ret;
+}
+
+
diff --git a/HLT/TPCLib/tracking-ca/AliHLTTPCCAInputDataCompressorComponent.h b/HLT/TPCLib/tracking-ca/AliHLTTPCCAInputDataCompressorComponent.h
new file mode 100644 (file)
index 0000000..7840f80
--- /dev/null
@@ -0,0 +1,85 @@
+//-*- Mode: C++ -*-
+// ************************************************************************
+// This file is property of and copyright by the ALICE HLT Project        *
+// ALICE Experiment at CERN, All rights reserved.                         *
+// See cxx source for full Copyright notice                               *
+//                                                                        *
+//*************************************************************************
+
+#ifndef ALIHLTTPCCAINPUTDATACOMPRESSORCOMPONENT_H
+#define ALIHLTTPCCAINPUTDATACOMPRESSORCOMPONENT_H
+
+#include "AliHLTProcessor.h"
+
+/**
+ * @class AliHLTTPCCAInputDataCompressorComponent
+ *
+ * The component produces a compressed TPC data for the Cellular Automaton tracker.
+ * Can be optionally used after the clusterfinder.
+ * It extracts from HLT clusters information needed by the tracker, and skips the rest.
+ * The compress ratio is about 4.7 times
+ * 
+ */
+class AliHLTTPCCAInputDataCompressorComponent : public AliHLTProcessor
+{
+  public:
+    /** standard constructor */
+    AliHLTTPCCAInputDataCompressorComponent();
+
+    /** dummy copy constructor, defined according to effective C++ style */
+    AliHLTTPCCAInputDataCompressorComponent( const AliHLTTPCCAInputDataCompressorComponent& );
+
+    /** dummy assignment op, but defined according to effective C++ style */
+    AliHLTTPCCAInputDataCompressorComponent& operator=( const AliHLTTPCCAInputDataCompressorComponent& );
+
+    /** standard destructor */
+    virtual ~AliHLTTPCCAInputDataCompressorComponent();
+
+    // Public functions to implement AliHLTComponent's interface.
+    // These functions are required for the registration process
+
+    /** @see component interface @ref AliHLTComponent::GetComponentID */
+    const char* GetComponentID() ;
+
+    /** @see component interface @ref AliHLTComponent::GetInputDataTypes */
+    void GetInputDataTypes( vector<AliHLTComponentDataType>& list )  ;
+
+    /** @see component interface @ref AliHLTComponent::GetOutputDataType */
+    AliHLTComponentDataType GetOutputDataType() ;
+
+    /** @see component interface @ref AliHLTComponent::GetOutputDataSize */
+    virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) ;
+
+    /** @see component interface @ref AliHLTComponent::Spawn */
+    AliHLTComponent* Spawn() ;
+
+  protected:
+
+    // Protected functions to implement AliHLTComponent's interface.
+    // These functions provide initialization as well as the actual processing
+    // capabilities of the component.
+
+    /** @see component interface @ref AliHLTComponent::DoInit */
+    int DoInit( int argc, const char** argv );
+
+    /** @see component interface @ref AliHLTComponent::DoDeinit */
+    int DoDeinit();
+
+    /** reconfigure **/
+    int Reconfigure( const char* cdbEntry, const char* chainId );
+
+    /** @see component interface @ref AliHLTProcessor::DoEvent */
+    int DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
+                 AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr,
+                 AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks );
+
+  private:
+
+    double fTotalTime; //* total time for DoEvent() [s]
+    double fTotalInputSize; //* total input size in [bytes]
+    double fTotalOutputSize; //* total output size in [bytes]
+    Long_t fNEvents;  //* number of reconstructed events
+
+    ClassDef( AliHLTTPCCAInputDataCompressorComponent, 0 );
+};
+#endif
index 53ce81e6870cffd1a2651accca8e80528ab06a3c..bcfaa506e69d488a2b224c8bc0708cc97030cd03 100644 (file)
@@ -38,6 +38,7 @@ using namespace std;
 
 #include "AliHLTTPCSpacePointData.h"
 #include "AliHLTTPCClusterDataFormat.h"
+#include "AliHLTTPCCACompressedInputData.h"
 #include "AliHLTTPCTransform.h"
 #include "AliHLTTPCTrackSegmentData.h"
 #include "AliHLTTPCTrackArray.h"
@@ -127,6 +128,7 @@ void AliHLTTPCCATrackerComponent::GetInputDataTypes( vector<AliHLTComponentDataT
   // see header file for class documentation
   list.clear();
   list.push_back( AliHLTTPCDefinitions::fgkClustersDataType );
+  list.push_back( AliHLTTPCCADefinitions::fgkCompressedInputDataType );
 }
 
 AliHLTComponentDataType AliHLTTPCCATrackerComponent::GetOutputDataType()
@@ -140,7 +142,7 @@ void AliHLTTPCCATrackerComponent::GetOutputDataSize( unsigned long& constBase, d
 {
   // define guess for the output data size
   constBase = 200;       // minimum size
-  inputMultiplier = 0.5; // size relative to input
+  inputMultiplier = 3.; // size relative to input
 }
 
 AliHLTComponent* AliHLTTPCCATrackerComponent::Spawn()
@@ -396,7 +398,6 @@ int AliHLTTPCCATrackerComponent::DoEvent
 
   const AliHLTComponentBlockData* iter = NULL;
   unsigned long ndx;
-  AliHLTTPCClusterData* inPtrSP;
 
   // Determine the slice number
 
@@ -411,7 +412,9 @@ int AliHLTTPCCATrackerComponent::DoEvent
 
     for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) {
       iter = blocks + ndx;
-      if ( iter->fDataType != AliHLTTPCDefinitions::fgkClustersDataType ) continue;
+      if ( iter->fDataType != AliHLTTPCDefinitions::fgkClustersDataType
+          && iter->fDataType != AliHLTTPCCADefinitions::fgkCompressedInputDataType
+          ) continue;
 
       slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter );
          if (slice < minslice || minslice == -1) minslice = slice;
@@ -566,10 +569,21 @@ int AliHLTTPCCATrackerComponent::DoEvent
 
          for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) {
                iter = blocks + ndx;
-               if ( iter->fDataType != AliHLTTPCDefinitions::fgkClustersDataType ) continue;
                if ( slice != AliHLTTPCDefinitions::GetMinSliceNr( *iter ) ) continue;
-               inPtrSP = ( AliHLTTPCClusterData* )( iter->fPtr );
-               nClustersTotal += inPtrSP->fSpacePointCnt;
+               if ( iter->fDataType == AliHLTTPCDefinitions::fgkClustersDataType ){
+                 AliHLTTPCClusterData* inPtrSP = ( AliHLTTPCClusterData* )( iter->fPtr );
+                 nClustersTotal += inPtrSP->fSpacePointCnt;
+               } 
+               else if ( iter->fDataType == AliHLTTPCCADefinitions::fgkCompressedInputDataType){
+                 const AliHLTUInt8_t * inPtr =  (const AliHLTUInt8_t *)iter->fPtr;
+                 while( inPtr< ((const AliHLTUInt8_t *) iter->fPtr) + iter->fSize ){
+                   AliHLTTPCCACompressedClusterRow *row = (AliHLTTPCCACompressedClusterRow*)inPtr;
+                   nClustersTotal+= row->fNClusters;     
+                   inPtr = (const AliHLTUInt8_t *)(row->fClusters+row->fNClusters);
+                 }
+               }
+               else continue;
+
                int patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
                if ( sliceminPatch[islice] > patch ) {
                  sliceminPatch[islice] = patch;
@@ -599,22 +613,61 @@ int AliHLTTPCCATrackerComponent::DoEvent
          for ( std::vector<unsigned long>::iterator pIter = patchIndices.begin(); pIter != patchIndices.end(); pIter++ ) {
                ndx = *pIter;
                iter = blocks + ndx;
-
                int patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
-               inPtrSP = ( AliHLTTPCClusterData* )( iter->fPtr );
-
-               Logging( kHLTLogDebug, "HLT::TPCCATracker::DoEvent", "Reading hits",
-                                "Reading %d hits for slice %d - patch %d", inPtrSP->fSpacePointCnt, slice, patch );
-
-               for ( unsigned int i = 0; i < inPtrSP->fSpacePointCnt; i++ ) {
-                 AliHLTTPCSpacePointData *c = &( inPtrSP->fSpacePoints[i] );
-                 if ( CAMath::Abs( c->fZ ) > fClusterZCut ) continue;
-                 if ( c->fPadRow > 159 ) {
-                       HLTError( "Wrong TPC cluster with row number %d received", c->fPadRow );
-                       continue;
+               int nPatchClust = 0;
+               if ( iter->fDataType == AliHLTTPCDefinitions::fgkClustersDataType ){
+                 AliHLTTPCClusterData* inPtrSP = ( AliHLTTPCClusterData* )( iter->fPtr );
+                 nPatchClust = inPtrSP->fSpacePointCnt;
+                 for ( unsigned int i = 0; i < inPtrSP->fSpacePointCnt; i++ ) {
+                   AliHLTTPCSpacePointData *c = &( inPtrSP->fSpacePoints[i] );
+                   if ( CAMath::Abs( c->fZ ) > fClusterZCut ) continue;
+                   if ( c->fPadRow > 159 ) {
+                     HLTError( "Wrong TPC cluster with row number %d received", c->fPadRow );
+                     continue;
+                   }
+                   clusterData[islice].ReadCluster( c->fID, c->fPadRow, c->fX, c->fY, c->fZ, c->fCharge );
+                 }           
+               } 
+               else if ( iter->fDataType == AliHLTTPCCADefinitions::fgkCompressedInputDataType){
+                 const AliHLTUInt8_t * inPtr = (const AliHLTUInt8_t *)iter->fPtr;
+                 nPatchClust=0;
+                 while( inPtr< ((const AliHLTUInt8_t *)iter->fPtr) + iter->fSize ){
+                   AliHLTTPCCACompressedClusterRow *row = (AliHLTTPCCACompressedClusterRow*)inPtr;
+                   UInt_t id = row->fSlicePatchRowID;
+                   UInt_t jslice = id>>10;       
+                   UInt_t jpatch = (id>>6) & 0x7;
+                   UInt_t jrow   =  id     & 0x3F;     
+                   jrow+= AliHLTTPCTransform::GetFirstRow( jpatch );
+                   Double_t rowX = AliHLTTPCTransform::Row2X( jrow );
+                   //cout<<"Read row: s "<<jslice<<" p "<<jpatch<<" r "<<jrow<<" x "<<row->fX<<" nclu "<<row->fNClusters<<" :"<<endl;
+                   if( jrow > 159 ) {
+                     HLTError( "Wrong TPC cluster with row number %d received", jrow );
+                     continue;
+                   }
+                   for ( unsigned int i = 0; i < row->fNClusters; i++ ) {
+                     AliHLTTPCCACompressedCluster *c = &( row->fClusters[i] );
+                     
+                     UInt_t ix0 = c->fP0 >>24;
+                     UInt_t ix1 = c->fP1 >>24;
+                     Double_t x = (ix1<<8) + ix0;
+                     Double_t y = c->fP0 & 0x00FFFFFF;
+                     Double_t z = c->fP1 & 0x00FFFFFF;
+                     x = (x - 32768.)*1.e-4 + rowX;
+                     y = (y - 8388608.)*1.e-4;
+                     z = (z - 8388608.)*1.e-4;
+                     
+                     UInt_t cluId = nPatchClust + ((jslice&0x7f)<<25)+((jpatch&0x7)<<22);
+                     //cout<<"clu "<<i<<": "<<x<<" "<<y<<" "<<z<<" "<<cluId<<endl;
+                     if ( CAMath::Abs( z ) <= fClusterZCut ){
+                       clusterData[islice].ReadCluster( cluId, jrow, x, y, z, 0 );
+                     }
+                     nPatchClust++;              
+                   }
+                   inPtr = (const AliHLTUInt8_t *)(row->fClusters+row->fNClusters);
                  }
-                 clusterData[islice].ReadCluster( c->fID, c->fPadRow, c->fX, c->fY, c->fZ, c->fCharge );
                }
+               Logging( kHLTLogInfo, "HLT::TPCCATracker::DoEvent", "Reading hits",
+                        "Read %d hits for slice %d - patch %d", nPatchClust, slice, patch );
          }
 
          clusterData[islice].FinishReading();
index ca9bd1f0c609096cc696020c0170c83c8143e98b..d27593db70c4ccb5990928cdd7a67eb26e733882 100644 (file)
@@ -28,7 +28,8 @@ TRACKING_CA:= tracking-ca/AliHLTTPCCATrack.h \
                tracking-ca/AliHLTTPCCASliceOutput.h \
                tracking-ca/AliHLTTPCCAStandaloneFramework.h \
                tracking-ca/AliTPCtrackerCA.h \
-               tracking-ca/AliHLTTPCCATrackerFramework.h
+               tracking-ca/AliHLTTPCCATrackerFramework.h \
+                tracking-ca/AliHLTTPCCAInputDataCompressorComponent.h
 #TRACKING_CA:= 
 
 CLASS_HDRS:=   AliHLTTPCTransform.h \