3 // Author: Uli Frankenfeld <mailto:franken@fi.uib.no>
4 //*-- Copyright © ALICE HLT Group
6 #include "AliL3StandardIncludes.h"
8 #include "AliL3Logging.h"
9 #include "AliL3VertexArray.h"
12 /** \class AliL3VertexArray
14 //_____________________________________________________________
17 // The L3 Fast Vertex Finder Base Class
21 //for(Int_t sec=0;sec<NSEC;sec++){
23 // FillSectorSeed3D(x,y,z);
24 // FillSector3D(x,y,z);
25 // FindSectorVertex();
26 // Double_t z = GetZSector();
27 // Double_t zerr = GetZSectorErr();
28 // // do somethink with z, zerr
33 ClassImp(AliL3VertexArray)
34 void AliL3VertexArray::AnalyzeSector(Float_t *vertex, Int_t *array, Int_t len){
35 //loop over all seeds and all vertex position
36 LOG(AliL3Log::kInformational,"AliL3VertexArray::AnalyzeSector","Analyze")
37 <<AliL3Log::kDec<<"Number of Seeds: "<<fNSeed<<ENDLOG;
38 for(Int_t i =0;i<fNSeed;i++)
39 for(Int_t bin = 0;bin<len;bin++)
40 array[bin] += Trace(fZSeed[i],fRSeed[i],fSecSeed[i],vertex[bin]);
43 void AliL3VertexArray::FindSectorVertex(Double_t pos, Double_t range, Int_t nbin){
44 //define position and range for search and
46 //and find position of vertex and error
47 const Int_t len = nbin;
48 const Double_t width = range;
49 const Double_t xmin = pos - width/2;
50 const Double_t step = width/len;
51 const Double_t start = xmin + step/2.;
52 Int_t * array = new Int_t[len];
53 Float_t * ver = new Float_t[len];
54 for(Int_t i=0;i<len;i++){
55 ver[i] = start + step * i;
58 AnalyzeSector(ver,array,len);
59 FindMean(ver,array,len);
64 void AliL3VertexArray::FindMean(Float_t *vertex,Int_t *array, Int_t len){
65 //find mean and error of array and store it in
66 //fZSector and fZSectorErr
67 const Int_t nbin = len;
70 for(Int_t i = 0;i<nbin;i++){
81 if(xmin<0) {ops++;break;}
82 if(array[xmin]<hmax) {
88 if(xmax>=nbin) {ops++;break;}
94 if(xbin >= nbin/2){xmin = 2 * xbin - nbin +1;xmax = nbin-1;}
95 else{xmin = 0;xmax = 2 * xbin;}
101 for(Int_t bin = xmin;bin<=xmax;bin++){
103 sumw2 += array[bin] * array[bin];
104 sumwx += array[bin] * vertex[bin];
105 sumwx2 += array[bin] * vertex[bin] * vertex[bin];
108 Double_t mean = sumwx/sumw;
109 Double_t rms2 = fabs(sumwx2/sumw - mean*mean);
110 fZSectorErr = sqrt(rms2/sumw);
113 else{fZSectorErr = fZSector = 0;}
114 sumw=sumw2=sumwx=sumwx2=0;
115 for(Int_t bin = 0;bin<nbin;bin++){
117 sumw2 += array[bin] * array[bin];
118 sumwx += array[bin] * vertex[bin];
119 sumwx2 += array[bin] * vertex[bin] * vertex[bin];
122 Double_t mean = fZSector;
123 Double_t rms2 = fabs(sumwx2/sumw - mean*mean);
124 fZSectorErr = sqrt(rms2/sumw);