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 | |
8 | class AliL3TrackArray; |
9 | |
10 | class 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); |
29 | void CreateDigits(Int_t row,Float_t pad,Float_t time,Int_t charge,Float_t ywidth,Float_t zwidth); |
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(); |
44 | void RestoreData(); |
45 | void WriteRestoredData(); |
46 | void WriteRootFile(Char_t *digitsfile,Char_t *rootfile); |
029912b7 |
47 | void PrintDigits(); |
92a876e2 |
48 | void PrintCompRatio(); |
49 | |
95a00d93 |
50 | AliL3TrackArray *GetTracks() {return fTracks;} |
51 | |
5bf93292 |
52 | ClassDef(AliL3Compress,1) |
53 | |
54 | }; |
55 | |
029912b7 |
56 | inline 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 | |
62 | if(fDPt[fNUsed]->fPad < pad) return 1; |
63 | if(fDPt[fNUsed]->fPad == pad && fDPt[fNUsed]->fTime < time) return 1; |
64 | |
65 | return 0; |
66 | |
67 | } |
68 | |
69 | inline Int_t AliL3Compress::CompareDigits(AliL3RandomDigitData *a,AliL3RandomDigitData *b) |
70 | { |
71 | if(a->fRow < b->fRow) return -1; |
72 | |
73 | if(a->fPad==b->fPad && a->fTime == b->fTime && a->fRow == b->fRow) return 0; |
74 | |
75 | if(a->fPad<b->fPad && a->fRow == b->fRow) return -1; |
76 | if(a->fPad==b->fPad && a->fTime<b->fTime && a->fRow == b->fRow) return -1; |
77 | |
78 | return 1; |
79 | } |
80 | |
5bf93292 |
81 | #endif |