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