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() :
45 fID(-1) // ID=-1 means the vertex with the biggest number of contributors
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 fID(-1) // ID=-1 means the vertex with the biggest number of contributors
67 // Constructor for vertex Z from pixels
72 fPosition[2] = positionZ;
74 SetNContributors(nContributors);
78 //-------------------------------------------------------------------------
79 AliESDVertex::AliESDVertex(Double_t position[3],Double_t covmatrix[6],
80 Double_t chi2,Int_t nContributors,
81 const Char_t *vtxName) :
82 AliVertex(position,0.,nContributors),
90 fID(-1) // ID=-1 means the vertex with the biggest number of contributors
93 // Constructor for vertex in 3D from tracks
100 //--------------------------------------------------------------------------
101 AliESDVertex::AliESDVertex(Double_t position[3],Double_t sigma[3],
102 const Char_t *vtxName) :
103 AliVertex(position,0.,0),
104 fCovXX(sigma[0]*sigma[0]),
106 fCovYY(sigma[1]*sigma[1]),
109 fCovZZ(sigma[2]*sigma[2]),
111 fID(-1) // ID=-1 means the vertex with the biggest number of contributors
114 // Constructor for smearing of true position
121 //--------------------------------------------------------------------------
122 AliESDVertex::AliESDVertex(Double_t position[3],Double_t sigma[3],
123 Double_t snr[3], const Char_t *vtxName) :
124 AliVertex(position,0.,0),
125 fCovXX(sigma[0]*sigma[0]),
127 fCovYY(sigma[1]*sigma[1]),
130 fCovZZ(sigma[2]*sigma[2]),
132 fID(-1) // ID=-1 means the vertex with the biggest number of contributors
135 // Constructor for Pb-Pb
146 //--------------------------------------------------------------------------
147 AliESDVertex::AliESDVertex(const AliESDVertex &source):
149 fCovXX(source.fCovXX),
150 fCovXY(source.fCovXY),
151 fCovYY(source.fCovYY),
152 fCovXZ(source.fCovXZ),
153 fCovYZ(source.fCovYZ),
154 fCovZZ(source.fCovZZ),
161 for(Int_t i=0;i<3;i++) {
162 fSNR[i] = source.fSNR[i];
165 //--------------------------------------------------------------------------
166 AliESDVertex &AliESDVertex::operator=(const AliESDVertex &source){
168 // assignment operator
171 AliVertex::operator=(source);
172 for(Int_t i=0;i<3;++i)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;
184 //--------------------------------------------------------------------------
185 void AliESDVertex::Copy(TObject &obj) const {
187 // this overwrites the virtual TOBject::Copy()
188 // to allow run time copying without casting
191 if(this==&obj)return;
192 AliESDVertex *robj = dynamic_cast<AliESDVertex*>(&obj);
193 if(!robj)return; // not an AliESDVertex
197 //--------------------------------------------------------------------------
198 void AliESDVertex::SetToZero() {
200 // Set the content of arrays to 0. Used by constructors
202 for(Int_t i=0; i<3; i++){
206 //--------------------------------------------------------------------------
207 void AliESDVertex::GetSigmaXYZ(Double_t sigma[3]) const {
209 // Return errors on vertex position in thrust frame
211 sigma[0] = TMath::Sqrt(fCovXX);
212 sigma[1] = TMath::Sqrt(fCovYY);
213 sigma[2] = TMath::Sqrt(fCovZZ);
217 //--------------------------------------------------------------------------
218 void AliESDVertex::GetCovMatrix(Double_t covmatrix[6]) const {
220 // Return covariance matrix of the vertex
222 covmatrix[0] = fCovXX;
223 covmatrix[1] = fCovXY;
224 covmatrix[2] = fCovYY;
225 covmatrix[3] = fCovXZ;
226 covmatrix[4] = fCovYZ;
227 covmatrix[5] = fCovZZ;
232 //--------------------------------------------------------------------------
233 void AliESDVertex::GetSNR(Double_t snr[3]) const {
237 for(Int_t i=0;i<3;i++) snr[i] = fSNR[i];
241 //--------------------------------------------------------------------------
242 void AliESDVertex::Print(Option_t* /*option*/) const {
244 // Print out information on all data members
246 printf("ESD vertex position:\n");
247 printf(" x = %f +- %f\n",fPosition[0],TMath::Sqrt(fCovXX));
248 printf(" y = %f +- %f\n",fPosition[1],TMath::Sqrt(fCovYY));
249 printf(" z = %f +- %f\n",fPosition[2],TMath::Sqrt(fCovZZ));
250 printf(" Covariance matrix:\n");
251 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);
252 printf(" S/N = (%f, %f, %f)\n",fSNR[0],fSNR[1],fSNR[2]);
253 printf(" chi2 = %f\n",fChi2);
254 printf(" # tracks (or tracklets) = %d\n",fNContributors);