]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
output of the slice tracker is compressed in order to minimize the network traffic
authorsgorbuno <sgorbuno@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 14 Feb 2010 11:01:10 +0000 (11:01 +0000)
committersgorbuno <sgorbuno@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 14 Feb 2010 11:01:10 +0000 (11:01 +0000)
HLT/TPCLib/tracking-ca/AliHLTTPCCADataCompressor.h
HLT/TPCLib/tracking-ca/AliHLTTPCCAMerger.cxx
HLT/TPCLib/tracking-ca/AliHLTTPCCASliceOutput.cxx
HLT/TPCLib/tracking-ca/AliHLTTPCCASliceOutput.h
HLT/TPCLib/tracking-ca/AliHLTTPCCATracker.cxx

index cd48cb9b81e0d2755c32fe6f3bdd26c09f073700..3269a9c968d782670da93fb39c48a5b10147645a 100644 (file)
@@ -10,6 +10,8 @@
 #define ALIHLTTPCCADATACOMPRESSOR_H
 
 #include "AliHLTTPCCADef.h"
+#include "AliHLTTPCCACompressedInputData.h"
+#include "AliHLTTPCTransform.h"
 
 /**
  * @class AliHLTTPCCADataCompressor
@@ -43,6 +45,48 @@ class AliHLTTPCCADataCompressor
     GPUhd() static float  UShort2Y ( unsigned short iYZ );
     GPUhd() static float  UShort2Z ( unsigned short iYZ );
 
+  static AliHLTTPCCACompressedCluster PackXYZ( int iRow, float X, float Y, float Z )
+  {
+    // pack the cluster
+
+    // get coordinates in [um]
+
+    Double_t rowX = AliHLTTPCTransform::Row2X( iRow );
+       
+    Double_t x = (X - rowX )*1.e4 + 32768.;
+    Double_t y = Y*1.e4 + 8388608.;
+    Double_t z = Z*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;
+       
+    AliHLTTPCCACompressedCluster ret;
+    ret.fP0 = (ix0<<24) + iy;
+    ret.fP1 = (ix1<<24) + iz;      
+    return ret;
+  }
+
+  static  void UnpackXYZ( int iRow, AliHLTTPCCACompressedCluster C, float &X, float &Y, float &Z  )
+  {
+    Double_t rowX = AliHLTTPCTransform::Row2X( iRow );
+
+    UInt_t ix0 = C.fP0 >>24;
+    UInt_t ix1 = C.fP1 >>24;
+    X = (ix1<<8) + ix0;
+    Y = C.fP0 & 0x00FFFFFF;
+    Z = C.fP1 & 0x00FFFFFF;
+    X = (X - 32768.)*1.e-4 + rowX;
+    Y = (Y - 8388608.)*1.e-4;
+    Z = (Z - 8388608.)*1.e-4;
+  }
+
 };
 
 
index 5353a3454dc3cd14edc2cefcc374cbed0da6d0b5..ad388ff7d6fa67c438443527570cfbbd2f9ab831 100644 (file)
@@ -35,7 +35,7 @@
 #include "AliHLTTPCCADataCompressor.h"
 #include "AliHLTTPCCAParam.h"
 #include "AliHLTTPCCATrackLinearisation.h"
-
+#include "AliHLTTPCCADataCompressor.h"
 
 class AliHLTTPCCAMerger::AliHLTTPCCASliceTrackInfo
 {
@@ -246,10 +246,12 @@ void AliHLTTPCCAMerger::UnpackSlices()
         clu.SetIRow( slice.ClusterRow( ic ) );
         clu.SetId( slice.ClusterId( ic ) );
         clu.SetPackedAmp( 0 );
-        float2 yz = slice.ClusterUnpackedYZ( ic );
-        clu.SetX( slice.ClusterUnpackedX( ic ) );
-        clu.SetY( yz.x );
-        clu.SetZ( yz.y );
+       float x,y,z;
+       AliHLTTPCCADataCompressor::UnpackXYZ( clu.IRow(), slice.ClusterPackedXYZ(ic), x, y, z );
+        
+        clu.SetX( x );
+        clu.SetY( y );
+        clu.SetZ( z );
 
         if ( !t0.TransportToX( clu.X(), fSliceParam.GetBz( t0 ), .999 ) ) continue;
 
index 5c2a990d60b43450154f9a045910604cbae6441d..e41d2db20bb62f35989ec8905217950bec1cb16b 100644 (file)
@@ -52,8 +52,7 @@ void AliHLTTPCCASliceOutput::SetPointers(int nTracks, int nTrackClusters, const
     AssignNoAlignment( fTracksOffset,            size, nTracks*sizeof(AliHLTTPCCASliceTrack) );
     AssignNoAlignment( fClusterIdOffset,         size, nTrackClusters*sizeof(int) );
     AssignNoAlignment( fClusterRowOffset,        size, nTrackClusters*sizeof(float) );
-    AssignNoAlignment( fClusterUnpackedYZOffset, size, nTrackClusters*sizeof(float2) );
-    AssignNoAlignment( fClusterUnpackedXOffset,  size, nTrackClusters*sizeof(float) );
+    AssignNoAlignment( fClusterPackedXYZOffset, size, nTrackClusters*sizeof(AliHLTTPCCACompressedCluster) );
    }
 
   char *mem = fMemory + size;
index f9dbe7d67bbf831d6b241f52447bd7727d1315f1..454fc3fba9668e4f75d0480cd9263ce3ed2b9be4 100644 (file)
@@ -13,6 +13,7 @@
 #include "AliHLTTPCCADef.h"
 #include <cstdlib>
 #include "AliHLTTPCCASliceTrack.h"
+#include "AliHLTTPCCACompressedInputData.h"
 //Obsolete
 #include "AliHLTTPCCAOutTrack.h"
 
@@ -47,8 +48,7 @@ class AliHLTTPCCASliceOutput
     GPUhd() const AliHLTTPCCASliceTrack &Track( int i ) const { return TracksP()[i]; }
     GPUhd() unsigned char   ClusterRow     ( int i )  const { return ClusterRowP()[i]; }
     GPUhd()  int   ClusterId     ( int i )  const { return ClusterIdP()[i]; }
-    GPUhd() float2   ClusterUnpackedYZ ( int i )  const { return ClusterUnpackedYZP()[i]; }
-    GPUhd() float    ClusterUnpackedX  ( int i )  const { return ClusterUnpackedXP()[i]; }
+    GPUhd() const AliHLTTPCCACompressedCluster &ClusterPackedXYZ ( int i )  const { return ClusterPackedXYZP()[i]; }
 
     GPUhd() static int EstimateSize( int nOfTracks, int nOfTrackClusters );
     void SetPointers(int nTracks = -1, int nTrackClusters = -1, const outputControlStruct* outputControl = NULL);
@@ -60,10 +60,9 @@ class AliHLTTPCCASliceOutput
     GPUhd() void SetTrack( int i, const AliHLTTPCCASliceTrack &v ) {  TracksP()[i] = v; }
     GPUhd() void SetClusterRow( int i, unsigned char v ) {  ClusterRowP()[i] = v; }
     GPUhd() void SetClusterId( int i, int v ) {  ClusterIdP()[i] = v; }
-    GPUhd() void SetClusterUnpackedYZ( int i, float2 v ) {  ClusterUnpackedYZP()[i] = v; }
-    GPUhd() void SetClusterUnpackedX( int i, float v ) {  ClusterUnpackedXP()[i] = v; }
+    GPUhd() void SetClusterPackedXYZ( int i, AliHLTTPCCACompressedCluster v ) {  ClusterPackedXYZP()[i] = v; }
 
-       GPUhd() size_t OutputMemorySize() const { return(fMemorySize); }
+    GPUhd() size_t OutputMemorySize() const { return(fMemorySize); }
 
        //Obsolete Output
 
@@ -78,7 +77,7 @@ class AliHLTTPCCASliceOutput
 
   private:
     AliHLTTPCCASliceOutput()
-        : fNTracks( 0 ), fNTrackClusters( 0 ), fTracksOffset( 0 ),  fClusterIdOffset( 0 ), fClusterRowOffset( 0 ), fClusterUnpackedYZOffset( 0 ), fClusterUnpackedXOffset( 0 ),
+        : fNTracks( 0 ), fNTrackClusters( 0 ), fTracksOffset( 0 ),  fClusterIdOffset( 0 ), fClusterRowOffset( 0 ), fClusterPackedXYZOffset( 0 ),
                fMemorySize( 0 ), fNOutTracks(0), fNOutTrackHits(0), fOutTracks(0), fOutTrackHits(0) {}
 
        ~AliHLTTPCCASliceOutput() {}
@@ -90,16 +89,14 @@ class AliHLTTPCCASliceOutput
   GPUh() AliHLTTPCCASliceTrack *TracksP() const { return (AliHLTTPCCASliceTrack*)(fMemory+fTracksOffset); }
   GPUh() int *ClusterIdP() const { return (int*)(fMemory+fClusterIdOffset); }
   GPUh() UChar_t *ClusterRowP() const { return (UChar_t *)(fMemory+fClusterRowOffset); }
-  GPUh() float2 *ClusterUnpackedYZP() const { return (float2 *)(fMemory+fClusterUnpackedYZOffset); }
-  GPUh() float *ClusterUnpackedXP() const { return (float *)(fMemory+fClusterUnpackedXOffset); }
+  GPUh() AliHLTTPCCACompressedCluster *ClusterPackedXYZP() const { return (AliHLTTPCCACompressedCluster *)(fMemory+fClusterPackedXYZOffset); }
 
     int fNTracks;                   // number of reconstructed tracks
     int fNTrackClusters;            // total number of track clusters
     int fTracksOffset; // pointer to reconstructed tracks
     int fClusterIdOffset;              // pointer to cluster Id's ( packed slice, patch, cluster )
     int fClusterRowOffset;     // pointer to cluster row numbers
-    int fClusterUnpackedYZOffset;    // pointer to cluster coordinates (temporary data, for debug proposes)
-    int fClusterUnpackedXOffset;     // pointer to cluster coordinates (temporary data, for debug proposes)
+    int fClusterPackedXYZOffset;    // pointer to cluster coordinates 
        size_t fMemorySize;                             // Amount of memory really used
 
     // obsolete output
index 33cbf568c0b0bda83933b8de8fbf2580358d6072..3faf7b308ec2c854a31636c2d9ab651614ddb1e2 100644 (file)
@@ -36,6 +36,7 @@
 #include "AliHLTTPCCASliceTrack.h"
 #include "AliHLTTPCCASliceOutput.h"
 #include "AliHLTTPCCAClusterData.h"
+#include "AliHLTTPCCADataCompressor.h"
 
 #include "AliHLTTPCCATrackParam.h"
 
@@ -700,16 +701,16 @@ GPUh() void AliHLTTPCCATracker::WriteOutput()
 
 
                  int id = fClusterData->Id( clusterIndex );
+                 AliHLTTPCCACompressedCluster cXYZ = AliHLTTPCCADataCompressor::PackXYZ( iRow, origX, origY, origZ );
 
-                 float2 hUnpackedYZ;
-                 hUnpackedYZ.x = origY;
-                 hUnpackedYZ.y = origZ;
-                 float hUnpackedX = origX;
+                 //float2 hUnpackedYZ;
+                 //hUnpackedYZ.x = origY;
+                 //hUnpackedYZ.y = origZ;
+                 //float hUnpackedX = origX;
 
                  useOutput->SetClusterId( nStoredHits, id  );
                  useOutput->SetClusterRow( nStoredHits, ( unsigned char ) iRow  );
-                 useOutput->SetClusterUnpackedYZ( nStoredHits, hUnpackedYZ );
-                 useOutput->SetClusterUnpackedX( nStoredHits, hUnpackedX );
+                 useOutput->SetClusterPackedXYZ( nStoredHits, cXYZ );
                  nStoredHits++;
                }
          }