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