2 // Original: AliHLTDataCompressorHelper.cxx,v 1.5 2004/06/15 10:26:57 hristov Exp $
4 //**************************************************************************
5 //* This file is property of and copyright by the ALICE HLT Project *
6 //* ALICE Experiment at CERN, All rights reserved. *
8 //* Primary Authors: Anders Vestbo *
9 //* for The ALICE HLT Project. *
11 //* Permission to use, copy, modify and distribute this software and its *
12 //* documentation strictly for non-commercial purposes is hereby granted *
13 //* without fee, provided that the above copyright notice appears in all *
14 //* copies and that both the copyright notice and this permission notice *
15 //* appear in the supporting documentation. The authors make no claims *
16 //* about the suitability of this software for any purpose. It is *
17 //* provided "as is" without express or implied warranty. *
18 //**************************************************************************
20 #include "AliHLTStdIncludes.h"
21 #include "AliHLTTPCRootTypes.h"
22 #include "AliHLTTPCTransform.h"
24 #include "AliHLTTPCDataCompressorHelper.h"
30 //_____________________________________________________________
32 // AliHLTTPCDataCompression
34 // Interface class; binary <-> AliROOT handling of TPC data compression classes.
38 ClassImp(AliHLTTPCDataCompressorHelper)
40 AliHLTTPCDataCompressorHelper::AliHLTTPCDataCompressorHelper()
44 AliHLTTPCDataCompressorHelper::~AliHLTTPCDataCompressorHelper()
48 Int_t AliHLTTPCDataCompressorHelper::fgNumTimeBits = 12;
49 Int_t AliHLTTPCDataCompressorHelper::fgNumPadBits = 12;
50 Int_t AliHLTTPCDataCompressorHelper::fgNumChargeBits = 14;
51 Int_t AliHLTTPCDataCompressorHelper::fgNumShapeBits = 14;
52 Float_t AliHLTTPCDataCompressorHelper::fgXYResidualStep1 = 0.03;
53 Float_t AliHLTTPCDataCompressorHelper::fgXYResidualStep2 = 0.03;
54 Float_t AliHLTTPCDataCompressorHelper::fgXYResidualStep3 = 0.03;
55 Float_t AliHLTTPCDataCompressorHelper::fgZResidualStep1 = 0.05;
56 Float_t AliHLTTPCDataCompressorHelper::fgZResidualStep2 = 0.05;
57 Float_t AliHLTTPCDataCompressorHelper::fgZResidualStep3 = 0.05;
58 Float_t AliHLTTPCDataCompressorHelper::fgXYWidthStep = 0.005;
59 Float_t AliHLTTPCDataCompressorHelper::fgZWidthStep = 0.005;
60 Int_t AliHLTTPCDataCompressorHelper::fgClusterCharge = 100;
61 Int_t AliHLTTPCDataCompressorHelper::fgNumPadBitsRemaining = 18;
62 Int_t AliHLTTPCDataCompressorHelper::fgNumTimeBitsRemaining = 19;
63 Int_t AliHLTTPCDataCompressorHelper::fgNumShapeBitsRemaining = 11;
65 void AliHLTTPCDataCompressorHelper::SetBitNumbers(Int_t pad,Int_t time,Int_t charge,Int_t shape)
67 // sets the numbers of bits
70 fgNumChargeBits = charge;
71 fgNumShapeBits = shape;
74 void AliHLTTPCDataCompressorHelper::SetTransverseResolutions(Float_t res1,Float_t res2,Float_t res3,Float_t width)
76 // sets the transverse resolution
77 fgXYResidualStep1 = res1;
78 fgXYResidualStep2 = res2;
79 fgXYResidualStep3 = res3;
80 fgXYWidthStep = width;
83 void AliHLTTPCDataCompressorHelper::SetLongitudinalResolutions(Float_t res1,Float_t res2,Float_t res3,Float_t width)
85 // sets the longitudinal resolution
86 fgZResidualStep1 = res1;
87 fgZResidualStep2 = res2;
88 fgZResidualStep3 = res3;
92 void AliHLTTPCDataCompressorHelper::SetRemainingBitNumbers(Int_t pad,Int_t time,Int_t shape)
94 // sets the numbers of remaining bits
95 fgNumPadBitsRemaining = pad;
96 fgNumTimeBitsRemaining = time;
97 fgNumShapeBitsRemaining = shape;
100 Float_t AliHLTTPCDataCompressorHelper::GetXYResidualStep(Int_t row)
102 // gets the XY residual step
103 if(row < AliHLTTPCTransform::GetNRowLow())
104 return fgXYResidualStep1;
105 else if(row < AliHLTTPCTransform::GetNRowLow() + AliHLTTPCTransform::GetNRowUp1())
106 return fgXYResidualStep2;
107 else if(row < AliHLTTPCTransform::GetNRowLow() + AliHLTTPCTransform::GetNRowUp1() + AliHLTTPCTransform::GetNRowUp2())
108 return fgXYResidualStep3;
111 cerr<<"AliHLTTPCDataCompressorHelper::GetXYResidualStep : Wrong row number "<<row<<endl;
116 Float_t AliHLTTPCDataCompressorHelper::GetZResidualStep(Int_t row)
118 // gets the Z residual step
119 if(row < AliHLTTPCTransform::GetNRowLow())
120 return fgZResidualStep1;
121 else if(row < AliHLTTPCTransform::GetNRowLow() + AliHLTTPCTransform::GetNRowUp1())
122 return fgZResidualStep2;
123 else if(row < AliHLTTPCTransform::GetNRowLow() + AliHLTTPCTransform::GetNRowUp1() + AliHLTTPCTransform::GetNRowUp2())
124 return fgZResidualStep3;
127 cerr<<"AliHLTTPCDataCompressorHelper::GetXYResidualStep : Wrong row number "<<row<<endl;
132 Float_t AliHLTTPCDataCompressorHelper::GetPadPrecisionFactor()
134 // gets pad precision factor
135 Int_t nbits = fgNumPadBitsRemaining;
148 cerr<<"AliHLTTPCDataCompressorHelper::GetRemainingPadFactor : Too few bits for the pad direction: "<<nbits<<endl;
153 Float_t AliHLTTPCDataCompressorHelper::GetTimePrecisionFactor()
155 // gest time precision factor
156 Int_t nbits = fgNumTimeBitsRemaining;
169 cerr<<"AliHLTTPCDataCompressorHelper::GetRemainingPadFactor : Too few bits for the pad direction: "<<nbits<<endl;
175 Int_t AliHLTTPCDataCompressorHelper::Nint(Double_t x)
177 // Round to nearest integer. Rounds half integers
178 // to the nearest even integer.
183 if (x + 0.5 == Double_t(i) && i & 1) i--;
186 if (x - 0.5 == Double_t(i) && i & 1) i++;