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 /** ROOT macro for the implementation of ROOT specific class methods */
42 ClassImp(AliHLTTPCCompDumpComponent)
44 AliHLTTPCCompDumpComponent::AliHLTTPCCompDumpComponent()
46 fBitDataCurrentWord(0),
47 fBitDataCurrentPosInWord(0),
48 fBitDataCurrentInput(NULL),
49 fBitDataCurrentInputStart(NULL),
50 fBitDataCurrentInputEnd(NULL)
52 // see header file for class documentation
55 AliHLTTPCCompDumpComponent::~AliHLTTPCCompDumpComponent()
57 // see header file for class documentation
60 const char* AliHLTTPCCompDumpComponent::GetComponentID()
62 // see header file for class documentation
63 return "TPCCompDump"; // The ID of this component
66 void AliHLTTPCCompDumpComponent::GetInputDataTypes( vector<AliHLTComponent_DataType>& list)
68 // see header file for class documentation
69 list.clear(); // We do not have any requirements for our input data type(s).
70 list.push_back( AliHLTTPCDefinitions::fgkClustersDataType );
71 list.push_back( AliHLTTPCDefinitions::fgkTrackSegmentsDataType );
72 list.push_back( AliHLTTPCDefinitions::fgkTracksDataType );
73 list.push_back( AliHLTTPCDefinitions::fgkClusterTracksModelDataType );
74 list.push_back( AliHLTTPCDefinitions::fgkRemainingClustersModelDataType );
77 AliHLTComponent_DataType AliHLTTPCCompDumpComponent::GetOutputDataType()
79 // see header file for class documentation
80 return AliHLTTPCDefinitions::fgkClusterTracksModelDataType;
83 void AliHLTTPCCompDumpComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
85 // see header file for class documentation
88 //#warning Adapt input Multiplier to something more realistic
92 // Spawn function, return new instance of this class
93 AliHLTComponent* AliHLTTPCCompDumpComponent::Spawn()
95 // see header file for class documentation
96 return new AliHLTTPCCompDumpComponent;
99 void AliHLTTPCCompDumpComponent::InitBitDataInput( AliHLTUInt8_t* input, UInt_t inputSize )
101 // see header file for class documentation
102 fBitDataCurrentWord = 0;
103 fBitDataCurrentPosInWord = 7;
104 fBitDataCurrentInput = fBitDataCurrentInputStart = input;
105 fBitDataCurrentInputEnd = input+inputSize;
106 fBitDataCurrentWord = *fBitDataCurrentInput;
109 bool AliHLTTPCCompDumpComponent::InputBit( AliHLTUInt8_t & value )
111 // see header file for class documentation
112 if ( fBitDataCurrentInput>=fBitDataCurrentInputEnd )
114 value = (fBitDataCurrentWord >> fBitDataCurrentPosInWord) & 1;
115 if ( fBitDataCurrentPosInWord )
116 fBitDataCurrentPosInWord--;
119 fBitDataCurrentInput++;
120 if ( fBitDataCurrentInput<fBitDataCurrentInputEnd )
122 fBitDataCurrentWord = *fBitDataCurrentInput;
123 fBitDataCurrentPosInWord = 7;
129 bool AliHLTTPCCompDumpComponent::InputBits( AliHLTUInt8_t & value, UInt_t const & bitCount )
131 // see header file for class documentation
134 HLTFatal( "Internal error: Attempt to write more than 32 bits (%u)", (unsigned)bitCount );
138 if ( !InputBits( temp, bitCount ) )
140 value = (AliHLTUInt8_t)( temp & (AliHLTUInt64_t)0xFFFFFFFFULL );
144 bool AliHLTTPCCompDumpComponent::InputBits( AliHLTUInt16_t & value, UInt_t const & bitCount )
146 // see header file for class documentation
149 HLTFatal( "Internal error: Attempt to write more than 32 bits (%u)", (unsigned)bitCount );
153 if ( !InputBits( temp, bitCount ) )
155 value = (AliHLTUInt16_t)( temp & (AliHLTUInt64_t)0xFFFFFFFFULL );
159 bool AliHLTTPCCompDumpComponent::InputBits( AliHLTUInt32_t & value, UInt_t const & bitCount )
161 // see header file for class documentation
164 HLTFatal( "Internal error: Attempt to write more than 32 bits (%u)", (unsigned)bitCount );
168 if ( !InputBits( temp, bitCount ) )
170 value = (AliHLTUInt32_t)( temp & (AliHLTUInt64_t)0xFFFFFFFFULL );
174 bool AliHLTTPCCompDumpComponent::InputBits( Int_t & value, UInt_t const & bitCount )
176 // see header file for class documentation
179 HLTFatal( "Internal error: Attempt to write more than 32 bits (%u)", (unsigned)bitCount );
183 if ( !InputBits( temp, bitCount ) )
185 value = (Int_t)( temp & (AliHLTUInt64_t)0xFFFFFFFFULL );
189 bool AliHLTTPCCompDumpComponent::InputBits( AliHLTUInt64_t & value, UInt_t const & bitCount )
191 // see header file for class documentation
194 HLTFatal( "Internal error: Attempt to write more than 64 bits (%u)", (unsigned)bitCount );
197 UInt_t bitsToRead=bitCount;
200 while ( bitsToRead>0 )
202 if ( fBitDataCurrentInput>=fBitDataCurrentInputEnd )
204 if ( bitsToRead >= fBitDataCurrentPosInWord+1 )
205 curBitCount = fBitDataCurrentPosInWord+1;
207 curBitCount = bitsToRead;
208 value = (value << curBitCount) | ( (fBitDataCurrentWord >> (fBitDataCurrentPosInWord-curBitCount+1)) & ((1 << curBitCount)-1) );
209 if ( fBitDataCurrentPosInWord < curBitCount )
211 fBitDataCurrentInput++;
212 if ( fBitDataCurrentInput<fBitDataCurrentInputEnd )
214 fBitDataCurrentWord = *fBitDataCurrentInput;
215 fBitDataCurrentPosInWord = 7;
219 fBitDataCurrentPosInWord -= curBitCount;
220 bitsToRead -= curBitCount;
225 void AliHLTTPCCompDumpComponent::Pad8Bits()
227 // see header file for class documentation
228 if ( fBitDataCurrentPosInWord == 7 )
230 fBitDataCurrentInput++;
231 if ( fBitDataCurrentInput<fBitDataCurrentInputEnd )
233 fBitDataCurrentWord = *fBitDataCurrentInput;
234 fBitDataCurrentPosInWord = 7;
238 bool AliHLTTPCCompDumpComponent::InputBytes( AliHLTUInt8_t* data, UInt_t const & byteCount )
240 // see header file for class documentation
242 if ( fBitDataCurrentInput+byteCount>fBitDataCurrentInputEnd )
244 memcpy( data, fBitDataCurrentInput, byteCount );
245 fBitDataCurrentInput += byteCount;
246 if ( fBitDataCurrentInput<fBitDataCurrentInputEnd )
248 fBitDataCurrentWord = *fBitDataCurrentInput;
249 fBitDataCurrentPosInWord = 7;
254 int AliHLTTPCCompDumpComponent::DoInit( int argc, const char** argv )
256 // see header file for class documentation
260 Logging( kHLTLogDebug, "HLT::TPCCompDump::DoInit", "Arguments", "argv[0] == %s", argv[0] );
261 Logging(kHLTLogError, "HLT::TPCCompDump::DoInit", "Unknown Option", "Unknown option '%s'", argv[0] );
267 int AliHLTTPCCompDumpComponent::DoDeinit()
269 // see header file for class documentation
273 int AliHLTTPCCompDumpComponent::DoEvent( const AliHLTComponent_EventData& evtData, const AliHLTComponent_BlockData* blocks,
274 AliHLTComponent_TriggerData& /*trigData*/, AliHLTUInt8_t* ,
275 AliHLTUInt32_t& size, vector<AliHLTComponent_BlockData>& )
277 // see header file for class documentation
279 // Loop over all input blocks in the event
280 for ( unsigned long n = 0; n < evtData.fBlockCnt; n++ )
282 AliHLTUInt8_t slice, patch;
283 if ( blocks[n].fDataType == AliHLTTPCDefinitions::fgkClustersDataType )
285 slice = AliHLTTPCDefinitions::GetMinSliceNr( blocks[n].fSpecification );
286 patch = AliHLTTPCDefinitions::GetMinPatchNr( blocks[n].fSpecification );
287 AliHLTTPCClusterData* clusters = (AliHLTTPCClusterData*)blocks[n].fPtr;
288 HLTInfo( "Cluster block slice %u - patch %u - %lu clusters", (unsigned)slice, (unsigned)patch, (unsigned long)clusters->fSpacePointCnt );
289 for ( unsigned long ii=0; ii<clusters->fSpacePointCnt; ii++ )
291 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",
292 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].IsUsed() ? "yes" : "no"), clusters->fSpacePoints[ii].GetTrackNumber() );
294 Float_t xyzG[3] = { clusters->fSpacePoints[ii].fX, clusters->fSpacePoints[ii].fY, clusters->fSpacePoints[ii].fZ };
295 Float_t xyzR[3] = { clusters->fSpacePoints[ii].fX, clusters->fSpacePoints[ii].fY, clusters->fSpacePoints[ii].fZ };
296 AliHLTTPCTransform::LocHLT2Global( xyzG, slice, clusters->fSpacePoints[ii].fPadRow );
297 AliHLTTPCTransform::LocHLT2Raw( xyzG, slice, clusters->fSpacePoints[ii].fPadRow );
298 HLTInfo( " Global: fX: %f - fY: %f - fZ: %f - fZ",
299 xyzG[0], xyzG[1], xyzG[2] );
300 HLTInfo( " Raw: fX: %f - fY: %f - fZ: %f - fZ",
301 xyzR[0], xyzR[1], xyzR[2] );
306 if ( blocks[n].fDataType == AliHLTTPCDefinitions::fgkTrackSegmentsDataType ||
307 blocks[n].fDataType == AliHLTTPCDefinitions::fgkTracksDataType)
309 //fConverter.SetInputTracks( (AliHLTTPCTrackletData*)blocks[n].fPtr );
310 AliHLTUInt8_t minSlice=0xFF, maxSlice=0xFF, minPatch=0xFF, maxPatch=0xFF;
311 minSlice = AliHLTTPCDefinitions::GetMinSliceNr( blocks[n].fSpecification );
312 maxSlice = AliHLTTPCDefinitions::GetMaxSliceNr( blocks[n].fSpecification );
313 minPatch = AliHLTTPCDefinitions::GetMinPatchNr( blocks[n].fSpecification );
314 maxPatch = AliHLTTPCDefinitions::GetMaxPatchNr( blocks[n].fSpecification );
315 AliHLTTPCTrackletData* tracks = (AliHLTTPCTrackletData*)blocks[n].fPtr;
316 AliHLTTPCTrackSegmentData* tracklet = tracks->fTracklets;
317 HLTInfo( "Track block slices %u-%u - patches %u-%u - %lu tracks",
318 (unsigned)minSlice, (unsigned)maxSlice, (unsigned)minPatch, (unsigned)maxPatch,
319 (unsigned long)tracks->fTrackletCnt );
320 for ( unsigned long ii=0; ii<tracks->fTrackletCnt; ii++ )
322 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",
323 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 );
324 for ( unsigned long jj=0; jj<tracklet->fNPoints; jj++ )
326 HLTInfo( " Point % 5lu: % 8u / 0x%08X", jj, tracklet->fPointIDs[jj], tracklet->fPointIDs[jj] );
328 tracklet = (AliHLTTPCTrackSegmentData*) ( ((AliHLTUInt8_t*)tracklet)+sizeof(AliHLTTPCTrackSegmentData)+tracklet->fNPoints*sizeof(UInt_t) );
332 if ( blocks[n].fDataType == AliHLTTPCDefinitions::fgkClusterTracksModelDataType )
334 AliHLTUInt8_t minSlice=0xFF, maxSlice=0xFF, minPatch=0xFF, maxPatch=0xFF;
335 minSlice = AliHLTTPCDefinitions::GetMinSliceNr( blocks[n].fSpecification );
336 maxSlice = AliHLTTPCDefinitions::GetMaxSliceNr( blocks[n].fSpecification );
337 minPatch = AliHLTTPCDefinitions::GetMinPatchNr( blocks[n].fSpecification );
338 maxPatch = AliHLTTPCDefinitions::GetMaxPatchNr( blocks[n].fSpecification );
339 unsigned long trackletCount = (blocks[n].fSize-sizeof(AliHLTUInt32_t)) / (sizeof(AliHLTTPCTrackModel)+AliHLTTPCTransform::GetNRows()*sizeof(AliHLTTPCClusterModel) );
340 HLTInfo( "Track model block version %u slices %u-%u - patches %u-%u - %lu tracks",
341 (unsigned)*(AliHLTUInt32_t*)blocks[n].fPtr,
342 (unsigned)minSlice, (unsigned)maxSlice, (unsigned)minPatch, (unsigned)maxPatch,
343 (unsigned long)trackletCount );
344 AliHLTTPCTrackModel* trackModel = (AliHLTTPCTrackModel*)(((AliHLTUInt8_t*)blocks[n].fPtr)+sizeof(AliHLTUInt32_t));
345 for ( unsigned long ii=0; ii<trackletCount; ii++ )
347 unsigned clusterCount=0;
348 AliHLTTPCClusterModel* clusters = (AliHLTTPCClusterModel*) ( ((AliHLTUInt8_t*)trackModel)+sizeof(AliHLTTPCTrackModel) );
349 for ( unsigned long jj=0; jj<(unsigned long)AliHLTTPCTransform::GetNRows(); jj++ )
351 if ( clusters[jj].fPresent )
354 HLTInfo( " Track Model % 5lu fKappa: %f - fPhi: %f - fD: %f - fZ0: %f - fTgl: %f - #clusters: %u",
355 ii, trackModel->fKappa, trackModel->fPhi, trackModel->fD, trackModel->fZ0, trackModel->fTgl, clusterCount );
357 for ( unsigned long jj=0; jj<(unsigned long)AliHLTTPCTransform::GetNRows(); jj++ )
359 if ( clusters[jj].fPresent )
362 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",
363 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 );
365 HLTInfo( " Cluster % 05u: fDTime: %f - fDPad: %f - fDCharge: %f - fDSigmaY: %f - fDSigmaZ: %f - fNPads: %u - fSlice: %hd - padrow: %lu - fPresent: %u",
366 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 );
372 trackModel = (AliHLTTPCTrackModel*) ( ((AliHLTUInt8_t*)trackModel)+sizeof(AliHLTTPCTrackModel)+AliHLTTPCTransform::GetNRows()*sizeof(AliHLTTPCClusterModel) );
376 if ( blocks[n].fDataType == AliHLTTPCDefinitions::fgkRemainingClustersModelDataType )
378 AliHLTUInt8_t minSlice=0xFF, maxSlice=0xFF, minPatch=0xFF, maxPatch=0xFF;
379 minSlice = AliHLTTPCDefinitions::GetMinSliceNr( blocks[n].fSpecification );
380 maxSlice = AliHLTTPCDefinitions::GetMaxSliceNr( blocks[n].fSpecification );
381 minPatch = AliHLTTPCDefinitions::GetMinPatchNr( blocks[n].fSpecification );
382 maxPatch = AliHLTTPCDefinitions::GetMaxPatchNr( blocks[n].fSpecification );
383 unsigned long clusterCount=0;
384 HLTInfo( "Remaining cluster model block version %u",
385 (unsigned)*(AliHLTUInt32_t*)blocks[n].fPtr );
386 AliHLTUInt8_t* readPtr = (AliHLTUInt8_t*)(((AliHLTUInt8_t*)blocks[n].fPtr)+sizeof(AliHLTUInt32_t));
387 for(Int_t lslice=0; lslice<36; lslice++)
389 for(Int_t lpatch=0; lpatch < 6; lpatch++)
396 unsigned rows = (unsigned)*readPtr;
398 for ( unsigned ii=0; ii<rows; ii++ )
400 AliHLTTPCRemainingRow* thisRow = (AliHLTTPCRemainingRow*)readPtr;
401 clusterCount += thisRow->fNClusters;
402 readPtr += sizeof(AliHLTTPCRemainingRow) + thisRow->fNClusters*sizeof(AliHLTTPCRemainingCluster);
406 HLTInfo( "Remaining cluster model block slices %u-%u - patches %u-%u - %lu clusters",
407 (unsigned)minSlice, (unsigned)maxSlice, (unsigned)minPatch, (unsigned)maxPatch,
409 readPtr = (AliHLTUInt8_t*)(((AliHLTUInt8_t*)blocks[n].fPtr)+sizeof(AliHLTUInt32_t));
411 for(Int_t lslice=0; lslice<36; lslice++)
413 for(Int_t lpatch=0; lpatch < 6; lpatch++)
420 unsigned rows = (unsigned)*readPtr;
423 HLTInfo( " Slice %d - Partition %d", lslice, lpatch );
424 for ( unsigned ii=0; ii<rows; ii++ )
426 AliHLTTPCRemainingRow* thisRow = (AliHLTTPCRemainingRow*)readPtr;
427 for ( unsigned jj=0; jj<thisRow->fNClusters; jj++ )
430 HLTInfo( " Cluster % 5lu: fID: %u (0x%08X) - fPadRow: %u - fPad: %f - fTime: %f - fSigmaY2: %f - fSigmaZ2: %f - fCharge: %hu",
431 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 );
433 HLTInfo( " Cluster % 5lu: fPadRow: %u - fPad: %f - fTime: %f - fSigmaY2: %f - fSigmaZ2: %f - fCharge: %hu",
434 clusterCount, (unsigned)thisRow->fPadRow, thisRow->fClusters[jj].fPad, thisRow->fClusters[jj].fTime, thisRow->fClusters[jj].fSigmaY2, thisRow->fClusters[jj].fSigmaZ2, thisRow->fClusters[jj].fCharge );
437 readPtr += sizeof(AliHLTTPCRemainingRow) + thisRow->fNClusters*sizeof(AliHLTTPCRemainingCluster);
442 if ( blocks[n].fDataType == AliHLTTPCDefinitions::fgkClusterTracksCompressedDataType )
444 AliHLTUInt8_t minSlice=0xFF, maxSlice=0xFF, minPatch=0xFF, maxPatch=0xFF;
445 minSlice = AliHLTTPCDefinitions::GetMinSliceNr( blocks[n].fSpecification );
446 maxSlice = AliHLTTPCDefinitions::GetMaxSliceNr( blocks[n].fSpecification );
447 minPatch = AliHLTTPCDefinitions::GetMinPatchNr( blocks[n].fSpecification );
448 maxPatch = AliHLTTPCDefinitions::GetMaxPatchNr( blocks[n].fSpecification );
449 HLTInfo( "Track model block slices %u-%u - patches %u-%u",
450 (unsigned)minSlice, (unsigned)maxSlice, (unsigned)minPatch, (unsigned)maxPatch );
451 InitBitDataInput( (AliHLTUInt8_t*)blocks[n].fPtr, blocks[n].fSize );
452 HLTInfo( "Input position: %lu / %u (0x%02X)", GetCurrentByteInputPosition(), GetCurrentBitInputPosition(), (unsigned)GetCurrentInputByte() );
453 AliHLTUInt8_t version;
454 if ( !InputBits( version, 4 ) ) // Version information
456 HLTError( "Corrupt input data. Cannot read data version number at position %lu / %u",
457 GetCurrentByteInputPosition(), GetCurrentBitInputPosition() );
460 HLTInfo( "Data Format Version: %u", (unsigned)version );
461 HLTInfo( "Input position: %lu / %u (0x%02X)", GetCurrentByteInputPosition(), GetCurrentBitInputPosition(), (unsigned)GetCurrentInputByte() );
462 AliHLTUInt8_t readShape;
463 if ( !InputBit( readShape ) ) // Data format flag
465 HLTError( "Corrupt input data. Cannot read shape flag at position %lu / %u",
466 GetCurrentByteInputPosition(), GetCurrentBitInputPosition() );
469 HLTInfo( "Read shape: %s (%u)", (readShape ? "yes" : "no"), (unsigned)readShape );
470 HLTInfo( "Input position: %lu / %u (0x%02X)", GetCurrentByteInputPosition(), GetCurrentBitInputPosition(), (unsigned)GetCurrentInputByte() );
472 HLTInfo( "Input position: %lu / %u (0x%02X)", GetCurrentByteInputPosition(), GetCurrentBitInputPosition(), (unsigned)GetCurrentInputByte() );
476 bool inputError=false;
477 unsigned trackCount=0;
479 while ( !EndOfBitInput() )
481 AliHLTTPCTrackModel trackModel;
482 memset( &trackModel, 0, sizeof(trackModel) );
483 if ( !InputBytes( (AliHLTUInt8_t*)&trackModel, sizeof(AliHLTTPCTrackModel) ) )
485 HLTError( "Corrupt input data. Cannot read track model data at position %lu / %u",
486 GetCurrentByteInputPosition(), GetCurrentBitInputPosition() );
490 HLTInfo( " Track Model % 5lu fKappa: %f - fPhi: %f - fD: %f - fZ0: %f - fTgl: %f",
491 trackCount, trackModel.fKappa, trackModel.fPhi, trackModel.fD, trackModel.fZ0, trackModel.fTgl );
492 HLTInfo( "Input position: %lu / %u (0x%02X)", GetCurrentByteInputPosition(), GetCurrentBitInputPosition(), (unsigned)GetCurrentInputByte() );
494 Int_t clustercount=0;
495 for(Int_t i=0; i<AliHLTTPCTransform::GetNRows(); i++)
497 AliHLTTPCClusterModel cluster;
498 memset( &cluster, 0, sizeof(cluster) );
499 AliHLTUInt8_t present;
500 if ( !InputBit( present ) )
502 HLTError( "Corrupt input data. Cannot read cluster presence bit at position %lu / %u",
503 GetCurrentByteInputPosition(), GetCurrentBitInputPosition() );
507 HLTInfo( "Cluster %u present: %s (%u)", (unsigned)i, (present ? "yes" : "no"), (unsigned)present );
508 HLTInfo( "Input position: %lu / %u (0x%02X)", GetCurrentByteInputPosition(), GetCurrentBitInputPosition(), (unsigned)GetCurrentInputByte() );
509 cluster.fPresent = present;
512 if ( clustercount==0 )
514 if ( !InputBits( slice,6 ) ) //Need 6 bits to encode slice number
516 HLTError( "Corrupt input data. Cannot read cluster slice number at position %lu / %u",
517 GetCurrentByteInputPosition(), GetCurrentBitInputPosition() );
521 HLTInfo( "First cluster slice: %u", (unsigned)slice );
522 HLTInfo( "Input position: %lu / %u (0x%02X)", GetCurrentByteInputPosition(), GetCurrentBitInputPosition(), (unsigned)GetCurrentInputByte() );
526 AliHLTUInt8_t sliceChange;
527 if ( !InputBit( sliceChange ) )
529 HLTError( "Corrupt input data. Cannot read cluster slice change bit at position %lu / %u",
530 GetCurrentByteInputPosition(), GetCurrentBitInputPosition() );
534 HLTInfo( "Slice change: %s (%u)", (sliceChange ? "yes" : "no"), (unsigned)sliceChange );
535 HLTInfo( "Input position: %lu / %u (0x%02X)", GetCurrentByteInputPosition(), GetCurrentBitInputPosition(), (unsigned)GetCurrentInputByte() );
538 if ( !InputBits( slice, 6 ) )
540 HLTError( "Corrupt input data. Cannot read cluster slice number at position %lu / %u",
541 GetCurrentByteInputPosition(), GetCurrentBitInputPosition() );
545 HLTInfo( "Changed cluster slice: %u", (unsigned)slice );
546 HLTInfo( "Input position: %lu / %u (0x%02X)", GetCurrentByteInputPosition(), GetCurrentBitInputPosition(), (unsigned)GetCurrentInputByte() );
549 HLTInfo( "Slice. %d", slice );
550 cluster.fSlice = slice;
551 if ( cluster.fSlice<0 || cluster.fSlice>35 )
553 HLTError( "Inconsistent slice number %u (track %u, cluster %d)", cluster.fSlice, trackCount, i );
557 AliHLTUInt8_t signBit;
561 //Read time information:
562 if ( !InputBit( signBit ) )
564 HLTError( "Corrupt input data. Cannot read DTime sign bit at position %lu / %u",
565 GetCurrentByteInputPosition(), GetCurrentBitInputPosition() );
569 HLTInfo( "Input position: %lu / %u (0x%02X)", GetCurrentByteInputPosition(), GetCurrentBitInputPosition(), (unsigned)GetCurrentInputByte() );
572 if ( !InputBits( temp, AliHLTTPCCompDataCompressorHelper::GetNTimeBits()-1 ) )
574 HLTError( "Corrupt input data. Cannot read DTime data at position %lu / %u",
575 GetCurrentByteInputPosition(), GetCurrentBitInputPosition() );
579 HLTInfo( "Input position: %lu / %u (0x%02X)", GetCurrentByteInputPosition(), GetCurrentBitInputPosition(), (unsigned)GetCurrentInputByte() );
581 cluster.fDTime = val*sign;
584 //Read pad information:
585 if ( !InputBit( signBit ) )
587 HLTError( "Corrupt input data. Cannot read DPad sign bit at position %lu / %u",
588 GetCurrentByteInputPosition(), GetCurrentBitInputPosition() );
592 HLTInfo( "Input position: %lu / %u (0x%02X)", GetCurrentByteInputPosition(), GetCurrentBitInputPosition(), (unsigned)GetCurrentInputByte() );
595 if ( !InputBits( temp, AliHLTTPCCompDataCompressorHelper::GetNPadBits()-1 ) )
597 HLTError( "Corrupt input data. Cannot read DPad data at position %lu / %u",
598 GetCurrentByteInputPosition(), GetCurrentBitInputPosition() );
602 HLTInfo( "Input position: %lu / %u (0x%02X)", GetCurrentByteInputPosition(), GetCurrentBitInputPosition(), (unsigned)GetCurrentInputByte() );
604 cluster.fDPad = val*sign;
606 // Read charge information:
607 if ( !InputBits( temp, AliHLTTPCCompDataCompressorHelper::GetNChargeBits() ) )
609 HLTError( "Corrupt input data. Cannot read charge data at position %lu / %u",
610 GetCurrentByteInputPosition(), GetCurrentBitInputPosition() );
614 HLTInfo( "Input position: %lu / %u (0x%02X)", GetCurrentByteInputPosition(), GetCurrentBitInputPosition(), (unsigned)GetCurrentInputByte() );
615 cluster.fDCharge = temp;
619 // Read shape information:
620 if ( !InputBit( signBit ) )
622 HLTError( "Corrupt input data. Cannot read DSigmaY sign bit at position %lu / %u",
623 GetCurrentByteInputPosition(), GetCurrentBitInputPosition() );
627 HLTInfo( "Input position: %lu / %u (0x%02X)", GetCurrentByteInputPosition(), GetCurrentBitInputPosition(), (unsigned)GetCurrentInputByte() );
630 if ( !InputBits( temp, AliHLTTPCCompDataCompressorHelper::GetNShapeBits()-1 ) )
632 HLTError( "Corrupt input data. Cannot read DSigmaY data at position %lu / %u",
633 GetCurrentByteInputPosition(), GetCurrentBitInputPosition() );
637 HLTInfo( "Input position: %lu / %u (0x%02X)", GetCurrentByteInputPosition(), GetCurrentBitInputPosition(), (unsigned)GetCurrentInputByte() );
639 cluster.fDSigmaY = val*sign;
641 if ( !InputBit( signBit ) )
643 HLTError( "Corrupt input data. Cannot read DSigmaZ sign bit at position %lu / %u",
644 GetCurrentByteInputPosition(), GetCurrentBitInputPosition() );
648 HLTInfo( "Input position: %lu / %u (0x%02X)", GetCurrentByteInputPosition(), GetCurrentBitInputPosition(), (unsigned)GetCurrentInputByte() );
651 if ( !InputBits( temp, AliHLTTPCCompDataCompressorHelper::GetNShapeBits()-1 ) )
653 HLTError( "Corrupt input data. Cannot read DSigmaZ data at position %lu / %u",
654 GetCurrentByteInputPosition(), GetCurrentBitInputPosition() );
658 HLTInfo( "Input position: %lu / %u (0x%02X)", GetCurrentByteInputPosition(), GetCurrentBitInputPosition(), (unsigned)GetCurrentInputByte() );
660 cluster.fDSigmaZ = val*sign;
664 HLTInfo( " Cluster % 05u: fDTime: %f - fDPad: %f - fDCharge: %f - fDSigmaY: %f - fDSigmaZ: %f - fNPads: %u - fSlice: %hd - padrow: %lu - fPresent: %u",
665 clustercount, cluster.fDTime, cluster.fDPad, cluster.fDCharge, cluster.fDSigmaY, cluster.fDSigmaZ, cluster.fNPads, cluster.fSlice, (unsigned long)i, (unsigned)cluster.fPresent );
675 HLTInfo( "Input position: %lu / %u (0x%02X)", GetCurrentByteInputPosition(), GetCurrentBitInputPosition(), (unsigned)GetCurrentInputByte() );
683 if ( blocks[n].fDataType == AliHLTTPCDefinitions::fgkRemainingClustersCompressedDataType )
685 AliHLTUInt8_t* inputPtr = (AliHLTUInt8_t*)blocks[n].fPtr;
687 InitBitDataInput( inputPtr, blocks[n].fSize );
688 AliHLTUInt8_t version;
689 if ( !InputBits( version, 4 ) ) // Version information
691 HLTError( "Corrupt input data. Cannot read data version number at position %u / %u",
692 (unsigned)GetCurrentByteInputPosition(), (unsigned)GetCurrentBitInputPosition() );
695 HLTInfo( "Remaining cluster data version: %u", (unsigned)version );
698 HLTError( "Unsupported version %hu. Only version 0 supported currently.", version );
702 unsigned long clusterCount=0;
703 for(Int_t lslice=0; lslice<=35; lslice++)
705 for(Int_t lpatch=0; lpatch < 6; lpatch++)
708 //Write number of padrows with clusters
710 if ( !InputBits( nRows, 8 ) )
712 HLTError( "Corrupt input data. Cannot read padrow count at position %u / %u",
713 (unsigned)GetCurrentByteInputPosition(), (unsigned)GetCurrentBitInputPosition() );
716 HLTInfo( "slice %u patch %u: %u padrows",
717 (unsigned)lslice, (unsigned)lpatch, (unsigned)nRows );
722 //HLTInfo( " Slice %d - Partition %d", slice, patch );
723 for ( UInt_t jj=0; jj<nRows; jj++ )
727 if ( !InputBits(padrow,8) ) //Read padrow #
729 HLTError( "Corrupt input data. Cannot read padrow number at position %u / %u",
730 (unsigned)GetCurrentByteInputPosition(), (unsigned)GetCurrentBitInputPosition() );
733 HLTInfo( "Padrow: %u", (unsigned)padrow );
735 if ( !InputBits(nClusters,10) )//Read number of clusters on this padrow
737 HLTError( "Corrupt input data. Cannot read cluster count at position %u / %u",
738 (unsigned)GetCurrentByteInputPosition(), (unsigned)GetCurrentBitInputPosition() );
741 HLTInfo( " #Clusters: %u", (unsigned)nClusters );
742 for ( i=0; i<nClusters; i++ )
745 AliHLTTPCRemainingCluster cl;
747 if ( !InputBits(buff,AliHLTTPCCompDataCompressorHelper::GetNPadBitsRemaining()) )
749 HLTError( "Corrupt input data. Cannot read cluster pad data at position %u / %u",
750 (unsigned)GetCurrentByteInputPosition(), (unsigned)GetCurrentBitInputPosition() );
753 cl.fPad = (Float_t)( ((double)buff) / AliHLTTPCCompDataCompressorHelper::GetPadPrecisionFactor() );
756 if ( !InputBits(buff,AliHLTTPCCompDataCompressorHelper::GetNTimeBitsRemaining()) )
758 HLTError( "Corrupt input data. Cannot read cluster time data at position %u / %u",
759 (unsigned)GetCurrentByteInputPosition(), (unsigned)GetCurrentBitInputPosition() );
762 cl.fTime = (Float_t)( ((double)buff) / AliHLTTPCCompDataCompressorHelper::GetTimePrecisionFactor() );
765 if ( !InputBits(buff,AliHLTTPCCompDataCompressorHelper::GetNShapeBitsRemaining()) )
767 HLTError( "Corrupt input data. Cannot read cluster pad width data at position %u / %u",
768 (unsigned)GetCurrentByteInputPosition(), (unsigned)GetCurrentBitInputPosition() );
771 Float_t padw = (Float_t)( ((double)buff) / AliHLTTPCCompDataCompressorHelper::GetPadPrecisionFactor() );
772 cl.fSigmaY2 = padw*padw;
774 if ( !InputBits(buff,AliHLTTPCCompDataCompressorHelper::GetNShapeBitsRemaining()) )
776 HLTError( "Corrupt input data. Cannot read cluster time width data at position %u / %u",
777 (unsigned)GetCurrentByteInputPosition(), (unsigned)GetCurrentBitInputPosition() );
780 Float_t timew = (Float_t)( ((double)buff) / AliHLTTPCCompDataCompressorHelper::GetTimePrecisionFactor() );
781 cl.fSigmaZ2 = timew*timew;
784 if ( !InputBits(buff,AliHLTTPCCompDataCompressorHelper::GetNChargeBits()) )
786 HLTError( "Corrupt input data. Cannot read cluster charge data at position %u / %u",
787 (unsigned)GetCurrentByteInputPosition(), (unsigned)GetCurrentBitInputPosition() );
792 HLTInfo( " Cluster % 5lu (% 5u): fPadRow: %u - fPad: %f - fTime: %f - fSigmaY2: %f - fSigmaZ2: %f - fCharge: %hu",
793 clusterCount, (unsigned)i, (unsigned)padrow, cl.fPad, cl.fTime, cl.fSigmaY2, cl.fSigmaZ2, cl.fCharge );