]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliESDVertex.cxx
No ISO/ANSI compliance for the old gcc compilers (2.95.2,2.96)
[u/mrichter/AliRoot.git] / STEER / AliESDVertex.cxx
CommitLineData
c5f0f3c1 1/**************************************************************************
0fc5cc25 2 * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
c5f0f3c1 3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16//-----------------------------------------------------------------
17// Implementation of the Primary Vertex class
18//
19// Origin: A.Dainese, Padova, andrea.dainese@pd.infn.it
20//-----------------------------------------------------------------
21
22//---- standard headers ----
8ba665e9 23#include "Riostream.h"
c5f0f3c1 24//---- Root headers --------
504de69b 25#include <TMath.h>
504de69b 26#include <TROOT.h>
c5f0f3c1 27#include <TNamed.h>
28//---- AliRoot headers -----
d681bb2d 29#include "AliESDVertex.h"
504de69b 30
31
d681bb2d 32ClassImp(AliESDVertex)
504de69b 33
c5f0f3c1 34//--------------------------------------------------------------------------
d681bb2d 35AliESDVertex::AliESDVertex() {
c5f0f3c1 36//
37// Default Constructor, set everything to 0
38//
0fc5cc25 39 SetToZero();
c5f0f3c1 40}
41//--------------------------------------------------------------------------
d681bb2d 42AliESDVertex::AliESDVertex(Double_t positionZ,Double_t sigmaZ,
11ba84a4 43 Int_t nContributors,Char_t *vtxName) {
0fc5cc25 44 //
45 // Constructor for vertex Z from pixels
46 //
c5f0f3c1 47
0fc5cc25 48 SetToZero();
c5f0f3c1 49
0fc5cc25 50 fPosition[2] = positionZ;
51 fCovZZ = sigmaZ*sigmaZ;
52 fNContributors = nContributors;
53 SetName(vtxName);
c5f0f3c1 54
c5f0f3c1 55}
56//-------------------------------------------------------------------------
d681bb2d 57AliESDVertex::AliESDVertex(Double_t position[3],Double_t covmatrix[6],
11ba84a4 58 Double_t chi2,Int_t nContributors,Char_t *vtxName) {
c5f0f3c1 59//
60// Constructor for vertex in 3D from tracks
61//
0fc5cc25 62
63 SetToZero();
c5f0f3c1 64 fPosition[0] = position[0];
65 fPosition[1] = position[1];
66 fPosition[2] = position[2];
67 fCovXX = covmatrix[0];
68 fCovXY = covmatrix[1];
69 fCovYY = covmatrix[2];
70 fCovXZ = covmatrix[3];
71 fCovYZ = covmatrix[4];
72 fCovZZ = covmatrix[5];
73
c5f0f3c1 74
c5f0f3c1 75 fChi2 = chi2;
76 fNContributors = nContributors;
77
78 SetName(vtxName);
79
cd77595e 80}
c5f0f3c1 81//--------------------------------------------------------------------------
d681bb2d 82AliESDVertex::AliESDVertex(Double_t position[3],Double_t sigma[3],
11ba84a4 83 Char_t *vtxName) {
c5f0f3c1 84//
85// Constructor for smearing of true position
86//
0fc5cc25 87
88 SetToZero();
c5f0f3c1 89 fPosition[0] = position[0];
90 fPosition[1] = position[1];
91 fPosition[2] = position[2];
92 fCovXX = sigma[0]*sigma[0];
93 fCovXY = 0;
94 fCovYY = sigma[1]*sigma[1];
95 fCovXZ = 0;
96 fCovYZ = 0;
97 fCovZZ = sigma[2]*sigma[2];
98
c5f0f3c1 99
100 SetName(vtxName);
101
c5f0f3c1 102}
103//--------------------------------------------------------------------------
d681bb2d 104AliESDVertex::AliESDVertex(Double_t position[3],Double_t sigma[3],
11ba84a4 105 Double_t snr[3],Char_t *vtxName) {
0fc5cc25 106 //
107 // Constructor for Pb-Pb
108 //
109
110 SetToZero();
111 fPosition[0] = position[0];
112 fPosition[1] = position[1];
113 fPosition[2] = position[2];
114 fCovXX = sigma[0]*sigma[0];
115 fCovXY = 0;
116 fCovYY = sigma[1]*sigma[1];
117 fCovXZ = 0;
118 fCovYZ = 0;
119 fCovZZ = sigma[2]*sigma[2];
120
121 fSNR[0] = snr[0];
122 fSNR[1] = snr[1];
123 fSNR[2] = snr[2];
124
125 SetName(vtxName);
c5f0f3c1 126
0fc5cc25 127}
128//--------------------------------------------------------------------------
d681bb2d 129void AliESDVertex::SetToZero() {
0fc5cc25 130 //
131 // Set some data members to 0. Used by constructors
132 //
133 for(Int_t i=0; i<3; i++){
134 fPosition[i] = 0.;
135 fTruePos[i] = 0;
136 fSNR[i] = 0.;
137 }
2257f27e 138 fCovXX = 0.005*0.005;
0fc5cc25 139 fCovXY = 0;
2257f27e 140 fCovYY = 0.005*0.005;
0fc5cc25 141 fCovXZ = 0;
142 fCovYZ = 0;
2257f27e 143 fCovZZ = 5.3*5.3;
0fc5cc25 144
0fc5cc25 145 fChi2 = 0;
146 fNContributors = 0;
147
148 SetDebug();
c5f0f3c1 149}
150//--------------------------------------------------------------------------
d681bb2d 151AliESDVertex::~AliESDVertex() {
c5f0f3c1 152//
153// Default Destructor
154//
0fc5cc25 155
c5f0f3c1 156}
157//--------------------------------------------------------------------------
d681bb2d 158void AliESDVertex::GetXYZ(Double_t position[3]) const {
c5f0f3c1 159//
160// Return position of the vertex in global frame
c5f0f3c1 161//
162 position[0] = fPosition[0];
163 position[1] = fPosition[1];
164 position[2] = fPosition[2];
165
166 return;
167}
168//--------------------------------------------------------------------------
d681bb2d 169void AliESDVertex::GetSigmaXYZ(Double_t sigma[3]) const {
c5f0f3c1 170//
c5f0f3c1 171// Return errors on vertex position in thrust frame
172//
173 sigma[0] = TMath::Sqrt(fCovXX);
174 sigma[1] = TMath::Sqrt(fCovYY);
175 sigma[2] = TMath::Sqrt(fCovZZ);
176
177 return;
cd77595e 178}
c5f0f3c1 179//--------------------------------------------------------------------------
d681bb2d 180void AliESDVertex::GetCovMatrix(Double_t covmatrix[6]) const {
c5f0f3c1 181//
182// Return covariance matrix of the vertex
c5f0f3c1 183//
184 covmatrix[0] = fCovXX;
185 covmatrix[1] = fCovXY;
186 covmatrix[2] = fCovYY;
187 covmatrix[3] = fCovXZ;
188 covmatrix[4] = fCovYZ;
189 covmatrix[5] = fCovZZ;
190
191 return;
cd77595e 192}
c5f0f3c1 193//--------------------------------------------------------------------------
d681bb2d 194Double_t AliESDVertex::GetXv() const {
c5f0f3c1 195//
196// Return global x
197//
11ba84a4 198 return fPosition[0];
c5f0f3c1 199}
200//--------------------------------------------------------------------------
d681bb2d 201Double_t AliESDVertex::GetYv() const {
c5f0f3c1 202//
203// Return global y
204//
11ba84a4 205 return fPosition[1];
c5f0f3c1 206}
207//--------------------------------------------------------------------------
d681bb2d 208Double_t AliESDVertex::GetZv() const {
c5f0f3c1 209//
210// Return global z
211//
212 return fPosition[2];
213}
214//--------------------------------------------------------------------------
d681bb2d 215Double_t AliESDVertex::GetXRes() const {
c5f0f3c1 216//
217// Return error on global x
218//
11ba84a4 219 return TMath::Sqrt(fCovXX);
c5f0f3c1 220}
221//--------------------------------------------------------------------------
d681bb2d 222Double_t AliESDVertex::GetYRes() const {
c5f0f3c1 223//
224// Return error on global y
225//
11ba84a4 226 return TMath::Sqrt(fCovYY);
c5f0f3c1 227}
228//--------------------------------------------------------------------------
d681bb2d 229Double_t AliESDVertex::GetZRes() const {
c5f0f3c1 230//
231// Return error on global z
232//
11ba84a4 233 return TMath::Sqrt(fCovZZ);
c5f0f3c1 234}
235//--------------------------------------------------------------------------
d681bb2d 236void AliESDVertex::GetSNR(Double_t snr[3]) const {
c5f0f3c1 237//
238// Return S/N ratios
239//
240 for(Int_t i=0;i<3;i++) snr[i] = fSNR[i];
241
242 return;
243}
244//--------------------------------------------------------------------------
d681bb2d 245void AliESDVertex::PrintStatus() const {
c5f0f3c1 246//
247// Print out information on all data members
248//
c5f0f3c1 249 printf(" Vertex position:\n");
250 printf(" x = %f +- %f\n",fPosition[0],TMath::Sqrt(fCovXX));
251 printf(" y = %f +- %f\n",fPosition[1],TMath::Sqrt(fCovYY));
252 printf(" z = %f +- %f\n",fPosition[2],TMath::Sqrt(fCovZZ));
253 printf(" Covariance matrix:\n");
254 printf(" %12.10f %12.10f %12.10f\n %12.10f %12.10f %12.10f\n %12.10f %12.10f %12.10f\n",fCovXX,fCovXY,fCovXZ,fCovXY,fCovYY,fCovYZ,fCovXZ,fCovYZ,fCovZZ);
255 printf(" S/N = (%f, %f, %f)\n",fSNR[0],fSNR[1],fSNR[2]);
256 printf(" chi2 = %f\n",fChi2);
257 printf(" # tracks (or tracklets) = %d\n",fNContributors);
258
0fc5cc25 259 printf(" True vertex position - for comparison: %12.10f %12.10f %12.10f\n ",fTruePos[0],fTruePos[1],fTruePos[2]);
260
c5f0f3c1 261 return;
262}
263
264
265
6b88f180 266