Line data Source code
1 : #ifndef ALIFLATESDVERTEX_H
2 : #define ALIFLATESDVERTEX_H
3 :
4 : /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 : * See cxx source for full Copyright notice *
6 : * Primary Authors : Sergey Gorbunov, Jochen Thaeder, Chiara Zampolli */
7 :
8 : /**
9 : * >> Flat structure representing a ESD vertex <<
10 : */
11 :
12 : #include "Rtypes.h"
13 : #include "AliVMisc.h"
14 : #include "AliESDVertex.h"
15 :
16 : struct AliFlatESDVertex
17 : {
18 : // -- Constructor / Destructors
19 :
20 : AliFlatESDVertex();
21 : ~AliFlatESDVertex() {}
22 :
23 : // constructor and method for reinitialisation of virtual table
24 : AliFlatESDVertex( AliVConstructorReinitialisationFlag );
25 : void Reinitialize() const {} // no virtual table - do nothing
26 :
27 : //--
28 :
29 : Double32_t fPosition[3]; // vertex position
30 : Double32_t fCov[6]; // vertex covariance matrix
31 : Int_t fNContributors; // # of tracklets/tracks used for the estimate
32 : Double32_t fChi2; // chi2 of vertex fit
33 : /*
34 : Double32_t fSigma; // track dispersion around found vertex
35 : Char_t fID; // ID of this vertex within an ESD event
36 : Char_t fBCID; // BC ID assigned to vertex
37 : */
38 :
39 :
40 : void SetFromESDVertex(const AliESDVertex &v );
41 : void GetESDVertex( AliESDVertex &v ) const;
42 :
43 : Double32_t GetX() const { return fPosition[0]; }
44 : Double32_t GetY() const { return fPosition[1]; }
45 : Double32_t GetZ() const { return fPosition[2]; }
46 :
47 : void GetXYZ(Double_t pos[3]) const { for(Int_t j=0; j<3; j++) pos[j]=fPosition[j]; }
48 : void SetXYZ(Double_t pos[3]) { for(Int_t j=0; j<3; j++) fPosition[j]=pos[j]; }
49 :
50 : void SetX(Double_t xVert) {fPosition[0]=xVert; }
51 : void SetY(Double_t yVert) {fPosition[1]=yVert; }
52 : void SetZ(Double_t zVert) {fPosition[2]=zVert; }
53 : void SetNContributors(Int_t nContr) {fNContributors=nContr; }
54 :
55 :
56 : Int_t GetNContributors() const { return fNContributors; }
57 :
58 : /*
59 : void GetCovarianceMatrix(Double_t covmatrix[6]) const;
60 : void SetCovarianceMatrix(const Double_t *) {}
61 :
62 : Double_t GetChi2perNDF() const {return -999.;}
63 : Double_t GetChi2() const {return -999.;}
64 : void SetChi2(Double_t ) {}
65 : Int_t GetNDF() const {return -999;}
66 :
67 : void GetSigmaXYZ(Double_t sigma[3]) const;
68 : void GetCovMatrix(Double_t covmatrix[6]) const;
69 : void GetCovarianceMatrix(Double_t covmatrix[6]) const
70 : {GetCovMatrix(covmatrix);}
71 : void GetSNR(Double_t snr[3]) const;
72 : void SetCovarianceMatrix(const Double_t *cov);
73 :
74 : Double_t GetXRes() const {return TMath::Sqrt(fCovXX);}
75 : Double_t GetYRes() const {return TMath::Sqrt(fCovYY);}
76 : Double_t GetZRes() const {return TMath::Sqrt(fCovZZ);}
77 : Double_t GetXSNR() const { return fSNR[0]; }
78 : Double_t GetYSNR() const { return fSNR[1]; }
79 : Double_t GetZSNR() const { return fSNR[2]; }
80 : void SetSNR(double snr, int i) {if (i<3 && i>=0) fSNR[i] = snr;}
81 :
82 : Double_t GetChi2() const { return fChi2; }
83 : void SetChi2(Double_t chi) { fChi2 = chi; }
84 : Double_t GetChi2toNDF() const
85 : { return fChi2/(2.*(Double_t)fNContributors-3.); }
86 : Double_t GetChi2perNDF() const { return GetChi2toNDF();}
87 : Int_t GetNDF() const {return (2*fNContributors-3);}
88 :
89 : void Print(Option_t* option = "") const;
90 : void PrintStatus() const {Print();}
91 :
92 : void Reset() { SetToZero(); SetName("Vertex"); }
93 :
94 : void SetID(Char_t id) {fID=id;}
95 : Char_t GetID() const {return fID;}
96 : //
97 : Double_t GetWDist(const AliESDVertex* v) const;
98 : */
99 :
100 0 : static size_t GetSize() { return sizeof(AliFlatESDVertex); }
101 :
102 : };
103 :
104 : inline AliFlatESDVertex::AliFlatESDVertex() :
105 : fNContributors(0),
106 : fChi2(0)
107 : {
108 : for( int i=0; i<3; i++) fPosition[i] = -9999;
109 : for( int i=0; i<6; i++) fCov[i] = -9999;
110 : }
111 :
112 : #pragma GCC diagnostic ignored "-Weffc++"
113 : inline AliFlatESDVertex::AliFlatESDVertex( AliVConstructorReinitialisationFlag ){} // do nothing
114 : #pragma GCC diagnostic warning "-Weffc++"
115 :
116 : inline void AliFlatESDVertex::SetFromESDVertex(const AliESDVertex &v )
117 : {
118 0 : fPosition[0] = v.GetX();
119 0 : fPosition[1] = v.GetY();
120 0 : fPosition[2] = v.GetZ();
121 0 : Double_t c[6];
122 0 : v.GetCovarianceMatrix( c );
123 0 : for( int i=0; i<6; i++) fCov[i] = c[i];
124 0 : fNContributors = v.GetNContributors();
125 0 : fChi2 = v.GetChi2();
126 0 : }
127 :
128 : inline void AliFlatESDVertex::GetESDVertex( AliESDVertex &v ) const
129 : {
130 : v.Reset();
131 : Double_t p[3] = { fPosition[0], fPosition[1], fPosition[2] };
132 : v.SetXYZ( p );
133 : Double_t c[6];
134 : for( int i=0; i<6; i++) c[i] = fCov[i];
135 : v.SetCovarianceMatrix( c );
136 : v.SetNContributors( fNContributors );
137 : v.SetChi2( fChi2 );
138 : }
139 :
140 : typedef struct AliFlatESDVertex AliFlatESDVertex;
141 :
142 : #endif
|