]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/src/AliL3VertexArray.h
Moved all the constants from AliL3Defs.h to static AliL3Transform. No
[u/mrichter/AliRoot.git] / HLT / src / AliL3VertexArray.h
1 #ifndef AliL3VERTEXARRAY_H
2 #define AliL3VERTEXARRAY_H
3
4 #include <math.h>
5 #include "AliL3RootTypes.h"
6  
7 class AliL3VertexArray{
8   private:
9
10   Char_t fArray[8320][8][8];
11   Double_t fZSector;
12   Double_t fZSectorErr;
13   Int_t fMaxSeed;
14   Int_t fNSeed;
15   Float_t fZSeed[400];
16   Float_t fRSeed[400];
17   Int_t fSecSeed[400];
18
19   void FindMean(Float_t *vertex,Int_t *array, Int_t len);
20   void AnalyzeSector(Float_t *vertex, Int_t *array, Int_t len);
21
22   public:
23   AliL3VertexArray(){fNSeed=0;fMaxSeed=400;}
24   AliL3VertexArray(AliL3VertexArray&){fNSeed=0;fMaxSeed=400;}
25   AliL3VertexArray(Int_t maxseed){fNSeed=0;fMaxSeed=maxseed;}
26   virtual ~AliL3VertexArray(){;}
27   
28   Int_t GetContent(Float_t z,Float_t r,Int_t sec);
29   Int_t Trace(Float_t z,Float_t r,Int_t sec,Float_t vertex);
30
31   Double_t GetZSectorErr(){return fZSectorErr;}
32   Double_t GetZSector(){return fZSector;}
33   Int_t GetMaxSeed(){return fMaxSeed;}
34   Int_t GetNSeed(){return fNSeed;}
35   Float_t GetRSeed(Int_t i){if(i<400) return fRSeed[i]; else return -999;}
36   Float_t GetZSeed(Int_t i){if(i<400) return fZSeed[i]; else return -999;} 
37   Float_t GetSecSeed(Int_t i){if(i<400) return fSecSeed[i]; else return -999;}
38
39   void FillSector2D(Float_t z,Float_t r,Int_t sec);
40   void FillSectorSeed2D(Float_t z,Float_t r,Int_t sec);
41   void FillSector3D(Float_t x,Float_t y, Float_t z);
42   void FillSectorSeed3D(Float_t x,Float_t y, Float_t z);
43   void FindSectorVertex(Double_t pos = 0,Double_t range = 60,Int_t nbin = 60);
44   void ResetSector();
45
46   ClassDef(AliL3VertexArray,1)  //The L3 Fast Vertex Finder Base Class
47
48 };
49
50 inline void AliL3VertexArray::FillSector3D(Float_t x, Float_t y, Float_t z){
51   // Filling routine in coordinates
52   Int_t sec = Int_t( (y+.168*x)/(.336*x)*8); // 8 subsec!!
53   Float_t r = sqrt(pow(y,2)+pow(x,2));
54   FillSector2D(z,r,sec); 
55 }
56
57 inline void AliL3VertexArray:: FillSectorSeed3D(Float_t x,Float_t y, Float_t z){
58   // Filling routine for seeds in coordinates
59   Int_t sec = Int_t( (y+.168*x)/(.336*x)*8); // 8 subsec!!
60   Float_t r = sqrt(pow(y,2)+pow(x,2));
61   FillSectorSeed2D(z,r,sec);    
62 }
63
64 inline void AliL3VertexArray::FillSectorSeed2D(Float_t z,Float_t r,Int_t sec){
65   // Filling routine in r,z coordinates 
66   if(fNSeed>=400) return;
67   fZSeed[fNSeed] = z; fRSeed[fNSeed] = r; fSecSeed[fNSeed] = sec;
68   fNSeed++; 
69 }
70
71 inline void AliL3VertexArray::FillSector2D(Float_t z,Float_t r,Int_t sec){
72   // Filling routine for seeds in r,z coordinates
73   if(z>r||z<=0||r<220||r>=252) return;
74   fArray[Int_t(z/r*32*260)][(Int_t(r-220))/4][sec] += 1;
75 }
76
77 inline Int_t AliL3VertexArray::GetContent(Float_t z,Float_t r,Int_t sec){
78   // Return content of array in r,z coordinates
79   if(z>r||z<=0||r<220||r>=252) return 0;
80   return  fArray[Int_t(z/r*32*260)][(Int_t(r-220))/4][sec];
81 }
82
83 inline void AliL3VertexArray::ResetSector(){
84   // do it!
85   fZSector=0;
86   fZSectorErr=0;
87   fNSeed=0;
88   for(Int_t i =0;i<400;i++)
89     fZSeed[i] =  fRSeed[i] =  fSecSeed[i] = 0;
90   for(Int_t z=0;z<8320;z++)
91     for(Int_t r=0;r<8;r++)
92       for(Int_t sec =0;sec<8;sec++)
93         fArray[z][r][sec] = 0;
94 }
95
96 inline Int_t AliL3VertexArray::Trace(Float_t z,Float_t r,Int_t sec,Float_t vertex){
97 // count the number of entries along starting from z,r to vertex,0
98   Int_t cont=0;
99   for(Int_t i = 0;i<8;i++){
100     Float_t ry = 222 +(i*4);
101     Float_t zx = (ry/r)*(z-vertex)+vertex;
102     cont += GetContent(zx,ry,sec);
103   }
104   if(cont < 5) return 0;
105   return cont;
106 }
107
108 #endif