2 // ************************************************************************
3 // This file is property of and copyright by the ALICE HLT Project *
4 // ALICE Experiment at CERN, All rights reserved. *
5 // See cxx source for full Copyright notice *
7 //*************************************************************************
9 #ifndef ALIHLTTPCCADATACOMPRESSOR_H
10 #define ALIHLTTPCCADATACOMPRESSOR_H
12 #include "AliHLTTPCCADef.h"
15 * @class AliHLTTPCCADataCompressor
17 * The AliHLTTPCCADataCompressor class is used to
18 * pack and unpack diffferent data, such as TPC cluster IDs, posistion, amplitude etc
21 class AliHLTTPCCADataCompressor
25 GPUhd() static UInt_t IRowIClu2IDrc( UInt_t iRow, UInt_t iCluster ){
26 return (iCluster<<8)+iRow;
29 GPUhd() static UInt_t IDrc2IRow( UInt_t IDrc ){ return ( IDrc%256 ); }
30 GPUhd() static UInt_t IDrc2IClu( UInt_t IDrc ){ return ( IDrc>>8 ); }
33 GPUhd() static UInt_t ISliceIRowIClu2IDsrc( UInt_t iSlice, UInt_t iRow, UInt_t iCluster ){
34 return (iCluster<<14) + (iRow<<6) + iSlice;
37 GPUhd() static UInt_t IDsrc2ISlice( UInt_t IDsrc ){ return ( IDsrc%64 ); }
38 GPUhd() static UInt_t IDsrc2IRow ( UInt_t IDsrc ){ return ( (IDsrc>>6)%256 ); }
39 GPUhd() static UInt_t IDsrc2IClu ( UInt_t IDsrc ){ return ( IDsrc>>14 ); }
42 GPUhd() static UShort_t YZ2UShort( Float_t Y, Float_t Z );
43 GPUhd() static Float_t UShort2Y ( UShort_t iYZ );
44 GPUhd() static Float_t UShort2Z ( UShort_t iYZ );
52 GPUhd() inline UShort_t AliHLTTPCCADataCompressor::YZ2UShort( Float_t Y, Float_t Z )
54 // compress Y and Z coordinates in range [-3., 3.] to 16 bits
56 const Float_t kMult = 255./6.;
60 else if( Y>255. ) Y = 255.;
62 else if( Z>255. ) Z = 255.;
63 return static_cast<UShort_t>( ( static_cast<UInt_t>( Y )<<8) + static_cast<UInt_t>( Z ) );
66 GPUhd() inline Float_t AliHLTTPCCADataCompressor::UShort2Y( UShort_t iYZ )
68 // extract Y coordinate from the compressed 16bits format to [-3.,3.]
70 const Float_t kMult = 6./255.;
71 return (iYZ >> 8)*kMult - 3.;
74 GPUhd() inline Float_t AliHLTTPCCADataCompressor::UShort2Z( UShort_t iYZ )
76 // extract Z coordinate from the compressed 16bits format to [-3.,3.]
78 const Float_t kMult = 6./255.;
79 return (iYZ % 256)*kMult - 3.;