1 /**************************************************************************
2 * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 //-----------------------------------------------------------------
17 // Implementation of the Primary Vertex class
19 // Origin: A.Dainese, Padova, andrea.dainese@pd.infn.it
20 //-----------------------------------------------------------------
22 //---- standard headers ----
23 #include "Riostream.h"
24 //---- Root headers --------
28 //---- AliRoot headers -----
29 #include "AliESDVertex.h"
32 ClassImp(AliESDVertex)
34 //--------------------------------------------------------------------------
35 AliESDVertex::AliESDVertex() {
37 // Default Constructor, set everything to 0
41 //--------------------------------------------------------------------------
42 AliESDVertex::AliESDVertex(Double_t positionZ,Double_t sigmaZ,
43 Int_t nContributors,Char_t *vtxName) {
45 // Constructor for vertex Z from pixels
50 fPosition[2] = positionZ;
51 fCovZZ = sigmaZ*sigmaZ;
52 fNContributors = nContributors;
56 //-------------------------------------------------------------------------
57 AliESDVertex::AliESDVertex(Double_t position[3],Double_t covmatrix[6],
58 Double_t chi2,Int_t nContributors,Char_t *vtxName) {
60 // Constructor for vertex in 3D from tracks
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];
76 fNContributors = nContributors;
81 //--------------------------------------------------------------------------
82 AliESDVertex::AliESDVertex(Double_t position[3],Double_t sigma[3],
85 // Constructor for smearing of true position
89 fPosition[0] = position[0];
90 fPosition[1] = position[1];
91 fPosition[2] = position[2];
92 fCovXX = sigma[0]*sigma[0];
94 fCovYY = sigma[1]*sigma[1];
97 fCovZZ = sigma[2]*sigma[2];
103 //--------------------------------------------------------------------------
104 AliESDVertex::AliESDVertex(Double_t position[3],Double_t sigma[3],
105 Double_t snr[3],Char_t *vtxName) {
107 // Constructor for Pb-Pb
111 fPosition[0] = position[0];
112 fPosition[1] = position[1];
113 fPosition[2] = position[2];
114 fCovXX = sigma[0]*sigma[0];
116 fCovYY = sigma[1]*sigma[1];
119 fCovZZ = sigma[2]*sigma[2];
128 //--------------------------------------------------------------------------
129 void AliESDVertex::SetToZero() {
131 // Set some data members to 0. Used by constructors
133 for(Int_t i=0; i<3; i++){
138 fCovXX = 0.005*0.005;
140 fCovYY = 0.005*0.005;
150 //--------------------------------------------------------------------------
151 AliESDVertex::~AliESDVertex() {
153 // Default Destructor
157 //--------------------------------------------------------------------------
158 void AliESDVertex::GetXYZ(Double_t position[3]) const {
160 // Return position of the vertex in global frame
162 position[0] = fPosition[0];
163 position[1] = fPosition[1];
164 position[2] = fPosition[2];
168 //--------------------------------------------------------------------------
169 void AliESDVertex::GetSigmaXYZ(Double_t sigma[3]) const {
171 // Return errors on vertex position in thrust frame
173 sigma[0] = TMath::Sqrt(fCovXX);
174 sigma[1] = TMath::Sqrt(fCovYY);
175 sigma[2] = TMath::Sqrt(fCovZZ);
179 //--------------------------------------------------------------------------
180 void AliESDVertex::GetCovMatrix(Double_t covmatrix[6]) const {
182 // Return covariance matrix of the vertex
184 covmatrix[0] = fCovXX;
185 covmatrix[1] = fCovXY;
186 covmatrix[2] = fCovYY;
187 covmatrix[3] = fCovXZ;
188 covmatrix[4] = fCovYZ;
189 covmatrix[5] = fCovZZ;
193 //--------------------------------------------------------------------------
194 Double_t AliESDVertex::GetXv() const {
200 //--------------------------------------------------------------------------
201 Double_t AliESDVertex::GetYv() const {
207 //--------------------------------------------------------------------------
208 Double_t AliESDVertex::GetZv() const {
214 //--------------------------------------------------------------------------
215 Double_t AliESDVertex::GetXRes() const {
217 // Return error on global x
219 return TMath::Sqrt(fCovXX);
221 //--------------------------------------------------------------------------
222 Double_t AliESDVertex::GetYRes() const {
224 // Return error on global y
226 return TMath::Sqrt(fCovYY);
228 //--------------------------------------------------------------------------
229 Double_t AliESDVertex::GetZRes() const {
231 // Return error on global z
233 return TMath::Sqrt(fCovZZ);
235 //--------------------------------------------------------------------------
236 void AliESDVertex::GetSNR(Double_t snr[3]) const {
240 for(Int_t i=0;i<3;i++) snr[i] = fSNR[i];
244 //--------------------------------------------------------------------------
245 void AliESDVertex::PrintStatus() const {
247 // Print out information on all data members
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);
259 printf(" True vertex position - for comparison: %12.10f %12.10f %12.10f\n ",fTruePos[0],fTruePos[1],fTruePos[2]);