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