]>
Commit | Line | Data |
---|---|---|
c5f0f3c1 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
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 | ||
32 | ClassImp(AliITSVertex) | |
33 | ||
c5f0f3c1 | 34 | //-------------------------------------------------------------------------- |
cd77595e | 35 | AliITSVertex::AliITSVertex() { |
c5f0f3c1 | 36 | // |
37 | // Default Constructor, set everything to 0 | |
38 | // | |
39 | fPosition[0] = 0; | |
40 | fPosition[1] = 0; | |
41 | fPosition[2] = 0; | |
42 | fCovXX = 0; | |
43 | fCovXY = 0; | |
44 | fCovYY = 0; | |
45 | fCovXZ = 0; | |
46 | fCovYZ = 0; | |
47 | fCovZZ = 0; | |
48 | ||
49 | fSNR[0] = 0; | |
50 | fSNR[1] = 0; | |
51 | fSNR[2] = 0; | |
52 | ||
53 | fPhi = 0; | |
54 | fChi2 = 0; | |
55 | fNContributors = 0; | |
56 | ||
57 | SetDebug(); | |
58 | } | |
59 | //-------------------------------------------------------------------------- | |
60 | AliITSVertex::AliITSVertex(Double_t positionZ,Double_t sigmaZ, | |
61 | Int_t nContributors,Char_t *vtxName) { | |
62 | // | |
63 | // Constructor for vertex Z from pixels | |
64 | // | |
65 | fPosition[0] = 0; | |
66 | fPosition[1] = 0; | |
67 | fPosition[2] = positionZ; | |
68 | fCovXX = 0; | |
69 | fCovXY = 0; | |
70 | fCovYY = 0; | |
71 | fCovXZ = 0; | |
72 | fCovYZ = 0; | |
73 | fCovZZ = sigmaZ*sigmaZ; | |
74 | ||
75 | fSNR[0] = 0; | |
76 | fSNR[1] = 0; | |
77 | fSNR[2] = 0; | |
78 | ||
79 | fPhi = 0; | |
80 | fChi2 = 0; | |
81 | fNContributors = nContributors; | |
82 | ||
83 | SetName(vtxName); | |
84 | ||
85 | SetDebug(); | |
86 | } | |
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) { | |
91 | // | |
92 | // Constructor for vertex in 3D from tracks | |
93 | // | |
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]; | |
103 | ||
104 | fSNR[0] = 0; | |
105 | fSNR[1] = 0; | |
106 | fSNR[2] = 0; | |
107 | ||
108 | fPhi = phi; | |
109 | fChi2 = chi2; | |
110 | fNContributors = nContributors; | |
111 | ||
112 | SetName(vtxName); | |
113 | ||
114 | SetDebug(); | |
cd77595e | 115 | } |
c5f0f3c1 | 116 | //-------------------------------------------------------------------------- |
117 | AliITSVertex::AliITSVertex(Double_t position[3],Double_t sigma[3], | |
118 | Char_t *vtxName) { | |
119 | // | |
120 | // Constructor for smearing of true position | |
121 | // | |
122 | fPosition[0] = position[0]; | |
123 | fPosition[1] = position[1]; | |
124 | fPosition[2] = position[2]; | |
125 | fCovXX = sigma[0]*sigma[0]; | |
126 | fCovXY = 0; | |
127 | fCovYY = sigma[1]*sigma[1]; | |
128 | fCovXZ = 0; | |
129 | fCovYZ = 0; | |
130 | fCovZZ = sigma[2]*sigma[2]; | |
131 | ||
132 | fSNR[0] = 0; | |
133 | fSNR[1] = 0; | |
134 | fSNR[2] = 0; | |
135 | ||
136 | fPhi = 0; | |
137 | fChi2 = 0; | |
138 | fNContributors = 0; | |
139 | ||
140 | SetName(vtxName); | |
141 | ||
142 | SetDebug(); | |
143 | } | |
144 | //-------------------------------------------------------------------------- | |
145 | AliITSVertex::AliITSVertex(Double_t position[3],Double_t sigma[3], | |
146 | Double_t snr[3],Char_t *vtxName) { | |
147 | // | |
148 | // Constructor for Pb-Pb | |
149 | // | |
150 | fPosition[0] = position[0]; | |
151 | fPosition[1] = position[1]; | |
152 | fPosition[2] = position[2]; | |
153 | fCovXX = sigma[0]*sigma[0]; | |
154 | fCovXY = 0; | |
155 | fCovYY = sigma[1]*sigma[1]; | |
156 | fCovXZ = 0; | |
157 | fCovYZ = 0; | |
158 | fCovZZ = sigma[2]*sigma[2]; | |
159 | ||
160 | fSNR[0] = snr[0]; | |
161 | fSNR[1] = snr[1]; | |
162 | fSNR[2] = snr[2]; | |
163 | ||
164 | fPhi = 0; | |
165 | fChi2 = 0; | |
166 | fNContributors = 0; | |
167 | ||
168 | SetName(vtxName); | |
169 | ||
170 | SetDebug(); | |
171 | } | |
172 | //-------------------------------------------------------------------------- | |
cd77595e | 173 | AliITSVertex::~AliITSVertex() { |
c5f0f3c1 | 174 | // |
175 | // Default Destructor | |
176 | // | |
177 | } | |
178 | //-------------------------------------------------------------------------- | |
179 | void AliITSVertex::GetXYZ(Double_t position[3]) const { | |
180 | // | |
181 | // Return position of the vertex in global frame | |
182 | // | |
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]; | |
186 | ||
187 | return; | |
188 | } | |
189 | //-------------------------------------------------------------------------- | |
190 | void AliITSVertex::GetXYZ_ThrustFrame(Double_t position[3]) const { | |
191 | // | |
192 | // Return position of the vertex in thrust frame | |
193 | // | |
194 | position[0] = fPosition[0]; | |
195 | position[1] = fPosition[1]; | |
196 | position[2] = fPosition[2]; | |
197 | ||
198 | return; | |
199 | } | |
200 | //-------------------------------------------------------------------------- | |
201 | void AliITSVertex::GetSigmaXYZ(Double_t sigma[3]) const { | |
202 | // | |
203 | // Return errors on vertex position in global frame | |
204 | // | |
205 | Double_t cm[6]; | |
206 | GetCovMatrix(cm); | |
207 | sigma[0] = TMath::Sqrt(cm[0]); | |
208 | sigma[1] = TMath::Sqrt(cm[2]); | |
209 | sigma[2] = TMath::Sqrt(cm[5]); | |
210 | ||
211 | return; | |
212 | } | |
213 | //-------------------------------------------------------------------------- | |
214 | void AliITSVertex::GetSigmaXYZ_ThrustFrame(Double_t sigma[3]) const { | |
215 | // | |
216 | // Return errors on vertex position in thrust frame | |
217 | // | |
218 | sigma[0] = TMath::Sqrt(fCovXX); | |
219 | sigma[1] = TMath::Sqrt(fCovYY); | |
220 | sigma[2] = TMath::Sqrt(fCovZZ); | |
221 | ||
222 | return; | |
cd77595e | 223 | } |
c5f0f3c1 | 224 | //-------------------------------------------------------------------------- |
225 | void AliITSVertex::GetCovMatrix(Double_t covmatrix[6]) const { | |
226 | // | |
227 | // Return covariance matrix of the vertex | |
228 | // | |
229 | Double_t cPhi = TMath::Cos(fPhi); | |
230 | Double_t sPhi = TMath::Sin(fPhi); | |
231 | ||
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; | |
238 | ||
239 | return; | |
504de69b | 240 | } |
c5f0f3c1 | 241 | //-------------------------------------------------------------------------- |
242 | void AliITSVertex::GetCovMatrix_ThrustFrame(Double_t covmatrix[6]) const { | |
243 | // | |
244 | // Return covariance matrix of the vertex | |
245 | // | |
246 | covmatrix[0] = fCovXX; | |
247 | covmatrix[1] = fCovXY; | |
248 | covmatrix[2] = fCovYY; | |
249 | covmatrix[3] = fCovXZ; | |
250 | covmatrix[4] = fCovYZ; | |
251 | covmatrix[5] = fCovZZ; | |
252 | ||
253 | return; | |
cd77595e | 254 | } |
c5f0f3c1 | 255 | //-------------------------------------------------------------------------- |
256 | Double_t AliITSVertex::GetXv() const { | |
257 | // | |
258 | // Return global x | |
259 | // | |
260 | return fPosition[0]*TMath::Cos(fPhi)-fPosition[1]*TMath::Sin(fPhi); | |
261 | } | |
262 | //-------------------------------------------------------------------------- | |
263 | Double_t AliITSVertex::GetYv() const { | |
264 | // | |
265 | // Return global y | |
266 | // | |
267 | return fPosition[0]*TMath::Sin(fPhi)+fPosition[1]*TMath::Cos(fPhi); | |
268 | } | |
269 | //-------------------------------------------------------------------------- | |
270 | Double_t AliITSVertex::GetZv() const { | |
271 | // | |
272 | // Return global z | |
273 | // | |
274 | return fPosition[2]; | |
275 | } | |
276 | //-------------------------------------------------------------------------- | |
277 | Double_t AliITSVertex::GetXRes() const { | |
278 | // | |
279 | // Return error on global x | |
280 | // | |
281 | Double_t cm[6]; | |
282 | GetCovMatrix(cm); | |
283 | return TMath::Sqrt(cm[0]); | |
284 | } | |
285 | //-------------------------------------------------------------------------- | |
286 | Double_t AliITSVertex::GetYRes() const { | |
287 | // | |
288 | // Return error on global y | |
289 | // | |
290 | Double_t cm[6]; | |
291 | GetCovMatrix(cm); | |
292 | return TMath::Sqrt(cm[2]); | |
293 | } | |
294 | //-------------------------------------------------------------------------- | |
295 | Double_t AliITSVertex::GetZRes() const { | |
296 | // | |
297 | // Return error on global z | |
298 | // | |
299 | Double_t cm[6]; | |
300 | GetCovMatrix(cm); | |
301 | return TMath::Sqrt(cm[5]); | |
302 | } | |
303 | //-------------------------------------------------------------------------- | |
304 | void AliITSVertex::GetSNR(Double_t snr[3]) const { | |
305 | // | |
306 | // Return S/N ratios | |
307 | // | |
308 | for(Int_t i=0;i<3;i++) snr[i] = fSNR[i]; | |
309 | ||
310 | return; | |
311 | } | |
312 | //-------------------------------------------------------------------------- | |
313 | void AliITSVertex::PrintStatus() const { | |
314 | // | |
315 | // Print out information on all data members | |
316 | // | |
317 | if(fPhi) { | |
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); | |
320 | } | |
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); | |
330 | ||
331 | return; | |
332 | } | |
333 | ||
334 | ||
335 | ||
6b88f180 | 336 |