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