AliRoot Core  ee782a0 (ee782a0)
AliAODVertex.h
Go to the documentation of this file.
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 
14 
15 #include <TRef.h>
16 #include <TRefArray.h>
17 #include <TMath.h>
18 
19 #include "AliVVertex.h"
20 #include "AliAODRedCov.h"
21 #include "AliLog.h"
22 
23 class AliAODVertex : public AliVVertex {
24 
25  public :
26 
28 
29  AliAODVertex();
30  AliAODVertex(const Double_t *position,
31  const Double_t *covMatrix=0x0,
32  Double_t chi2perNDF = -999.,
33  TObject *parent = 0x0,
34  Short_t id=-1,
35  Char_t vtype=kUndef,
36  Int_t nprong = 0);
37  AliAODVertex(const Float_t *position,
38  const Float_t *covMatrix=0x0,
39  Double_t chi2perNDF = -999.,
40  TObject *parent = 0x0,
41  Short_t id=-1,
42  Char_t vtype=kUndef,
43  Int_t nprong = 0);
44  AliAODVertex(const Double_t *position,
45  Double_t chi2perNDF,
46  Char_t vtype=kUndef,
47  Int_t nprong = 0);
48  AliAODVertex(const Float_t *position,
49  Double_t chi2perNDF,
50  Char_t vtype=kUndef,
51  Int_t nprong = 0);
52 
53  virtual ~AliAODVertex();
54  AliAODVertex(const AliAODVertex& vtx);
55  AliAODVertex& operator=(const AliAODVertex& vtx);
56 
57  virtual AliAODVertex* CloneWithoutRefs() const;
58 
59  void SetX(Double_t x) { fPosition[0] = x; }
60  void SetY(Double_t y) { fPosition[1] = y; }
61  void SetZ(Double_t z) { fPosition[2] = z; }
62  void SetPosition(Double_t x, Double_t y, Double_t z) { fPosition[0] = x; fPosition[1] = y; fPosition[2] = z; }
63  template <class T> void SetPosition(T *pos)
64  { fPosition[0] = pos[0]; fPosition[1] = pos[1]; fPosition[2] = pos[2]; }
65 
66  void SetChi2perNDF(Double_t chi2perNDF) { fChi2perNDF = chi2perNDF; }
67 
68  void SetParent(TObject *parent) { fParent = parent; }
69 
70  Double_t GetX() const { return fPosition[0]; }
71  Double_t GetY() const { return fPosition[1]; }
72  Double_t GetZ() const { return fPosition[2]; }
73  void GetXYZ(Double_t position[3]) const
74  {position[0]=fPosition[0]; position[1]=fPosition[1]; position[2]=fPosition[2];}
75  template <class T> void GetPosition(T *pos) const
76  {pos[0]=fPosition[0]; pos[1]=fPosition[1]; pos[2]=fPosition[2];}
77 
78  template <class T> void SetCovMatrix(const T *covMatrix) {
80  fCovMatrix->SetCovMatrix(covMatrix);}
81 
82  template <class T> Bool_t GetCovMatrix(T *covMatrix) const {
83  if(!fCovMatrix) return kFALSE;
84  fCovMatrix->GetCovMatrix(covMatrix); return kTRUE;}
85 
86  void GetCovarianceMatrix(Double_t covmatrix[6]) const
87  {GetCovMatrix(covmatrix);}
88  void RemoveCovMatrix() {delete fCovMatrix; fCovMatrix=NULL;}
89 
90  template <class T> void GetSigmaXYZ(T *sigma) const;
91 
92  Double_t GetChi2perNDF() const { return fChi2perNDF; }
93  Double_t GetChi2() const { return fChi2perNDF*(Double_t)GetNDF(); }
94  Int_t GetNDF() const { return 2*GetNContributors()-3; }
95 
96  Short_t GetID() const { return fID; }
97  void SetID(Short_t id) { fID=id; }
98 
99  Char_t GetType() const { return fType; }
100  void SetType(AODVtx_t vtype) { fType=vtype; }
101 
102  TObject* GetParent() const { return fParent.GetObject(); }
103  Bool_t HasParent(TObject *parent) const { return (fParent.GetObject() == parent) ? kTRUE : kFALSE; }
104 
105  void AddDaughter(TObject *daughter);
106  void RemoveDaughter(TObject *daughter) { fDaughters.Remove(daughter); }
107  void RemoveDaughters() { fDaughters.Clear(); if(fProngs) {delete [] fProngs; fProngs=0; MakeProngs(); fIprong=0;} }
108  TObject* GetDaughter(Int_t i);
109  Bool_t HasDaughter(TObject *daughter) const;
110  Int_t GetNDaughters() const;
111  Int_t GetNContributors() const;
112  Int_t CountRealContributors() const;
113  Int_t GetNContributorsStored() const {return fNContributors;}
114 
115  void SetNContributors(Int_t nc) {fNContributors = nc;}
116  // covariance matrix elements after rotation by phi around z-axis
117  // and, then, by theta around new y-axis
118  Double_t RotatedCovMatrixXX(Double_t phi = 0., Double_t theta = 0.) const;
119  Double_t RotatedCovMatrixXY(Double_t phi = 0., Double_t theta = 0.) const;
120  Double_t RotatedCovMatrixYY(Double_t phi = 0.) const;
121  Double_t RotatedCovMatrixXZ(Double_t phi = 0., Double_t theta = 0.) const;
122  Double_t RotatedCovMatrixYZ(Double_t phi = 0., Double_t theta = 0.) const;
123  Double_t RotatedCovMatrixZZ(Double_t phi = 0., Double_t theta = 0.) const;
124 
125  template <class T, class P> void PhiAndThetaToVertex(AliAODVertex *vtx, P &phi, T &theta) const;
126  Double_t Distance2ToVertex(const AliAODVertex *vtx) const;
127  Double_t DistanceToVertex(AliAODVertex *vtx) const
128  {return TMath::Sqrt(Distance2ToVertex(vtx));}
129  Double_t DistanceXY2ToVertex(const AliAODVertex *vtx) const;
130  Double_t DistanceXYToVertex(AliAODVertex *vtx) const
131  {return TMath::Sqrt(DistanceXY2ToVertex(vtx));}
132  Double_t Error2DistanceToVertex(AliAODVertex *vtx) const;
133  Double_t ErrorDistanceToVertex(AliAODVertex *vtx) const
134  {return TMath::Sqrt(Error2DistanceToVertex(vtx));}
135  Double_t Error2DistanceXYToVertex(AliAODVertex *vtx) const;
137  {return TMath::Sqrt(Error2DistanceXYToVertex(vtx));}
138 
139  void PrintIndices() const;
140  void Print(Option_t* option = "") const;
141 
142  const char* AsString() const;
143 
144  static const char* GetTypeName(AODVtx_t type);
147 
148  void SetBC(Int_t bc) {fBCID = bc;}
149  Int_t GetBC() const {return fBCID;}
150 private:
151  void MakeProngs() {if (fNprong > 0) {fProngs = new TRef[fNprong]; fIprong=0;}}
152 
153  private:
154 
155  Double32_t fPosition[3];
156  Double32_t fChi2perNDF;
157  Short_t fID;
158  Char_t fBCID;
159  Char_t fType;
160  Int_t fNprong;
161  Int_t fIprong;
164  TRef fParent;
165  TRefArray fDaughters;
166  TRef *fProngs; //[fNprong]
168 
170 
171  ClassDef(AliAODVertex, 8);
172 };
173 
174 inline Int_t AliAODVertex::GetNDaughters() const
175 {
176  if (!fProngs) {
177  return fDaughters.GetEntriesFast();
178  } else {
179  return fNprong;
180  }
181 }
182 
183 inline TObject* AliAODVertex::GetDaughter(Int_t i)
184 {
185  if (!fProngs) {
186  return fDaughters.At(i);
187  } else {
188  if (i < fNprong) {
189  return fProngs[i].GetObject();
190  } else {
191  AliWarning("Daughter index out of range !\n");
192  return 0;
193  }
194  }
195 }
196 
197 #endif
static const char * GetTypeName(AODVtx_t type)
void RemoveDaughters()
Definition: AliAODVertex.h:107
Double_t DistanceToVertex(AliAODVertex *vtx) const
Definition: AliAODVertex.h:127
Bool_t HasDaughter(TObject *daughter) const
void RemoveCovMatrix()
Definition: AliAODVertex.h:88
static Bool_t fgUseCountVtxTrackContributors
enforce old-style counting of VertexTracks contributors
Definition: AliAODVertex.h:169
Double_t GetChi2() const
Definition: AliAODVertex.h:93
Double_t Distance2ToVertex(const AliAODVertex *vtx) const
Double_t RotatedCovMatrixXY(Double_t phi=0., Double_t theta=0.) const
void PrintIndices() const
Char_t fType
vertex type
Definition: AliAODVertex.h:159
void GetPosition(T *pos) const
Definition: AliAODVertex.h:75
Bool_t HasParent(TObject *parent) const
Definition: AliAODVertex.h:103
AliAODRedCov< 3 > * fCovMatrix
vertex covariance matrix; values of and below the diagonal
Definition: AliAODVertex.h:163
Double_t GetZ() const
Definition: AliAODVertex.h:72
Int_t fIprong
! index of prong
Definition: AliAODVertex.h:161
Double_t Error2DistanceToVertex(AliAODVertex *vtx) const
const char * AsString() const
Double_t Error2DistanceXYToVertex(AliAODVertex *vtx) const
void SetPosition(Double_t x, Double_t y, Double_t z)
Definition: AliAODVertex.h:62
Int_t GetNDF() const
Definition: AliAODVertex.h:94
#define AliWarning(message)
Definition: AliLog.h:541
void SetNContributors(Int_t nc)
Definition: AliAODVertex.h:115
Double_t RotatedCovMatrixXX(Double_t phi=0., Double_t theta=0.) const
Double_t RotatedCovMatrixYY(Double_t phi=0.) const
void SetZ(Double_t z)
Definition: AliAODVertex.h:61
void PhiAndThetaToVertex(AliAODVertex *vtx, P &phi, T &theta) const
virtual ~AliAODVertex()
void SetType(AODVtx_t vtype)
Definition: AliAODVertex.h:100
TObject * GetDaughter(Int_t i)
Definition: AliAODVertex.h:183
Double_t GetY() const
Definition: AliAODVertex.h:71
Double_t RotatedCovMatrixYZ(Double_t phi=0., Double_t theta=0.) const
void SetCovMatrix(T *cmat)
Definition: AliAODRedCov.h:87
Char_t fBCID
BC ID assigned to vertex.
Definition: AliAODVertex.h:158
void SetID(Short_t id)
Definition: AliAODVertex.h:97
virtual AliAODVertex * CloneWithoutRefs() const
Int_t GetNDaughters() const
Definition: AliAODVertex.h:174
Double_t RotatedCovMatrixZZ(Double_t phi=0., Double_t theta=0.) const
Double32_t fChi2perNDF
chi2/NDF of vertex fit
Definition: AliAODVertex.h:156
Short_t GetID() const
Definition: AliAODVertex.h:96
Double_t GetX() const
Definition: AliAODVertex.h:70
void GetCovMatrix(T *cmat) const
Definition: AliAODRedCov.h:60
void SetCovMatrix(const T *covMatrix)
Definition: AliAODVertex.h:78
Int_t CountRealContributors() const
Int_t GetNContributors() const
void MakeProngs()
Definition: AliAODVertex.h:151
void SetParent(TObject *parent)
Definition: AliAODVertex.h:68
Int_t GetBC() const
Definition: AliAODVertex.h:149
static void SetUseCountVtxTrackContributors(Bool_t v)
Definition: AliAODVertex.h:146
Int_t fNprong
number of prongs
Definition: AliAODVertex.h:160
Double_t DistanceXYToVertex(AliAODVertex *vtx) const
Definition: AliAODVertex.h:130
void SetY(Double_t y)
Definition: AliAODVertex.h:60
void Print(Option_t *option="") const
void AddDaughter(TObject *daughter)
Double32_t fPosition[3]
vertex position
Definition: AliAODVertex.h:155
Double_t ErrorDistanceXYToVertex(AliAODVertex *vtx) const
Definition: AliAODVertex.h:136
Double_t RotatedCovMatrixXZ(Double_t phi=0., Double_t theta=0.) const
Short_t fID
vertex ID; corresponds to the array index of the appropriate ESD container
Definition: AliAODVertex.h:157
Double_t ErrorDistanceToVertex(AliAODVertex *vtx) const
Definition: AliAODVertex.h:133
void SetChi2perNDF(Double_t chi2perNDF)
Definition: AliAODVertex.h:66
static Bool_t GetUseCountVtxTrackContributors()
Definition: AliAODVertex.h:145
TObject * GetParent() const
Definition: AliAODVertex.h:102
Double_t DistanceXY2ToVertex(const AliAODVertex *vtx) const
void RemoveDaughter(TObject *daughter)
Definition: AliAODVertex.h:106
void GetSigmaXYZ(T *sigma) const
TRef * fProngs
alternative daughters for n-prong vertex
Definition: AliAODVertex.h:167
Bool_t GetCovMatrix(T *covMatrix) const
Definition: AliAODVertex.h:82
void SetPosition(T *pos)
Definition: AliAODVertex.h:63
Int_t GetNContributorsStored() const
Definition: AliAODVertex.h:113
TRef fParent
reference to the parent particle
Definition: AliAODVertex.h:164
void GetCovarianceMatrix(Double_t covmatrix[6]) const
Definition: AliAODVertex.h:86
Double_t GetChi2perNDF() const
Definition: AliAODVertex.h:92
AliAODVertex & operator=(const AliAODVertex &vtx)
void SetBC(Int_t bc)
Definition: AliAODVertex.h:148
AOD vertex base class.
Definition: AliAODVertex.h:23
Int_t fNContributors
Number of contributors for SPD vertex.
Definition: AliAODVertex.h:162
TRefArray fDaughters
Definition: AliAODVertex.h:165
Char_t GetType() const
Definition: AliAODVertex.h:99
void SetX(Double_t x)
Definition: AliAODVertex.h:59
void GetXYZ(Double_t position[3]) const
Definition: AliAODVertex.h:73