]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSVertex.cxx
Transition to newIO
[u/mrichter/AliRoot.git] / ITS / AliITSVertex.cxx
CommitLineData
c5f0f3c1 1/**************************************************************************
0fc5cc25 2 * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
c5f0f3c1 3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16//-----------------------------------------------------------------
17// Implementation of the Primary Vertex class
18//
19// Origin: A.Dainese, Padova, andrea.dainese@pd.infn.it
20//-----------------------------------------------------------------
21
22//---- standard headers ----
8ba665e9 23#include "Riostream.h"
c5f0f3c1 24//---- Root headers --------
504de69b 25#include <TMath.h>
504de69b 26#include <TROOT.h>
c5f0f3c1 27#include <TNamed.h>
28//---- AliRoot headers -----
29#include "AliITSVertex.h"
504de69b 30
31
32ClassImp(AliITSVertex)
33
c5f0f3c1 34//--------------------------------------------------------------------------
cd77595e 35AliITSVertex::AliITSVertex() {
c5f0f3c1 36//
37// Default Constructor, set everything to 0
38//
0fc5cc25 39 SetToZero();
c5f0f3c1 40}
41//--------------------------------------------------------------------------
42AliITSVertex::AliITSVertex(Double_t positionZ,Double_t sigmaZ,
43 Int_t nContributors,Char_t *vtxName) {
0fc5cc25 44 //
45 // Constructor for vertex Z from pixels
46 //
c5f0f3c1 47
0fc5cc25 48 SetToZero();
c5f0f3c1 49
0fc5cc25 50 fPosition[2] = positionZ;
51 fCovZZ = sigmaZ*sigmaZ;
52 fNContributors = nContributors;
53 SetName(vtxName);
c5f0f3c1 54
c5f0f3c1 55}
56//-------------------------------------------------------------------------
57AliITSVertex::AliITSVertex(Double_t phi,
58 Double_t position[3],Double_t covmatrix[6],
59 Double_t chi2,Int_t nContributors,Char_t *vtxName) {
60//
61// Constructor for vertex in 3D from tracks
62//
0fc5cc25 63
64 SetToZero();
c5f0f3c1 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];
74
c5f0f3c1 75
76 fPhi = phi;
77 fChi2 = chi2;
78 fNContributors = nContributors;
79
80 SetName(vtxName);
81
cd77595e 82}
c5f0f3c1 83//--------------------------------------------------------------------------
84AliITSVertex::AliITSVertex(Double_t position[3],Double_t sigma[3],
85 Char_t *vtxName) {
86//
87// Constructor for smearing of true position
88//
0fc5cc25 89
90 SetToZero();
c5f0f3c1 91 fPosition[0] = position[0];
92 fPosition[1] = position[1];
93 fPosition[2] = position[2];
94 fCovXX = sigma[0]*sigma[0];
95 fCovXY = 0;
96 fCovYY = sigma[1]*sigma[1];
97 fCovXZ = 0;
98 fCovYZ = 0;
99 fCovZZ = sigma[2]*sigma[2];
100
c5f0f3c1 101
102 SetName(vtxName);
103
c5f0f3c1 104}
105//--------------------------------------------------------------------------
106AliITSVertex::AliITSVertex(Double_t position[3],Double_t sigma[3],
107 Double_t snr[3],Char_t *vtxName) {
0fc5cc25 108 //
109 // Constructor for Pb-Pb
110 //
111
112 SetToZero();
113 fPosition[0] = position[0];
114 fPosition[1] = position[1];
115 fPosition[2] = position[2];
116 fCovXX = sigma[0]*sigma[0];
117 fCovXY = 0;
118 fCovYY = sigma[1]*sigma[1];
119 fCovXZ = 0;
120 fCovYZ = 0;
121 fCovZZ = sigma[2]*sigma[2];
122
123 fSNR[0] = snr[0];
124 fSNR[1] = snr[1];
125 fSNR[2] = snr[2];
126
127 SetName(vtxName);
c5f0f3c1 128
0fc5cc25 129}
130//--------------------------------------------------------------------------
131void AliITSVertex::SetToZero() {
132 //
133 // Set some data members to 0. Used by constructors
134 //
135 for(Int_t i=0; i<3; i++){
136 fPosition[i] = 0.;
137 fTruePos[i] = 0;
138 fSNR[i] = 0.;
139 }
140 fCovXX = 0;
141 fCovXY = 0;
142 fCovYY = 0;
143 fCovXZ = 0;
144 fCovYZ = 0;
145 fCovZZ = 0;
146
147 fPhi = 0;
148 fChi2 = 0;
149 fNContributors = 0;
150
151 SetDebug();
c5f0f3c1 152}
153//--------------------------------------------------------------------------
cd77595e 154AliITSVertex::~AliITSVertex() {
c5f0f3c1 155//
156// Default Destructor
157//
0fc5cc25 158
c5f0f3c1 159}
160//--------------------------------------------------------------------------
161void AliITSVertex::GetXYZ(Double_t position[3]) const {
162//
163// Return position of the vertex in global frame
164//
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];
168
169 return;
170}
171//--------------------------------------------------------------------------
172void AliITSVertex::GetXYZ_ThrustFrame(Double_t position[3]) const {
173//
174// Return position of the vertex in thrust frame
175//
176 position[0] = fPosition[0];
177 position[1] = fPosition[1];
178 position[2] = fPosition[2];
179
180 return;
181}
182//--------------------------------------------------------------------------
183void AliITSVertex::GetSigmaXYZ(Double_t sigma[3]) const {
184//
185// Return errors on vertex position in global frame
186//
187 Double_t cm[6];
188 GetCovMatrix(cm);
189 sigma[0] = TMath::Sqrt(cm[0]);
190 sigma[1] = TMath::Sqrt(cm[2]);
191 sigma[2] = TMath::Sqrt(cm[5]);
192
193 return;
194}
195//--------------------------------------------------------------------------
196void AliITSVertex::GetSigmaXYZ_ThrustFrame(Double_t sigma[3]) const {
197//
198// Return errors on vertex position in thrust frame
199//
200 sigma[0] = TMath::Sqrt(fCovXX);
201 sigma[1] = TMath::Sqrt(fCovYY);
202 sigma[2] = TMath::Sqrt(fCovZZ);
203
204 return;
cd77595e 205}
c5f0f3c1 206//--------------------------------------------------------------------------
207void AliITSVertex::GetCovMatrix(Double_t covmatrix[6]) const {
208//
209// Return covariance matrix of the vertex
210//
211 Double_t cPhi = TMath::Cos(fPhi);
212 Double_t sPhi = TMath::Sin(fPhi);
213
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;
220
221 return;
504de69b 222}
c5f0f3c1 223//--------------------------------------------------------------------------
224void AliITSVertex::GetCovMatrix_ThrustFrame(Double_t covmatrix[6]) const {
225//
226// Return covariance matrix of the vertex
227//
228 covmatrix[0] = fCovXX;
229 covmatrix[1] = fCovXY;
230 covmatrix[2] = fCovYY;
231 covmatrix[3] = fCovXZ;
232 covmatrix[4] = fCovYZ;
233 covmatrix[5] = fCovZZ;
234
235 return;
cd77595e 236}
c5f0f3c1 237//--------------------------------------------------------------------------
238Double_t AliITSVertex::GetXv() const {
239//
240// Return global x
241//
242 return fPosition[0]*TMath::Cos(fPhi)-fPosition[1]*TMath::Sin(fPhi);
243}
244//--------------------------------------------------------------------------
245Double_t AliITSVertex::GetYv() const {
246//
247// Return global y
248//
249 return fPosition[0]*TMath::Sin(fPhi)+fPosition[1]*TMath::Cos(fPhi);
250}
251//--------------------------------------------------------------------------
252Double_t AliITSVertex::GetZv() const {
253//
254// Return global z
255//
256 return fPosition[2];
257}
258//--------------------------------------------------------------------------
259Double_t AliITSVertex::GetXRes() const {
260//
261// Return error on global x
262//
263 Double_t cm[6];
264 GetCovMatrix(cm);
265 return TMath::Sqrt(cm[0]);
266}
267//--------------------------------------------------------------------------
268Double_t AliITSVertex::GetYRes() const {
269//
270// Return error on global y
271//
272 Double_t cm[6];
273 GetCovMatrix(cm);
274 return TMath::Sqrt(cm[2]);
275}
276//--------------------------------------------------------------------------
277Double_t AliITSVertex::GetZRes() const {
278//
279// Return error on global z
280//
281 Double_t cm[6];
282 GetCovMatrix(cm);
283 return TMath::Sqrt(cm[5]);
284}
285//--------------------------------------------------------------------------
286void AliITSVertex::GetSNR(Double_t snr[3]) const {
287//
288// Return S/N ratios
289//
290 for(Int_t i=0;i<3;i++) snr[i] = fSNR[i];
291
292 return;
293}
294//--------------------------------------------------------------------------
295void AliITSVertex::PrintStatus() const {
296//
297// Print out information on all data members
298//
299 if(fPhi) {
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);
302 }
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);
312
0fc5cc25 313 printf(" True vertex position - for comparison: %12.10f %12.10f %12.10f\n ",fTruePos[0],fTruePos[1],fTruePos[2]);
314
c5f0f3c1 315 return;
316}
317
318
319
6b88f180 320