]>
Commit | Line | Data |
---|---|---|
df9db588 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-2007, 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 | /* $Id$ */ | |
17 | ||
18 | //------------------------------------------------------------------------- | |
19 | // AOD track base class | |
20 | // Base class for Analysis Object Data | |
21 | // Generic version | |
22 | // Author: Markus Oldenburg, CERN | |
bdd011d6 | 23 | // Inheritance from AliVVertex: A. Dainese |
df9db588 | 24 | //------------------------------------------------------------------------- |
25 | ||
26 | #include "AliAODVertex.h" | |
0657f082 | 27 | #include "AliAODTrack.h" |
28 | ||
df9db588 | 29 | ClassImp(AliAODVertex) |
30 | ||
31 | //______________________________________________________________________________ | |
32 | AliAODVertex::AliAODVertex() : | |
bdd011d6 | 33 | AliVVertex(), |
0657f082 | 34 | fChi2perNDF(-999.), |
02153d58 | 35 | fID(-1), |
0e7f6e3e | 36 | fBCID(AliVTrack::kTOFBCNA), |
9333290e | 37 | fType(kUndef), |
bca58dd7 | 38 | fNprong(0), |
39 | fIprong(0), | |
d999f2e6 | 40 | fNContributors(0), |
9f7c531f | 41 | fCovMatrix(NULL), |
0f09edc3 | 42 | fParent(), |
bca58dd7 | 43 | fDaughters(), |
44 | fProngs(NULL) | |
9333290e | 45 | { |
df9db588 | 46 | // default constructor |
47 | ||
48 | fPosition[0] = fPosition[1] = fPosition[2] = -999.; | |
49 | } | |
50 | ||
51 | //______________________________________________________________________________ | |
52 | AliAODVertex::AliAODVertex(const Double_t position[3], | |
31fd97b2 | 53 | const Double_t covMatrix[6], |
0657f082 | 54 | Double_t chi2perNDF, |
df9db588 | 55 | TObject *parent, |
02153d58 | 56 | Short_t id, |
bca58dd7 | 57 | Char_t vtype, |
58 | Int_t nprong) : | |
bdd011d6 | 59 | AliVVertex(), |
0657f082 | 60 | fChi2perNDF(chi2perNDF), |
02153d58 | 61 | fID(id), |
0e7f6e3e | 62 | fBCID(AliVTrack::kTOFBCNA), |
9333290e | 63 | fType(vtype), |
bca58dd7 | 64 | fNprong(nprong), |
65 | fIprong(0), | |
d999f2e6 | 66 | fNContributors(0), |
9f7c531f | 67 | fCovMatrix(NULL), |
df9db588 | 68 | fParent(parent), |
bca58dd7 | 69 | fDaughters(), |
70 | fProngs(0) | |
df9db588 | 71 | { |
72 | // constructor | |
73 | ||
74 | SetPosition(position); | |
75 | if (covMatrix) SetCovMatrix(covMatrix); | |
bca58dd7 | 76 | MakeProngs(); |
df9db588 | 77 | } |
78 | ||
79 | //______________________________________________________________________________ | |
80 | AliAODVertex::AliAODVertex(const Float_t position[3], | |
81 | const Float_t covMatrix[6], | |
0657f082 | 82 | Double_t chi2perNDF, |
df9db588 | 83 | TObject *parent, |
02153d58 | 84 | Short_t id, |
bca58dd7 | 85 | Char_t vtype, |
86 | Int_t nprong) : | |
4d209fca | 87 | |
bdd011d6 | 88 | AliVVertex(), |
0657f082 | 89 | fChi2perNDF(chi2perNDF), |
02153d58 | 90 | fID(id), |
0e7f6e3e | 91 | fBCID(AliVTrack::kTOFBCNA), |
9333290e | 92 | fType(vtype), |
bca58dd7 | 93 | fNprong(nprong), |
94 | fIprong(0), | |
d999f2e6 | 95 | fNContributors(0), |
9f7c531f | 96 | fCovMatrix(NULL), |
df9db588 | 97 | fParent(parent), |
bca58dd7 | 98 | fDaughters(), |
99 | fProngs(0) | |
df9db588 | 100 | { |
101 | // constructor | |
102 | ||
103 | SetPosition(position); | |
104 | if (covMatrix) SetCovMatrix(covMatrix); | |
bca58dd7 | 105 | MakeProngs(); |
df9db588 | 106 | } |
107 | ||
108 | //______________________________________________________________________________ | |
109 | AliAODVertex::AliAODVertex(const Double_t position[3], | |
0657f082 | 110 | Double_t chi2perNDF, |
bca58dd7 | 111 | Char_t vtype, |
112 | Int_t nprong) : | |
bdd011d6 | 113 | AliVVertex(), |
0657f082 | 114 | fChi2perNDF(chi2perNDF), |
02153d58 | 115 | fID(-1), |
0e7f6e3e | 116 | fBCID(AliVTrack::kTOFBCNA), |
9333290e | 117 | fType(vtype), |
bca58dd7 | 118 | fNprong(nprong), |
119 | fIprong(0), | |
d999f2e6 | 120 | fNContributors(0), |
9f7c531f | 121 | fCovMatrix(NULL), |
0f09edc3 | 122 | fParent(), |
bca58dd7 | 123 | fDaughters(), |
124 | fProngs(0) | |
df9db588 | 125 | { |
126 | // constructor without covariance matrix | |
127 | ||
128 | SetPosition(position); | |
bca58dd7 | 129 | MakeProngs(); |
df9db588 | 130 | } |
131 | ||
132 | //______________________________________________________________________________ | |
133 | AliAODVertex::AliAODVertex(const Float_t position[3], | |
0657f082 | 134 | Double_t chi2perNDF, |
bca58dd7 | 135 | Char_t vtype, Int_t nprong) : |
bdd011d6 | 136 | AliVVertex(), |
0657f082 | 137 | fChi2perNDF(chi2perNDF), |
02153d58 | 138 | fID(-1), |
0e7f6e3e | 139 | fBCID(AliVTrack::kTOFBCNA), |
9333290e | 140 | fType(vtype), |
bca58dd7 | 141 | fNprong(nprong), |
142 | fIprong(0), | |
d999f2e6 | 143 | fNContributors(0), |
9f7c531f | 144 | fCovMatrix(NULL), |
0f09edc3 | 145 | fParent(), |
bca58dd7 | 146 | fDaughters(), |
147 | fProngs(0) | |
df9db588 | 148 | { |
149 | // constructor without covariance matrix | |
150 | ||
151 | SetPosition(position); | |
bca58dd7 | 152 | MakeProngs(); |
df9db588 | 153 | } |
154 | ||
155 | //______________________________________________________________________________ | |
156 | AliAODVertex::~AliAODVertex() | |
157 | { | |
158 | // Destructor | |
159 | ||
160 | delete fCovMatrix; | |
bca58dd7 | 161 | if (fNprong > 0) delete[] fProngs; |
df9db588 | 162 | } |
163 | ||
164 | //______________________________________________________________________________ | |
165 | AliAODVertex::AliAODVertex(const AliAODVertex& vtx) : | |
bdd011d6 | 166 | AliVVertex(vtx), |
0657f082 | 167 | fChi2perNDF(vtx.fChi2perNDF), |
02153d58 | 168 | fID(vtx.fID), |
0249e9b8 | 169 | fBCID(vtx.fBCID), |
9333290e | 170 | fType(vtx.fType), |
bca58dd7 | 171 | fNprong(vtx.fNprong), |
172 | fIprong(vtx.fIprong), | |
d999f2e6 | 173 | fNContributors(vtx.fNContributors), |
9f7c531f | 174 | fCovMatrix(NULL), |
df9db588 | 175 | fParent(vtx.fParent), |
bca58dd7 | 176 | fDaughters(vtx.fDaughters), |
177 | fProngs(0) | |
df9db588 | 178 | { |
179 | // Copy constructor. | |
180 | ||
181 | for (int i = 0; i < 3; i++) | |
182 | fPosition[i] = vtx.fPosition[i]; | |
183 | ||
5d62ce04 | 184 | if (vtx.fCovMatrix) fCovMatrix=new AliAODRedCov<3>(*vtx.fCovMatrix); |
bca58dd7 | 185 | MakeProngs(); |
186 | for (int i = 0; i < fNprong; i++) { | |
187 | fProngs[i] = vtx.fProngs[i]; | |
188 | } | |
df9db588 | 189 | } |
190 | ||
26ba01d4 | 191 | //______________________________________________________________________________ |
192 | AliAODVertex* AliAODVertex::CloneWithoutRefs() const | |
193 | { | |
194 | // Special method to copy all but the refs | |
195 | ||
196 | Double_t cov[6] = { 0.0 }; | |
197 | ||
198 | if (fCovMatrix) fCovMatrix->GetCovMatrix(cov); | |
199 | ||
200 | AliAODVertex* v = new AliAODVertex(fPosition, | |
201 | cov, | |
202 | fChi2perNDF, | |
203 | 0x0, | |
204 | fID, | |
205 | fType, | |
206 | 0); | |
207 | ||
208 | v->SetNContributors(fNContributors); | |
209 | ||
210 | return v; | |
211 | } | |
212 | ||
df9db588 | 213 | //______________________________________________________________________________ |
214 | AliAODVertex& AliAODVertex::operator=(const AliAODVertex& vtx) | |
215 | { | |
216 | // Assignment operator | |
217 | if (this != &vtx) { | |
218 | ||
219 | // name and type | |
bdd011d6 | 220 | AliVVertex::operator=(vtx); |
df9db588 | 221 | |
222 | //momentum | |
223 | for (int i = 0; i < 3; i++) | |
921c078c | 224 | fPosition[i] = vtx.fPosition[i]; |
df9db588 | 225 | |
0657f082 | 226 | fChi2perNDF = vtx.fChi2perNDF; |
921c078c | 227 | fID = vtx.fID; |
9333290e | 228 | fType = vtx.fType; |
921c078c | 229 | fBCID = vtx.fBCID; |
230 | ||
df9db588 | 231 | //covariance matrix |
232 | delete fCovMatrix; | |
9f7c531f | 233 | fCovMatrix = NULL; |
921c078c | 234 | if (vtx.fCovMatrix) fCovMatrix = new AliAODRedCov<3>(*vtx.fCovMatrix); |
df9db588 | 235 | |
236 | //other stuff | |
921c078c | 237 | fNContributors = vtx.fNContributors; |
238 | fParent = vtx.fParent; | |
239 | fDaughters = vtx.fDaughters; | |
240 | fNprong = vtx.fNprong; | |
241 | fIprong = vtx.fIprong; | |
242 | ||
bca58dd7 | 243 | MakeProngs(); |
244 | for (int i = 0; i < fNprong; i++) { | |
245 | fProngs[i] = vtx.fProngs[i]; | |
246 | } | |
df9db588 | 247 | } |
248 | ||
249 | return *this; | |
250 | } | |
251 | ||
cfa5b70c | 252 | //______________________________________________________________________________ |
253 | void AliAODVertex::AddDaughter(TObject *daughter) | |
254 | { | |
255 | // Add reference to daughter track | |
bca58dd7 | 256 | if (!fProngs) { |
257 | if (fDaughters.GetEntries()==0) { | |
258 | TRefArray* arr = &fDaughters; | |
259 | new(arr)TRefArray(TProcessID::GetProcessWithUID(daughter)); | |
260 | } | |
261 | fDaughters.Add(daughter); | |
262 | } else { | |
263 | if (fIprong < fNprong) { | |
264 | fProngs[fIprong++] = daughter; | |
265 | } else { | |
266 | AliWarning("Number of daughters out of range !\n"); | |
267 | } | |
268 | } | |
cfa5b70c | 269 | return; |
270 | } | |
271 | ||
bca58dd7 | 272 | |
df9db588 | 273 | //______________________________________________________________________________ |
274 | template <class T> void AliAODVertex::GetSigmaXYZ(T sigma[3]) const | |
275 | { | |
276 | // Return errors on vertex position in thrust frame | |
277 | ||
278 | if(fCovMatrix) { | |
279 | sigma[0]=fCovMatrix[3]; //GetCovXZ | |
280 | sigma[1]=fCovMatrix[4]; //GetCovYZ | |
281 | sigma[2]=fCovMatrix[5]; //GetCovZZ | |
282 | } else | |
283 | sigma[0]=sigma[1]=sigma[2]=-999.; | |
284 | ||
285 | /* | |
286 | for (int i = 0, j = 6; i < 3; i++) { | |
287 | j -= i+1; | |
288 | sigma[2-i] = fCovMatrix ? TMath::Sqrt(fCovMatrix[j]) : -999.; | |
289 | } | |
290 | */ | |
291 | } | |
292 | ||
0657f082 | 293 | //______________________________________________________________________________ |
294 | Int_t AliAODVertex::GetNContributors() const | |
295 | { | |
296 | // Returns the number of tracks used to fit this vertex. | |
8b5318b9 | 297 | Int_t cont = 0; |
0657f082 | 298 | |
1c1c7167 | 299 | TString vtitle = GetTitle(); |
d87a807e | 300 | if (!vtitle.Contains("VertexerTracks") || vtitle.Contains("TracksNoConstraint") || fType==kPileupTracks |
301 | ) { | |
91bad62d | 302 | cont = fNContributors; |
19d55689 | 303 | } else { |
304 | for (Int_t iDaug = 0; iDaug < GetNDaughters(); iDaug++) { | |
8b5318b9 | 305 | AliAODTrack* aodT = dynamic_cast<AliAODTrack*>(fDaughters.At(iDaug)); |
306 | if (!aodT) continue; | |
307 | if (aodT->GetUsedForPrimVtxFit()) cont++; | |
308 | } | |
bee8cd19 | 309 | // the constraint adds another DOF |
310 | if(vtitle.Contains("VertexerTracksWithConstraint"))cont++; | |
311 | } | |
0657f082 | 312 | return cont; |
313 | } | |
314 | ||
df9db588 | 315 | //______________________________________________________________________________ |
316 | Bool_t AliAODVertex::HasDaughter(TObject *daughter) const | |
317 | { | |
318 | // Checks if the given daughter (particle) is part of this vertex. | |
bca58dd7 | 319 | if (!fProngs) { |
320 | TRefArrayIter iter(&fDaughters); | |
321 | while (TObject *daugh = iter.Next()) { | |
322 | if (daugh == daughter) return kTRUE; | |
323 | } | |
324 | return kFALSE; | |
325 | } else { | |
326 | Bool_t has = kFALSE; | |
5c2137c1 | 327 | for (int i = 0; i < fNprong; i++) { |
bca58dd7 | 328 | if (fProngs[i].GetObject() == daughter) has = kTRUE; |
329 | } | |
330 | return has; | |
331 | } | |
df9db588 | 332 | } |
333 | ||
334 | //______________________________________________________________________________ | |
335 | Double_t AliAODVertex::RotatedCovMatrixXX(Double_t phi, Double_t theta) const | |
336 | { | |
337 | // XX term of covariance matrix after rotation by phi around z-axis | |
338 | // and, then, by theta around new y-axis | |
339 | ||
340 | if (!fCovMatrix) { | |
341 | //AliFatal("Covariance matrix not set"); | |
342 | return -999.; | |
343 | } | |
344 | ||
345 | Double_t covMatrix[6]; | |
346 | ||
347 | GetCovMatrix(covMatrix); | |
348 | ||
349 | Double_t cp = TMath::Cos(phi); | |
350 | Double_t sp = TMath::Sin(phi); | |
351 | Double_t ct = TMath::Cos(theta); | |
352 | Double_t st = TMath::Sin(theta); | |
353 | return | |
354 | covMatrix[0]*cp*cp*ct*ct // GetCovXX | |
355 | +covMatrix[1]*2.*cp*sp*ct*ct // GetCovXY | |
356 | +covMatrix[3]*2.*cp*ct*st // GetCovXZ | |
357 | +covMatrix[2]*sp*sp*ct*ct // GetCovYY | |
358 | +covMatrix[4]*2.*sp*ct*st // GetCovYZ | |
359 | +covMatrix[5]*st*st; // GetCovZZ | |
360 | } | |
361 | ||
362 | //______________________________________________________________________________ | |
363 | Double_t AliAODVertex::RotatedCovMatrixXY(Double_t phi, Double_t theta) const | |
364 | { | |
365 | // XY term of covariance matrix after rotation by phi around z-axis | |
366 | // and, then, by theta around new y-axis | |
367 | ||
368 | if (!fCovMatrix) { | |
369 | //AliFatal("Covariance matrix not set"); | |
370 | return -999.; | |
371 | } | |
372 | ||
373 | Double_t covMatrix[6]; | |
374 | ||
375 | GetCovMatrix(covMatrix); | |
376 | ||
377 | Double_t cp = TMath::Cos(phi); | |
378 | Double_t sp = TMath::Sin(phi); | |
379 | Double_t ct = TMath::Cos(theta); | |
380 | Double_t st = TMath::Sin(theta); | |
381 | return | |
382 | -covMatrix[0]*cp*sp*ct // GetCovXX | |
383 | +covMatrix[1]*ct*(cp*cp-sp*sp) // GetCovXY | |
384 | -covMatrix[3]*sp*st // GetCovXZ | |
385 | +covMatrix[2]*cp*sp*ct // GetCovYY | |
386 | +covMatrix[4]*cp*st; // GetCovYZ | |
387 | } | |
388 | ||
389 | //______________________________________________________________________________ | |
390 | Double_t AliAODVertex::RotatedCovMatrixXZ(Double_t phi, Double_t theta) const | |
391 | { | |
392 | // XZ term of covariance matrix after rotation by phi around z-axis | |
393 | // and, then, by theta around new y-axis | |
394 | ||
395 | if (!fCovMatrix) { | |
396 | //AliFatal("Covariance matrix not set"); | |
397 | return -999.; | |
398 | } | |
399 | ||
400 | Double_t covMatrix[6]; | |
401 | ||
402 | GetCovMatrix(covMatrix); | |
403 | ||
404 | Double_t cp = TMath::Cos(phi); | |
405 | Double_t sp = TMath::Sin(phi); | |
406 | Double_t ct = TMath::Cos(theta); | |
407 | Double_t st = TMath::Sin(theta); | |
408 | return | |
409 | -covMatrix[0]*cp*cp*ct*st // GetCovXX | |
410 | -covMatrix[1]*2.*cp*sp*ct*st // GetCovXY | |
411 | +covMatrix[3]*cp*(ct*ct-st*st) // GetCovXZ | |
412 | -covMatrix[2]*sp*sp*ct*st // GetCovYY | |
413 | +covMatrix[4]*sp*(ct*ct-st*st) // GetCovYZ | |
414 | +covMatrix[5]*ct*st; // GetCovZZ | |
415 | } | |
416 | ||
417 | //______________________________________________________________________________ | |
418 | Double_t AliAODVertex::RotatedCovMatrixYY(Double_t phi) const | |
419 | { | |
420 | // YY term of covariance matrix after rotation by phi around z-axis | |
421 | // and, then, by theta around new y-axis | |
422 | ||
423 | if (!fCovMatrix) { | |
424 | //AliFatal("Covariance matrix not set"); | |
425 | return -999.; | |
426 | } | |
427 | ||
428 | Double_t covMatrix[6]; | |
429 | ||
430 | GetCovMatrix(covMatrix); | |
431 | ||
432 | Double_t cp = TMath::Cos(phi); | |
433 | Double_t sp = TMath::Sin(phi); | |
434 | return | |
435 | covMatrix[0]*sp*sp // GetCovXX | |
436 | -covMatrix[1]*2.*cp*sp // GetCovXY | |
437 | +covMatrix[2]*cp*cp; // GetCovYY | |
438 | } | |
439 | ||
440 | //______________________________________________________________________________ | |
441 | Double_t AliAODVertex::RotatedCovMatrixYZ(Double_t phi, Double_t theta) const | |
442 | { | |
443 | // YZ term of covariance matrix after rotation by phi around z-axis | |
444 | // and, then, by theta around new y-axis | |
445 | ||
446 | if (!fCovMatrix) { | |
447 | //AliFatal("Covariance matrix not set"); | |
448 | return -999.; | |
449 | } | |
450 | ||
451 | Double_t covMatrix[6]; | |
452 | ||
453 | GetCovMatrix(covMatrix); | |
454 | ||
455 | Double_t cp = TMath::Cos(phi); | |
456 | Double_t sp = TMath::Sin(phi); | |
457 | Double_t ct = TMath::Cos(theta); | |
458 | Double_t st = TMath::Sin(theta); | |
459 | return | |
460 | covMatrix[0]*cp*sp*st // GetCovXX | |
461 | +covMatrix[1]*st*(sp*sp-cp*cp) // GetCovXY | |
462 | -covMatrix[3]*sp*ct // GetCovXZ | |
463 | -covMatrix[2]*cp*sp*st // GetCovYY | |
464 | +covMatrix[4]*cp*ct; // GetCovYZ | |
465 | } | |
466 | ||
467 | //______________________________________________________________________________ | |
468 | Double_t AliAODVertex::RotatedCovMatrixZZ(Double_t phi, Double_t theta) const | |
469 | { | |
470 | // ZZ term of covariance matrix after rotation by phi around z-axis | |
471 | // and, then, by theta around new y-axis | |
472 | ||
473 | if (!fCovMatrix) { | |
474 | //AliFatal("Covariance matrix not set"); | |
475 | return -999.; | |
476 | } | |
477 | ||
478 | Double_t covMatrix[6]; | |
479 | ||
480 | GetCovMatrix(covMatrix); | |
481 | ||
482 | Double_t cp = TMath::Cos(phi); | |
483 | Double_t sp = TMath::Sin(phi); | |
484 | Double_t ct = TMath::Cos(theta); | |
485 | Double_t st = TMath::Sin(theta); | |
486 | return | |
487 | covMatrix[0]*cp*cp*st*st // GetCovXX | |
488 | +covMatrix[1]*2.*cp*sp*st*st // GetCovXY | |
489 | -covMatrix[3]*2.*cp*ct*st // GetCovXZ | |
490 | +covMatrix[2]*sp*sp*st*st // GetCovYY | |
491 | -covMatrix[4]*2.*sp*sp*ct*st // GetCovYZ | |
492 | +covMatrix[5]*ct*ct; // GetCovZZ | |
493 | } | |
494 | ||
495 | //______________________________________________________________________________ | |
5e6a3170 | 496 | Double_t AliAODVertex::Distance2ToVertex(const AliAODVertex *vtx) const |
df9db588 | 497 | { |
498 | // distance in 3D to another AliAODVertex | |
499 | ||
500 | Double_t dx = GetX()-vtx->GetX(); | |
501 | Double_t dy = GetY()-vtx->GetY(); | |
502 | Double_t dz = GetZ()-vtx->GetZ(); | |
503 | ||
6766c805 | 504 | return dx*dx+dy*dy+dz*dz; |
df9db588 | 505 | } |
506 | ||
507 | //______________________________________________________________________________ | |
5e6a3170 | 508 | Double_t AliAODVertex::DistanceXY2ToVertex(const AliAODVertex *vtx) const |
df9db588 | 509 | { |
510 | // distance in XY to another AliAODVertex | |
511 | ||
512 | Double_t dx = GetX()-vtx->GetX(); | |
513 | Double_t dy = GetY()-vtx->GetY(); | |
514 | ||
6766c805 | 515 | return dx*dx+dy*dy; |
df9db588 | 516 | } |
517 | ||
518 | //______________________________________________________________________________ | |
6766c805 | 519 | Double_t AliAODVertex::Error2DistanceToVertex(AliAODVertex *vtx) const |
df9db588 | 520 | { |
521 | // error on the distance in 3D to another AliAODVertex | |
522 | ||
523 | Double_t phi,theta; | |
524 | PhiAndThetaToVertex(vtx,phi,theta); | |
525 | // error2 due to this vertex | |
526 | Double_t error2 = RotatedCovMatrixXX(phi,theta); | |
527 | // error2 due to vtx vertex | |
528 | Double_t error2vtx = vtx->RotatedCovMatrixXX(phi,theta); | |
529 | ||
6766c805 | 530 | return error2+error2vtx; |
df9db588 | 531 | } |
532 | ||
533 | //______________________________________________________________________________ | |
6766c805 | 534 | Double_t AliAODVertex::Error2DistanceXYToVertex(AliAODVertex *vtx) const |
df9db588 | 535 | { |
536 | // error on the distance in XY to another AliAODVertex | |
537 | ||
538 | Double_t phi,theta; | |
539 | PhiAndThetaToVertex(vtx,phi,theta); | |
540 | // error2 due to this vertex | |
541 | Double_t error2 = RotatedCovMatrixXX(phi); | |
542 | // error2 due to vtx vertex | |
543 | Double_t error2vtx = vtx->RotatedCovMatrixXX(phi); | |
544 | ||
6766c805 | 545 | return error2+error2vtx; |
df9db588 | 546 | } |
547 | ||
548 | //______________________________________________________________________________ | |
549 | template <class T, class P> | |
550 | void AliAODVertex::PhiAndThetaToVertex(AliAODVertex *vtx, P &phi, T &theta) const | |
551 | { | |
552 | // rotation angles around z-axis (phi) and around new y-axis (theta) | |
553 | // with which vtx is seen (used by RotatedCovMatrix... methods) | |
554 | ||
b1a9edc8 | 555 | phi = TMath::Pi()+TMath::ATan2(-vtx->GetY()+GetY(),-vtx->GetX()+GetX()); |
df9db588 | 556 | Double_t vtxxphi = vtx->GetX()*TMath::Cos(phi)+vtx->GetY()*TMath::Sin(phi); |
557 | Double_t xphi = GetX()*TMath::Cos(phi)+GetY()*TMath::Sin(phi); | |
558 | theta = TMath::ATan2(vtx->GetZ()-GetZ(),vtxxphi-xphi); | |
559 | } | |
560 | ||
561 | //______________________________________________________________________________ | |
562 | void AliAODVertex::PrintIndices() const | |
563 | { | |
564 | // Print indices of particles originating form this vertex | |
565 | ||
566 | TRefArrayIter iter(&fDaughters); | |
567 | while (TObject *daugh = iter.Next()) { | |
f12d42ce | 568 | printf("Particle %p originates from this vertex.\n", static_cast<void*>(daugh)); |
df9db588 | 569 | } |
570 | } | |
571 | ||
26ba01d4 | 572 | //______________________________________________________________________________ |
573 | const char* AliAODVertex::AsString() const | |
574 | { | |
575 | // Make a string describing this object | |
576 | ||
577 | TString tmp(Form("%10s pos(%7.2f,%7.2f,%7.2f)",GetTypeName((AODVtx_t)GetType()),GetX(),GetY(),GetZ())); | |
578 | ||
579 | if (GetType()==kPrimary || GetType()==kMainSPD || GetType()==kPileupSPD ) | |
580 | { | |
581 | tmp += Form(" ncontrib %d chi2/ndf %4.1f",GetNContributors(),GetChi2perNDF()); | |
582 | ||
583 | } | |
584 | ||
585 | if ( !fParent.GetObject() ) | |
586 | { | |
587 | tmp += " no parent"; | |
588 | } | |
589 | if ( fDaughters.GetEntriesFast() > 0 ) | |
590 | { | |
591 | if ( fDaughters.GetEntriesFast() == 1 ) | |
592 | { | |
593 | tmp += " origin of 1 particle"; | |
594 | } | |
595 | else | |
596 | { | |
597 | tmp += Form(" origin of %2d particles",fDaughters.GetEntriesFast()); | |
598 | } | |
599 | } | |
600 | ||
601 | return tmp.Data(); | |
602 | } | |
603 | ||
604 | //______________________________________________________________________________ | |
605 | const char* AliAODVertex::GetTypeName(AODVtx_t type) | |
606 | { | |
607 | // Return an ASCII version of type | |
608 | ||
609 | switch (type) | |
610 | { | |
611 | case kPrimary: | |
612 | return "primary"; | |
613 | break; | |
614 | case kKink: | |
615 | return "kink"; | |
616 | break; | |
617 | case kV0: | |
618 | return "v0"; | |
619 | break; | |
620 | case kCascade: | |
621 | return "cascade"; | |
622 | break; | |
623 | case kMainSPD: | |
624 | return "mainSPD"; | |
625 | break; | |
626 | case kPileupSPD: | |
627 | return "pileupSPD"; | |
628 | break; | |
629 | case kPileupTracks: | |
630 | return "pileupTRK"; | |
631 | break; | |
632 | case kMainTPC: | |
633 | return "mainTPC"; | |
634 | break; | |
635 | default: | |
636 | return "unknown"; | |
637 | break; | |
638 | }; | |
639 | } | |
640 | ||
df9db588 | 641 | //______________________________________________________________________________ |
642 | void AliAODVertex::Print(Option_t* /*option*/) const | |
643 | { | |
644 | // Print information of all data members | |
645 | ||
646 | printf("Vertex position:\n"); | |
647 | printf(" x = %f\n", fPosition[0]); | |
648 | printf(" y = %f\n", fPosition[1]); | |
649 | printf(" z = %f\n", fPosition[2]); | |
f12d42ce | 650 | printf(" parent particle: %p\n", static_cast<void*>(fParent.GetObject())); |
df9db588 | 651 | printf(" origin of %d particles\n", fDaughters.GetEntriesFast()); |
652 | printf(" vertex type %d\n", fType); | |
653 | ||
654 | /* | |
655 | if (fCovMatrix) { | |
656 | printf("Covariance matrix:\n"); | |
657 | printf(" %12.10f %12.10f %12.10f\n %12.10f %12.10f %12.10f\n %12.10f %12.10f %12.10f\n", | |
658 | fCovMatrix[0], | |
659 | fCovMatrix[1], | |
660 | fCovMatrix[3], | |
661 | fCovMatrix[1], | |
662 | fCovMatrix[2], | |
663 | fCovMatrix[4], | |
664 | fCovMatrix[3], | |
665 | fCovMatrix[4], | |
666 | fCovMatrix[5]); | |
667 | } */ | |
0657f082 | 668 | printf(" Chi^2/NDF = %f\n", fChi2perNDF); |
df9db588 | 669 | } |
670 |