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