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, andrea.dainese@lnl.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() :
47 // Default Constructor, set everything to 0
52 //--------------------------------------------------------------------------
53 AliESDVertex::AliESDVertex(Double_t positionZ,Double_t sigmaZ,
54 Int_t nContributors,const Char_t *vtxName) :
61 fCovZZ(sigmaZ*sigmaZ),
65 // Constructor for vertex Z from pixels
70 fPosition[2] = positionZ;
72 SetNContributors(nContributors);
76 //-------------------------------------------------------------------------
77 AliESDVertex::AliESDVertex(Double_t position[3],Double_t covmatrix[6],
78 Double_t chi2,Int_t nContributors,
79 const Char_t *vtxName) :
80 AliVertex(position,0.,nContributors),
90 // Constructor for vertex in 3D from tracks
97 //--------------------------------------------------------------------------
98 AliESDVertex::AliESDVertex(Double_t position[3],Double_t sigma[3],
99 const Char_t *vtxName) :
100 AliVertex(position,0.,0),
101 fCovXX(sigma[0]*sigma[0]),
103 fCovYY(sigma[1]*sigma[1]),
106 fCovZZ(sigma[2]*sigma[2]),
110 // Constructor for smearing of true position
117 //--------------------------------------------------------------------------
118 AliESDVertex::AliESDVertex(Double_t position[3],Double_t sigma[3],
119 Double_t snr[3], const Char_t *vtxName) :
120 AliVertex(position,0.,0),
121 fCovXX(sigma[0]*sigma[0]),
123 fCovYY(sigma[1]*sigma[1]),
126 fCovZZ(sigma[2]*sigma[2]),
130 // Constructor for Pb-Pb
141 //--------------------------------------------------------------------------
142 AliESDVertex::AliESDVertex(const AliESDVertex &source):
144 fCovXX(source.fCovXX),
145 fCovXY(source.fCovXY),
146 fCovYY(source.fCovYY),
147 fCovXZ(source.fCovXZ),
148 fCovYZ(source.fCovYZ),
149 fCovZZ(source.fCovZZ),
155 for(Int_t i=0;i<3;i++) {
156 fSNR[i] = source.fSNR[i];
157 fTruePos[i] = source.fTruePos[i];
160 //--------------------------------------------------------------------------
161 AliESDVertex &AliESDVertex::operator=(const AliESDVertex &source){
163 // assignment operator
165 if(&source == this) return *this;
166 this->SetName(source.GetName());
167 this->SetTitle(source.GetTitle());
168 for(Int_t i=0;i<3;i++) {
169 fPosition[i] = source.fPosition[i];
170 fTruePos[i] = source.fTruePos[i];
171 fSNR[i] = source.fSNR[i];
173 fCovXX = source.fCovXX;
174 fCovXY = source.fCovXY;
175 fCovYY = source.fCovYY;
176 fCovXZ = source.fCovXZ;
177 fCovYZ = source.fCovYZ;
178 fCovZZ = source.fCovZZ;
179 fChi2 = source.fChi2;
180 fSigma = source.GetDispersion();
181 fNContributors = source.GetNContributors();
182 fNIndices = source.GetNIndices();
183 if(source.fNIndices>0) {
184 fIndices = new UShort_t[fNIndices];
185 memcpy(fIndices,source.fIndices,fNIndices*sizeof(UShort_t));
189 //--------------------------------------------------------------------------
190 void AliESDVertex::SetToZero() {
192 // Set the content of arrays to 0. Used by constructors
194 for(Int_t i=0; i<3; i++){
199 //--------------------------------------------------------------------------
200 void AliESDVertex::GetSigmaXYZ(Double_t sigma[3]) const {
202 // Return errors on vertex position in thrust frame
204 sigma[0] = TMath::Sqrt(fCovXX);
205 sigma[1] = TMath::Sqrt(fCovYY);
206 sigma[2] = TMath::Sqrt(fCovZZ);
210 //--------------------------------------------------------------------------
211 void AliESDVertex::GetCovMatrix(Double_t covmatrix[6]) const {
213 // Return covariance matrix of the vertex
215 covmatrix[0] = fCovXX;
216 covmatrix[1] = fCovXY;
217 covmatrix[2] = fCovYY;
218 covmatrix[3] = fCovXZ;
219 covmatrix[4] = fCovYZ;
220 covmatrix[5] = fCovZZ;
225 //--------------------------------------------------------------------------
226 void AliESDVertex::GetSNR(Double_t snr[3]) const {
230 for(Int_t i=0;i<3;i++) snr[i] = fSNR[i];
234 //--------------------------------------------------------------------------
235 void AliESDVertex::Print(Option_t* /*option*/) const {
237 // Print out information on all data members
239 printf("ESD vertex position:\n");
240 printf(" x = %f +- %f\n",fPosition[0],TMath::Sqrt(fCovXX));
241 printf(" y = %f +- %f\n",fPosition[1],TMath::Sqrt(fCovYY));
242 printf(" z = %f +- %f\n",fPosition[2],TMath::Sqrt(fCovZZ));
243 printf(" Covariance matrix:\n");
244 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);
245 printf(" S/N = (%f, %f, %f)\n",fSNR[0],fSNR[1],fSNR[2]);
246 printf(" chi2 = %f\n",fChi2);
247 printf(" # tracks (or tracklets) = %d\n",fNContributors);
249 printf(" True vertex position - for comparison: %12.10f %12.10f %12.10f\n ",fTruePos[0],fTruePos[1],fTruePos[2]);