]>
Commit | Line | Data |
---|---|---|
bffc7f8c | 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 | // | |
18 | // Support class for various common operation on MFT objects | |
19 | // | |
20 | // Contact author: antonio.uras@cern.ch | |
21 | // | |
22 | //==================================================================================================================================================== | |
23 | ||
24 | #include "AliMUONTrackParam.h" | |
25 | #include "AliMUONTrackExtrap.h" | |
26 | #include "AliAODTrack.h" | |
27 | #include "AliAODDimuon.h" | |
28 | #include "TLorentzVector.h" | |
29 | #include "AliMFTConstants.h" | |
30 | #include "TDatabasePDG.h" | |
31 | #include "TMath.h" | |
32 | #include "AliLog.h" | |
19393921 | 33 | #include "TObjArray.h" |
bffc7f8c | 34 | |
35 | #include "AliMFTAnalysisTools.h" | |
36 | ||
37 | ClassImp(AliMFTAnalysisTools) | |
38 | ||
39 | //==================================================================================================================================================== | |
40 | ||
41 | Bool_t AliMFTAnalysisTools::ExtrapAODMuonToZ(AliAODTrack *muon, Double_t z, Double_t xy[2]) { | |
42 | ||
43 | if (!(muon->Pz()!=0)) return kFALSE; | |
44 | ||
45 | AliMUONTrackParam *param = new AliMUONTrackParam(); | |
46 | ||
47 | param -> SetNonBendingCoor(muon->XAtDCA()); | |
48 | param -> SetBendingCoor(muon->YAtDCA()); | |
49 | param -> SetZ(AliMFTConstants::fZEvalKinem); | |
50 | param -> SetNonBendingSlope(muon->Px()/muon->Pz()); | |
51 | param -> SetBendingSlope(muon->Py()/muon->Pz()); | |
52 | param -> SetInverseBendingMomentum( muon->Charge() * (1./muon->Pz()) / (TMath::Sqrt(1+TMath::Power(muon->Py()/muon->Pz(),2))) ); | |
53 | ||
54 | AliMUONTrackExtrap::ExtrapToZ(param, z); | |
55 | xy[0] = param->GetNonBendingCoor(); | |
56 | xy[1] = param->GetBendingCoor(); | |
57 | ||
58 | delete param; | |
59 | ||
60 | return kTRUE; | |
61 | ||
62 | } | |
63 | ||
64 | //==================================================================================================================================================== | |
65 | ||
66 | Bool_t AliMFTAnalysisTools::ExtrapAODMuonToZ(AliAODTrack *muon, Double_t z, Double_t xy[2], TLorentzVector &kinem) { | |
67 | ||
68 | if (!(muon->Pz()!=0)) return kFALSE; | |
69 | ||
70 | AliMUONTrackParam *param = new AliMUONTrackParam(); | |
71 | ||
72 | param -> SetNonBendingCoor(muon->XAtDCA()); | |
73 | param -> SetBendingCoor(muon->YAtDCA()); | |
74 | param -> SetZ(AliMFTConstants::fZEvalKinem); | |
75 | param -> SetNonBendingSlope(muon->Px()/muon->Pz()); | |
76 | param -> SetBendingSlope(muon->Py()/muon->Pz()); | |
77 | param -> SetInverseBendingMomentum( muon->Charge() * (1./muon->Pz()) / (TMath::Sqrt(1+TMath::Power(muon->Py()/muon->Pz(),2))) ); | |
78 | ||
79 | AliMUONTrackExtrap::ExtrapToZ(param, z); | |
80 | xy[0] = param->GetNonBendingCoor(); | |
81 | xy[1] = param->GetBendingCoor(); | |
82 | ||
83 | Double_t massMu = TDatabasePDG::Instance()->GetParticle("mu-")->Mass(); | |
84 | Double_t energy = TMath::Sqrt(massMu*massMu + param->Px()*param->Px() + param->Py()*param->Py() + param->Pz()*param->Pz()); | |
85 | ||
86 | kinem.SetPxPyPzE(param->Px(), param->Py(), param->Pz(), energy); | |
87 | ||
88 | delete param; | |
89 | ||
90 | return kTRUE; | |
91 | ||
92 | } | |
93 | ||
94 | //==================================================================================================================================================== | |
95 | ||
96 | Bool_t AliMFTAnalysisTools::ExtrapAODMuonToZ(AliAODTrack *muon, Double_t z, Double_t xy[2], TLorentzVector &kinem, TMatrixD &cov) { | |
97 | ||
98 | if (!(muon->Pz()!=0)) return kFALSE; | |
99 | ||
100 | AliMUONTrackParam *param = new AliMUONTrackParam(); | |
101 | ||
102 | param -> SetNonBendingCoor(muon->XAtDCA()); | |
103 | param -> SetBendingCoor(muon->YAtDCA()); | |
104 | param -> SetZ(AliMFTConstants::fZEvalKinem); | |
105 | param -> SetNonBendingSlope(muon->Px()/muon->Pz()); | |
106 | param -> SetBendingSlope(muon->Py()/muon->Pz()); | |
107 | param -> SetInverseBendingMomentum( muon->Charge() * (1./muon->Pz()) / (TMath::Sqrt(1+TMath::Power(muon->Py()/muon->Pz(),2))) ); | |
108 | ||
109 | param -> SetCovariances(ConvertCovMatrixAOD2MUON(muon)); | |
110 | ||
111 | AliMUONTrackExtrap::ExtrapToZCov(param, z); | |
112 | xy[0] = param->GetNonBendingCoor(); | |
113 | xy[1] = param->GetBendingCoor(); | |
114 | ||
115 | Double_t massMu = TDatabasePDG::Instance()->GetParticle("mu-")->Mass(); | |
116 | Double_t energy = TMath::Sqrt(massMu*massMu + param->Px()*param->Px() + param->Py()*param->Py() + param->Pz()*param->Pz()); | |
117 | ||
118 | kinem.SetPxPyPzE(param->Px(), param->Py(), param->Pz(), energy); | |
119 | ||
120 | cov = param->GetCovariances(); | |
121 | ||
122 | delete param; | |
123 | ||
124 | return kTRUE; | |
125 | ||
126 | } | |
127 | ||
128 | //==================================================================================================================================================== | |
129 | ||
130 | Double_t AliMFTAnalysisTools::GetAODMuonOffset(AliAODTrack *muon, Double_t xv, Double_t yv, Double_t zv) { | |
131 | ||
132 | Double_t xy[2] = {0}; | |
133 | ExtrapAODMuonToZ(muon, zv, xy); | |
134 | ||
135 | return TMath::Sqrt((xv-xy[0])*(xv-xy[0]) + (yv-xy[1])*(yv-xy[1])); | |
136 | ||
137 | } | |
138 | ||
139 | //==================================================================================================================================================== | |
140 | ||
141 | Double_t AliMFTAnalysisTools::GetAODMuonWeightedOffset(AliAODTrack *muon, Double_t xv, Double_t yv, Double_t zv) { | |
142 | ||
143 | Double_t xy[2] = {0}; | |
144 | TLorentzVector kinem(0,0,0,0); | |
145 | TMatrixD cov(5,5); | |
146 | ||
147 | ExtrapAODMuonToZ(muon, zv, xy, kinem, cov); | |
148 | ||
149 | TMatrixD covCoordinates(2,2); | |
150 | covCoordinates(0,0) = cov(0,0); | |
151 | covCoordinates(0,1) = cov(0,2); | |
152 | covCoordinates(1,0) = cov(2,0); | |
153 | covCoordinates(1,1) = cov(2,2); | |
154 | ||
155 | TMatrixD covCoordinatesInverse = covCoordinates.Invert(); | |
156 | ||
157 | Double_t dX = xy[0] - xv; | |
158 | Double_t dY = xy[1] - yv; | |
159 | ||
160 | Double_t weightedOffset = TMath::Sqrt(0.5*(dX*dX*covCoordinatesInverse(0,0) + | |
161 | dY*dY*covCoordinatesInverse(1,1) + | |
162 | 2.*dX*dY*covCoordinatesInverse(0,1))); | |
163 | ||
164 | return weightedOffset; | |
165 | ||
166 | } | |
167 | ||
168 | //==================================================================================================================================================== | |
169 | ||
170 | Double_t AliMFTAnalysisTools::GetPseudoProperDecayTimeXY(Double_t xVtx, Double_t yVtx, | |
171 | Double_t xDimu, Double_t yDimu, | |
172 | Double_t mDimu, Double_t ptDimu) { | |
173 | ||
174 | // pseudo-proper decay time of a particle produced in the primary vertex and decaying into a dimuon (+ X) | |
175 | // evaluated using the transverse degree of freedom of the decay topology | |
176 | ||
177 | if (ptDimu != 0) { | |
178 | Double_t decayLengthXY = TMath::Sqrt((xVtx-xDimu)*(xVtx-xDimu)+(yVtx-yDimu)*(yVtx-yDimu)); | |
179 | return (decayLengthXY * mDimu/ptDimu)/TMath::Ccgs()*1E12; // in ps | |
180 | } | |
181 | ||
182 | return -99999999; | |
183 | ||
184 | } | |
185 | ||
186 | //==================================================================================================================================================== | |
187 | ||
188 | Double_t AliMFTAnalysisTools::GetPseudoProperDecayTimeZ(Double_t zVtx, | |
189 | Double_t zDimu, | |
190 | Double_t mDimu, Double_t pzDimu) { | |
191 | ||
192 | // pseudo-proper decay time of a particle produced in the primary vertex and decaying into a dimuon (+ X) | |
193 | // evaluated using the longitudinal degree of freedom of the decay topology | |
194 | ||
195 | if (pzDimu != 0) { | |
196 | Double_t decayLengthZ = zDimu - zVtx; | |
197 | return (decayLengthZ * mDimu/pzDimu)/TMath::Ccgs()*1E12; // in ps | |
198 | } | |
199 | ||
200 | return -99999999; | |
201 | ||
202 | } | |
203 | ||
204 | //==================================================================================================================================================== | |
205 | ||
19393921 | 206 | Bool_t AliMFTAnalysisTools::CalculatePCA(AliAODDimuon *dimuon, Double_t *pca, Double_t &pcaQuality, TLorentzVector &kinem) { |
207 | ||
208 | TObjArray *muons = new TObjArray(); | |
209 | muons -> Add(dimuon->GetMu(0)); | |
210 | muons -> Add(dimuon->GetMu(1)); | |
211 | ||
212 | return CalculatePCA(muons, pca, pcaQuality, kinem); | |
213 | ||
214 | } | |
215 | ||
216 | //==================================================================================================================================================== | |
217 | ||
218 | Bool_t AliMFTAnalysisTools::CalculatePCA(TObjArray *muons, Double_t *pca, Double_t &pcaQuality, TLorentzVector &kinem) { | |
bffc7f8c | 219 | |
220 | const Int_t nMuons = muons->GetEntriesFast(); | |
221 | if (nMuons<2 || nMuons>AliMFTConstants::fNMaxMuonsForPCA) { | |
222 | printf("W-AliMFTAnalysisTools::CalculatePCA: number of muons not valid\n"); | |
223 | return kFALSE; | |
224 | } | |
225 | ||
226 | Double_t fXPointOfClosestApproach=0, fYPointOfClosestApproach=0, fZPointOfClosestApproach=0; | |
227 | ||
6ffd24bb | 228 | AliAODTrack *muon[AliMFTConstants::fNMaxMuonsForPCA] = {0}; |
229 | AliMUONTrackParam *param[AliMFTConstants::fNMaxMuonsForPCA] = {0}; | |
bffc7f8c | 230 | |
231 | // Finding AliMUONTrackParam objects for each muon | |
232 | ||
233 | for (Int_t iMu=0; iMu<nMuons; iMu++) { | |
234 | muon[iMu] = (AliAODTrack*) muons->At(iMu); | |
235 | if (TMath::Abs(muon[iMu]->Pz())<1.e-6) return kFALSE; | |
236 | param[iMu] = new AliMUONTrackParam(); | |
237 | param[iMu] -> SetNonBendingCoor(muon[iMu]->XAtDCA()); | |
238 | param[iMu] -> SetBendingCoor(muon[iMu]->YAtDCA()); | |
239 | param[iMu] -> SetZ(0.); | |
240 | param[iMu] -> SetNonBendingSlope(muon[iMu]->Px()/muon[iMu]->Pz()); | |
241 | param[iMu] -> SetBendingSlope(muon[iMu]->Py()/muon[iMu]->Pz()); | |
242 | param[iMu] -> SetInverseBendingMomentum( muon[iMu]->Charge() * (1./muon[iMu]->Pz()) / (TMath::Sqrt(1+TMath::Power(muon[iMu]->Py()/muon[iMu]->Pz(),2))) ); | |
243 | } | |
244 | ||
245 | // here we want to understand in which direction we have to search the minimum... | |
246 | ||
247 | Double_t step = 1.; // initial step, in cm | |
248 | Double_t startPoint = 0.; | |
249 | ||
250 | Double_t r[3]={0}, z[3]={startPoint, startPoint+step, startPoint+2*step}; | |
251 | ||
6ffd24bb | 252 | TVector3 **points = new TVector3*[AliMFTConstants::fNMaxMuonsForPCA]; |
bffc7f8c | 253 | |
254 | for (Int_t i=0; i<3; i++) { | |
255 | for (Int_t iMu=0; iMu<nMuons; iMu++) { | |
256 | AliMUONTrackExtrap::ExtrapToZ(param[iMu], z[i]); | |
257 | points[iMu] = new TVector3(param[iMu]->GetNonBendingCoor(),param[iMu]->GetBendingCoor(),z[i]); | |
258 | } | |
259 | r[i] = GetDistanceBetweenPoints(points,nMuons); | |
260 | } | |
261 | ||
262 | Int_t researchDirection = 0; | |
263 | ||
264 | if (r[0]>r[1] && r[1]>r[2]) researchDirection = +1; // towards z positive | |
265 | else if (r[0]<r[1] && r[1]<r[2]) researchDirection = -1; // towards z negative | |
266 | else if (r[0]<r[1] && r[1]>r[2]) { | |
267 | printf("E-AliMFTAnalysisTools::CalculatePCA: Point of closest approach cannot be found for dimuon (no minima)\n"); | |
268 | return kFALSE; | |
269 | } | |
270 | ||
271 | while (TMath::Abs(researchDirection)>0.5) { | |
272 | ||
273 | if (researchDirection>0) { | |
274 | z[0] = z[1]; | |
275 | z[1] = z[2]; | |
276 | z[2] = z[1]+researchDirection*step; | |
277 | } | |
278 | else { | |
279 | z[2] = z[1]; | |
280 | z[1] = z[0]; | |
281 | z[0] = z[1]+researchDirection*step; | |
282 | } | |
283 | if (TMath::Abs(z[0])>900.) { | |
284 | printf("E-AliMFTAnalysisTools::CalculatePCA: Point of closest approach cannot be found for dimuon (no minima in the fiducial region)\n"); | |
285 | return kFALSE; | |
286 | } | |
287 | ||
bffc7f8c | 288 | for (Int_t i=0; i<3; i++) { |
289 | for (Int_t iMu=0; iMu<nMuons; iMu++) { | |
290 | AliMUONTrackExtrap::ExtrapToZ(param[iMu], z[i]); | |
291 | points[iMu] = new TVector3(param[iMu]->GetNonBendingCoor(),param[iMu]->GetBendingCoor(),z[i]); | |
292 | } | |
293 | r[i] = GetDistanceBetweenPoints(points,nMuons); | |
294 | } | |
295 | researchDirection=0; | |
296 | if (r[0]>r[1] && r[1]>r[2]) researchDirection = +1; // towards z positive | |
297 | else if (r[0]<r[1] && r[1]<r[2]) researchDirection = -1; // towards z negative | |
298 | ||
299 | } | |
300 | ||
563c075f | 301 | // now we know that the minimum is between z[0] and z[2] and we search for it |
bffc7f8c | 302 | |
303 | step *= 0.5; | |
304 | while (step>AliMFTConstants::fPrecisionPointOfClosestApproach) { | |
305 | z[0] = z[1]-step; | |
306 | z[2] = z[1]+step; | |
307 | for (Int_t i=0; i<3; i++) { | |
308 | for (Int_t iMu=0; iMu<nMuons; iMu++) { | |
309 | AliMUONTrackExtrap::ExtrapToZ(param[iMu], z[i]); | |
310 | points[iMu] = new TVector3(param[iMu]->GetNonBendingCoor(),param[iMu]->GetBendingCoor(),z[i]); | |
311 | } | |
312 | r[i] = GetDistanceBetweenPoints(points,nMuons); | |
313 | } | |
314 | if (r[0]<r[1]) z[1] = z[0]; | |
315 | else if (r[2]<r[1]) z[1] = z[2]; | |
316 | else step *= 0.5; | |
317 | } | |
318 | ||
563c075f | 319 | // for (Int_t iMuon=0; iMuon<AliMFTConstants::fNMaxMuonsForPCA; iMuon++) if (points[iMuon]) delete points[iMuon]; |
320 | delete [] points; | |
bffc7f8c | 321 | |
322 | // Once z of minimum is found, we evaluate the x and y coordinates by averaging over the contributing tracks | |
323 | ||
324 | fZPointOfClosestApproach = z[1]; | |
325 | fXPointOfClosestApproach = 0.; | |
326 | fYPointOfClosestApproach = 0.; | |
327 | for (Int_t iMu=0; iMu<nMuons; iMu++) { | |
328 | AliMUONTrackExtrap::ExtrapToZ(param[iMu], fZPointOfClosestApproach); | |
329 | fXPointOfClosestApproach += param[iMu]->GetNonBendingCoor(); | |
330 | fYPointOfClosestApproach += param[iMu]->GetBendingCoor(); | |
331 | } | |
332 | fXPointOfClosestApproach /= Double_t(nMuons); | |
333 | fYPointOfClosestApproach /= Double_t(nMuons); | |
334 | ||
335 | pca[0] = fXPointOfClosestApproach; | |
336 | pca[1] = fYPointOfClosestApproach; | |
337 | pca[2] = fZPointOfClosestApproach; | |
338 | ||
339 | // Evaluating the kinematics of the N-muon | |
340 | ||
341 | Double_t pTot[3] = {0}; | |
342 | Double_t ene = 0.; | |
343 | Double_t massMu = TDatabasePDG::Instance()->GetParticle("mu-")->Mass(); | |
344 | for (Int_t iMu=0; iMu<nMuons; iMu++) { | |
345 | pTot[0] += param[iMu]->Px(); | |
346 | pTot[1] += param[iMu]->Py(); | |
347 | pTot[2] += param[iMu]->Pz(); | |
348 | ene += TMath::Sqrt(massMu*massMu + param[iMu]->Px()*param[iMu]->Px() + param[iMu]->Py()*param[iMu]->Py() + param[iMu]->Pz()*param[iMu]->Pz()); | |
349 | } | |
350 | ||
351 | kinem.SetPxPyPzE(pTot[0], pTot[1], pTot[2], ene); | |
352 | ||
353 | // Evaluating the PCA quality of the N-muon | |
354 | ||
355 | Double_t sum=0.,squareSum=0.; | |
356 | for (Int_t iMu=0; iMu<nMuons; iMu++) { | |
357 | Double_t wOffset = AliMFTAnalysisTools::GetAODMuonWeightedOffset(muon[iMu],fXPointOfClosestApproach, fYPointOfClosestApproach, fZPointOfClosestApproach); | |
358 | Double_t f = TMath::Exp(-0.5 * wOffset); | |
359 | sum += f; | |
360 | squareSum += f*f; | |
361 | } | |
362 | if (sum > 0.) pcaQuality = (sum-squareSum/sum) / (nMuons-1); | |
363 | else pcaQuality = 0.; | |
364 | ||
563c075f | 365 | for (Int_t iMu=0; iMu<AliMFTConstants::fNMaxMuonsForPCA; iMu++) if (param[iMu]) delete param[iMu]; |
366 | // delete param; | |
367 | ||
bffc7f8c | 368 | return kTRUE; |
369 | ||
370 | } | |
371 | ||
372 | //========================================================================================================================= | |
373 | ||
374 | Double_t AliMFTAnalysisTools::GetDistanceBetweenPoints(TVector3 **points, Int_t nPoints) { | |
375 | ||
376 | if (nPoints>AliMFTConstants::fNMaxMuonsForPCA) { | |
377 | printf("W-AliMFTAnalysisTools::GetDistanceBetweenPoints: number of points not valid\n"); | |
378 | return 1.e9; | |
379 | } | |
380 | ||
381 | if (nPoints<2) return 0.; | |
382 | if (nPoints<3) return TMath::Sqrt( (points[0]->X()-points[1]->X()) * (points[0]->X()-points[1]->X()) + | |
383 | (points[0]->Y()-points[1]->Y()) * (points[0]->Y()-points[1]->Y()) + | |
384 | (points[0]->Z()-points[1]->Z()) * (points[0]->Z()-points[1]->Z()) ); | |
385 | ||
386 | const Int_t nEdgesMax = ((AliMFTConstants::fNMaxMuonsForPCA) * (AliMFTConstants::fNMaxMuonsForPCA - 1)) / 2; | |
387 | ||
388 | Int_t startID[nEdgesMax] = {0}; | |
389 | Int_t stopID[nEdgesMax] = {0}; | |
390 | Double_t edgeLength[nEdgesMax] = {0}; | |
391 | ||
392 | Bool_t pointStatus[AliMFTConstants::fNMaxMuonsForPCA] = {0}; | |
393 | ||
394 | Int_t nEdges=0; | |
395 | for (Int_t i=0; i<nPoints-1; i++) { | |
396 | for (Int_t j=i+1; j<nPoints; j++) { | |
397 | edgeLength[nEdges] = TMath::Sqrt( (points[i]->X()-points[j]->X()) * (points[i]->X()-points[j]->X()) + | |
398 | (points[i]->Y()-points[j]->Y()) * (points[i]->Y()-points[j]->Y()) + | |
399 | (points[i]->Z()-points[j]->Z()) * (points[i]->Z()-points[j]->Z()) ); | |
400 | stopID[nEdges] = i; | |
401 | startID[nEdges] = j; | |
402 | nEdges++; | |
403 | } | |
404 | } | |
405 | ||
406 | // Order Edges | |
407 | ||
408 | Double_t min = 0; | |
409 | Int_t iMin = 0; | |
410 | ||
411 | for (Int_t iEdge=0; iEdge<nEdges-1; iEdge++) { | |
412 | min = edgeLength[iEdge]; | |
413 | iMin = iEdge; | |
414 | for (Int_t j=iEdge+1; j<nEdges; j++) { | |
415 | if (edgeLength[j]<min) { | |
416 | min = edgeLength[j]; | |
417 | iMin = j; | |
418 | } | |
419 | } | |
420 | ||
421 | if (iMin != iEdge) { | |
422 | ||
423 | Double_t edgeLengthMin = edgeLength[iMin]; | |
424 | Int_t startIDmin = startID[iMin]; | |
425 | Int_t stopIDmin = stopID[iMin]; | |
426 | ||
427 | edgeLength[iMin] = edgeLength[iEdge]; | |
428 | startID[iMin] = startID[iEdge]; | |
429 | stopID[iMin] = stopID[iEdge]; | |
430 | ||
431 | edgeLength[iEdge] = edgeLengthMin; | |
432 | startID[iEdge] = startIDmin; | |
433 | stopID[iEdge] = stopIDmin; | |
434 | ||
435 | } | |
436 | ||
437 | } | |
438 | ||
439 | // Connect | |
440 | ||
441 | Double_t length = 0.; | |
442 | for (Int_t i=0; i<nEdges; i++) { | |
443 | if (!(pointStatus[startID[i]] && pointStatus[stopID[i]])) { | |
444 | pointStatus[startID[i]] = kTRUE; | |
445 | pointStatus[stopID[i]] = kTRUE; | |
446 | length += edgeLength[i]; | |
447 | } | |
448 | } | |
449 | ||
450 | return length; | |
451 | ||
452 | } | |
453 | ||
454 | //==================================================================================================================================================== | |
455 | ||
456 | void AliMFTAnalysisTools::ConvertCovMatrixMUON2AOD(const TMatrixD& covMUON, Double_t covAOD[21]) { | |
457 | ||
458 | // Converts the cov matrix from the MUON format (TMatrixD) to the AOD one (Double_t[21]) | |
459 | // | |
460 | // Cov(x,x) ... : cv[0] | |
461 | // Cov(x,slopeX) ... : cv[1] cv[2] | |
462 | // Cov(x,y) ... : cv[3] cv[4] cv[5] | |
463 | // Cov(x,slopeY) ... : cv[6] cv[7] cv[8] cv[9] | |
464 | // Cov(x,invP_yz) ... : cv[10] cv[11] cv[12] cv[13] cv[14] | |
465 | // not-used ... : cv[15] cv[16] cv[17] cv[18] cv[19] cv[20] | |
466 | ||
467 | covAOD[0] = covMUON(0,0); | |
468 | ||
469 | covAOD[1] = covMUON(1,0); | |
470 | covAOD[2] = covMUON(1,1); | |
471 | ||
472 | covAOD[3] = covMUON(2,0); | |
473 | covAOD[4] = covMUON(2,1); | |
474 | covAOD[5] = covMUON(2,2); | |
475 | ||
476 | covAOD[6] = covMUON(3,0); | |
477 | covAOD[7] = covMUON(3,1); | |
478 | covAOD[8] = covMUON(3,2); | |
479 | covAOD[9] = covMUON(3,3); | |
480 | ||
481 | covAOD[10] = covMUON(4,0); | |
482 | covAOD[11] = covMUON(4,1); | |
483 | covAOD[12] = covMUON(4,2); | |
484 | covAOD[13] = covMUON(4,3); | |
485 | covAOD[14] = covMUON(4,4); | |
486 | ||
487 | covAOD[15] = 0; | |
488 | covAOD[16] = 0; | |
489 | covAOD[17] = 0; | |
490 | covAOD[18] = 0; | |
491 | covAOD[19] = 0; | |
492 | covAOD[20] = 0; | |
493 | ||
494 | } | |
495 | ||
496 | //==================================================================================================================================================== | |
497 | ||
498 | const TMatrixD AliMFTAnalysisTools::ConvertCovMatrixAOD2MUON(AliAODTrack *muon) { | |
499 | ||
500 | Double_t covAOD[21] = {0}; | |
501 | muon -> GetCovarianceXYZPxPyPz(covAOD); | |
502 | ||
503 | TMatrixD covMUON(5,5); | |
504 | ||
505 | covMUON(0,0) = covAOD[0]; | |
506 | ||
507 | covMUON(1,0) = covAOD[1]; | |
508 | covMUON(1,1) = covAOD[2]; | |
509 | ||
510 | covMUON(2,0) = covAOD[3]; | |
511 | covMUON(2,1) = covAOD[4]; | |
512 | covMUON(2,2) = covAOD[5]; | |
513 | ||
514 | covMUON(3,0) = covAOD[6]; | |
515 | covMUON(3,1) = covAOD[7]; | |
516 | covMUON(3,2) = covAOD[8]; | |
517 | covMUON(3,3) = covAOD[9]; | |
518 | ||
519 | covMUON(4,0) = covAOD[10]; | |
520 | covMUON(4,1) = covAOD[11]; | |
521 | covMUON(4,2) = covAOD[12]; | |
522 | covMUON(4,3) = covAOD[13]; | |
523 | covMUON(4,4) = covAOD[14]; | |
524 | ||
525 | return covMUON; | |
526 | ||
527 | } | |
528 | ||
529 | //==================================================================================================================================================== | |
530 |