Moved from AliTransbit to AliL3Transbit.
[u/mrichter/AliRoot.git] / HLT / comp / AliL3Compress.h
CommitLineData
5bf93292 1#ifndef AliL3_Compress
2#define AliL3_Compress
3
4#include "AliL3RootTypes.h"
5#include "AliL3Models.h"
029912b7 6#include "AliL3DigitData.h"
5bf93292 7
8class AliL3TrackArray;
9
10class AliL3Compress {
11
12 private:
95a00d93 13 AliL3TrackArray *fTracks; //!
029912b7 14 AliL3RandomDigitData *fDigits; //!
15 AliL3RandomDigitData **fDPt; //!
16 Int_t fNDigits;
17 Int_t fNUsed;
18 Int_t fMaxDigits;
5bf93292 19
029912b7 20 Int_t fNumPadBits;
21 Int_t fNumTimeBits;
22 Int_t fNumChargeBits;
23 Int_t fNumShapeBits;
24 Int_t fSlice;
25 Int_t fPatch;
be6ddb10 26 Char_t fPath[100];
27
029912b7 28 void CreateDigitArray(Int_t maxnumber);
ae9fbfa1 29 void CreateDigits(Int_t row,Int_t npads,Float_t pad,Float_t time,Int_t charge,Float_t ywidth,Float_t zwidth);
029912b7 30 void QSort(AliL3RandomDigitData **a, Int_t first, Int_t last);
31 Int_t ComparePoints(Int_t row,UShort_t pad,UShort_t time);
32 Int_t CompareDigits(AliL3RandomDigitData *a,AliL3RandomDigitData *b);
33
5bf93292 34 public:
35 AliL3Compress();
be6ddb10 36 AliL3Compress(Int_t slice,Int_t patch,Char_t *path="./");
5bf93292 37 virtual ~AliL3Compress();
38
029912b7 39 void SetBitNumbers(Int_t pad,Int_t time,Int_t charge,Int_t shape);
be6ddb10 40 void WriteFile(AliL3TrackArray *tracks);
41 void ReadFile(Char_t which);
42 void CompressFile();
43 void ExpandFile();
4a838220 44 void RestoreData(Char_t which='u');
be6ddb10 45 void WriteRestoredData();
4a838220 46 void WriteRootFile(Char_t *newrootfile);
47 void PrintDigits(Int_t padrow=-1);
92a876e2 48 void PrintCompRatio();
49
95a00d93 50 AliL3TrackArray *GetTracks() {return fTracks;}
51
5bf93292 52 ClassDef(AliL3Compress,1)
53
54};
55
029912b7 56inline Int_t AliL3Compress::ComparePoints(Int_t row,UShort_t pad,UShort_t time)
57{
be6ddb10 58 if(fNUsed >= fNDigits) return 0;
029912b7 59
60 if(fDPt[fNUsed]->fRow != row) return 0;
61
4a838220 62
029912b7 63 if(fDPt[fNUsed]->fPad < pad) return 1;
64 if(fDPt[fNUsed]->fPad == pad && fDPt[fNUsed]->fTime < time) return 1;
65
4a838220 66 //if(fDPt[fNUsed]->fPad == pad && fDPt[fNUsed]->fTime == time) return 2;
67
029912b7 68 return 0;
69
70}
71
72inline Int_t AliL3Compress::CompareDigits(AliL3RandomDigitData *a,AliL3RandomDigitData *b)
73{
74 if(a->fRow < b->fRow) return -1;
75
76 if(a->fPad==b->fPad && a->fTime == b->fTime && a->fRow == b->fRow) return 0;
77
78 if(a->fPad<b->fPad && a->fRow == b->fRow) return -1;
79 if(a->fPad==b->fPad && a->fTime<b->fTime && a->fRow == b->fRow) return -1;
80
81 return 1;
82}
83
5bf93292 84#endif