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