]>
Commit | Line | Data |
---|---|---|
df9db588 | 1 | #ifndef AliAODVertex_H |
2 | #define AliAODVertex_H | |
3 | /* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. * | |
4 | * See cxx source for full Copyright notice */ | |
5 | ||
6 | /* $Id$ */ | |
7 | ||
8 | //------------------------------------------------------------------------- | |
9 | // AOD vertex base class | |
10 | // Author: Markus Oldenburg, CERN | |
11 | //------------------------------------------------------------------------- | |
12 | ||
13 | #include <TNamed.h> | |
14 | #include <TRef.h> | |
15 | #include <TRefArray.h> | |
16 | #include <TMath.h> | |
17 | ||
18 | class AliAODVertex : public TObject { | |
19 | ||
20 | public : | |
21 | ||
22 | enum AODVtx_t {kUndef=-1, kPrimary, kKink, kV0, kCascade, kMulti}; | |
23 | ||
24 | AliAODVertex(); | |
25 | AliAODVertex(const Double_t *position, | |
26 | const Double_t *covMatrix=0x0, | |
27 | Double_t chi2 = -999., | |
28 | TObject *parent = 0x0, | |
29 | Char_t vtype=kUndef); | |
30 | AliAODVertex(const Float_t *position, | |
31 | const Float_t *covMatrix=0x0, | |
32 | Double_t chi2 = -999., | |
33 | TObject *parent = 0x0, | |
34 | Char_t vtype=kUndef); | |
35 | AliAODVertex(const Double_t *position, | |
36 | Double_t chi2, | |
37 | Char_t vtype=kUndef); | |
38 | AliAODVertex(const Float_t *position, | |
39 | Double_t chi2, | |
40 | Char_t vtype=kUndef); | |
41 | ||
42 | virtual ~AliAODVertex(); | |
43 | AliAODVertex(const AliAODVertex& vtx); | |
44 | AliAODVertex& operator=(const AliAODVertex& vtx); | |
45 | ||
46 | void SetX(Double_t x) { fPosition[0] = x; } | |
47 | void SetY(Double_t y) { fPosition[1] = y; } | |
48 | void SetZ(Double_t z) { fPosition[2] = z; } | |
49 | void SetPosition(Double_t x, Double_t y, Double_t z) { fPosition[0] = x; fPosition[1] = y; fPosition[2] = z; } | |
50 | template <class T> void SetPosition(T *pos) | |
51 | { fPosition[0] = pos[0]; fPosition[1] = pos[1]; fPosition[2] = pos[2]; } | |
52 | ||
53 | void SetChi2(Double_t chi2) { fChi2 = chi2; } | |
54 | ||
55 | void SetParent(TObject *parent) { fParent = parent; } | |
56 | ||
57 | Double_t GetX() const { return fPosition[0]; } | |
58 | Double_t GetY() const { return fPosition[1]; } | |
59 | Double_t GetZ() const { return fPosition[2]; } | |
9f7c531f | 60 | template <class T> void GetPosition(T *pos) const |
61 | {pos[0]=fPosition[0]; pos[1]=fPosition[1]; pos[2]=fPosition[2];} | |
df9db588 | 62 | |
63 | template <class T> void SetCovMatrix(const T *covMatrix) { | |
64 | if(!fCovMatrix) fCovMatrix=new AliAODVtxCov(); | |
65 | fCovMatrix->SetCovMatrix(covMatrix);} | |
66 | ||
67 | template <class T> Bool_t GetCovMatrix(T *covMatrix) const { | |
68 | if(!fCovMatrix) return kFALSE; | |
69 | fCovMatrix->GetCovMatrix(covMatrix); return kTRUE;} | |
70 | ||
71 | void RemoveCovMatrix() {delete fCovMatrix; fCovMatrix=NULL;} | |
72 | ||
73 | template <class T> void GetSigmaXYZ(T *sigma) const; | |
74 | ||
75 | Double_t GetChi2() const { return fChi2; } | |
9f7c531f | 76 | Double_t GetChi2perNDF() const |
77 | { return fChi2/(2.*fDaughters.GetEntriesFast()-3.); } | |
df9db588 | 78 | |
79 | Char_t GetVtxType() const { return fType; } | |
80 | void GetVtxType(Char_t vtype) { fType=vtype; } | |
81 | ||
82 | TObject* GetParent() const { return fParent.GetObject(); } | |
83 | Bool_t HasParent(TObject *parent) const { return (fParent.GetObject() == parent) ? kTRUE : kFALSE; } | |
84 | ||
85 | void AddDaughter(TObject *daughter) { fDaughters.Add(daughter);} | |
86 | void RemoveDaughter(TObject *daughter) { fDaughters.Remove(daughter); } | |
87 | Bool_t HasDaughter(TObject *daughter) const; | |
88 | ||
89 | // covariance matrix elements after rotation by phi around z-axis | |
90 | // and, then, by theta around new y-axis | |
91 | Double_t RotatedCovMatrixXX(Double_t phi = 0., Double_t theta = 0.) const; | |
92 | Double_t RotatedCovMatrixXY(Double_t phi = 0., Double_t theta = 0.) const; | |
93 | Double_t RotatedCovMatrixYY(Double_t phi = 0.) const; | |
94 | Double_t RotatedCovMatrixXZ(Double_t phi = 0., Double_t theta = 0.) const; | |
95 | Double_t RotatedCovMatrixYZ(Double_t phi = 0., Double_t theta = 0.) const; | |
96 | Double_t RotatedCovMatrixZZ(Double_t phi = 0., Double_t theta = 0.) const; | |
97 | ||
98 | template <class T, class P> void PhiAndThetaToVertex(AliAODVertex *vtx, P &phi, T &theta) const; | |
99 | Double_t DistanceToVertex(AliAODVertex *vtx) const; | |
100 | Double_t ErrorDistanceToVertex(AliAODVertex *vtx) const; | |
101 | Double_t DistanceXYToVertex(AliAODVertex *vtx) const; | |
102 | Double_t ErrorDistanceXYToVertex(AliAODVertex *vtx) const; | |
103 | ||
104 | void PrintIndices() const; | |
105 | void Print(Option_t* option = "") const; | |
106 | ||
107 | class AliAODVtxCov { | |
108 | ||
109 | // | |
110 | // Class containing the covariance matrix for the vertex | |
111 | // | |
112 | // X Y Z | |
113 | // | |
114 | // X fDiag[ 0] | |
115 | // | |
116 | // Y fOdia[ 0] fDiag[ 1] | |
117 | // | |
118 | // Z fOdia[ 1] fOdia[ 2] fDiag[ 2] | |
119 | // | |
120 | // | |
121 | ||
122 | public: | |
123 | AliAODVtxCov() {} | |
124 | virtual ~AliAODVtxCov() {} | |
125 | template <class T> void GetCovMatrix(T *cmat) const; | |
126 | template <class T> void SetCovMatrix(T *cmat); | |
127 | ||
128 | private: | |
129 | Double32_t fDiag[3]; // Diagonal elements | |
9f7c531f | 130 | Double32_t fODia[3]; // [-1, 1,8] 8 bit precision for off diagonal elements |
df9db588 | 131 | |
132 | ClassDef(AliAODVertex::AliAODVtxCov,1) | |
133 | ||
134 | }; | |
135 | ||
136 | private : | |
137 | ||
9f7c531f | 138 | Double32_t fPosition[3]; // vertex position |
139 | Double32_t fChi2; // chi2 of vertex fit | |
df9db588 | 140 | AliAODVtxCov *fCovMatrix; // vertex covariance matrix; values of and below the diagonal |
9f7c531f | 141 | TRef fParent; // reference to the parent particle |
142 | TRefArray fDaughters; // references to the daughter particles | |
143 | Char_t fType; // Vertex type | |
df9db588 | 144 | |
145 | ClassDef(AliAODVertex,1); | |
146 | }; | |
147 | ||
df9db588 | 148 | #endif |