]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/src/AliL3VertexArray.h
Additional protection
[u/mrichter/AliRoot.git] / HLT / src / AliL3VertexArray.h
CommitLineData
3e87ef69 1// @(#) $Id$
2
108615fc 3#ifndef AliL3VERTEXARRAY_H
4#define AliL3VERTEXARRAY_H
5
6#include <math.h>
7#include "AliL3RootTypes.h"
8
b1ed0288 9class AliL3VertexArray {
108615fc 10 private:
11
b1ed0288 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
108615fc 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
b661165c 48 ClassDef(AliL3VertexArray,1) //The L3 Fast Vertex Finder Base Class
108615fc 49
50};
51
b1ed0288 52inline void AliL3VertexArray::FillSector3D(Float_t x, Float_t y, Float_t z)
53{
108615fc 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
b1ed0288 60inline void AliL3VertexArray:: FillSectorSeed3D(Float_t x,Float_t y, Float_t z)
61{
108615fc 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
b1ed0288 68inline void AliL3VertexArray::FillSectorSeed2D(Float_t z,Float_t r,Int_t sec)
69{
108615fc 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
b1ed0288 76inline void AliL3VertexArray::FillSector2D(Float_t z,Float_t r,Int_t sec)
77{
108615fc 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
b1ed0288 83inline Int_t AliL3VertexArray::GetContent(Float_t z,Float_t r,Int_t sec)
84{
108615fc 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
b1ed0288 90inline void AliL3VertexArray::ResetSector()
91{
108615fc 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
b1ed0288 104inline Int_t AliL3VertexArray::Trace(Float_t z,Float_t r,Int_t sec,Float_t vertex)
105{
108615fc 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