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() {
38 // Default Constructor, set everything to 0
42 //--------------------------------------------------------------------------
43 AliESDVertex::AliESDVertex(Double_t positionZ,Double_t sigmaZ,
44 Int_t nContributors,const Char_t *vtxName) {
46 // Constructor for vertex Z from pixels
51 fPosition[2] = positionZ;
52 fCovZZ = sigmaZ*sigmaZ;
53 fNContributors = nContributors;
57 //-------------------------------------------------------------------------
58 AliESDVertex::AliESDVertex(Double_t position[3],Double_t covmatrix[6],
59 Double_t chi2,Int_t nContributors, const Char_t *vtxName) {
61 // Constructor for vertex in 3D from tracks
65 fPosition[0] = position[0];
66 fPosition[1] = position[1];
67 fPosition[2] = position[2];
68 fCovXX = covmatrix[0];
69 fCovXY = covmatrix[1];
70 fCovYY = covmatrix[2];
71 fCovXZ = covmatrix[3];
72 fCovYZ = covmatrix[4];
73 fCovZZ = covmatrix[5];
77 fNContributors = nContributors;
82 //--------------------------------------------------------------------------
83 AliESDVertex::AliESDVertex(Double_t position[3],Double_t sigma[3],
84 const Char_t *vtxName) {
86 // Constructor for smearing of true position
90 fPosition[0] = position[0];
91 fPosition[1] = position[1];
92 fPosition[2] = position[2];
93 fCovXX = sigma[0]*sigma[0];
95 fCovYY = sigma[1]*sigma[1];
98 fCovZZ = sigma[2]*sigma[2];
104 //--------------------------------------------------------------------------
105 AliESDVertex::AliESDVertex(Double_t position[3],Double_t sigma[3],
106 Double_t snr[3], const Char_t *vtxName) {
108 // Constructor for Pb-Pb
112 fPosition[0] = position[0];
113 fPosition[1] = position[1];
114 fPosition[2] = position[2];
115 fCovXX = sigma[0]*sigma[0];
117 fCovYY = sigma[1]*sigma[1];
120 fCovZZ = sigma[2]*sigma[2];
129 //--------------------------------------------------------------------------
130 void AliESDVertex::SetToZero() {
132 // Set some data members to 0. Used by constructors
134 for(Int_t i=0; i<3; i++){
139 fCovXX = 0.005*0.005;
141 fCovYY = 0.005*0.005;
149 //--------------------------------------------------------------------------
150 AliESDVertex::~AliESDVertex() {
152 // Default Destructor
156 //--------------------------------------------------------------------------
157 void AliESDVertex::GetXYZ(Double_t position[3]) const {
159 // Return position of the vertex in global frame
161 position[0] = fPosition[0];
162 position[1] = fPosition[1];
163 position[2] = fPosition[2];
167 //--------------------------------------------------------------------------
168 void AliESDVertex::GetSigmaXYZ(Double_t sigma[3]) const {
170 // Return errors on vertex position in thrust frame
172 sigma[0] = TMath::Sqrt(fCovXX);
173 sigma[1] = TMath::Sqrt(fCovYY);
174 sigma[2] = TMath::Sqrt(fCovZZ);
178 //--------------------------------------------------------------------------
179 void AliESDVertex::GetCovMatrix(Double_t covmatrix[6]) const {
181 // Return covariance matrix of the vertex
183 covmatrix[0] = fCovXX;
184 covmatrix[1] = fCovXY;
185 covmatrix[2] = fCovYY;
186 covmatrix[3] = fCovXZ;
187 covmatrix[4] = fCovYZ;
188 covmatrix[5] = fCovZZ;
192 //--------------------------------------------------------------------------
193 Double_t AliESDVertex::GetXv() const {
199 //--------------------------------------------------------------------------
200 Double_t AliESDVertex::GetYv() const {
206 //--------------------------------------------------------------------------
207 Double_t AliESDVertex::GetZv() const {
213 //--------------------------------------------------------------------------
214 Double_t AliESDVertex::GetXRes() const {
216 // Return error on global x
218 return TMath::Sqrt(fCovXX);
220 //--------------------------------------------------------------------------
221 Double_t AliESDVertex::GetYRes() const {
223 // Return error on global y
225 return TMath::Sqrt(fCovYY);
227 //--------------------------------------------------------------------------
228 Double_t AliESDVertex::GetZRes() const {
230 // Return error on global z
232 return TMath::Sqrt(fCovZZ);
234 //--------------------------------------------------------------------------
235 void AliESDVertex::GetSNR(Double_t snr[3]) const {
239 for(Int_t i=0;i<3;i++) snr[i] = fSNR[i];
243 //--------------------------------------------------------------------------
244 void AliESDVertex::Print(Option_t* /*option*/) const {
246 // Print out information on all data members
248 printf("ESD vertex position:\n");
249 printf(" x = %f +- %f\n",fPosition[0],TMath::Sqrt(fCovXX));
250 printf(" y = %f +- %f\n",fPosition[1],TMath::Sqrt(fCovYY));
251 printf(" z = %f +- %f\n",fPosition[2],TMath::Sqrt(fCovZZ));
252 printf(" Covariance matrix:\n");
253 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);
254 printf(" S/N = (%f, %f, %f)\n",fSNR[0],fSNR[1],fSNR[2]);
255 printf(" chi2 = %f\n",fChi2);
256 printf(" # tracks (or tracklets) = %d\n",fNContributors);
258 printf(" True vertex position - for comparison: %12.10f %12.10f %12.10f\n ",fTruePos[0],fTruePos[1],fTruePos[2]);