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