]>
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 | ||
0df1f11b | 208 | v->SetName(GetName()); |
209 | // NOTE title is not allowed to be set, as GetNContributors | |
210 | // relies on the title to use the references which are not copied here | |
211 | ||
212 | // to insure the main vertex retains the ncontributors information | |
213 | // (which is otherwise computed dynamically from | |
214 | // references to tracks, which is not kept in the returned object) | |
215 | // we set it here | |
26ba01d4 | 216 | v->SetNContributors(fNContributors); |
217 | ||
218 | return v; | |
219 | } | |
220 | ||
df9db588 | 221 | //______________________________________________________________________________ |
222 | AliAODVertex& AliAODVertex::operator=(const AliAODVertex& vtx) | |
223 | { | |
224 | // Assignment operator | |
225 | if (this != &vtx) { | |
226 | ||
227 | // name and type | |
bdd011d6 | 228 | AliVVertex::operator=(vtx); |
df9db588 | 229 | |
230 | //momentum | |
231 | for (int i = 0; i < 3; i++) | |
921c078c | 232 | fPosition[i] = vtx.fPosition[i]; |
df9db588 | 233 | |
0657f082 | 234 | fChi2perNDF = vtx.fChi2perNDF; |
921c078c | 235 | fID = vtx.fID; |
9333290e | 236 | fType = vtx.fType; |
921c078c | 237 | fBCID = vtx.fBCID; |
238 | ||
df9db588 | 239 | //covariance matrix |
240 | delete fCovMatrix; | |
9f7c531f | 241 | fCovMatrix = NULL; |
921c078c | 242 | if (vtx.fCovMatrix) fCovMatrix = new AliAODRedCov<3>(*vtx.fCovMatrix); |
df9db588 | 243 | |
244 | //other stuff | |
921c078c | 245 | fNContributors = vtx.fNContributors; |
246 | fParent = vtx.fParent; | |
247 | fDaughters = vtx.fDaughters; | |
248 | fNprong = vtx.fNprong; | |
249 | fIprong = vtx.fIprong; | |
250 | ||
bca58dd7 | 251 | MakeProngs(); |
252 | for (int i = 0; i < fNprong; i++) { | |
253 | fProngs[i] = vtx.fProngs[i]; | |
254 | } | |
df9db588 | 255 | } |
256 | ||
257 | return *this; | |
258 | } | |
259 | ||
cfa5b70c | 260 | //______________________________________________________________________________ |
261 | void AliAODVertex::AddDaughter(TObject *daughter) | |
262 | { | |
263 | // Add reference to daughter track | |
bca58dd7 | 264 | if (!fProngs) { |
265 | if (fDaughters.GetEntries()==0) { | |
266 | TRefArray* arr = &fDaughters; | |
267 | new(arr)TRefArray(TProcessID::GetProcessWithUID(daughter)); | |
268 | } | |
269 | fDaughters.Add(daughter); | |
270 | } else { | |
271 | if (fIprong < fNprong) { | |
272 | fProngs[fIprong++] = daughter; | |
273 | } else { | |
274 | AliWarning("Number of daughters out of range !\n"); | |
275 | } | |
276 | } | |
cfa5b70c | 277 | return; |
278 | } | |
279 | ||
bca58dd7 | 280 | |
df9db588 | 281 | //______________________________________________________________________________ |
282 | template <class T> void AliAODVertex::GetSigmaXYZ(T sigma[3]) const | |
283 | { | |
284 | // Return errors on vertex position in thrust frame | |
285 | ||
286 | if(fCovMatrix) { | |
287 | sigma[0]=fCovMatrix[3]; //GetCovXZ | |
288 | sigma[1]=fCovMatrix[4]; //GetCovYZ | |
289 | sigma[2]=fCovMatrix[5]; //GetCovZZ | |
290 | } else | |
291 | sigma[0]=sigma[1]=sigma[2]=-999.; | |
292 | ||
293 | /* | |
294 | for (int i = 0, j = 6; i < 3; i++) { | |
295 | j -= i+1; | |
296 | sigma[2-i] = fCovMatrix ? TMath::Sqrt(fCovMatrix[j]) : -999.; | |
297 | } | |
298 | */ | |
299 | } | |
300 | ||
0657f082 | 301 | //______________________________________________________________________________ |
302 | Int_t AliAODVertex::GetNContributors() const | |
303 | { | |
304 | // Returns the number of tracks used to fit this vertex. | |
8b5318b9 | 305 | Int_t cont = 0; |
0657f082 | 306 | |
1c1c7167 | 307 | TString vtitle = GetTitle(); |
d87a807e | 308 | if (!vtitle.Contains("VertexerTracks") || vtitle.Contains("TracksNoConstraint") || fType==kPileupTracks |
309 | ) { | |
91bad62d | 310 | cont = fNContributors; |
19d55689 | 311 | } else { |
312 | for (Int_t iDaug = 0; iDaug < GetNDaughters(); iDaug++) { | |
8b5318b9 | 313 | AliAODTrack* aodT = dynamic_cast<AliAODTrack*>(fDaughters.At(iDaug)); |
314 | if (!aodT) continue; | |
315 | if (aodT->GetUsedForPrimVtxFit()) cont++; | |
316 | } | |
bee8cd19 | 317 | // the constraint adds another DOF |
318 | if(vtitle.Contains("VertexerTracksWithConstraint"))cont++; | |
319 | } | |
0657f082 | 320 | return cont; |
321 | } | |
322 | ||
df9db588 | 323 | //______________________________________________________________________________ |
324 | Bool_t AliAODVertex::HasDaughter(TObject *daughter) const | |
325 | { | |
326 | // Checks if the given daughter (particle) is part of this vertex. | |
bca58dd7 | 327 | if (!fProngs) { |
328 | TRefArrayIter iter(&fDaughters); | |
329 | while (TObject *daugh = iter.Next()) { | |
330 | if (daugh == daughter) return kTRUE; | |
331 | } | |
332 | return kFALSE; | |
333 | } else { | |
334 | Bool_t has = kFALSE; | |
5c2137c1 | 335 | for (int i = 0; i < fNprong; i++) { |
bca58dd7 | 336 | if (fProngs[i].GetObject() == daughter) has = kTRUE; |
337 | } | |
338 | return has; | |
339 | } | |
df9db588 | 340 | } |
341 | ||
342 | //______________________________________________________________________________ | |
343 | Double_t AliAODVertex::RotatedCovMatrixXX(Double_t phi, Double_t theta) const | |
344 | { | |
345 | // XX term of covariance matrix after rotation by phi around z-axis | |
346 | // and, then, by theta around new y-axis | |
347 | ||
348 | if (!fCovMatrix) { | |
349 | //AliFatal("Covariance matrix not set"); | |
350 | return -999.; | |
351 | } | |
352 | ||
353 | Double_t covMatrix[6]; | |
354 | ||
355 | GetCovMatrix(covMatrix); | |
356 | ||
357 | Double_t cp = TMath::Cos(phi); | |
358 | Double_t sp = TMath::Sin(phi); | |
359 | Double_t ct = TMath::Cos(theta); | |
360 | Double_t st = TMath::Sin(theta); | |
361 | return | |
362 | covMatrix[0]*cp*cp*ct*ct // GetCovXX | |
363 | +covMatrix[1]*2.*cp*sp*ct*ct // GetCovXY | |
364 | +covMatrix[3]*2.*cp*ct*st // GetCovXZ | |
365 | +covMatrix[2]*sp*sp*ct*ct // GetCovYY | |
366 | +covMatrix[4]*2.*sp*ct*st // GetCovYZ | |
367 | +covMatrix[5]*st*st; // GetCovZZ | |
368 | } | |
369 | ||
370 | //______________________________________________________________________________ | |
371 | Double_t AliAODVertex::RotatedCovMatrixXY(Double_t phi, Double_t theta) const | |
372 | { | |
373 | // XY term of covariance matrix after rotation by phi around z-axis | |
374 | // and, then, by theta around new y-axis | |
375 | ||
376 | if (!fCovMatrix) { | |
377 | //AliFatal("Covariance matrix not set"); | |
378 | return -999.; | |
379 | } | |
380 | ||
381 | Double_t covMatrix[6]; | |
382 | ||
383 | GetCovMatrix(covMatrix); | |
384 | ||
385 | Double_t cp = TMath::Cos(phi); | |
386 | Double_t sp = TMath::Sin(phi); | |
387 | Double_t ct = TMath::Cos(theta); | |
388 | Double_t st = TMath::Sin(theta); | |
389 | return | |
390 | -covMatrix[0]*cp*sp*ct // GetCovXX | |
391 | +covMatrix[1]*ct*(cp*cp-sp*sp) // GetCovXY | |
392 | -covMatrix[3]*sp*st // GetCovXZ | |
393 | +covMatrix[2]*cp*sp*ct // GetCovYY | |
394 | +covMatrix[4]*cp*st; // GetCovYZ | |
395 | } | |
396 | ||
397 | //______________________________________________________________________________ | |
398 | Double_t AliAODVertex::RotatedCovMatrixXZ(Double_t phi, Double_t theta) const | |
399 | { | |
400 | // XZ term of covariance matrix after rotation by phi around z-axis | |
401 | // and, then, by theta around new y-axis | |
402 | ||
403 | if (!fCovMatrix) { | |
404 | //AliFatal("Covariance matrix not set"); | |
405 | return -999.; | |
406 | } | |
407 | ||
408 | Double_t covMatrix[6]; | |
409 | ||
410 | GetCovMatrix(covMatrix); | |
411 | ||
412 | Double_t cp = TMath::Cos(phi); | |
413 | Double_t sp = TMath::Sin(phi); | |
414 | Double_t ct = TMath::Cos(theta); | |
415 | Double_t st = TMath::Sin(theta); | |
416 | return | |
417 | -covMatrix[0]*cp*cp*ct*st // GetCovXX | |
418 | -covMatrix[1]*2.*cp*sp*ct*st // GetCovXY | |
419 | +covMatrix[3]*cp*(ct*ct-st*st) // GetCovXZ | |
420 | -covMatrix[2]*sp*sp*ct*st // GetCovYY | |
421 | +covMatrix[4]*sp*(ct*ct-st*st) // GetCovYZ | |
422 | +covMatrix[5]*ct*st; // GetCovZZ | |
423 | } | |
424 | ||
425 | //______________________________________________________________________________ | |
426 | Double_t AliAODVertex::RotatedCovMatrixYY(Double_t phi) const | |
427 | { | |
428 | // YY term of covariance matrix after rotation by phi around z-axis | |
429 | // and, then, by theta around new y-axis | |
430 | ||
431 | if (!fCovMatrix) { | |
432 | //AliFatal("Covariance matrix not set"); | |
433 | return -999.; | |
434 | } | |
435 | ||
436 | Double_t covMatrix[6]; | |
437 | ||
438 | GetCovMatrix(covMatrix); | |
439 | ||
440 | Double_t cp = TMath::Cos(phi); | |
441 | Double_t sp = TMath::Sin(phi); | |
442 | return | |
443 | covMatrix[0]*sp*sp // GetCovXX | |
444 | -covMatrix[1]*2.*cp*sp // GetCovXY | |
445 | +covMatrix[2]*cp*cp; // GetCovYY | |
446 | } | |
447 | ||
448 | //______________________________________________________________________________ | |
449 | Double_t AliAODVertex::RotatedCovMatrixYZ(Double_t phi, Double_t theta) const | |
450 | { | |
451 | // YZ term of covariance matrix after rotation by phi around z-axis | |
452 | // and, then, by theta around new y-axis | |
453 | ||
454 | if (!fCovMatrix) { | |
455 | //AliFatal("Covariance matrix not set"); | |
456 | return -999.; | |
457 | } | |
458 | ||
459 | Double_t covMatrix[6]; | |
460 | ||
461 | GetCovMatrix(covMatrix); | |
462 | ||
463 | Double_t cp = TMath::Cos(phi); | |
464 | Double_t sp = TMath::Sin(phi); | |
465 | Double_t ct = TMath::Cos(theta); | |
466 | Double_t st = TMath::Sin(theta); | |
467 | return | |
468 | covMatrix[0]*cp*sp*st // GetCovXX | |
469 | +covMatrix[1]*st*(sp*sp-cp*cp) // GetCovXY | |
470 | -covMatrix[3]*sp*ct // GetCovXZ | |
471 | -covMatrix[2]*cp*sp*st // GetCovYY | |
472 | +covMatrix[4]*cp*ct; // GetCovYZ | |
473 | } | |
474 | ||
475 | //______________________________________________________________________________ | |
476 | Double_t AliAODVertex::RotatedCovMatrixZZ(Double_t phi, Double_t theta) const | |
477 | { | |
478 | // ZZ term of covariance matrix after rotation by phi around z-axis | |
479 | // and, then, by theta around new y-axis | |
480 | ||
481 | if (!fCovMatrix) { | |
482 | //AliFatal("Covariance matrix not set"); | |
483 | return -999.; | |
484 | } | |
485 | ||
486 | Double_t covMatrix[6]; | |
487 | ||
488 | GetCovMatrix(covMatrix); | |
489 | ||
490 | Double_t cp = TMath::Cos(phi); | |
491 | Double_t sp = TMath::Sin(phi); | |
492 | Double_t ct = TMath::Cos(theta); | |
493 | Double_t st = TMath::Sin(theta); | |
494 | return | |
495 | covMatrix[0]*cp*cp*st*st // GetCovXX | |
496 | +covMatrix[1]*2.*cp*sp*st*st // GetCovXY | |
497 | -covMatrix[3]*2.*cp*ct*st // GetCovXZ | |
498 | +covMatrix[2]*sp*sp*st*st // GetCovYY | |
499 | -covMatrix[4]*2.*sp*sp*ct*st // GetCovYZ | |
500 | +covMatrix[5]*ct*ct; // GetCovZZ | |
501 | } | |
502 | ||
503 | //______________________________________________________________________________ | |
5e6a3170 | 504 | Double_t AliAODVertex::Distance2ToVertex(const AliAODVertex *vtx) const |
df9db588 | 505 | { |
506 | // distance in 3D to another AliAODVertex | |
507 | ||
508 | Double_t dx = GetX()-vtx->GetX(); | |
509 | Double_t dy = GetY()-vtx->GetY(); | |
510 | Double_t dz = GetZ()-vtx->GetZ(); | |
511 | ||
6766c805 | 512 | return dx*dx+dy*dy+dz*dz; |
df9db588 | 513 | } |
514 | ||
515 | //______________________________________________________________________________ | |
5e6a3170 | 516 | Double_t AliAODVertex::DistanceXY2ToVertex(const AliAODVertex *vtx) const |
df9db588 | 517 | { |
518 | // distance in XY to another AliAODVertex | |
519 | ||
520 | Double_t dx = GetX()-vtx->GetX(); | |
521 | Double_t dy = GetY()-vtx->GetY(); | |
522 | ||
6766c805 | 523 | return dx*dx+dy*dy; |
df9db588 | 524 | } |
525 | ||
526 | //______________________________________________________________________________ | |
6766c805 | 527 | Double_t AliAODVertex::Error2DistanceToVertex(AliAODVertex *vtx) const |
df9db588 | 528 | { |
529 | // error on the distance in 3D to another AliAODVertex | |
530 | ||
531 | Double_t phi,theta; | |
532 | PhiAndThetaToVertex(vtx,phi,theta); | |
533 | // error2 due to this vertex | |
534 | Double_t error2 = RotatedCovMatrixXX(phi,theta); | |
535 | // error2 due to vtx vertex | |
536 | Double_t error2vtx = vtx->RotatedCovMatrixXX(phi,theta); | |
537 | ||
6766c805 | 538 | return error2+error2vtx; |
df9db588 | 539 | } |
540 | ||
541 | //______________________________________________________________________________ | |
6766c805 | 542 | Double_t AliAODVertex::Error2DistanceXYToVertex(AliAODVertex *vtx) const |
df9db588 | 543 | { |
544 | // error on the distance in XY to another AliAODVertex | |
545 | ||
546 | Double_t phi,theta; | |
547 | PhiAndThetaToVertex(vtx,phi,theta); | |
548 | // error2 due to this vertex | |
549 | Double_t error2 = RotatedCovMatrixXX(phi); | |
550 | // error2 due to vtx vertex | |
551 | Double_t error2vtx = vtx->RotatedCovMatrixXX(phi); | |
552 | ||
6766c805 | 553 | return error2+error2vtx; |
df9db588 | 554 | } |
555 | ||
556 | //______________________________________________________________________________ | |
557 | template <class T, class P> | |
558 | void AliAODVertex::PhiAndThetaToVertex(AliAODVertex *vtx, P &phi, T &theta) const | |
559 | { | |
560 | // rotation angles around z-axis (phi) and around new y-axis (theta) | |
561 | // with which vtx is seen (used by RotatedCovMatrix... methods) | |
562 | ||
b1a9edc8 | 563 | phi = TMath::Pi()+TMath::ATan2(-vtx->GetY()+GetY(),-vtx->GetX()+GetX()); |
df9db588 | 564 | Double_t vtxxphi = vtx->GetX()*TMath::Cos(phi)+vtx->GetY()*TMath::Sin(phi); |
565 | Double_t xphi = GetX()*TMath::Cos(phi)+GetY()*TMath::Sin(phi); | |
566 | theta = TMath::ATan2(vtx->GetZ()-GetZ(),vtxxphi-xphi); | |
567 | } | |
568 | ||
569 | //______________________________________________________________________________ | |
570 | void AliAODVertex::PrintIndices() const | |
571 | { | |
572 | // Print indices of particles originating form this vertex | |
573 | ||
574 | TRefArrayIter iter(&fDaughters); | |
575 | while (TObject *daugh = iter.Next()) { | |
f12d42ce | 576 | printf("Particle %p originates from this vertex.\n", static_cast<void*>(daugh)); |
df9db588 | 577 | } |
578 | } | |
579 | ||
26ba01d4 | 580 | //______________________________________________________________________________ |
581 | const char* AliAODVertex::AsString() const | |
582 | { | |
583 | // Make a string describing this object | |
584 | ||
585 | TString tmp(Form("%10s pos(%7.2f,%7.2f,%7.2f)",GetTypeName((AODVtx_t)GetType()),GetX(),GetY(),GetZ())); | |
586 | ||
587 | if (GetType()==kPrimary || GetType()==kMainSPD || GetType()==kPileupSPD ) | |
588 | { | |
589 | tmp += Form(" ncontrib %d chi2/ndf %4.1f",GetNContributors(),GetChi2perNDF()); | |
590 | ||
591 | } | |
592 | ||
593 | if ( !fParent.GetObject() ) | |
594 | { | |
595 | tmp += " no parent"; | |
596 | } | |
597 | if ( fDaughters.GetEntriesFast() > 0 ) | |
598 | { | |
599 | if ( fDaughters.GetEntriesFast() == 1 ) | |
600 | { | |
601 | tmp += " origin of 1 particle"; | |
602 | } | |
603 | else | |
604 | { | |
605 | tmp += Form(" origin of %2d particles",fDaughters.GetEntriesFast()); | |
606 | } | |
607 | } | |
608 | ||
609 | return tmp.Data(); | |
610 | } | |
611 | ||
612 | //______________________________________________________________________________ | |
613 | const char* AliAODVertex::GetTypeName(AODVtx_t type) | |
614 | { | |
615 | // Return an ASCII version of type | |
616 | ||
617 | switch (type) | |
618 | { | |
619 | case kPrimary: | |
620 | return "primary"; | |
621 | break; | |
622 | case kKink: | |
623 | return "kink"; | |
624 | break; | |
625 | case kV0: | |
626 | return "v0"; | |
627 | break; | |
628 | case kCascade: | |
629 | return "cascade"; | |
630 | break; | |
631 | case kMainSPD: | |
632 | return "mainSPD"; | |
633 | break; | |
634 | case kPileupSPD: | |
635 | return "pileupSPD"; | |
636 | break; | |
637 | case kPileupTracks: | |
638 | return "pileupTRK"; | |
639 | break; | |
640 | case kMainTPC: | |
641 | return "mainTPC"; | |
642 | break; | |
643 | default: | |
644 | return "unknown"; | |
645 | break; | |
646 | }; | |
647 | } | |
648 | ||
df9db588 | 649 | //______________________________________________________________________________ |
650 | void AliAODVertex::Print(Option_t* /*option*/) const | |
651 | { | |
652 | // Print information of all data members | |
653 | ||
654 | printf("Vertex position:\n"); | |
655 | printf(" x = %f\n", fPosition[0]); | |
656 | printf(" y = %f\n", fPosition[1]); | |
657 | printf(" z = %f\n", fPosition[2]); | |
f12d42ce | 658 | printf(" parent particle: %p\n", static_cast<void*>(fParent.GetObject())); |
df9db588 | 659 | printf(" origin of %d particles\n", fDaughters.GetEntriesFast()); |
660 | printf(" vertex type %d\n", fType); | |
661 | ||
662 | /* | |
663 | if (fCovMatrix) { | |
664 | printf("Covariance matrix:\n"); | |
665 | printf(" %12.10f %12.10f %12.10f\n %12.10f %12.10f %12.10f\n %12.10f %12.10f %12.10f\n", | |
666 | fCovMatrix[0], | |
667 | fCovMatrix[1], | |
668 | fCovMatrix[3], | |
669 | fCovMatrix[1], | |
670 | fCovMatrix[2], | |
671 | fCovMatrix[4], | |
672 | fCovMatrix[3], | |
673 | fCovMatrix[4], | |
674 | fCovMatrix[5]); | |
675 | } */ | |
0657f082 | 676 | printf(" Chi^2/NDF = %f\n", fChi2perNDF); |
df9db588 | 677 | } |
678 |