3 //**************************************************************************
4 //* This file is property of and copyright by the ALICE HLT Project *
5 //* ALICE Experiment at CERN, All rights reserved. *
7 //* Primary Authors: Timm Steinbeck <timm@kip.uni-heidelberg.de> *
8 //* for The ALICE HLT Project. *
10 //* Permission to use, copy, modify and distribute this software and its *
11 //* documentation strictly for non-commercial purposes is hereby granted *
12 //* without fee, provided that the above copyright notice appears in all *
13 //* copies and that both the copyright notice and this permission notice *
14 //* appear in the supporting documentation. The authors make no claims *
15 //* about the suitability of this software for any purpose. It is *
16 //* provided "as is" without express or implied warranty. *
17 //**************************************************************************
19 /** @file AliHLTTPCCompDumpComponent.cxx
20 @author Timm Steinbeck
22 @brief A copy processing component for the HLT
23 that writes the results of the Vestbo compression
24 components to humanly readable files
31 #include "AliHLTTPCCompDumpComponent.h"
32 #include "AliHLTTPCDefinitions.h"
33 #include "AliHLTTPCTrackletDataFormat.h"
34 #include "AliHLTTPCClusterDataFormat.h"
35 #include "AliHLTTPCModels.h"
36 #include "AliHLTTPCTransform.h"
37 #include "AliHLTTPCCompDataCompressorHelper.h"
41 // this is a global object used for automatic component registration, do not use this
42 AliHLTTPCCompDumpComponent gAliHLTTPCCompClusterDumpComponent;
44 ClassImp(AliHLTTPCCompDumpComponent)
46 AliHLTTPCCompDumpComponent::AliHLTTPCCompDumpComponent()
48 fBitDataCurrentWord(0),
49 fBitDataCurrentPosInWord(0),
50 fBitDataCurrentInput(NULL),
51 fBitDataCurrentInputStart(NULL),
52 fBitDataCurrentInputEnd(NULL)
54 // see header file for class documentation
57 AliHLTTPCCompDumpComponent::~AliHLTTPCCompDumpComponent()
59 // see header file for class documentation
62 const char* AliHLTTPCCompDumpComponent::GetComponentID()
64 // see header file for class documentation
65 return "TPCCompDump"; // The ID of this component
68 void AliHLTTPCCompDumpComponent::GetInputDataTypes( vector<AliHLTComponent_DataType>& list)
70 // see header file for class documentation
71 list.clear(); // We do not have any requirements for our input data type(s).
72 list.push_back( AliHLTTPCDefinitions::fgkClustersDataType );
73 list.push_back( AliHLTTPCDefinitions::fgkTrackSegmentsDataType );
74 list.push_back( AliHLTTPCDefinitions::fgkTracksDataType );
75 list.push_back( AliHLTTPCDefinitions::fgkClusterTracksModelDataType );
76 list.push_back( AliHLTTPCDefinitions::fgkRemainingClustersModelDataType );
79 AliHLTComponent_DataType AliHLTTPCCompDumpComponent::GetOutputDataType()
81 // see header file for class documentation
82 return AliHLTTPCDefinitions::fgkClusterTracksModelDataType;
85 void AliHLTTPCCompDumpComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
87 // see header file for class documentation
90 //#warning Adapt input Multiplier to something more realistic
94 // Spawn function, return new instance of this class
95 AliHLTComponent* AliHLTTPCCompDumpComponent::Spawn()
97 // see header file for class documentation
98 return new AliHLTTPCCompDumpComponent;
101 void AliHLTTPCCompDumpComponent::InitBitDataInput( AliHLTUInt8_t* input, UInt_t inputSize )
103 // see header file for class documentation
104 fBitDataCurrentWord = 0;
105 fBitDataCurrentPosInWord = 7;
106 fBitDataCurrentInput = fBitDataCurrentInputStart = input;
107 fBitDataCurrentInputEnd = input+inputSize;
108 fBitDataCurrentWord = *fBitDataCurrentInput;
111 bool AliHLTTPCCompDumpComponent::InputBit( AliHLTUInt8_t & value )
113 // see header file for class documentation
114 if ( fBitDataCurrentInput>=fBitDataCurrentInputEnd )
116 value = (fBitDataCurrentWord >> fBitDataCurrentPosInWord) & 1;
117 if ( fBitDataCurrentPosInWord )
118 fBitDataCurrentPosInWord--;
121 fBitDataCurrentInput++;
122 if ( fBitDataCurrentInput<fBitDataCurrentInputEnd )
124 fBitDataCurrentWord = *fBitDataCurrentInput;
125 fBitDataCurrentPosInWord = 7;
131 bool AliHLTTPCCompDumpComponent::InputBits( AliHLTUInt8_t & value, UInt_t const & bitCount )
133 // see header file for class documentation
136 HLTFatal( "Internal error: Attempt to write more than 32 bits (%u)", (unsigned)bitCount );
140 if ( !InputBits( temp, bitCount ) )
142 value = (AliHLTUInt8_t)( temp & (AliHLTUInt64_t)0xFFFFFFFFULL );
146 bool AliHLTTPCCompDumpComponent::InputBits( AliHLTUInt16_t & value, UInt_t const & bitCount )
148 // see header file for class documentation
151 HLTFatal( "Internal error: Attempt to write more than 32 bits (%u)", (unsigned)bitCount );
155 if ( !InputBits( temp, bitCount ) )
157 value = (AliHLTUInt16_t)( temp & (AliHLTUInt64_t)0xFFFFFFFFULL );
161 bool AliHLTTPCCompDumpComponent::InputBits( AliHLTUInt32_t & value, UInt_t const & bitCount )
163 // see header file for class documentation
166 HLTFatal( "Internal error: Attempt to write more than 32 bits (%u)", (unsigned)bitCount );
170 if ( !InputBits( temp, bitCount ) )
172 value = (AliHLTUInt32_t)( temp & (AliHLTUInt64_t)0xFFFFFFFFULL );
176 bool AliHLTTPCCompDumpComponent::InputBits( Int_t & value, UInt_t const & bitCount )
178 // see header file for class documentation
181 HLTFatal( "Internal error: Attempt to write more than 32 bits (%u)", (unsigned)bitCount );
185 if ( !InputBits( temp, bitCount ) )
187 value = (Int_t)( temp & (AliHLTUInt64_t)0xFFFFFFFFULL );
191 bool AliHLTTPCCompDumpComponent::InputBits( AliHLTUInt64_t & value, UInt_t const & bitCount )
193 // see header file for class documentation
196 HLTFatal( "Internal error: Attempt to write more than 64 bits (%u)", (unsigned)bitCount );
199 UInt_t bitsToRead=bitCount;
202 while ( bitsToRead>0 )
204 if ( fBitDataCurrentInput>=fBitDataCurrentInputEnd )
206 if ( bitsToRead >= fBitDataCurrentPosInWord+1 )
207 curBitCount = fBitDataCurrentPosInWord+1;
209 curBitCount = bitsToRead;
210 value = (value << curBitCount) | ( (fBitDataCurrentWord >> (fBitDataCurrentPosInWord-curBitCount+1)) & ((1 << curBitCount)-1) );
211 if ( fBitDataCurrentPosInWord < curBitCount )
213 fBitDataCurrentInput++;
214 if ( fBitDataCurrentInput<fBitDataCurrentInputEnd )
216 fBitDataCurrentWord = *fBitDataCurrentInput;
217 fBitDataCurrentPosInWord = 7;
221 fBitDataCurrentPosInWord -= curBitCount;
222 bitsToRead -= curBitCount;
227 void AliHLTTPCCompDumpComponent::Pad8Bits()
229 // see header file for class documentation
230 if ( fBitDataCurrentPosInWord == 7 )
232 fBitDataCurrentInput++;
233 if ( fBitDataCurrentInput<fBitDataCurrentInputEnd )
235 fBitDataCurrentWord = *fBitDataCurrentInput;
236 fBitDataCurrentPosInWord = 7;
240 bool AliHLTTPCCompDumpComponent::InputBytes( AliHLTUInt8_t* data, UInt_t const & byteCount )
242 // see header file for class documentation
244 if ( fBitDataCurrentInput+byteCount>fBitDataCurrentInputEnd )
246 memcpy( data, fBitDataCurrentInput, byteCount );
247 fBitDataCurrentInput += byteCount;
248 if ( fBitDataCurrentInput<fBitDataCurrentInputEnd )
250 fBitDataCurrentWord = *fBitDataCurrentInput;
251 fBitDataCurrentPosInWord = 7;
256 int AliHLTTPCCompDumpComponent::DoInit( int argc, const char** argv )
258 // see header file for class documentation
262 Logging( kHLTLogDebug, "HLT::TPCCompDump::DoInit", "Arguments", "argv[0] == %s", argv[0] );
263 Logging(kHLTLogError, "HLT::TPCCompDump::DoInit", "Unknown Option", "Unknown option '%s'", argv[0] );
269 int AliHLTTPCCompDumpComponent::DoDeinit()
271 // see header file for class documentation
275 int AliHLTTPCCompDumpComponent::DoEvent( const AliHLTComponent_EventData& evtData, const AliHLTComponent_BlockData* blocks,
276 AliHLTComponent_TriggerData& /*trigData*/, AliHLTUInt8_t* ,
277 AliHLTUInt32_t& size, vector<AliHLTComponent_BlockData>& )
279 // see header file for class documentation
281 // Loop over all input blocks in the event
282 for ( unsigned long n = 0; n < evtData.fBlockCnt; n++ )
284 AliHLTUInt8_t slice, patch;
285 if ( blocks[n].fDataType == AliHLTTPCDefinitions::fgkClustersDataType )
287 slice = AliHLTTPCDefinitions::GetMinSliceNr( blocks[n].fSpecification );
288 patch = AliHLTTPCDefinitions::GetMinPatchNr( blocks[n].fSpecification );
289 AliHLTTPCClusterData* clusters = (AliHLTTPCClusterData*)blocks[n].fPtr;
290 HLTInfo( "Cluster block slice %u - patch %u - %lu clusters", (unsigned)slice, (unsigned)patch, (unsigned long)clusters->fSpacePointCnt );
291 for ( unsigned long ii=0; ii<clusters->fSpacePointCnt; ii++ )
293 HLTInfo( " Cluster % 5lu: fX: %f - fY: %f - fZ: %f - fZ - fID: %u (0x%08X) - fPadRow: %u - fSigmaY2: %f - fSigmaZ2: %f - fCharge: %u - fUsed: %s - fTrackN: %d",
294 ii, clusters->fSpacePoints[ii].fX, clusters->fSpacePoints[ii].fY, clusters->fSpacePoints[ii].fZ, clusters->fSpacePoints[ii].fID, clusters->fSpacePoints[ii].fID, (unsigned)clusters->fSpacePoints[ii].fPadRow, clusters->fSpacePoints[ii].fSigmaY2, clusters->fSpacePoints[ii].fSigmaZ2, clusters->fSpacePoints[ii].fCharge, (clusters->fSpacePoints[ii].fUsed ? "yes" : "no"), clusters->fSpacePoints[ii].fTrackN );
296 Float_t xyzG[3] = { clusters->fSpacePoints[ii].fX, clusters->fSpacePoints[ii].fY, clusters->fSpacePoints[ii].fZ };
297 Float_t xyzR[3] = { clusters->fSpacePoints[ii].fX, clusters->fSpacePoints[ii].fY, clusters->fSpacePoints[ii].fZ };
298 AliHLTTPCTransform::LocHLT2Global( xyzG, slice, clusters->fSpacePoints[ii].fPadRow );
299 AliHLTTPCTransform::LocHLT2Raw( xyzG, slice, clusters->fSpacePoints[ii].fPadRow );
300 HLTInfo( " Global: fX: %f - fY: %f - fZ: %f - fZ",
301 xyzG[0], xyzG[1], xyzG[2] );
302 HLTInfo( " Raw: fX: %f - fY: %f - fZ: %f - fZ",
303 xyzR[0], xyzR[1], xyzR[2] );
308 if ( blocks[n].fDataType == AliHLTTPCDefinitions::fgkTrackSegmentsDataType ||
309 blocks[n].fDataType == AliHLTTPCDefinitions::fgkTracksDataType)
311 //fConverter.SetInputTracks( (AliHLTTPCTrackletData*)blocks[n].fPtr );
312 AliHLTUInt8_t minSlice=0xFF, maxSlice=0xFF, minPatch=0xFF, maxPatch=0xFF;
313 minSlice = AliHLTTPCDefinitions::GetMinSliceNr( blocks[n].fSpecification );
314 maxSlice = AliHLTTPCDefinitions::GetMaxSliceNr( blocks[n].fSpecification );
315 minPatch = AliHLTTPCDefinitions::GetMinPatchNr( blocks[n].fSpecification );
316 maxPatch = AliHLTTPCDefinitions::GetMaxPatchNr( blocks[n].fSpecification );
317 AliHLTTPCTrackletData* tracks = (AliHLTTPCTrackletData*)blocks[n].fPtr;
318 AliHLTTPCTrackSegmentData* tracklet = tracks->fTracklets;
319 HLTInfo( "Track block slices %u-%u - patches %u-%u - %lu tracks",
320 (unsigned)minSlice, (unsigned)maxSlice, (unsigned)minPatch, (unsigned)maxPatch,
321 (unsigned long)tracks->fTrackletCnt );
322 for ( unsigned long ii=0; ii<tracks->fTrackletCnt; ii++ )
324 HLTInfo( " Track % 5lu: fX: %f - fY: %f - fZ: %f - fLastX: %f - fLastY: %f - fLastZ: %f - fPt: %f - fPsi: %f - fTgl: %f - fPterr: %f - fPsierr: %f - fTglerr: %f - fCharge: %d - fNPoints: %u",
325 ii, tracklet->fX, tracklet->fY, tracklet->fZ, tracklet->fLastX, tracklet->fLastY, tracklet->fLastZ, tracklet->fPt, tracklet->fPsi, tracklet->fTgl, tracklet->fPterr, tracklet->fPsierr, tracklet->fTglerr, tracklet->fCharge, tracklet->fNPoints );
326 for ( unsigned long jj=0; jj<tracklet->fNPoints; jj++ )
328 HLTInfo( " Point % 5lu: % 8u / 0x%08X", jj, tracklet->fPointIDs[jj], tracklet->fPointIDs[jj] );
330 tracklet = (AliHLTTPCTrackSegmentData*) ( ((AliHLTUInt8_t*)tracklet)+sizeof(AliHLTTPCTrackSegmentData)+tracklet->fNPoints*sizeof(UInt_t) );
334 if ( blocks[n].fDataType == AliHLTTPCDefinitions::fgkClusterTracksModelDataType )
336 AliHLTUInt8_t minSlice=0xFF, maxSlice=0xFF, minPatch=0xFF, maxPatch=0xFF;
337 minSlice = AliHLTTPCDefinitions::GetMinSliceNr( blocks[n].fSpecification );
338 maxSlice = AliHLTTPCDefinitions::GetMaxSliceNr( blocks[n].fSpecification );
339 minPatch = AliHLTTPCDefinitions::GetMinPatchNr( blocks[n].fSpecification );
340 maxPatch = AliHLTTPCDefinitions::GetMaxPatchNr( blocks[n].fSpecification );
341 unsigned long trackletCount = (blocks[n].fSize-sizeof(AliHLTUInt32_t)) / (sizeof(AliHLTTPCTrackModel)+AliHLTTPCTransform::GetNRows()*sizeof(AliHLTTPCClusterModel) );
342 HLTInfo( "Track model block version %u slices %u-%u - patches %u-%u - %lu tracks",
343 (unsigned)*(AliHLTUInt32_t*)blocks[n].fPtr,
344 (unsigned)minSlice, (unsigned)maxSlice, (unsigned)minPatch, (unsigned)maxPatch,
345 (unsigned long)trackletCount );
346 AliHLTTPCTrackModel* trackModel = (AliHLTTPCTrackModel*)(((AliHLTUInt8_t*)blocks[n].fPtr)+sizeof(AliHLTUInt32_t));
347 for ( unsigned long ii=0; ii<trackletCount; ii++ )
349 unsigned clusterCount=0;
350 AliHLTTPCClusterModel* clusters = (AliHLTTPCClusterModel*) ( ((AliHLTUInt8_t*)trackModel)+sizeof(AliHLTTPCTrackModel) );
351 for ( unsigned long jj=0; jj<(unsigned long)AliHLTTPCTransform::GetNRows(); jj++ )
353 if ( clusters[jj].fPresent )
356 HLTInfo( " Track Model % 5lu fKappa: %f - fPhi: %f - fD: %f - fZ0: %f - fTgl: %f - #clusters: %u",
357 ii, trackModel->fKappa, trackModel->fPhi, trackModel->fD, trackModel->fZ0, trackModel->fTgl, clusterCount );
359 for ( unsigned long jj=0; jj<(unsigned long)AliHLTTPCTransform::GetNRows(); jj++ )
361 if ( clusters[jj].fPresent )
364 HLTInfo( " Cluster % 05u: fID: %u (0x%08X) - fDTime: %f - fDPad: %f - fDCharge: %f - fDSigmaY: %f - fDSigmaZ: %f - fNPads: %u - fSlice: %hd - padrow: %lu - fPresent: %u",
365 clusterCount, clusters[jj].fID, clusters[jj].fID, clusters[jj].fDTime, clusters[jj].fDPad, clusters[jj].fDCharge, clusters[jj].fDSigmaY, clusters[jj].fDSigmaZ, clusters[jj].fNPads, clusters[jj].fSlice, jj, (unsigned)clusters[jj].fPresent );
367 HLTInfo( " Cluster % 05u: fDTime: %f - fDPad: %f - fDCharge: %f - fDSigmaY: %f - fDSigmaZ: %f - fNPads: %u - fSlice: %hd - padrow: %lu - fPresent: %u",
368 clusterCount, clusters[jj].fDTime, clusters[jj].fDPad, clusters[jj].fDCharge, clusters[jj].fDSigmaY, clusters[jj].fDSigmaZ, clusters[jj].fNPads, clusters[jj].fSlice, jj, (unsigned)clusters[jj].fPresent );
374 trackModel = (AliHLTTPCTrackModel*) ( ((AliHLTUInt8_t*)trackModel)+sizeof(AliHLTTPCTrackModel)+AliHLTTPCTransform::GetNRows()*sizeof(AliHLTTPCClusterModel) );
378 if ( blocks[n].fDataType == AliHLTTPCDefinitions::fgkRemainingClustersModelDataType )
380 AliHLTUInt8_t minSlice=0xFF, maxSlice=0xFF, minPatch=0xFF, maxPatch=0xFF;
381 minSlice = AliHLTTPCDefinitions::GetMinSliceNr( blocks[n].fSpecification );
382 maxSlice = AliHLTTPCDefinitions::GetMaxSliceNr( blocks[n].fSpecification );
383 minPatch = AliHLTTPCDefinitions::GetMinPatchNr( blocks[n].fSpecification );
384 maxPatch = AliHLTTPCDefinitions::GetMaxPatchNr( blocks[n].fSpecification );
385 unsigned long clusterCount=0;
386 HLTInfo( "Remaining cluster model block version %u",
387 (unsigned)*(AliHLTUInt32_t*)blocks[n].fPtr );
388 AliHLTUInt8_t* readPtr = (AliHLTUInt8_t*)(((AliHLTUInt8_t*)blocks[n].fPtr)+sizeof(AliHLTUInt32_t));
389 for(Int_t slice=0; slice<36; slice++)
391 for(Int_t patch=0; patch < 6; patch++)
398 unsigned rows = (unsigned)*readPtr;
400 for ( unsigned ii=0; ii<rows; ii++ )
402 AliHLTTPCRemainingRow* thisRow = (AliHLTTPCRemainingRow*)readPtr;
403 clusterCount += thisRow->fNClusters;
404 readPtr += sizeof(AliHLTTPCRemainingRow) + thisRow->fNClusters*sizeof(AliHLTTPCRemainingCluster);
408 HLTInfo( "Remaining cluster model block slices %u-%u - patches %u-%u - %lu clusters",
409 (unsigned)minSlice, (unsigned)maxSlice, (unsigned)minPatch, (unsigned)maxPatch,
411 readPtr = (AliHLTUInt8_t*)(((AliHLTUInt8_t*)blocks[n].fPtr)+sizeof(AliHLTUInt32_t));
413 for(Int_t slice=0; slice<36; slice++)
415 for(Int_t patch=0; patch < 6; patch++)
422 unsigned rows = (unsigned)*readPtr;
425 HLTInfo( " Slice %d - Partition %d", slice, patch );
426 for ( unsigned ii=0; ii<rows; ii++ )
428 AliHLTTPCRemainingRow* thisRow = (AliHLTTPCRemainingRow*)readPtr;
429 for ( unsigned jj=0; jj<thisRow->fNClusters; jj++ )
432 HLTInfo( " Cluster % 5lu: fID: %u (0x%08X) - fPadRow: %u - fPad: %f - fTime: %f - fSigmaY2: %f - fSigmaZ2: %f - fCharge: %hu",
433 clusterCount, thisRow->fClusters[jj].fID, thisRow->fClusters[jj].fID, (unsigned)thisRow->fPadRow, thisRow->fClusters[jj].fPad, thisRow->fClusters[jj].fTime, thisRow->fClusters[jj].fSigmaY2, thisRow->fClusters[jj].fSigmaZ2, thisRow->fClusters[jj].fCharge );
435 HLTInfo( " Cluster % 5lu: fPadRow: %u - fPad: %f - fTime: %f - fSigmaY2: %f - fSigmaZ2: %f - fCharge: %hu",
436 clusterCount, (unsigned)thisRow->fPadRow, thisRow->fClusters[jj].fPad, thisRow->fClusters[jj].fTime, thisRow->fClusters[jj].fSigmaY2, thisRow->fClusters[jj].fSigmaZ2, thisRow->fClusters[jj].fCharge );
439 readPtr += sizeof(AliHLTTPCRemainingRow) + thisRow->fNClusters*sizeof(AliHLTTPCRemainingCluster);
444 if ( blocks[n].fDataType == AliHLTTPCDefinitions::fgkClusterTracksCompressedDataType )
446 AliHLTUInt8_t minSlice=0xFF, maxSlice=0xFF, minPatch=0xFF, maxPatch=0xFF;
447 minSlice = AliHLTTPCDefinitions::GetMinSliceNr( blocks[n].fSpecification );
448 maxSlice = AliHLTTPCDefinitions::GetMaxSliceNr( blocks[n].fSpecification );
449 minPatch = AliHLTTPCDefinitions::GetMinPatchNr( blocks[n].fSpecification );
450 maxPatch = AliHLTTPCDefinitions::GetMaxPatchNr( blocks[n].fSpecification );
451 HLTInfo( "Track model block slices %u-%u - patches %u-%u",
452 (unsigned)minSlice, (unsigned)maxSlice, (unsigned)minPatch, (unsigned)maxPatch );
453 InitBitDataInput( (AliHLTUInt8_t*)blocks[n].fPtr, blocks[n].fSize );
454 HLTInfo( "Input position: %lu / %u (0x%02X)", GetCurrentByteInputPosition(), GetCurrentBitInputPosition(), (unsigned)GetCurrentInputByte() );
455 AliHLTUInt8_t version;
456 if ( !InputBits( version, 4 ) ) // Version information
458 HLTError( "Corrupt input data. Cannot read data version number at position %lu / %u",
459 GetCurrentByteInputPosition(), GetCurrentBitInputPosition() );
462 HLTInfo( "Data Format Version: %u", (unsigned)version );
463 HLTInfo( "Input position: %lu / %u (0x%02X)", GetCurrentByteInputPosition(), GetCurrentBitInputPosition(), (unsigned)GetCurrentInputByte() );
464 AliHLTUInt8_t readShape;
465 if ( !InputBit( readShape ) ) // Data format flag
467 HLTError( "Corrupt input data. Cannot read shape flag at position %lu / %u",
468 GetCurrentByteInputPosition(), GetCurrentBitInputPosition() );
471 HLTInfo( "Read shape: %s (%u)", (readShape ? "yes" : "no"), (unsigned)readShape );
472 HLTInfo( "Input position: %lu / %u (0x%02X)", GetCurrentByteInputPosition(), GetCurrentBitInputPosition(), (unsigned)GetCurrentInputByte() );
474 HLTInfo( "Input position: %lu / %u (0x%02X)", GetCurrentByteInputPosition(), GetCurrentBitInputPosition(), (unsigned)GetCurrentInputByte() );
478 bool inputError=false;
479 unsigned trackCount=0;
481 while ( !EndOfBitInput() )
483 AliHLTTPCTrackModel trackModel;
484 memset( &trackModel, 0, sizeof(trackModel) );
485 if ( !InputBytes( (AliHLTUInt8_t*)&trackModel, sizeof(AliHLTTPCTrackModel) ) )
487 HLTError( "Corrupt input data. Cannot read track model data at position %lu / %u",
488 GetCurrentByteInputPosition(), GetCurrentBitInputPosition() );
492 HLTInfo( " Track Model % 5lu fKappa: %f - fPhi: %f - fD: %f - fZ0: %f - fTgl: %f",
493 trackCount, trackModel.fKappa, trackModel.fPhi, trackModel.fD, trackModel.fZ0, trackModel.fTgl );
494 HLTInfo( "Input position: %lu / %u (0x%02X)", GetCurrentByteInputPosition(), GetCurrentBitInputPosition(), (unsigned)GetCurrentInputByte() );
496 Int_t clustercount=0;
497 for(Int_t i=0; i<AliHLTTPCTransform::GetNRows(); i++)
499 AliHLTTPCClusterModel cluster;
500 memset( &cluster, 0, sizeof(cluster) );
501 AliHLTUInt8_t present;
502 if ( !InputBit( present ) )
504 HLTError( "Corrupt input data. Cannot read cluster presence bit at position %lu / %u",
505 GetCurrentByteInputPosition(), GetCurrentBitInputPosition() );
509 HLTInfo( "Cluster %u present: %s (%u)", (unsigned)i, (present ? "yes" : "no"), (unsigned)present );
510 HLTInfo( "Input position: %lu / %u (0x%02X)", GetCurrentByteInputPosition(), GetCurrentBitInputPosition(), (unsigned)GetCurrentInputByte() );
511 cluster.fPresent = present;
514 if ( clustercount==0 )
516 if ( !InputBits( slice,6 ) ) //Need 6 bits to encode slice number
518 HLTError( "Corrupt input data. Cannot read cluster slice number at position %lu / %u",
519 GetCurrentByteInputPosition(), GetCurrentBitInputPosition() );
523 HLTInfo( "First cluster slice: %u", (unsigned)slice );
524 HLTInfo( "Input position: %lu / %u (0x%02X)", GetCurrentByteInputPosition(), GetCurrentBitInputPosition(), (unsigned)GetCurrentInputByte() );
528 AliHLTUInt8_t sliceChange;
529 if ( !InputBit( sliceChange ) )
531 HLTError( "Corrupt input data. Cannot read cluster slice change bit at position %lu / %u",
532 GetCurrentByteInputPosition(), GetCurrentBitInputPosition() );
536 HLTInfo( "Slice change: %s (%u)", (sliceChange ? "yes" : "no"), (unsigned)sliceChange );
537 HLTInfo( "Input position: %lu / %u (0x%02X)", GetCurrentByteInputPosition(), GetCurrentBitInputPosition(), (unsigned)GetCurrentInputByte() );
540 if ( !InputBits( slice, 6 ) )
542 HLTError( "Corrupt input data. Cannot read cluster slice number at position %lu / %u",
543 GetCurrentByteInputPosition(), GetCurrentBitInputPosition() );
547 HLTInfo( "Changed cluster slice: %u", (unsigned)slice );
548 HLTInfo( "Input position: %lu / %u (0x%02X)", GetCurrentByteInputPosition(), GetCurrentBitInputPosition(), (unsigned)GetCurrentInputByte() );
551 HLTInfo( "Slice. %d", slice );
552 cluster.fSlice = slice;
553 if ( cluster.fSlice<0 || cluster.fSlice>35 )
555 HLTError( "Inconsistent slice number %u (track %u, cluster %d)", cluster.fSlice, trackCount, i );
559 AliHLTUInt8_t signBit;
563 //Read time information:
564 if ( !InputBit( signBit ) )
566 HLTError( "Corrupt input data. Cannot read DTime sign bit at position %lu / %u",
567 GetCurrentByteInputPosition(), GetCurrentBitInputPosition() );
571 HLTInfo( "Input position: %lu / %u (0x%02X)", GetCurrentByteInputPosition(), GetCurrentBitInputPosition(), (unsigned)GetCurrentInputByte() );
574 if ( !InputBits( temp, AliHLTTPCCompDataCompressorHelper::GetNTimeBits()-1 ) )
576 HLTError( "Corrupt input data. Cannot read DTime data at position %lu / %u",
577 GetCurrentByteInputPosition(), GetCurrentBitInputPosition() );
581 HLTInfo( "Input position: %lu / %u (0x%02X)", GetCurrentByteInputPosition(), GetCurrentBitInputPosition(), (unsigned)GetCurrentInputByte() );
583 cluster.fDTime = val*sign;
586 //Read pad information:
587 if ( !InputBit( signBit ) )
589 HLTError( "Corrupt input data. Cannot read DPad sign bit at position %lu / %u",
590 GetCurrentByteInputPosition(), GetCurrentBitInputPosition() );
594 HLTInfo( "Input position: %lu / %u (0x%02X)", GetCurrentByteInputPosition(), GetCurrentBitInputPosition(), (unsigned)GetCurrentInputByte() );
597 if ( !InputBits( temp, AliHLTTPCCompDataCompressorHelper::GetNPadBits()-1 ) )
599 HLTError( "Corrupt input data. Cannot read DPad data at position %lu / %u",
600 GetCurrentByteInputPosition(), GetCurrentBitInputPosition() );
604 HLTInfo( "Input position: %lu / %u (0x%02X)", GetCurrentByteInputPosition(), GetCurrentBitInputPosition(), (unsigned)GetCurrentInputByte() );
606 cluster.fDPad = val*sign;
608 // Read charge information:
609 if ( !InputBits( temp, AliHLTTPCCompDataCompressorHelper::GetNChargeBits() ) )
611 HLTError( "Corrupt input data. Cannot read charge data at position %lu / %u",
612 GetCurrentByteInputPosition(), GetCurrentBitInputPosition() );
616 HLTInfo( "Input position: %lu / %u (0x%02X)", GetCurrentByteInputPosition(), GetCurrentBitInputPosition(), (unsigned)GetCurrentInputByte() );
617 cluster.fDCharge = temp;
621 // Read shape information:
622 if ( !InputBit( signBit ) )
624 HLTError( "Corrupt input data. Cannot read DSigmaY sign bit at position %lu / %u",
625 GetCurrentByteInputPosition(), GetCurrentBitInputPosition() );
629 HLTInfo( "Input position: %lu / %u (0x%02X)", GetCurrentByteInputPosition(), GetCurrentBitInputPosition(), (unsigned)GetCurrentInputByte() );
632 if ( !InputBits( temp, AliHLTTPCCompDataCompressorHelper::GetNShapeBits()-1 ) )
634 HLTError( "Corrupt input data. Cannot read DSigmaY data at position %lu / %u",
635 GetCurrentByteInputPosition(), GetCurrentBitInputPosition() );
639 HLTInfo( "Input position: %lu / %u (0x%02X)", GetCurrentByteInputPosition(), GetCurrentBitInputPosition(), (unsigned)GetCurrentInputByte() );
641 cluster.fDSigmaY = val*sign;
643 if ( !InputBit( signBit ) )
645 HLTError( "Corrupt input data. Cannot read DSigmaZ sign bit at position %lu / %u",
646 GetCurrentByteInputPosition(), GetCurrentBitInputPosition() );
650 HLTInfo( "Input position: %lu / %u (0x%02X)", GetCurrentByteInputPosition(), GetCurrentBitInputPosition(), (unsigned)GetCurrentInputByte() );
653 if ( !InputBits( temp, AliHLTTPCCompDataCompressorHelper::GetNShapeBits()-1 ) )
655 HLTError( "Corrupt input data. Cannot read DSigmaZ data at position %lu / %u",
656 GetCurrentByteInputPosition(), GetCurrentBitInputPosition() );
660 HLTInfo( "Input position: %lu / %u (0x%02X)", GetCurrentByteInputPosition(), GetCurrentBitInputPosition(), (unsigned)GetCurrentInputByte() );
662 cluster.fDSigmaZ = val*sign;
666 HLTInfo( " Cluster % 05u: fDTime: %f - fDPad: %f - fDCharge: %f - fDSigmaY: %f - fDSigmaZ: %f - fNPads: %u - fSlice: %hd - padrow: %lu - fPresent: %u",
667 clustercount, cluster.fDTime, cluster.fDPad, cluster.fDCharge, cluster.fDSigmaY, cluster.fDSigmaZ, cluster.fNPads, cluster.fSlice, (unsigned long)i, (unsigned)cluster.fPresent );
677 HLTInfo( "Input position: %lu / %u (0x%02X)", GetCurrentByteInputPosition(), GetCurrentBitInputPosition(), (unsigned)GetCurrentInputByte() );
685 if ( blocks[n].fDataType == AliHLTTPCDefinitions::fgkRemainingClustersCompressedDataType )
687 AliHLTUInt8_t* inputPtr = (AliHLTUInt8_t*)blocks[n].fPtr;
689 InitBitDataInput( inputPtr, blocks[n].fSize );
690 AliHLTUInt8_t version;
691 if ( !InputBits( version, 4 ) ) // Version information
693 HLTError( "Corrupt input data. Cannot read data version number at position %u / %u",
694 (unsigned)GetCurrentByteInputPosition(), (unsigned)GetCurrentBitInputPosition() );
697 HLTInfo( "Remaining cluster data version: %u", (unsigned)version );
700 HLTError( "Unsupported version %hu. Only version 0 supported currently.", version );
704 unsigned long clusterCount=0;
705 for(Int_t slice=0; slice<=35; slice++)
707 for(Int_t patch=0; patch < 6; patch++)
710 //Write number of padrows with clusters
712 if ( !InputBits( nRows, 8 ) )
714 HLTError( "Corrupt input data. Cannot read padrow count at position %u / %u",
715 (unsigned)GetCurrentByteInputPosition(), (unsigned)GetCurrentBitInputPosition() );
718 HLTInfo( "slice %u patch %u: %u padrows",
719 (unsigned)slice, (unsigned)patch, (unsigned)nRows );
724 //HLTInfo( " Slice %d - Partition %d", slice, patch );
725 for ( UInt_t jj=0; jj<nRows; jj++ )
729 if ( !InputBits(padrow,8) ) //Read padrow #
731 HLTError( "Corrupt input data. Cannot read padrow number at position %u / %u",
732 (unsigned)GetCurrentByteInputPosition(), (unsigned)GetCurrentBitInputPosition() );
735 HLTInfo( "Padrow: %u", (unsigned)padrow );
737 if ( !InputBits(nClusters,10) )//Read number of clusters on this padrow
739 HLTError( "Corrupt input data. Cannot read cluster count at position %u / %u",
740 (unsigned)GetCurrentByteInputPosition(), (unsigned)GetCurrentBitInputPosition() );
743 HLTInfo( " #Clusters: %u", (unsigned)nClusters );
744 for ( i=0; i<nClusters; i++ )
747 AliHLTTPCRemainingCluster cl;
749 if ( !InputBits(buff,AliHLTTPCCompDataCompressorHelper::GetNPadBitsRemaining()) )
751 HLTError( "Corrupt input data. Cannot read cluster pad data at position %u / %u",
752 (unsigned)GetCurrentByteInputPosition(), (unsigned)GetCurrentBitInputPosition() );
755 cl.fPad = (Float_t)( ((double)buff) / AliHLTTPCCompDataCompressorHelper::GetPadPrecisionFactor() );
758 if ( !InputBits(buff,AliHLTTPCCompDataCompressorHelper::GetNTimeBitsRemaining()) )
760 HLTError( "Corrupt input data. Cannot read cluster time data at position %u / %u",
761 (unsigned)GetCurrentByteInputPosition(), (unsigned)GetCurrentBitInputPosition() );
764 cl.fTime = (Float_t)( ((double)buff) / AliHLTTPCCompDataCompressorHelper::GetTimePrecisionFactor() );
767 if ( !InputBits(buff,AliHLTTPCCompDataCompressorHelper::GetNShapeBitsRemaining()) )
769 HLTError( "Corrupt input data. Cannot read cluster pad width data at position %u / %u",
770 (unsigned)GetCurrentByteInputPosition(), (unsigned)GetCurrentBitInputPosition() );
773 Float_t padw = (Float_t)( ((double)buff) / AliHLTTPCCompDataCompressorHelper::GetPadPrecisionFactor() );
774 cl.fSigmaY2 = padw*padw;
776 if ( !InputBits(buff,AliHLTTPCCompDataCompressorHelper::GetNShapeBitsRemaining()) )
778 HLTError( "Corrupt input data. Cannot read cluster time width data at position %u / %u",
779 (unsigned)GetCurrentByteInputPosition(), (unsigned)GetCurrentBitInputPosition() );
782 Float_t timew = (Float_t)( ((double)buff) / AliHLTTPCCompDataCompressorHelper::GetTimePrecisionFactor() );
783 cl.fSigmaZ2 = timew*timew;
786 if ( !InputBits(buff,AliHLTTPCCompDataCompressorHelper::GetNChargeBits()) )
788 HLTError( "Corrupt input data. Cannot read cluster charge data at position %u / %u",
789 (unsigned)GetCurrentByteInputPosition(), (unsigned)GetCurrentBitInputPosition() );
794 HLTInfo( " Cluster % 5lu (% 5u): fPadRow: %u - fPad: %f - fTime: %f - fSigmaY2: %f - fSigmaZ2: %f - fCharge: %hu",
795 clusterCount, (unsigned)i, (unsigned)padrow, cl.fPad, cl.fTime, cl.fSigmaY2, cl.fSigmaZ2, cl.fCharge );