1 /**************************************************************************
2 * Copyright(c) 1998-1999, 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 ----
24 //---- Root headers --------
28 //---- AliRoot headers -----
29 #include "AliITSVertex.h"
32 ClassImp(AliITSVertex)
34 //--------------------------------------------------------------------------
35 AliITSVertex::AliITSVertex() {
37 // Default Constructor, set everything to 0
59 //--------------------------------------------------------------------------
60 AliITSVertex::AliITSVertex(Double_t positionZ,Double_t sigmaZ,
61 Int_t nContributors,Char_t *vtxName) {
63 // Constructor for vertex Z from pixels
67 fPosition[2] = positionZ;
73 fCovZZ = sigmaZ*sigmaZ;
81 fNContributors = nContributors;
87 //-------------------------------------------------------------------------
88 AliITSVertex::AliITSVertex(Double_t phi,
89 Double_t position[3],Double_t covmatrix[6],
90 Double_t chi2,Int_t nContributors,Char_t *vtxName) {
92 // Constructor for vertex in 3D from tracks
94 fPosition[0] = position[0];
95 fPosition[1] = position[1];
96 fPosition[2] = position[2];
97 fCovXX = covmatrix[0];
98 fCovXY = covmatrix[1];
99 fCovYY = covmatrix[2];
100 fCovXZ = covmatrix[3];
101 fCovYZ = covmatrix[4];
102 fCovZZ = covmatrix[5];
110 fNContributors = nContributors;
116 //--------------------------------------------------------------------------
117 AliITSVertex::AliITSVertex(Double_t position[3],Double_t sigma[3],
120 // Constructor for smearing of true position
122 fPosition[0] = position[0];
123 fPosition[1] = position[1];
124 fPosition[2] = position[2];
125 fCovXX = sigma[0]*sigma[0];
127 fCovYY = sigma[1]*sigma[1];
130 fCovZZ = sigma[2]*sigma[2];
144 //--------------------------------------------------------------------------
145 AliITSVertex::AliITSVertex(Double_t position[3],Double_t sigma[3],
146 Double_t snr[3],Char_t *vtxName) {
148 // Constructor for Pb-Pb
150 fPosition[0] = position[0];
151 fPosition[1] = position[1];
152 fPosition[2] = position[2];
153 fCovXX = sigma[0]*sigma[0];
155 fCovYY = sigma[1]*sigma[1];
158 fCovZZ = sigma[2]*sigma[2];
172 //--------------------------------------------------------------------------
173 AliITSVertex::~AliITSVertex() {
175 // Default Destructor
178 //--------------------------------------------------------------------------
179 void AliITSVertex::GetXYZ(Double_t position[3]) const {
181 // Return position of the vertex in global frame
183 position[0] = fPosition[0]*TMath::Cos(fPhi)-fPosition[1]*TMath::Sin(fPhi);
184 position[1] = fPosition[0]*TMath::Sin(fPhi)+fPosition[1]*TMath::Cos(fPhi);
185 position[2] = fPosition[2];
189 //--------------------------------------------------------------------------
190 void AliITSVertex::GetXYZ_ThrustFrame(Double_t position[3]) const {
192 // Return position of the vertex in thrust frame
194 position[0] = fPosition[0];
195 position[1] = fPosition[1];
196 position[2] = fPosition[2];
200 //--------------------------------------------------------------------------
201 void AliITSVertex::GetSigmaXYZ(Double_t sigma[3]) const {
203 // Return errors on vertex position in global frame
207 sigma[0] = TMath::Sqrt(cm[0]);
208 sigma[1] = TMath::Sqrt(cm[2]);
209 sigma[2] = TMath::Sqrt(cm[5]);
213 //--------------------------------------------------------------------------
214 void AliITSVertex::GetSigmaXYZ_ThrustFrame(Double_t sigma[3]) const {
216 // Return errors on vertex position in thrust frame
218 sigma[0] = TMath::Sqrt(fCovXX);
219 sigma[1] = TMath::Sqrt(fCovYY);
220 sigma[2] = TMath::Sqrt(fCovZZ);
224 //--------------------------------------------------------------------------
225 void AliITSVertex::GetCovMatrix(Double_t covmatrix[6]) const {
227 // Return covariance matrix of the vertex
229 Double_t cPhi = TMath::Cos(fPhi);
230 Double_t sPhi = TMath::Sin(fPhi);
232 covmatrix[0] = fCovXX*cPhi*cPhi-2.*fCovXY*cPhi*sPhi+fCovYY*sPhi*sPhi;
233 covmatrix[1] = (fCovXX-fCovYY)*cPhi*sPhi+fCovXY*(cPhi*cPhi-sPhi*sPhi);
234 covmatrix[2] = fCovXX*sPhi*sPhi+2.*fCovXY*cPhi*sPhi+fCovYY*cPhi*cPhi;
235 covmatrix[3] = fCovXZ*cPhi-fCovYZ*sPhi;
236 covmatrix[4] = fCovXZ*sPhi+fCovYZ*cPhi;
237 covmatrix[5] = fCovZZ;
241 //--------------------------------------------------------------------------
242 void AliITSVertex::GetCovMatrix_ThrustFrame(Double_t covmatrix[6]) const {
244 // Return covariance matrix of the vertex
246 covmatrix[0] = fCovXX;
247 covmatrix[1] = fCovXY;
248 covmatrix[2] = fCovYY;
249 covmatrix[3] = fCovXZ;
250 covmatrix[4] = fCovYZ;
251 covmatrix[5] = fCovZZ;
255 //--------------------------------------------------------------------------
256 Double_t AliITSVertex::GetXv() const {
260 return fPosition[0]*TMath::Cos(fPhi)-fPosition[1]*TMath::Sin(fPhi);
262 //--------------------------------------------------------------------------
263 Double_t AliITSVertex::GetYv() const {
267 return fPosition[0]*TMath::Sin(fPhi)+fPosition[1]*TMath::Cos(fPhi);
269 //--------------------------------------------------------------------------
270 Double_t AliITSVertex::GetZv() const {
276 //--------------------------------------------------------------------------
277 Double_t AliITSVertex::GetXRes() const {
279 // Return error on global x
283 return TMath::Sqrt(cm[0]);
285 //--------------------------------------------------------------------------
286 Double_t AliITSVertex::GetYRes() const {
288 // Return error on global y
292 return TMath::Sqrt(cm[2]);
294 //--------------------------------------------------------------------------
295 Double_t AliITSVertex::GetZRes() const {
297 // Return error on global z
301 return TMath::Sqrt(cm[5]);
303 //--------------------------------------------------------------------------
304 void AliITSVertex::GetSNR(Double_t snr[3]) const {
308 for(Int_t i=0;i<3;i++) snr[i] = fSNR[i];
312 //--------------------------------------------------------------------------
313 void AliITSVertex::PrintStatus() const {
315 // Print out information on all data members
318 printf(" ! The vertex fitting has been done in the thrust frame !\n");
319 printf(" The rotation angle is %f. Numbers are given in the rotated frame.\n",fPhi);
321 printf(" Vertex position:\n");
322 printf(" x = %f +- %f\n",fPosition[0],TMath::Sqrt(fCovXX));
323 printf(" y = %f +- %f\n",fPosition[1],TMath::Sqrt(fCovYY));
324 printf(" z = %f +- %f\n",fPosition[2],TMath::Sqrt(fCovZZ));
325 printf(" Covariance matrix:\n");
326 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);
327 printf(" S/N = (%f, %f, %f)\n",fSNR[0],fSNR[1],fSNR[2]);
328 printf(" chi2 = %f\n",fChi2);
329 printf(" # tracks (or tracklets) = %d\n",fNContributors);