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 "AliITSVertex.h"
32 ClassImp(AliITSVertex)
34 //--------------------------------------------------------------------------
35 AliITSVertex::AliITSVertex() {
37 // Default Constructor, set everything to 0
41 //--------------------------------------------------------------------------
42 AliITSVertex::AliITSVertex(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 AliITSVertex::AliITSVertex(Double_t phi,
58 Double_t position[3],Double_t covmatrix[6],
59 Double_t chi2,Int_t nContributors,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];
78 fNContributors = nContributors;
83 //--------------------------------------------------------------------------
84 AliITSVertex::AliITSVertex(Double_t position[3],Double_t sigma[3],
87 // Constructor for smearing of true position
91 fPosition[0] = position[0];
92 fPosition[1] = position[1];
93 fPosition[2] = position[2];
94 fCovXX = sigma[0]*sigma[0];
96 fCovYY = sigma[1]*sigma[1];
99 fCovZZ = sigma[2]*sigma[2];
105 //--------------------------------------------------------------------------
106 AliITSVertex::AliITSVertex(Double_t position[3],Double_t sigma[3],
107 Double_t snr[3],Char_t *vtxName) {
109 // Constructor for Pb-Pb
113 fPosition[0] = position[0];
114 fPosition[1] = position[1];
115 fPosition[2] = position[2];
116 fCovXX = sigma[0]*sigma[0];
118 fCovYY = sigma[1]*sigma[1];
121 fCovZZ = sigma[2]*sigma[2];
130 //--------------------------------------------------------------------------
131 void AliITSVertex::SetToZero() {
133 // Set some data members to 0. Used by constructors
135 for(Int_t i=0; i<3; i++){
153 //--------------------------------------------------------------------------
154 AliITSVertex::~AliITSVertex() {
156 // Default Destructor
160 //--------------------------------------------------------------------------
161 void AliITSVertex::GetXYZ(Double_t position[3]) const {
163 // Return position of the vertex in global frame
165 position[0] = fPosition[0]*TMath::Cos(fPhi)-fPosition[1]*TMath::Sin(fPhi);
166 position[1] = fPosition[0]*TMath::Sin(fPhi)+fPosition[1]*TMath::Cos(fPhi);
167 position[2] = fPosition[2];
171 //--------------------------------------------------------------------------
172 void AliITSVertex::GetXYZ_ThrustFrame(Double_t position[3]) const {
174 // Return position of the vertex in thrust frame
176 position[0] = fPosition[0];
177 position[1] = fPosition[1];
178 position[2] = fPosition[2];
182 //--------------------------------------------------------------------------
183 void AliITSVertex::GetSigmaXYZ(Double_t sigma[3]) const {
185 // Return errors on vertex position in global frame
189 sigma[0] = TMath::Sqrt(cm[0]);
190 sigma[1] = TMath::Sqrt(cm[2]);
191 sigma[2] = TMath::Sqrt(cm[5]);
195 //--------------------------------------------------------------------------
196 void AliITSVertex::GetSigmaXYZ_ThrustFrame(Double_t sigma[3]) const {
198 // Return errors on vertex position in thrust frame
200 sigma[0] = TMath::Sqrt(fCovXX);
201 sigma[1] = TMath::Sqrt(fCovYY);
202 sigma[2] = TMath::Sqrt(fCovZZ);
206 //--------------------------------------------------------------------------
207 void AliITSVertex::GetCovMatrix(Double_t covmatrix[6]) const {
209 // Return covariance matrix of the vertex
211 Double_t cPhi = TMath::Cos(fPhi);
212 Double_t sPhi = TMath::Sin(fPhi);
214 covmatrix[0] = fCovXX*cPhi*cPhi-2.*fCovXY*cPhi*sPhi+fCovYY*sPhi*sPhi;
215 covmatrix[1] = (fCovXX-fCovYY)*cPhi*sPhi+fCovXY*(cPhi*cPhi-sPhi*sPhi);
216 covmatrix[2] = fCovXX*sPhi*sPhi+2.*fCovXY*cPhi*sPhi+fCovYY*cPhi*cPhi;
217 covmatrix[3] = fCovXZ*cPhi-fCovYZ*sPhi;
218 covmatrix[4] = fCovXZ*sPhi+fCovYZ*cPhi;
219 covmatrix[5] = fCovZZ;
223 //--------------------------------------------------------------------------
224 void AliITSVertex::GetCovMatrix_ThrustFrame(Double_t covmatrix[6]) const {
226 // Return covariance matrix of the vertex
228 covmatrix[0] = fCovXX;
229 covmatrix[1] = fCovXY;
230 covmatrix[2] = fCovYY;
231 covmatrix[3] = fCovXZ;
232 covmatrix[4] = fCovYZ;
233 covmatrix[5] = fCovZZ;
237 //--------------------------------------------------------------------------
238 Double_t AliITSVertex::GetXv() const {
242 return fPosition[0]*TMath::Cos(fPhi)-fPosition[1]*TMath::Sin(fPhi);
244 //--------------------------------------------------------------------------
245 Double_t AliITSVertex::GetYv() const {
249 return fPosition[0]*TMath::Sin(fPhi)+fPosition[1]*TMath::Cos(fPhi);
251 //--------------------------------------------------------------------------
252 Double_t AliITSVertex::GetZv() const {
258 //--------------------------------------------------------------------------
259 Double_t AliITSVertex::GetXRes() const {
261 // Return error on global x
265 return TMath::Sqrt(cm[0]);
267 //--------------------------------------------------------------------------
268 Double_t AliITSVertex::GetYRes() const {
270 // Return error on global y
274 return TMath::Sqrt(cm[2]);
276 //--------------------------------------------------------------------------
277 Double_t AliITSVertex::GetZRes() const {
279 // Return error on global z
283 return TMath::Sqrt(cm[5]);
285 //--------------------------------------------------------------------------
286 void AliITSVertex::GetSNR(Double_t snr[3]) const {
290 for(Int_t i=0;i<3;i++) snr[i] = fSNR[i];
294 //--------------------------------------------------------------------------
295 void AliITSVertex::PrintStatus() const {
297 // Print out information on all data members
300 printf(" ! The vertex fitting has been done in the thrust frame !\n");
301 printf(" The rotation angle is %f. Numbers are given in the rotated frame.\n",fPhi);
303 printf(" Vertex position:\n");
304 printf(" x = %f +- %f\n",fPosition[0],TMath::Sqrt(fCovXX));
305 printf(" y = %f +- %f\n",fPosition[1],TMath::Sqrt(fCovYY));
306 printf(" z = %f +- %f\n",fPosition[2],TMath::Sqrt(fCovZZ));
307 printf(" Covariance matrix:\n");
308 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);
309 printf(" S/N = (%f, %f, %f)\n",fSNR[0],fSNR[1],fSNR[2]);
310 printf(" chi2 = %f\n",fChi2);
311 printf(" # tracks (or tracklets) = %d\n",fNContributors);
313 printf(" True vertex position - for comparison: %12.10f %12.10f %12.10f\n ",fTruePos[0],fTruePos[1],fTruePos[2]);