#include "AliTPCcalibDB.h"
#include "AliTPCCalPad.h"
#include "AliTPCParam.h"
+#include "AliHLTTPCCAInputDataCompressorComponent.h"
+#include "AliHLTTPCCADef.h"
#include <cstdlib>
#include <cerrno>
tgtList.clear();
tgtList.push_back(AliHLTTPCDefinitions::fgkClustersDataType);
tgtList.push_back(kAliHLTDataTypeHwAddr16);
+ tgtList.push_back(AliHLTTPCCADefinitions::fgkCompressedInputDataType);
return tgtList.size();
}
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);
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;
bd.fSpecification = iter->fSpecification;
bd.fDataType = GetOutputDataType();
outputBlocks.push_back( bd );
- outTotalSize+=dSize;
+ outTotalSize+=dSize;
}
size = outTotalSize;
}
+
+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;
+}
{
// see header file for class documentation
list.clear();
- list.push_back( AliHLTTPCDefinitions::fgkClustersDataType );
+ //list.push_back( AliHLTTPCDefinitions::fgkClustersDataType );
list.push_back( AliHLTTPCCADefinitions::fgkCompressedInputDataType );
}
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 );
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;
iter = blocks + ndx;
int patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
int nPatchClust = 0;
+ /*
if ( iter->fDataType == AliHLTTPCDefinitions::fgkClustersDataType ){
AliHLTTPCClusterData* inPtrSP = ( AliHLTTPCClusterData* )( iter->fPtr );
nPatchClust = inPtrSP->fSpacePointCnt;
}
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 ){