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
18 // for the Event Data Summary class
19 // This class contains the Primary Vertex
20 // of the event coming from reconstruction
21 // Origin: A.Dainese, Padova, andrea.dainese@pd.infn.it
22 //-----------------------------------------------------------------
24 //---- standard headers ----
25 #include "Riostream.h"
26 //---- Root headers --------
29 //---- AliRoot headers -----
30 #include "AliESDVertex.h"
33 ClassImp(AliESDVertex)
35 //--------------------------------------------------------------------------
36 AliESDVertex::AliESDVertex() :
48 // Default Constructor, set everything to 0
53 //--------------------------------------------------------------------------
54 AliESDVertex::AliESDVertex(Double_t positionZ,Double_t sigmaZ,
55 Int_t nContributors,const Char_t *vtxName) :
62 fCovZZ(sigmaZ*sigmaZ),
64 fNContributors(nContributors)
67 // Constructor for vertex Z from pixels
72 fPosition[2] = positionZ;
76 //-------------------------------------------------------------------------
77 AliESDVertex::AliESDVertex(Double_t position[3],Double_t covmatrix[6],
78 Double_t chi2,Int_t nContributors,
79 const Char_t *vtxName) :
88 fNContributors(nContributors)
91 // Constructor for vertex in 3D from tracks
95 fPosition[0] = position[0];
96 fPosition[1] = position[1];
97 fPosition[2] = position[2];
100 //--------------------------------------------------------------------------
101 AliESDVertex::AliESDVertex(Double_t position[3],Double_t sigma[3],
102 const Char_t *vtxName) :
104 fCovXX(sigma[0]*sigma[0]),
106 fCovYY(sigma[1]*sigma[1]),
109 fCovZZ(sigma[2]*sigma[2]),
114 // Constructor for smearing of true position
118 fPosition[0] = position[0];
119 fPosition[1] = position[1];
120 fPosition[2] = position[2];
123 //--------------------------------------------------------------------------
124 AliESDVertex::AliESDVertex(Double_t position[3],Double_t sigma[3],
125 Double_t snr[3], const Char_t *vtxName) :
127 fCovXX(sigma[0]*sigma[0]),
129 fCovYY(sigma[1]*sigma[1]),
132 fCovZZ(sigma[2]*sigma[2]),
137 // Constructor for Pb-Pb
141 fPosition[0] = position[0];
142 fPosition[1] = position[1];
143 fPosition[2] = position[2];
151 //--------------------------------------------------------------------------
152 void AliESDVertex::SetToZero() {
154 // Set the content of arrays to 0. Used by constructors
156 for(Int_t i=0; i<3; i++){
162 //--------------------------------------------------------------------------
163 AliESDVertex::~AliESDVertex() {
169 //--------------------------------------------------------------------------
170 void AliESDVertex::GetXYZ(Double_t position[3]) const {
172 // Return position of the vertex in global frame
174 position[0] = fPosition[0];
175 position[1] = fPosition[1];
176 position[2] = fPosition[2];
180 //--------------------------------------------------------------------------
181 void AliESDVertex::GetSigmaXYZ(Double_t sigma[3]) const {
183 // Return errors on vertex position in thrust frame
185 sigma[0] = TMath::Sqrt(fCovXX);
186 sigma[1] = TMath::Sqrt(fCovYY);
187 sigma[2] = TMath::Sqrt(fCovZZ);
191 //--------------------------------------------------------------------------
192 void AliESDVertex::GetCovMatrix(Double_t covmatrix[6]) const {
194 // Return covariance matrix of the vertex
196 covmatrix[0] = fCovXX;
197 covmatrix[1] = fCovXY;
198 covmatrix[2] = fCovYY;
199 covmatrix[3] = fCovXZ;
200 covmatrix[4] = fCovYZ;
201 covmatrix[5] = fCovZZ;
205 //--------------------------------------------------------------------------
206 Double_t AliESDVertex::GetXv() const {
212 //--------------------------------------------------------------------------
213 Double_t AliESDVertex::GetYv() const {
219 //--------------------------------------------------------------------------
220 Double_t AliESDVertex::GetZv() const {
226 //--------------------------------------------------------------------------
227 Double_t AliESDVertex::GetXRes() const {
229 // Return error on global x
231 return TMath::Sqrt(fCovXX);
233 //--------------------------------------------------------------------------
234 Double_t AliESDVertex::GetYRes() const {
236 // Return error on global y
238 return TMath::Sqrt(fCovYY);
240 //--------------------------------------------------------------------------
241 Double_t AliESDVertex::GetZRes() const {
243 // Return error on global z
245 return TMath::Sqrt(fCovZZ);
247 //--------------------------------------------------------------------------
248 void AliESDVertex::GetSNR(Double_t snr[3]) const {
252 for(Int_t i=0;i<3;i++) snr[i] = fSNR[i];
256 //--------------------------------------------------------------------------
257 void AliESDVertex::Print(Option_t* /*option*/) const {
259 // Print out information on all data members
261 printf("ESD vertex position:\n");
262 printf(" x = %f +- %f\n",fPosition[0],TMath::Sqrt(fCovXX));
263 printf(" y = %f +- %f\n",fPosition[1],TMath::Sqrt(fCovYY));
264 printf(" z = %f +- %f\n",fPosition[2],TMath::Sqrt(fCovZZ));
265 printf(" Covariance matrix:\n");
266 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);
267 printf(" S/N = (%f, %f, %f)\n",fSNR[0],fSNR[1],fSNR[2]);
268 printf(" chi2 = %f\n",fChi2);
269 printf(" # tracks (or tracklets) = %d\n",fNContributors);
271 printf(" True vertex position - for comparison: %12.10f %12.10f %12.10f\n ",fTruePos[0],fTruePos[1],fTruePos[2]);