]>
Commit | Line | Data |
---|---|---|
a6c02c85 | 1 | // @(#) $Id$ |
2 | ||
3 | #ifndef AliHLTTPCVERTEXARRAY_H | |
4 | #define AliHLTTPCVERTEXARRAY_H | |
5 | ||
6 | #include <math.h> | |
7 | #include "AliHLTTPCRootTypes.h" | |
8 | ||
9 | class AliHLTTPCVertexArray { | |
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 | AliHLTTPCVertexArray(){fNSeed=0;fMaxSeed=400;} | |
26 | AliHLTTPCVertexArray(AliHLTTPCVertexArray&){fNSeed=0;fMaxSeed=400;} | |
27 | AliHLTTPCVertexArray(Int_t maxseed){fNSeed=0;fMaxSeed=maxseed;} | |
28 | virtual ~AliHLTTPCVertexArray(){;} | |
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(AliHLTTPCVertexArray,1) //The HLTTPC Fast Vertex Finder Base Class | |
49 | ||
50 | }; | |
51 | ||
52 | inline void AliHLTTPCVertexArray::FillSector3D(Float_t x, Float_t y, Float_t z) | |
53 | { | |
54 | // Filling routine in coordinates | |
55 | Int_t sec = Int_t( (y+.168*x)/(.336*x)*8); // 8 subsec!! | |
56 | Float_t r = sqrt(pow(y,2)+pow(x,2)); | |
57 | FillSector2D(z,r,sec); | |
58 | } | |
59 | ||
60 | inline void AliHLTTPCVertexArray:: FillSectorSeed3D(Float_t x,Float_t y, Float_t z) | |
61 | { | |
62 | // Filling routine for seeds in coordinates | |
63 | Int_t sec = Int_t( (y+.168*x)/(.336*x)*8); // 8 subsec!! | |
64 | Float_t r = sqrt(pow(y,2)+pow(x,2)); | |
65 | FillSectorSeed2D(z,r,sec); | |
66 | } | |
67 | ||
68 | inline void AliHLTTPCVertexArray::FillSectorSeed2D(Float_t z,Float_t r,Int_t sec) | |
69 | { | |
70 | // Filling routine in r,z coordinates | |
71 | if(fNSeed>=400) return; | |
72 | fZSeed[fNSeed] = z; fRSeed[fNSeed] = r; fSecSeed[fNSeed] = sec; | |
73 | fNSeed++; | |
74 | } | |
75 | ||
76 | inline void AliHLTTPCVertexArray::FillSector2D(Float_t z,Float_t r,Int_t sec) | |
77 | { | |
78 | // Filling routine for seeds in r,z coordinates | |
79 | if(z>r||z<=0||r<220||r>=252) return; | |
80 | fArray[Int_t(z/r*32*260)][(Int_t(r-220))/4][sec] += 1; | |
81 | } | |
82 | ||
83 | inline Int_t AliHLTTPCVertexArray::GetContent(Float_t z,Float_t r,Int_t sec) | |
84 | { | |
85 | // Return content of array in r,z coordinates | |
86 | if(z>r||z<=0||r<220||r>=252) return 0; | |
87 | return fArray[Int_t(z/r*32*260)][(Int_t(r-220))/4][sec]; | |
88 | } | |
89 | ||
90 | inline void AliHLTTPCVertexArray::ResetSector() | |
91 | { | |
92 | // do it! | |
93 | fZSector=0; | |
94 | fZSectorErr=0; | |
95 | fNSeed=0; | |
96 | for(Int_t i =0;i<400;i++) | |
97 | fZSeed[i] = fRSeed[i] = fSecSeed[i] = 0; | |
98 | for(Int_t z=0;z<8320;z++) | |
99 | for(Int_t r=0;r<8;r++) | |
100 | for(Int_t sec =0;sec<8;sec++) | |
101 | fArray[z][r][sec] = 0; | |
102 | } | |
103 | ||
104 | inline Int_t AliHLTTPCVertexArray::Trace(Float_t z,Float_t r,Int_t sec,Float_t vertex) | |
105 | { | |
106 | // count the number of entries along starting from z,r to vertex,0 | |
107 | Int_t cont=0; | |
108 | for(Int_t i = 0;i<8;i++){ | |
109 | Float_t ry = 222 +(i*4); | |
110 | Float_t zx = (ry/r)*(z-vertex)+vertex; | |
111 | cont += GetContent(zx,ry,sec); | |
112 | } | |
113 | if(cont < 5) return 0; | |
114 | return cont; | |
115 | } | |
116 | ||
117 | #endif |