]>
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 | ||
df9db588 | 13 | #include <TRef.h> |
14 | #include <TRefArray.h> | |
15 | #include <TMath.h> | |
16 | ||
5d62ce04 | 17 | #include "AliAODRedCov.h" |
18 | ||
df9db588 | 19 | class AliAODVertex : public TObject { |
20 | ||
21 | public : | |
22 | ||
23 | enum AODVtx_t {kUndef=-1, kPrimary, kKink, kV0, kCascade, kMulti}; | |
24 | ||
25 | AliAODVertex(); | |
26 | AliAODVertex(const Double_t *position, | |
27 | const Double_t *covMatrix=0x0, | |
0657f082 | 28 | Double_t chi2perNDF = -999., |
df9db588 | 29 | TObject *parent = 0x0, |
30 | Char_t vtype=kUndef); | |
31 | AliAODVertex(const Float_t *position, | |
32 | const Float_t *covMatrix=0x0, | |
0657f082 | 33 | Double_t chi2perNDF = -999., |
df9db588 | 34 | TObject *parent = 0x0, |
35 | Char_t vtype=kUndef); | |
36 | AliAODVertex(const Double_t *position, | |
0657f082 | 37 | Double_t chi2perNDF, |
df9db588 | 38 | Char_t vtype=kUndef); |
39 | AliAODVertex(const Float_t *position, | |
0657f082 | 40 | Double_t chi2perNDF, |
df9db588 | 41 | Char_t vtype=kUndef); |
42 | ||
43 | virtual ~AliAODVertex(); | |
44 | AliAODVertex(const AliAODVertex& vtx); | |
45 | AliAODVertex& operator=(const AliAODVertex& vtx); | |
46 | ||
47 | void SetX(Double_t x) { fPosition[0] = x; } | |
48 | void SetY(Double_t y) { fPosition[1] = y; } | |
49 | void SetZ(Double_t z) { fPosition[2] = z; } | |
50 | void SetPosition(Double_t x, Double_t y, Double_t z) { fPosition[0] = x; fPosition[1] = y; fPosition[2] = z; } | |
51 | template <class T> void SetPosition(T *pos) | |
52 | { fPosition[0] = pos[0]; fPosition[1] = pos[1]; fPosition[2] = pos[2]; } | |
53 | ||
0657f082 | 54 | void SetChi2perNDF(Double_t chi2perNDF) { fChi2perNDF = chi2perNDF; } |
df9db588 | 55 | |
56 | void SetParent(TObject *parent) { fParent = parent; } | |
57 | ||
58 | Double_t GetX() const { return fPosition[0]; } | |
59 | Double_t GetY() const { return fPosition[1]; } | |
60 | Double_t GetZ() const { return fPosition[2]; } | |
9f7c531f | 61 | template <class T> void GetPosition(T *pos) const |
62 | {pos[0]=fPosition[0]; pos[1]=fPosition[1]; pos[2]=fPosition[2];} | |
df9db588 | 63 | |
64 | template <class T> void SetCovMatrix(const T *covMatrix) { | |
5d62ce04 | 65 | if(!fCovMatrix) fCovMatrix=new AliAODRedCov<3>(); |
df9db588 | 66 | fCovMatrix->SetCovMatrix(covMatrix);} |
67 | ||
68 | template <class T> Bool_t GetCovMatrix(T *covMatrix) const { | |
69 | if(!fCovMatrix) return kFALSE; | |
70 | fCovMatrix->GetCovMatrix(covMatrix); return kTRUE;} | |
71 | ||
72 | void RemoveCovMatrix() {delete fCovMatrix; fCovMatrix=NULL;} | |
73 | ||
74 | template <class T> void GetSigmaXYZ(T *sigma) const; | |
75 | ||
0657f082 | 76 | Double_t GetChi2perNDF() const { return fChi2perNDF; } |
77 | Double_t GetChi2() const { return fChi2perNDF*(Double_t)GetNDF(); } | |
78 | Int_t GetNDF() const { return 2*GetNContributors()-3; } | |
df9db588 | 79 | |
83000620 | 80 | Char_t GetType() const { return fType; } |
81 | void SetType(AODVtx_t vtype) { fType=vtype; } | |
df9db588 | 82 | |
83 | TObject* GetParent() const { return fParent.GetObject(); } | |
84 | Bool_t HasParent(TObject *parent) const { return (fParent.GetObject() == parent) ? kTRUE : kFALSE; } | |
85 | ||
86 | void AddDaughter(TObject *daughter) { fDaughters.Add(daughter);} | |
87 | void RemoveDaughter(TObject *daughter) { fDaughters.Remove(daughter); } | |
1a3f462b | 88 | TObject* GetDaughter(Int_t i) { return fDaughters.At(i); } |
df9db588 | 89 | Bool_t HasDaughter(TObject *daughter) const; |
5c2fdfa2 | 90 | Int_t GetNDaughters() const { return fDaughters.GetEntriesFast(); } |
0657f082 | 91 | Int_t GetNContributors() const; |
df9db588 | 92 | |
93 | // covariance matrix elements after rotation by phi around z-axis | |
94 | // and, then, by theta around new y-axis | |
95 | Double_t RotatedCovMatrixXX(Double_t phi = 0., Double_t theta = 0.) const; | |
96 | Double_t RotatedCovMatrixXY(Double_t phi = 0., Double_t theta = 0.) const; | |
97 | Double_t RotatedCovMatrixYY(Double_t phi = 0.) const; | |
98 | Double_t RotatedCovMatrixXZ(Double_t phi = 0., Double_t theta = 0.) const; | |
99 | Double_t RotatedCovMatrixYZ(Double_t phi = 0., Double_t theta = 0.) const; | |
100 | Double_t RotatedCovMatrixZZ(Double_t phi = 0., Double_t theta = 0.) const; | |
101 | ||
102 | template <class T, class P> void PhiAndThetaToVertex(AliAODVertex *vtx, P &phi, T &theta) const; | |
103 | Double_t DistanceToVertex(AliAODVertex *vtx) const; | |
104 | Double_t ErrorDistanceToVertex(AliAODVertex *vtx) const; | |
105 | Double_t DistanceXYToVertex(AliAODVertex *vtx) const; | |
106 | Double_t ErrorDistanceXYToVertex(AliAODVertex *vtx) const; | |
107 | ||
108 | void PrintIndices() const; | |
109 | void Print(Option_t* option = "") const; | |
110 | ||
df9db588 | 111 | private : |
112 | ||
9f7c531f | 113 | Double32_t fPosition[3]; // vertex position |
0657f082 | 114 | Double32_t fChi2perNDF; // chi2/NDF of vertex fit |
5d62ce04 | 115 | AliAODRedCov<3> *fCovMatrix; // vertex covariance matrix; values of and below the diagonal |
9f7c531f | 116 | TRef fParent; // reference to the parent particle |
117 | TRefArray fDaughters; // references to the daughter particles | |
118 | Char_t fType; // Vertex type | |
df9db588 | 119 | |
0657f082 | 120 | ClassDef(AliAODVertex,2); |
df9db588 | 121 | }; |
122 | ||
df9db588 | 123 | #endif |