1 // $Id: AliHLTTPCCompModelDeflater.cxx,v 1.2 2006/08/10 09:46:51 richterm Exp $
3 /**************************************************************************
4 * TPCCompModelDeflaterright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
6 * Authors: Timm Steinbeck <timm@kip.uni-heidelberg.de> *
7 * for The ALICE Off-line Project. *
9 * Permission to use, copy, modify and distribute this software and its *
10 * documentation strictly for non-commercial purposes is hereby granted *
11 * without fee, provided that the above copyright notice appears in all *
12 * copies and that both the copyright notice and this permission notice *
13 * appear in the supporting documentation. The authors make no claims *
14 * about the suitability of this software for any purpose. It is *
15 * provided "as is" without express or implied warranty. *
16 **************************************************************************/
18 /** @file AliHLTTPCCompModelDeflater.cxx
19 @author Timm Steinbeck
21 @brief A copy processing component for the HLT. */
27 #include "AliHLTTPCCompModelDeflater.h"
28 #include "AliHLTTPCTransform.h"
29 #include "AliHLTTPCTrack.h"
30 #include "AliHLTTPCModelTrack.h"
31 #include "AliHLTTPCCompDataCompressorHelper.h"
32 #include "AliHLTDataTypes.h"
35 AliHLTTPCCompModelDeflater::AliHLTTPCCompModelDeflater():
37 fBitDataCurrentWord(0),
38 fBitDataCurrentPosInWord(0),
39 fBitDataCurrentOutput(0),
40 fBitDataCurrentOutputStart(0),
41 fBitDataCurrentOutputEnd(0)
43 // see header file for class documentation
46 AliHLTTPCCompModelDeflater::~AliHLTTPCCompModelDeflater()
48 // see header file for class documentation
51 int AliHLTTPCCompModelDeflater::CompressTracks( AliHLTUInt8_t* inData, UInt_t const& inputSize, AliHLTUInt8_t* output, UInt_t& outputSize )
53 // see header file for class documentation
54 AliHLTUInt8_t* inputPtr = inData;
55 AliHLTUInt8_t* inputEndPtr = inData+inputSize;
57 if ( inputPtr+sizeof(AliHLTUInt32_t)>inputEndPtr )
59 HLTError( "Cannot read input data version number" );
62 if ( *(AliHLTUInt32_t*)inputPtr != 0 )
64 HLTError( "Only input data format version 0 is supported. Found version: %u",
65 (unsigned)*(AliHLTUInt32_t*)inputPtr );
68 inputPtr += sizeof(AliHLTUInt32_t);
70 printf( "outuptSize: %lu\n", (unsigned long)outputSize );
72 InitBitDataOutput( output, outputSize );
73 HLTDebug( "Output: Position: %lu / %u (0x%02X)", GetCurrentByteOutputPosition(), GetCurrentBitOutputPosition(), (unsigned)GetCurrentOutputByte() );
74 OutputBits( 0, 4 ); // Version information
75 HLTDebug( "Output: Position: %lu / %u (0x%02X)", GetCurrentByteOutputPosition(), GetCurrentBitOutputPosition(), (unsigned)GetCurrentOutputByte() );
76 OutputBit( fWriteShape ? 1 : 0 ); // Data format flag
77 HLTDebug( "Output: Position: %lu / %u (0x%02X)", GetCurrentByteOutputPosition(), GetCurrentBitOutputPosition(), (unsigned)GetCurrentOutputByte() );
79 HLTDebug( "Output: Position: %lu / %u (0x%02X / 0x%02X)", GetCurrentByteOutputPosition(), GetCurrentBitOutputPosition(), (unsigned)GetCurrentOutputByte(-1), (unsigned)GetCurrentOutputByte() );
81 AliHLTTPCClusterModel *cluster;
85 Int_t timeo,pado,chargeo,padshapeo,timeshapeo;
86 timeo=pado=chargeo=padshapeo=timeshapeo=0;
88 while( inputPtr<inputEndPtr )
90 if ( !OutputBytes( inputPtr, sizeof(AliHLTTPCTrackModel) ) )
92 HLTError( "Not enough space to write compressed data. %lu already written",
93 (unsigned long)GetBitDataOutputSizeBytes() );
94 printf( "TRACE: %s:%d\n", __FILE__, __LINE__ );
95 outputSize = GetBitDataOutputSizeBytes();
98 HLTDebug( "sizeof(AliHLTTPCTrackModel): %d", sizeof(AliHLTTPCTrackModel) );
99 HLTDebug( "Output: Position: %lu / %u (0x%02X / 0x%02X)", GetCurrentByteOutputPosition(), GetCurrentBitOutputPosition(), (unsigned)GetCurrentOutputByte(-1), (unsigned)GetCurrentOutputByte() );
100 inputPtr += sizeof(AliHLTTPCTrackModel);
102 Int_t origslice=-1,slice,clustercount=0;
103 for(Int_t i=0; i<AliHLTTPCTransform::GetNRows(); i++)
105 cluster = (AliHLTTPCClusterModel*)inputPtr;
106 inputPtr += sizeof(AliHLTTPCClusterModel);
109 if ( !OutputBit( cluster->fPresent ? 1 : 0 ) )
111 HLTError( "Not enough space to write compressed data. %lu already written",
112 (unsigned long)GetBitDataOutputSizeBytes() );
113 printf( "TRACE: %s:%d\n", __FILE__, __LINE__ );
114 outputSize = GetBitDataOutputSizeBytes();
117 HLTDebug( "Output: Position: %lu / %u (0x%02X / 0x%02X)", GetCurrentByteOutputPosition(), GetCurrentBitOutputPosition(), (unsigned)GetCurrentOutputByte(-1), (unsigned)GetCurrentOutputByte() );
118 if ( !cluster->fPresent )
121 if ( cluster->fSlice<0 || cluster->fSlice>35 )
123 HLTError( "Inconsistent slice number %u (track %u, cluster %d)", cluster->fSlice, trackCnt, i );
124 printf( "TRACE: %s:%d\n", __FILE__, __LINE__ );
128 //Write slice number of first point
129 if ( clustercount==0 )
131 origslice = cluster->fSlice;
132 if ( !OutputBits( origslice,6 ) ) //Need 6 bits to encode slice number
134 HLTError( "Not enough space to write compressed data. %lu already written",
135 (unsigned long)GetBitDataOutputSizeBytes() );
136 printf( "TRACE: %s:%d\n", __FILE__, __LINE__ );
137 outputSize = GetBitDataOutputSizeBytes();
140 HLTDebug( "Output: Position: %lu / %u (0x%02X / 0x%02X)", GetCurrentByteOutputPosition(), GetCurrentBitOutputPosition(), (unsigned)GetCurrentOutputByte(-1), (unsigned)GetCurrentOutputByte() );
144 slice = cluster->fSlice;
145 if( slice == origslice )
147 if ( !OutputBit( 0 ) ) //No change of slice
149 HLTError( "Not enough space to write compressed data. %lu already written",
150 (unsigned long)GetBitDataOutputSizeBytes() );
151 outputSize = GetBitDataOutputSizeBytes();
152 printf( "TRACE: %s:%d\n", __FILE__, __LINE__ );
155 HLTDebug( "No slice change (%d/%d)", (int)origslice, (int)slice );
156 HLTDebug( "Output: Position: %lu / %u (0x%02X / 0x%02X)", GetCurrentByteOutputPosition(), GetCurrentBitOutputPosition(), (unsigned)GetCurrentOutputByte(-1), (unsigned)GetCurrentOutputByte() );
160 if ( !OutputBit( 1 ) )
162 HLTError( "Not enough space to write compressed data. %lu already written",
163 (unsigned long)GetBitDataOutputSizeBytes() );
164 outputSize = GetBitDataOutputSizeBytes();
165 printf( "TRACE: %s:%d\n", __FILE__, __LINE__ );
168 HLTDebug( "Slice change (%d/%d)", (int)origslice, (int)slice );
169 HLTDebug( "Output: Position: %lu / %u (0x%02X / 0x%02X)", GetCurrentByteOutputPosition(), GetCurrentBitOutputPosition(), (unsigned)GetCurrentOutputByte(-1), (unsigned)GetCurrentOutputByte() );
170 if ( !OutputBits( slice, 6 ) )
172 HLTError( "Not enough space to write compressed data. %lu already written",
173 (unsigned long)GetBitDataOutputSizeBytes() );
174 outputSize = GetBitDataOutputSizeBytes();
175 printf( "TRACE: %s:%d\n", __FILE__, __LINE__ );
178 HLTDebug( "Output: Position: %lu / %u (0x%02X / 0x%02X)", GetCurrentByteOutputPosition(), GetCurrentBitOutputPosition(), (unsigned)GetCurrentOutputByte(-1), (unsigned)GetCurrentOutputByte() );
183 //Write time information:
184 temp = (Int_t)rint(cluster->fDTime);
187 if ( !OutputBit( 0 ) )
189 HLTError( "Not enough space to write compressed data. %lu already written",
190 (unsigned long)GetBitDataOutputSizeBytes() );
191 outputSize = GetBitDataOutputSizeBytes();
192 printf( "TRACE: %s:%d\n", __FILE__, __LINE__ );
195 HLTDebug( "Output: Position: %lu / %u (0x%02X / 0x%02X)", GetCurrentByteOutputPosition(), GetCurrentBitOutputPosition(), (unsigned)GetCurrentOutputByte(-1), (unsigned)GetCurrentOutputByte() );
199 if ( !OutputBit( 1 ) )
201 HLTError( "Not enough space to write compressed data. %lu already written",
202 (unsigned long)GetBitDataOutputSizeBytes() );
203 printf( "TRACE: %s:%d\n", __FILE__, __LINE__ );
204 outputSize = GetBitDataOutputSizeBytes();
207 HLTDebug( "Output: Position: %lu / %u (0x%02X / 0x%02X)", GetCurrentByteOutputPosition(), GetCurrentBitOutputPosition(), (unsigned)GetCurrentOutputByte(-1), (unsigned)GetCurrentOutputByte() );
209 power = 1<<(AliHLTTPCCompDataCompressorHelper::GetNTimeBits()-1);
210 if ( abs(temp)>=power )
212 //cout<<abs(temp)<<" "<<power<<endl;
217 if ( !OutputBits(temp,(AliHLTTPCCompDataCompressorHelper::GetNTimeBits()-1)) )
219 HLTError( "Not enough space to write compressed data. %lu already written",
220 (unsigned long)GetBitDataOutputSizeBytes() );
221 printf( "TRACE: %s:%d\n", __FILE__, __LINE__ );
222 outputSize = GetBitDataOutputSizeBytes();
225 HLTDebug( "Output: Position: %lu / %u (0x%02X / 0x%02X / 0x%02X)", GetCurrentByteOutputPosition(), GetCurrentBitOutputPosition(), (unsigned)GetCurrentOutputByte(-2), (unsigned)GetCurrentOutputByte(-1), (unsigned)GetCurrentOutputByte() );
227 //Write pad information:
228 temp = (Int_t)rint(cluster->fDPad);
229 HLTDebug( "cluster->fDPad (%d): %f - temp: %d", clustercount, cluster->fDPad, temp );
232 if ( !OutputBit( 0 ) )
234 HLTError( "Not enough space to write compressed data. %lu already written",
235 (unsigned long)GetBitDataOutputSizeBytes() );
236 outputSize = GetBitDataOutputSizeBytes();
237 printf( "TRACE: %s:%d\n", __FILE__, __LINE__ );
240 HLTDebug( "Output: Position: %lu / %u (0x%02X / 0x%02X)", GetCurrentByteOutputPosition(), GetCurrentBitOutputPosition(), (unsigned)GetCurrentOutputByte(-1), (unsigned)GetCurrentOutputByte() );
244 if ( !OutputBit( 1 ) )
246 HLTError( "Not enough space to write compressed data. %lu already written",
247 (unsigned long)GetBitDataOutputSizeBytes() );
248 outputSize = GetBitDataOutputSizeBytes();
249 printf( "TRACE: %s:%d\n", __FILE__, __LINE__ );
252 HLTDebug( "Output: Position: %lu / %u (0x%02X / 0x%02X)", GetCurrentByteOutputPosition(), GetCurrentBitOutputPosition(), (unsigned)GetCurrentOutputByte(-1), (unsigned)GetCurrentOutputByte() );
254 power = 1<<(AliHLTTPCCompDataCompressorHelper::GetNPadBits()-1);
255 if ( abs(temp)>=power )
261 if ( !OutputBits(temp,(AliHLTTPCCompDataCompressorHelper::GetNPadBits()-1)) )
263 HLTError( "Not enough space to write compressed data. %lu already written",
264 (unsigned long)GetBitDataOutputSizeBytes() );
265 outputSize = GetBitDataOutputSizeBytes();
266 printf( "TRACE: %s:%d\n", __FILE__, __LINE__ );
269 HLTDebug( "Output: Position: %lu / %u (0x%02X / 0x%02X / 0x%02X)", GetCurrentByteOutputPosition(), GetCurrentBitOutputPosition(), (unsigned)GetCurrentOutputByte(-2), (unsigned)GetCurrentOutputByte(-1), (unsigned)GetCurrentOutputByte() );
271 //Write charge information:
272 temp = (Int_t)cluster->fDCharge;
273 power = 1<<(AliHLTTPCCompDataCompressorHelper::GetNChargeBits());
274 if ( abs(temp)>=power )
280 if ( !OutputBits(temp,(AliHLTTPCCompDataCompressorHelper::GetNChargeBits())) )
282 HLTError( "Not enough space to write compressed data. %lu already written",
283 (unsigned long)GetBitDataOutputSizeBytes() );
284 outputSize = GetBitDataOutputSizeBytes();
285 printf( "TRACE: %s:%d\n", __FILE__, __LINE__ );
288 HLTDebug( "Output: Position: %lu / %u (0x%02X / 0x%02X / 0x%02X)", GetCurrentByteOutputPosition(), GetCurrentBitOutputPosition(), (unsigned)GetCurrentOutputByte(-2), (unsigned)GetCurrentOutputByte(-1), (unsigned)GetCurrentOutputByte() );
292 //Write shape information:
293 // HLTInfo("DSigmaY %f", cluster->fDSigmaY);
294 temp = (Int_t)rint(cluster->fDSigmaY);
295 // HLTInfo("temp %d", temp);
298 if ( !OutputBit( 0 ) )
300 HLTError( "Not enough space to write compressed data. %lu already written",
301 (unsigned long)GetBitDataOutputSizeBytes() );
302 printf( "TRACE: %s:%d\n", __FILE__, __LINE__ );
303 outputSize = GetBitDataOutputSizeBytes();
306 HLTDebug( "Output: Position: %lu / %u (0x%02X / 0x%02X)", GetCurrentByteOutputPosition(), GetCurrentBitOutputPosition(), (unsigned)GetCurrentOutputByte(-1), (unsigned)GetCurrentOutputByte() );
310 if ( !OutputBit( 1 ) )
312 HLTError( "Not enough space to write compressed data. %lu already written",
313 (unsigned long)GetBitDataOutputSizeBytes() );
314 outputSize = GetBitDataOutputSizeBytes();
315 printf( "TRACE: %s:%d\n", __FILE__, __LINE__ );
318 HLTDebug( "Output: Position: %lu / %u (0x%02X / 0x%02X)", GetCurrentByteOutputPosition(), GetCurrentBitOutputPosition(), (unsigned)GetCurrentOutputByte(-1), (unsigned)GetCurrentOutputByte() );
320 power = 1<<(AliHLTTPCCompDataCompressorHelper::GetNShapeBits()-1);
321 if ( abs(temp) >= power )
327 if ( !OutputBits(temp,(AliHLTTPCCompDataCompressorHelper::GetNShapeBits()-1)) )
329 HLTError( "Not enough space to write compressed data. %lu already written",
330 (unsigned long)GetBitDataOutputSizeBytes() );
331 printf( "TRACE: %s:%d\n", __FILE__, __LINE__ );
332 outputSize = GetBitDataOutputSizeBytes();
335 HLTDebug( "Output: Position: %lu / %u (0x%02X / 0x%02X / 0x%02X)", GetCurrentByteOutputPosition(), GetCurrentBitOutputPosition(), (unsigned)GetCurrentOutputByte(-2), (unsigned)GetCurrentOutputByte(-1), (unsigned)GetCurrentOutputByte() );
337 temp = (Int_t)rint(cluster->fDSigmaZ);
340 if ( !OutputBit( 0 ) )
342 HLTError( "Not enough space to write compressed data. %lu already written",
343 (unsigned long)GetBitDataOutputSizeBytes() );
344 printf( "TRACE: %s:%d\n", __FILE__, __LINE__ );
345 outputSize = GetBitDataOutputSizeBytes();
348 HLTDebug( "Output: Position: %lu / %u (0x%02X / 0x%02X)", GetCurrentByteOutputPosition(), GetCurrentBitOutputPosition(), (unsigned)GetCurrentOutputByte(-1), (unsigned)GetCurrentOutputByte() );
352 if ( !OutputBit( 1 ) )
354 HLTError( "Not enough space to write compressed data. %lu already written",
355 (unsigned long)GetBitDataOutputSizeBytes() );
356 printf( "TRACE: %s:%d\n", __FILE__, __LINE__ );
357 outputSize = GetBitDataOutputSizeBytes();
360 HLTDebug( "Output: Position: %lu / %u (0x%02X / 0x%02X)", GetCurrentByteOutputPosition(), GetCurrentBitOutputPosition(), (unsigned)GetCurrentOutputByte(-1), (unsigned)GetCurrentOutputByte() );
362 power = 1<<(AliHLTTPCCompDataCompressorHelper::GetNShapeBits()-1);
363 if ( abs(temp) >= power )
369 if ( !OutputBits(temp,(AliHLTTPCCompDataCompressorHelper::GetNShapeBits()-1)) )
371 HLTError( "Not enough space to write compressed data. %lu already written",
372 (unsigned long)GetBitDataOutputSizeBytes() );
373 printf( "TRACE: %s:%d\n", __FILE__, __LINE__ );
374 outputSize = GetBitDataOutputSizeBytes();
377 HLTDebug( "Output: Position: %lu / %u (0x%02X / 0x%02X / 0x%02X)", GetCurrentByteOutputPosition(), GetCurrentBitOutputPosition(), (unsigned)GetCurrentOutputByte(-2), (unsigned)GetCurrentOutputByte(-1), (unsigned)GetCurrentOutputByte() );
385 CloseBitDataOutput();
386 HLTDebug( "Output: Position: %lu / %u (0x%02X / 0x%02X)", GetCurrentByteOutputPosition(), GetCurrentBitOutputPosition(), (unsigned)GetCurrentOutputByte(-1), (unsigned)GetCurrentOutputByte() );
387 outputSize = GetBitDataOutputSizeBytes();
391 int AliHLTTPCCompModelDeflater::CompressRemainingClusters( AliHLTUInt8_t* inData, UInt_t const& inputSize, AliHLTUInt8_t* output, UInt_t& outputSize )
393 // see header file for class documentation
394 AliHLTUInt8_t* inputPtr = inData;
395 AliHLTUInt8_t* inputEndPtr = inData+inputSize;
397 AliHLTUInt32_t version = *(AliHLTUInt32_t*)inputPtr;
398 inputPtr += sizeof(AliHLTUInt32_t);
401 HLTError( "Unsupported version %hu. Only version 0 supported currently.", version );
405 InitBitDataOutput( output, outputSize );
406 OutputBits( 0, 4 ); // Version information
407 //OutputBit( fWriteShape ); // Data format flag
410 //Write the remaining clusters in a compressed format.
412 for(Int_t slice=0; slice<=35; slice++)
414 for(Int_t patch=0; patch < 6; patch++)
417 HLTDebug( "slice %u patch %u: %u padrows",
418 (unsigned)slice, (unsigned)patch, (unsigned)*inputPtr );
419 //Write number of padrows with clusters
420 if ( inputPtr>=inputEndPtr )
422 HLTError( "Corrupt input data, cannot read row counter for slice %u, partition %u", (unsigned)slice, (unsigned)patch );
425 if ( !OutputBits( *inputPtr,8 ) )
427 HLTError( "Not enough space to write compressed data. %lu already written",
428 (unsigned long)GetBitDataOutputSizeBytes() );
429 outputSize = GetBitDataOutputSizeBytes();
437 UInt_t nRows=(UInt_t)*inputPtr;
439 if ( inputPtr>=inputEndPtr )
441 HLTError( "Corrupt input data, unexpected end of data after row counter for slice %u, partition %u", (unsigned)slice, (unsigned)patch );
445 for ( UInt_t jj=0; jj<nRows; jj++ )
448 AliHLTTPCRemainingRow *thisRow = (AliHLTTPCRemainingRow*)inputPtr;
449 if ( inputPtr+sizeof(AliHLTTPCRemainingRow)>inputEndPtr )
451 HLTError( "Corrupt input data, cannot read row data for row %u of slice %u, partition %u", (unsigned)jj, (unsigned)slice, (unsigned)patch );
454 AliHLTTPCRemainingCluster *cl = thisRow->fClusters;
455 HLTDebug( "Row %u: %u clusters", (unsigned)thisRow->fPadRow, (unsigned)thisRow->fNClusters );
456 if ( inputPtr+sizeof(AliHLTTPCRemainingRow)+thisRow->fNClusters*sizeof(AliHLTTPCRemainingCluster)>inputEndPtr )
458 HLTError( "Corrupt input data, unable to read clusters for row %u, slice %u, partition %u", (unsigned)jj, (unsigned)slice, (unsigned)patch );
461 Int_t padrow = thisRow->fPadRow;
462 if ( !OutputBits(padrow,8) ) //Write padrow #
464 HLTError( "Not enough space to write compressed data. %lu already written",
465 (unsigned long)GetBitDataOutputSizeBytes() );
466 outputSize = GetBitDataOutputSizeBytes();
469 if( thisRow->fNClusters >= 1<<10)
471 HLTError( "Too many remaining clusters (%u)", (unsigned)thisRow->fNClusters );
474 if ( !OutputBits(thisRow->fNClusters,10) )//Write number of clusters on this padrow
476 HLTError( "Not enough space to write compressed data. %lu already written",
477 (unsigned long)GetBitDataOutputSizeBytes() );
478 outputSize = GetBitDataOutputSizeBytes();
481 for ( i=0; i<thisRow->fNClusters; i++ )
484 Float_t padw = sqrt(cl[i].fSigmaY2);
485 //HLTInfo( "padw0: %f", padw );
486 Float_t timew = sqrt( cl[i].fSigmaZ2 );
488 //Check for saturation in the widths.
489 //Basically only store a certain number of decimals here, and cut the widths which is higher:
490 if(padw >= (1<<AliHLTTPCCompDataCompressorHelper::GetNShapeBitsRemaining()) / AliHLTTPCCompDataCompressorHelper::GetPadPrecisionFactor())
491 padw = (1<<AliHLTTPCCompDataCompressorHelper::GetNShapeBitsRemaining()) / AliHLTTPCCompDataCompressorHelper::GetPadPrecisionFactor() - 1/AliHLTTPCCompDataCompressorHelper::GetPadPrecisionFactor();
492 //HLTInfo( "padw1: %f", padw );
493 if(timew >= (1<<AliHLTTPCCompDataCompressorHelper::GetNShapeBitsRemaining()) / AliHLTTPCCompDataCompressorHelper::GetTimePrecisionFactor())
494 timew = (1<<AliHLTTPCCompDataCompressorHelper::GetNShapeBitsRemaining()) / AliHLTTPCCompDataCompressorHelper::GetTimePrecisionFactor() - 1/AliHLTTPCCompDataCompressorHelper::GetTimePrecisionFactor();;
498 buff = (Int_t)rint(cl[i].fPad*AliHLTTPCCompDataCompressorHelper::GetPadPrecisionFactor());
501 HLTError( "Wrong pad value %d (%f, %f, row %u, i: %u)",buff, cl[i].fPad, AliHLTTPCCompDataCompressorHelper::GetPadPrecisionFactor(), (unsigned)thisRow->fNClusters, (unsigned)i );
504 if ( !OutputBits(buff,AliHLTTPCCompDataCompressorHelper::GetNPadBitsRemaining()) )
506 HLTError( "Not enough space to write compressed data. %lu already written",
507 (unsigned long)GetBitDataOutputSizeBytes() );
508 outputSize = GetBitDataOutputSizeBytes();
514 buff = (Int_t)rint(cl[i].fTime*AliHLTTPCCompDataCompressorHelper::GetTimePrecisionFactor());
517 HLTError( "Wrong time value %d",buff);
520 if ( !OutputBits(buff,AliHLTTPCCompDataCompressorHelper::GetNTimeBitsRemaining()) )
522 HLTError( "Not enough space to write compressed data. %lu already written",
523 (unsigned long)GetBitDataOutputSizeBytes() );
524 outputSize = GetBitDataOutputSizeBytes();
529 buff = (Int_t)rint(padw*AliHLTTPCCompDataCompressorHelper::GetPadPrecisionFactor());
530 HLTDebug( "padw/buff: %d (%d / 0x%08X)", buff,
531 (buff & ((1<<AliHLTTPCCompDataCompressorHelper::GetNShapeBitsRemaining())-1)),
532 (buff & ((1<<AliHLTTPCCompDataCompressorHelper::GetNShapeBitsRemaining())-1)) );
534 if ( !OutputBits(buff,AliHLTTPCCompDataCompressorHelper::GetNShapeBitsRemaining()) )
536 HLTError( "Not enough space to write compressed data. %lu already written",
537 (unsigned long)GetBitDataOutputSizeBytes() );
538 outputSize = GetBitDataOutputSizeBytes();
541 buff = (Int_t)rint(timew*AliHLTTPCCompDataCompressorHelper::GetTimePrecisionFactor());
542 if ( !OutputBits(buff,AliHLTTPCCompDataCompressorHelper::GetNShapeBitsRemaining()) )
544 HLTError( "Not enough space to write compressed data. %lu already written",
545 (unsigned long)GetBitDataOutputSizeBytes() );
546 outputSize = GetBitDataOutputSizeBytes();
551 buff = cl[i].fCharge;
552 if(buff >= 1<<(AliHLTTPCCompDataCompressorHelper::GetNChargeBits()))
553 buff = (1<<(AliHLTTPCCompDataCompressorHelper::GetNChargeBits()))-1;
554 if ( !OutputBits(buff,AliHLTTPCCompDataCompressorHelper::GetNChargeBits()) )
556 HLTError( "Not enough space to write compressed data. %lu already written",
557 (unsigned long)GetBitDataOutputSizeBytes() );
558 outputSize = GetBitDataOutputSizeBytes();
562 inputPtr += sizeof(AliHLTTPCRemainingRow)+thisRow->fNClusters*sizeof(AliHLTTPCRemainingCluster);
567 CloseBitDataOutput();
568 outputSize = GetBitDataOutputSizeBytes();