]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Now the TPC clusterfinder produces a special compressed input for the CA tracker,
authorsgorbuno <sgorbuno@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 19 Feb 2010 10:58:20 +0000 (10:58 +0000)
committersgorbuno <sgorbuno@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 19 Feb 2010 10:58:20 +0000 (10:58 +0000)
in order to reduce the network traffic.

HLT/TPCLib/AliHLTTPCClusterFinderComponent.cxx
HLT/TPCLib/tracking-ca/AliHLTTPCCAInputDataCompressorComponent.cxx
HLT/TPCLib/tracking-ca/AliHLTTPCCAInputDataCompressorComponent.h
HLT/TPCLib/tracking-ca/AliHLTTPCCATrackerComponent.cxx

index a44fa7883054f3a678bd39592202ad12df2f3b8d..b860ad46de120277fd058633bfe617d153cdf41e 100644 (file)
@@ -42,6 +42,8 @@ using namespace std;
 #include "AliTPCcalibDB.h"
 #include "AliTPCCalPad.h"
 #include "AliTPCParam.h"
+#include "AliHLTTPCCAInputDataCompressorComponent.h"
+#include "AliHLTTPCCADef.h"
 
 #include <cstdlib>
 #include <cerrno>
@@ -155,6 +157,7 @@ int AliHLTTPCClusterFinderComponent::GetOutputDataTypes(AliHLTComponentDataTypeL
   tgtList.clear();
   tgtList.push_back(AliHLTTPCDefinitions::fgkClustersDataType);
   tgtList.push_back(kAliHLTDataTypeHwAddr16);
+  tgtList.push_back(AliHLTTPCCADefinitions::fgkCompressedInputDataType);
   return tgtList.size();
 }
 
@@ -498,6 +501,38 @@ int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& ev
        tSize+=nHWAdd*sizeof(AliHLTUInt16_t);
       }
 
+      { // compressed output for the CA tracker        
+
+       AliHLTUInt32_t dSize = 0;       
+
+       int ret = AliHLTTPCCAInputDataCompressorComponent::Compress(  (AliHLTTPCClusterData*)( outputPtr + bd.fOffset ),
+                                                                     size - tSize,
+                                                                     outputPtr+tSize,
+                                                                     dSize );
+       
+       if ( ret!=0 || tSize + dSize > size )
+         {
+           Logging( kHLTLogFatal, "HLT::TPCClusterFinder::DoEvent", "Too much data", 
+                    "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu.",
+                    tSize + dSize, size );
+           iResult=-ENOSPC;
+           break;
+         }
+       
+       AliHLTComponentBlockData bdCompressed;
+       FillBlockData( bdCompressed );
+       bdCompressed.fOffset = tSize ;
+       bdCompressed.fSize = dSize;
+       bdCompressed.fSpecification = iter->fSpecification;
+       bdCompressed.fDataType = AliHLTTPCCADefinitions::fgkCompressedInputDataType;
+       outputBlocks.push_back( bdCompressed );
+       
+       tSize += dSize;
+       outBPtr += dSize;
+       outPtr = (AliHLTTPCClusterData*)outBPtr;        
+      }
+
+
       if(fDoMC){
        Int_t maxNumberOfClusterMCInfo = (Int_t)((size-tSize)/sizeof(AliHLTTPCClusterFinder::ClusterMCInfo)-1);
        AliHLTTPCClusterFinder::ClusterMCInfo* outputMCInfo= (AliHLTTPCClusterFinder::ClusterMCInfo*)(outputPtr+tSize);
index 6b64aa31800977499b0f4c1062d740a27fa3038f..d1cc1239f0da649a6d2f32901ff8319b0f5ab81e 100644 (file)
@@ -188,71 +188,20 @@ int AliHLTTPCCAInputDataCompressorComponent::DoEvent
 
     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;
-      }
-    }
+    AliHLTUInt32_t dSize = 0;
+   
+    ret = Compress( ( AliHLTTPCClusterData* )( iter->fPtr ), maxBufferSize - outTotalSize,
+                   outputPtr+outTotalSize,
+                   dSize );
     
-    if ( outTotalSize + dSize > (int) maxBufferSize ) {
-      HLTWarning( "Output buffer size exceed (buffer size %d, current size %d)", maxBufferSize, outTotalSize+ dSize );
-      ret = -ENOSPC;
+    if ( ret!=0 ){
+      HLTWarning( "Output buffer size exceed (buffer size %d, current size %d)", maxBufferSize );     
       break;
     }    
+   
     AliHLTComponentBlockData bd;
     FillBlockData( bd );
     bd.fOffset = outTotalSize;
@@ -260,7 +209,7 @@ int AliHLTTPCCAInputDataCompressorComponent::DoEvent
     bd.fSpecification = iter->fSpecification;
     bd.fDataType = GetOutputDataType();
     outputBlocks.push_back( bd );
-    outTotalSize+=dSize;    
+    outTotalSize+=dSize;      
   }
 
   size = outTotalSize;
@@ -285,3 +234,79 @@ int AliHLTTPCCAInputDataCompressorComponent::DoEvent
 }
 
 
