]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/comp/AliL3Compress.h
Added possibility to compile and run with mc information. This was done
[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
28   void CreateDigitArray(Int_t maxnumber);
29   void CreateDigits(Int_t row,Int_t npads,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
34  public:
35   AliL3Compress();
36   AliL3Compress(Int_t slice,Int_t patch,Char_t *path="./");
37   virtual ~AliL3Compress();
38   
39   void SetBitNumbers(Int_t pad,Int_t time,Int_t charge,Int_t shape);
40   void WriteFile(AliL3TrackArray *tracks);
41   void ReadFile(Char_t which);
42   void CompressFile();
43   void ExpandFile();
44   void RestoreData(Char_t which='u');
45   void WriteRestoredData();
46   void WriteRootFile(Char_t *newrootfile);
47   void PrintDigits(Int_t padrow=-1);
48   void PrintCompRatio();
49   
50   AliL3TrackArray *GetTracks() {return fTracks;}
51   
52   ClassDef(AliL3Compress,1) 
53
54 };
55
56 inline Int_t  AliL3Compress::ComparePoints(Int_t row,UShort_t pad,UShort_t time)
57 {
58   if(fNUsed >= fNDigits) return 0;
59   
60   if(fDPt[fNUsed]->fRow != row) return 0;
61   
62   
63   if(fDPt[fNUsed]->fPad < pad) return 1;
64   if(fDPt[fNUsed]->fPad == pad && fDPt[fNUsed]->fTime < time) return 1;
65   
66   //if(fDPt[fNUsed]->fPad == pad && fDPt[fNUsed]->fTime == time) return 2;
67   
68   return 0;
69
70 }
71
72 inline 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
84 #endif