]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/src/AliHLTVertexArray.h
L3 becomes HLT
[u/mrichter/AliRoot.git] / HLT / src / AliHLTVertexArray.h
1 // @(#) $Id$
2
3 #ifndef AliHLTVERTEXARRAY_H
4 #define AliHLTVERTEXARRAY_H
5
6 #include <math.h>
7 #include "AliHLTRootTypes.h"
8  
9 class AliHLTVertexArray {
10   private:
11
12   Char_t fArray[8320][8][8]; //array
13   Double_t fZSector;    //sector
14   Double_t fZSectorErr; //sector error
15   Int_t fMaxSeed;  //max seed
16   Int_t fNSeed;    //number of seeds
17   Float_t fZSeed[400]; //seed in Z
18   Float_t fRSeed[400]; //seed in XY
19   Int_t fSecSeed[400]; //seed for sectors
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   AliHLTVertexArray(){fNSeed=0;fMaxSeed=400;}
26   AliHLTVertexArray(AliHLTVertexArray&){fNSeed=0;fMaxSeed=400;}
27   AliHLTVertexArray(Int_t maxseed){fNSeed=0;fMaxSeed=maxseed;}
28   virtual ~AliHLTVertexArray(){;}
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(AliHLTVertexArray,1)  //The L3 Fast Vertex Finder Base Class
49
50 };
51
52 typedef AliHLTVertexArray AliL3VertexArray; // for backward compatibility
53
54 inline void AliHLTVertexArray::FillSector3D(Float_t x, Float_t y, Float_t z)
55 {
56   // Filling routine in coordinates
57   Int_t sec = Int_t( (y+.168*x)/(.336*x)*8); // 8 subsec!!
58   Float_t r = sqrt(pow(y,2)+pow(x,2));
59   FillSector2D(z,r,sec); 
60 }
61
62 inline void AliHLTVertexArray:: FillSectorSeed3D(Float_t x,Float_t y, Float_t z)
63 {
64   // Filling routine for seeds in coordinates
65   Int_t sec = Int_t( (y+.168*x)/(.336*x)*8); // 8 subsec!!
66   Float_t r = sqrt(pow(y,2)+pow(x,2));
67   FillSectorSeed2D(z,r,sec);    
68 }
69
70 inline void AliHLTVertexArray::FillSectorSeed2D(Float_t z,Float_t r,Int_t sec)
71 {
72   // Filling routine in r,z coordinates 
73   if(fNSeed>=400) return;
74   fZSeed[fNSeed] = z; fRSeed[fNSeed] = r; fSecSeed[fNSeed] = sec;
75   fNSeed++; 
76 }
77
78 inline void AliHLTVertexArray::FillSector2D(Float_t z,Float_t r,Int_t sec)
79 {
80   // Filling routine for seeds in r,z coordinates
81   if(z>r||z<=0||r<220||r>=252) return;
82   fArray[Int_t(z/r*32*260)][(Int_t(r-220))/4][sec] += 1;
83 }
84
85 inline Int_t AliHLTVertexArray::GetContent(Float_t z,Float_t r,Int_t sec)
86 {
87   // Return content of array in r,z coordinates
88   if(z>r||z<=0||r<220||r>=252) return 0;
89   return  fArray[Int_t(z/r*32*260)][(Int_t(r-220))/4][sec];
90 }
91
92 inline void AliHLTVertexArray::ResetSector()
93 {
94   // do it!
95   fZSector=0;
96   fZSectorErr=0;
97   fNSeed=0;
98   for(Int_t i =0;i<400;i++)
99     fZSeed[i] =  fRSeed[i] =  fSecSeed[i] = 0;
100   for(Int_t z=0;z<8320;z++)
101     for(Int_t r=0;r<8;r++)
102       for(Int_t sec =0;sec<8;sec++)
103         fArray[z][r][sec] = 0;
104 }
105
106 inline Int_t AliHLTVertexArray::Trace(Float_t z,Float_t r,Int_t sec,Float_t vertex)
107 {
108 // count the number of entries along starting from z,r to vertex,0
109   Int_t cont=0;
110   for(Int_t i = 0;i<8;i++){
111     Float_t ry = 222 +(i*4);
112     Float_t zx = (ry/r)*(z-vertex)+vertex;
113     cont += GetContent(zx,ry,sec);
114   }
115   if(cont < 5) return 0;
116   return cont;
117 }
118
119 #endif