+
+int AliHLTTPCCAInputDataCompressorComponent::Compress( AliHLTTPCClusterData* inputPtr,
+                                                      AliHLTUInt32_t maxBufferSize,
+                                                      AliHLTUInt8_t* outputPtr,
+                                                      AliHLTUInt32_t& outputSize
+                                                      )
+{
+  // Preprocess the data for CA Slice Tracker
+
+  Int_t ret = 0;
+  outputSize = 0;
+
+  AliHLTTPCCACompressedCluster *outCluster = (AliHLTTPCCACompressedCluster*)( outputPtr );
+  AliHLTTPCCACompressedClusterRow *outRow = 0;
+
+  UShort_t oldId = 0;
+
+  for ( unsigned int i = 0; i < inputPtr->fSpacePointCnt; i++ ){ 
+    AliHLTTPCSpacePointData *cluster = &( inputPtr->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;  
+      outputSize+= ( ( AliHLTUInt8_t * )outCluster ) -  (( AliHLTUInt8_t * )outRow);
+      if ( outputSize > (int) maxBufferSize ){
+       ret = -ENOSPC;
+       outputSize=0;
+       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;
+      
+      outputSize+= sizeof( AliHLTTPCCACompressedCluster );
+      if ( outputSize > (int) maxBufferSize ){
+       outputSize = 0;
+       ret = -ENOSPC;
+       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;
+    }
+  }
+    
+  return ret;
+}
index 7840f809b553e882371b5d7c721ef4de2bbc65f5..495ed712454157b7ea121afdc2a0b7fe3a01d421 100644 (file)
@@ -10,6 +10,7 @@
 #define ALIHLTTPCCAINPUTDATACOMPRESSORCOMPONENT_H
 
 #include "AliHLTProcessor.h"
+class AliHLTTPCClusterData;
 
 /**
  * @class AliHLTTPCCAInputDataCompressorComponent
@@ -53,6 +54,12 @@ class AliHLTTPCCAInputDataCompressorComponent : public AliHLTProcessor
     /** @see component interface @ref AliHLTComponent::Spawn */
     AliHLTComponent* Spawn() ;
 
+  static int Compress( AliHLTTPCClusterData* inputPtr,
+                      AliHLTUInt32_t maxBufferSize,
+                      AliHLTUInt8_t* outputPtr,
+                      AliHLTUInt32_t& outputSize
+                      );
+
   protected:
 
     // Protected functions to implement AliHLTComponent's interface.
index 46dabc38c3a45a5ab9d18c22c3864db61e8e6482..553db9535e71cda6141336343bba8b21ba5acd92 100644 (file)
@@ -126,7 +126,7 @@ void AliHLTTPCCATrackerComponent::GetInputDataTypes( vector<AliHLTComponentDataT
 {
   // see header file for class documentation
   list.clear();
-  list.push_back( AliHLTTPCDefinitions::fgkClustersDataType );
+  //list.push_back( AliHLTTPCDefinitions::fgkClustersDataType );
   list.push_back( AliHLTTPCCADefinitions::fgkCompressedInputDataType );
 }
 
@@ -410,8 +410,8 @@ int AliHLTTPCCATrackerComponent::DoEvent
 
     for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) {
       iter = blocks + ndx;
-      if ( iter->fDataType != AliHLTTPCDefinitions::fgkClustersDataType
-          && iter->fDataType != AliHLTTPCCADefinitions::fgkCompressedInputDataType
+      if ( // iter->fDataType != AliHLTTPCDefinitions::fgkClustersDataType &&
+          iter->fDataType != AliHLTTPCCADefinitions::fgkCompressedInputDataType
           ) continue;
 
       slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter );
@@ -552,11 +552,11 @@ int AliHLTTPCCATrackerComponent::DoEvent
          for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) {
                iter = blocks + ndx;
                if ( slice != AliHLTTPCDefinitions::GetMinSliceNr( *iter ) ) continue;
-               if ( iter->fDataType == AliHLTTPCDefinitions::fgkClustersDataType ){
-                 AliHLTTPCClusterData* inPtrSP = ( AliHLTTPCClusterData* )( iter->fPtr );
-                 nClustersTotal += inPtrSP->fSpacePointCnt;
-               } 
-               else if ( iter->fDataType == AliHLTTPCCADefinitions::fgkCompressedInputDataType){
+               //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;
@@ -597,6 +597,7 @@ int AliHLTTPCCATrackerComponent::DoEvent
                iter = blocks + ndx;
                int patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
                int nPatchClust = 0;
+               /*
                if ( iter->fDataType == AliHLTTPCDefinitions::fgkClustersDataType ){
                  AliHLTTPCClusterData* inPtrSP = ( AliHLTTPCClusterData* )( iter->fPtr );
                  nPatchClust = inPtrSP->fSpacePointCnt;
@@ -609,8 +610,9 @@ int AliHLTTPCCATrackerComponent::DoEvent
                    }
                    clusterData[islice].ReadCluster( c->fID, c->fPadRow, c->fX, c->fY, c->fZ, c->fCharge );
                  }           
-               } 
-               else if ( iter->fDataType == AliHLTTPCCADefinitions::fgkCompressedInputDataType){
+               } 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 ){