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