3 /* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
8 //-------------------------------------------------------------------------
9 // AOD vertex base class
10 // Author: Markus Oldenburg, CERN
11 //-------------------------------------------------------------------------
15 #include <TRefArray.h>
18 #include "AliAODRedCov.h"
20 class AliAODVertex : public TObject {
24 enum AODVtx_t {kUndef=-1, kPrimary, kKink, kV0, kCascade, kMulti};
27 AliAODVertex(const Double_t *position,
28 const Double_t *covMatrix=0x0,
29 Double_t chi2 = -999.,
30 TObject *parent = 0x0,
32 AliAODVertex(const Float_t *position,
33 const Float_t *covMatrix=0x0,
34 Double_t chi2 = -999.,
35 TObject *parent = 0x0,
37 AliAODVertex(const Double_t *position,
40 AliAODVertex(const Float_t *position,
44 virtual ~AliAODVertex();
45 AliAODVertex(const AliAODVertex& vtx);
46 AliAODVertex& operator=(const AliAODVertex& vtx);
48 void SetX(Double_t x) { fPosition[0] = x; }
49 void SetY(Double_t y) { fPosition[1] = y; }
50 void SetZ(Double_t z) { fPosition[2] = z; }
51 void SetPosition(Double_t x, Double_t y, Double_t z) { fPosition[0] = x; fPosition[1] = y; fPosition[2] = z; }
52 template <class T> void SetPosition(T *pos)
53 { fPosition[0] = pos[0]; fPosition[1] = pos[1]; fPosition[2] = pos[2]; }
55 void SetChi2(Double_t chi2) { fChi2 = chi2; }
57 void SetParent(TObject *parent) { fParent = parent; }
59 Double_t GetX() const { return fPosition[0]; }
60 Double_t GetY() const { return fPosition[1]; }
61 Double_t GetZ() const { return fPosition[2]; }
62 template <class T> void GetPosition(T *pos) const
63 {pos[0]=fPosition[0]; pos[1]=fPosition[1]; pos[2]=fPosition[2];}
65 template <class T> void SetCovMatrix(const T *covMatrix) {
66 if(!fCovMatrix) fCovMatrix=new AliAODRedCov<3>();
67 fCovMatrix->SetCovMatrix(covMatrix);}
69 template <class T> Bool_t GetCovMatrix(T *covMatrix) const {
70 if(!fCovMatrix) return kFALSE;
71 fCovMatrix->GetCovMatrix(covMatrix); return kTRUE;}
73 void RemoveCovMatrix() {delete fCovMatrix; fCovMatrix=NULL;}
75 template <class T> void GetSigmaXYZ(T *sigma) const;
77 Double_t GetChi2() const { return fChi2; }
78 Double_t GetChi2perNDF() const
79 { return fChi2/(2.*fDaughters.GetEntriesFast()-3.); }
81 Char_t GetVtxType() const { return fType; }
82 void GetVtxType(Char_t vtype) { fType=vtype; }
84 TObject* GetParent() const { return fParent.GetObject(); }
85 Bool_t HasParent(TObject *parent) const { return (fParent.GetObject() == parent) ? kTRUE : kFALSE; }
87 void AddDaughter(TObject *daughter) { fDaughters.Add(daughter);}
88 void RemoveDaughter(TObject *daughter) { fDaughters.Remove(daughter); }
89 Bool_t HasDaughter(TObject *daughter) const;
91 // covariance matrix elements after rotation by phi around z-axis
92 // and, then, by theta around new y-axis
93 Double_t RotatedCovMatrixXX(Double_t phi = 0., Double_t theta = 0.) const;
94 Double_t RotatedCovMatrixXY(Double_t phi = 0., Double_t theta = 0.) const;
95 Double_t RotatedCovMatrixYY(Double_t phi = 0.) const;
96 Double_t RotatedCovMatrixXZ(Double_t phi = 0., Double_t theta = 0.) const;
97 Double_t RotatedCovMatrixYZ(Double_t phi = 0., Double_t theta = 0.) const;
98 Double_t RotatedCovMatrixZZ(Double_t phi = 0., Double_t theta = 0.) const;
100 template <class T, class P> void PhiAndThetaToVertex(AliAODVertex *vtx, P &phi, T &theta) const;
101 Double_t DistanceToVertex(AliAODVertex *vtx) const;
102 Double_t ErrorDistanceToVertex(AliAODVertex *vtx) const;
103 Double_t DistanceXYToVertex(AliAODVertex *vtx) const;
104 Double_t ErrorDistanceXYToVertex(AliAODVertex *vtx) const;
106 void PrintIndices() const;
107 void Print(Option_t* option = "") const;
111 Double32_t fPosition[3]; // vertex position
112 Double32_t fChi2; // chi2 of vertex fit
113 AliAODRedCov<3> *fCovMatrix; // vertex covariance matrix; values of and below the diagonal
114 TRef fParent; // reference to the parent particle
115 TRefArray fDaughters; // references to the daughter particles
116 Char_t fType; // Vertex type
118 ClassDef(AliAODVertex,1);