Bug fix and code cleanup.
[u/mrichter/AliRoot.git] / STEER / CreateAODfromKineTree.C
CommitLineData
3a0584e6 1#if !defined(__CINT__) || defined(__MAKECINT__)
2
3#include <Riostream.h>
4#include <TFile.h>
5#include <TTree.h>
6#include <TMath.h>
7
8#include "AliRun.h"
9#include "AliRunLoader.h"
10#include "AliHeader.h"
11#include "AliStack.h"
12#include "TParticle.h"
13
14#include "AliAODEvent.h"
15#include "AliAODHeader.h"
16#include "AliAODVertex.h"
17#include "AliAODTrack.h"
18#include "AliAODCluster.h"
19
20#endif
21
22// function declarations
23void SetVertexType(TParticle *part, AliAODVertex *vertex);
24void SetChargeAndPID(Int_t pdgCode, AliAODTrack *track);
25Int_t LoopOverSecondaries(TParticle *mother);
26void CreateAODfromKineTree(const char *inFileName = "galice.root",
27 const char *outFileName = "AliAOD.root");
28
29// global variables
30AliAODEvent *aod = NULL;
31AliStack *stack = NULL;
32
33Int_t jVertices = 0;
34Int_t jTracks = 0;
35Int_t jKinks = 0;
36Int_t jV0s = 0;
37Int_t jCascades = 0;
38Int_t jMultis = 0;
39Int_t nPos = 0;
40Int_t nNeg = 0;
41
42Int_t nGamma = 0;
43Int_t nElectron = 0;
44Int_t nPositron = 0;
45Int_t nMuon = 0;
46Int_t nAntiMuon = 0;
47Int_t nProton = 0;
48Int_t nAntiProton = 0;
49Int_t nNeutron = 0;
50Int_t nAntiNeutron = 0;
51Int_t nPi0 = 0;
52Int_t nPiMinus = 0;
53Int_t nPiPlus = 0;
54Int_t nK0 = 0;
55Int_t nKPlus = 0;
56Int_t nKMinus = 0;
57
58void CreateAODfromKineTree(const char *inFileName,
59 const char *outFileName) {
60 printf("This macro works only correctly in comiled mode!\n");
61 /* This probem is due to CINT which gets confused if arrays are reused */
62
63 // create an AliAOD object
64 aod = new AliAODEvent();
65 aod->CreateStdContent();
66
67 // open the file
68 TFile *outFile = TFile::Open(outFileName, "RECREATE");
69
70 // create the tree
71 TTree *aodTree = new TTree("AOD", "AliAOD tree");
72 aodTree->Branch(aod->GetList());
73
74 AliRunLoader *runLoader;
75 delete gAlice;
76 gAlice = NULL;
77 runLoader = AliRunLoader::Open(inFileName);
78 if (!runLoader) return;
79
80 runLoader->LoadHeader();
81 runLoader->LoadKinematics();
82
83 Int_t nEvents = runLoader->GetNumberOfEvents();
84
85 // loop over events and fill them
86 for (Int_t iEvent = 0; iEvent < nEvents; ++iEvent) {
87
88 cout << "Event " << iEvent+1 << "/" << nEvents;
89 runLoader->GetEvent(iEvent);
90
91 AliHeader *aliHeader = runLoader->GetHeader();
92 stack = runLoader->Stack();
93 Int_t nTracks = stack->GetNtrack();
94 Int_t nPrims = stack->GetNprimary();
95
96 nPos = 0;
97 nNeg = 0;
98
99 nGamma = 0;
100 nElectron = 0;
101 nPositron = 0;
102 nMuon = 0;
103 nAntiMuon = 0;
104 nProton = 0;
105 nAntiProton = 0;
106 nNeutron = 0;
107 nAntiNeutron = 0;
108 nPi0 = 0;
109 nPiMinus = 0;
110 nPiPlus = 0;
111 nK0 = 0;
112 nKPlus = 0;
113 nKMinus = 0;
114
115 // create the header
116 aod->AddHeader(new AliAODHeader(aliHeader->GetRun(),
117 0, // bunchX number
118 0, // orbit number
119 nTracks,
120 nPos,
121 nNeg,
122 -999, // mag. field
123 -999., // muon mag. field
124 -999., // centrality
125 -999, // ZDCN1Energy
126 -999, // ZDCP1Energy
127 -999, // ZDCN2Energy
128 -999, // ZDCP2Energy
129 -999, // ZDCEMEnergy
130 0, // TriggerMask
131 0, // TriggerCluster
132 0)); // EventType
133
134 // Access to the header
135 AliAODHeader *header = aod->GetHeader();
136
137 // Access to the AOD container of vertices
138 TClonesArray &vertices = *(aod->GetVertices());
139 jVertices=0;
140 jKinks=0;
141 jV0s=0;
142 jCascades=0;
143 jMultis=0;
144
145 // Access to the AOD container of tracks
146 TClonesArray &tracks = *(aod->GetTracks());
147 jTracks=0;
148
149 aod->ResetStd(nTracks, 1);
150
151 Float_t p[3];
152 Float_t x[3];
153 Float_t *covTr = NULL;
154 Float_t *pid = NULL;
155 AliAODVertex *primary = NULL;
156 AliAODTrack* currTrack = NULL;
157 // track loop
158 for (Int_t iTrack = 0; iTrack < nPrims; ++iTrack) {
159
160 TParticle *part = stack->Particle(iTrack);
161
162 //if (part->IsPrimary()) { // this will exclude 'funny' primaries, too
163 if (kTRUE) { // this won't
164 p[0] = part->Px(); p[1] = part->Py(); p[2] = part->Pz();
165 x[0] = part->Vx(); x[1] = part->Vy(); x[2] = part->Vz();
166
167 if (iTrack == 0) {
168 // add primary vertex
169 primary = new(vertices[jVertices++])
170 AliAODVertex(x, NULL, -999., NULL, AliAODVertex::kPrimary);
171 }
172
173 // add primary tracks
174 primary->AddDaughter(new(tracks[jTracks++]) AliAODTrack(0, // ID,
175 0, // Label
176 p,
177 kTRUE,
178 x,
179 kFALSE,
180 covTr,
181 (Short_t)-99,
182 0, // no ITSClusterMap
183 pid,
184 primary,
185 kFALSE, // no fit preformed
186 AliAODTrack::kPrimary));
187 currTrack = (AliAODTrack*)tracks.Last();
188 SetChargeAndPID(part->GetPdgCode(), currTrack);
189 if (currTrack->Charge() != -99) {
190 if (currTrack->Charge() > 0) {
191 nPos++;
192 } else if (currTrack->Charge() < 0) {
193 nNeg++;
194 }
195 }
196
197 LoopOverSecondaries(part);
198 }
199 } // end of track loop
200
201 header->SetRefMultiplicityPos(nPos);
202 header->SetRefMultiplicityNeg(nNeg);
203
204 cout << ":: primaries: " << nPrims << " secondaries: " << tracks.GetEntriesFast()-nPrims <<
205 " (pos: " << nPos << ", neg: " << nNeg << "), vertices: " << vertices.GetEntriesFast() <<
206 " (kinks: " << jKinks << ", V0: " << jV0s << ", cascades: " << jCascades <<
207 ", multi: " << jMultis << ")" << endl;
208 /*
209 cout << " gamma: " << nGamma << " e-: " << nElectron << " e+: " << nPositron << " p: " << nProton <<
210 " pBar: " << nAntiProton << " n: " << nNeutron << " nBar: " << nAntiNeutron << " pi0: " << nPi0 <<
211 " pi+: " << nPiPlus << " pi-: " << nPiMinus << " K0: " << nK0 << " K+: " << nKPlus <<
212 " K-: " << nKMinus << endl;
213 */
214 // fill the tree for this event
215 aodTree->Fill();
216 } // end of event loop
217
218 aodTree->GetUserInfo()->Add(aod);
219
220 // write the tree to the specified file
221 outFile = aodTree->GetCurrentFile();
222 outFile->cd();
223 aodTree->Write();
224 outFile->Close();
225
226}
227
228
229Int_t LoopOverSecondaries(TParticle *mother) {
230
231 if (mother->GetNDaughters() > 0) {
232
233 TClonesArray &vertices = *(aod->GetVertices());
234 TClonesArray &tracks = *(aod->GetTracks());
235
236 Float_t pSec[3];
237 Float_t xSec[3];
238 Float_t *covSec = NULL;
239 Float_t *pidSec = NULL;
240 AliAODVertex *secondary = NULL;
241 AliAODTrack* currTrackSec = NULL;
242
243 for (Int_t iDaughter = mother->GetFirstDaughter(); iDaughter <= mother->GetLastDaughter(); iDaughter++) {
244 TParticle *partSec = stack->Particle(iDaughter);
245
246 pSec[0] = partSec->Px(); pSec[1] = partSec->Py(); pSec[2] = partSec->Pz();
247 xSec[0] = partSec->Vx(); xSec[1] = partSec->Vy(); xSec[2] = partSec->Vz();
248
249 if (iDaughter == mother->GetFirstDaughter()) {
250 // add secondary vertex
251 secondary = new(vertices[jVertices++])
252 AliAODVertex(xSec, NULL, -999., tracks.Last(), AliAODVertex::kUndef);
253
254 SetVertexType(partSec, secondary);
255 }
256
257 // add secondary tracks
258 secondary->AddDaughter(new(tracks[jTracks++]) AliAODTrack(0, // ID
259 0, // label
260 pSec,
261 kTRUE,
262 xSec,
263 kFALSE,
264 covSec,
265 (Short_t)-99,
266 0, // no cluster map available
267 pidSec,
268 secondary,
269 kFALSE, // no fit performed
270 AliAODTrack::kSecondary));
271
272 currTrackSec = (AliAODTrack*)tracks.Last();
273 SetChargeAndPID(partSec->GetPdgCode(), currTrackSec);
274 if (currTrackSec->Charge() != -99) {
275 if (currTrackSec->Charge() > 0) {
276 nPos++;
277 } else if (currTrackSec->Charge() < 0) {
278 nNeg++;
279 }
280 }
281
282 LoopOverSecondaries(partSec);
283 }
284 return 1;
285 } else {
286 return 0;
287 }
288}
289
290
291void SetChargeAndPID(Int_t pdgCode, AliAODTrack *track) {
292
293 Float_t PID[10] = {0., 0., 0., 0., 0., 0., 0., 0., 0., 0.};
294
295 switch (pdgCode) {
2ca95bbe 296
3a0584e6 297 case 22: // gamma
298 track->SetCharge(0);
2ca95bbe 299 PID[AliAODTrack::kUnknown] = 1.;
3a0584e6 300 track->SetPID(PID);
301 nGamma++;
302 break;
303
2ca95bbe 304 case 11: // e-
3a0584e6 305 track->SetCharge(-1);
2ca95bbe 306 PID[AliAODTrack::kElectron] = 1.;
3a0584e6 307 track->SetPID(PID);
308 nElectron++;
309 break;
310
2ca95bbe 311 case -11: // e+
3a0584e6 312 track->SetCharge(+1);
2ca95bbe 313 PID[AliAODTrack::kElectron] = 1.;
3a0584e6 314 track->SetPID(PID);
315 nPositron++;
316 break;
317
2ca95bbe 318 case 13: // mu-
3a0584e6 319 track->SetCharge(-1);
2ca95bbe 320 PID[AliAODTrack::kMuon] = 1.;
3a0584e6 321 track->SetPID(PID);
322 nMuon++;
323 break;
324
2ca95bbe 325 case -13: // mu+
3a0584e6 326 track->SetCharge(+1);
2ca95bbe 327 PID[AliAODTrack::kMuon] = 1.;
3a0584e6 328 track->SetPID(PID);
329 nAntiMuon++;
330 break;
331
332 case 111: // pi0
333 track->SetCharge(0);
2ca95bbe 334 PID[AliAODTrack::kUnknown] = 1.;
3a0584e6 335 track->SetPID(PID);
336 nPi0++;
337 break;
338
339 case 211: // pi+
340 track->SetCharge(+1);
2ca95bbe 341 PID[AliAODTrack::kPion] = 1.;
3a0584e6 342 track->SetPID(PID);
343 nPiPlus++;
344 break;
345
346 case -211: // pi-
347 track->SetCharge(-1);
2ca95bbe 348 PID[AliAODTrack::kPion] = 1.;
3a0584e6 349 track->SetPID(PID);
350 nPiMinus++;
351 break;
352
353 case 130: // K0L
354 track->SetCharge(0);
2ca95bbe 355 PID[AliAODTrack::kUnknown] = 1.;
3a0584e6 356 track->SetPID(PID);
357 nK0++;
358 break;
359
360 case 321: // K+
361 track->SetCharge(+1);
2ca95bbe 362 PID[AliAODTrack::kKaon] = 1.;
3a0584e6 363 track->SetPID(PID);
364 nKPlus++;
365 break;
366
367 case -321: // K-
368 track->SetCharge(-1);
2ca95bbe 369 PID[AliAODTrack::kKaon] = 1.;
3a0584e6 370 track->SetPID(PID);
371 nKMinus++;
372 break;
373
2ca95bbe 374 case 2112: // n
3a0584e6 375 track->SetCharge(0);
2ca95bbe 376 PID[AliAODTrack::kUnknown] = 1.;
3a0584e6 377 track->SetPID(PID);
378 nNeutron++;
379 break;
380
381 case 2212: // p
382 track->SetCharge(+1);
2ca95bbe 383 PID[AliAODTrack::kProton] = 1.;
3a0584e6 384 track->SetPID(PID);
385 nProton++;
386 break;
387
388 case -2212: // anti-p
389 track->SetCharge(-1);
2ca95bbe 390 PID[AliAODTrack::kProton] = 1.;
3a0584e6 391 track->SetPID(PID);
392 nAntiProton++;
393 break;
394
395 case 310: // K0S
396 track->SetCharge(0);
2ca95bbe 397 PID[AliAODTrack::kUnknown] = 1.;
398 track->SetPID(PID);
399 nK0++;
400 break;
401
402 case 311: // K0
403 track->SetCharge(0);
404 PID[AliAODTrack::kUnknown] = 1.;
405 track->SetPID(PID);
406 nK0++;
407 break;
408
409 case -311: // anti-K0
410 track->SetCharge(0);
411 PID[AliAODTrack::kUnknown] = 1.;
3a0584e6 412 track->SetPID(PID);
413 nK0++;
414 break;
415
416 case 221: // eta
417 track->SetCharge(0);
2ca95bbe 418 PID[AliAODTrack::kUnknown] = 1.;
419 track->SetPID(PID);
3a0584e6 420 break;
421
422 case 3122: // lambda
423 track->SetCharge(0);
2ca95bbe 424 PID[AliAODTrack::kUnknown] = 1.;
425 track->SetPID(PID);
3a0584e6 426 break;
427
428 case 3222: // Sigma+
429 track->SetCharge(+1);
2ca95bbe 430 PID[AliAODTrack::kUnknown] = 1.;
431 track->SetPID(PID);
3a0584e6 432 break;
433
434 case 3212: // Sigma0
435 track->SetCharge(-1);
2ca95bbe 436 PID[AliAODTrack::kUnknown] = 1.;
437 track->SetPID(PID);
3a0584e6 438 break;
439
440 case 3112: // Sigma-
441 track->SetCharge(-1);
2ca95bbe 442 PID[AliAODTrack::kUnknown] = 1.;
443 track->SetPID(PID);
3a0584e6 444 break;
445
446 case 3322: // Xi0
447 track->SetCharge(0);
2ca95bbe 448 PID[AliAODTrack::kUnknown] = 1.;
449 track->SetPID(PID);
3a0584e6 450 break;
451
452 case 3312: // Xi-
453 track->SetCharge(-1);
2ca95bbe 454 PID[AliAODTrack::kUnknown] = 1.;
455 track->SetPID(PID);
3a0584e6 456 break;
457
2ca95bbe 458 case 3334: // Omega-
3a0584e6 459 track->SetCharge(-1);
2ca95bbe 460 PID[AliAODTrack::kUnknown] = 1.;
461 track->SetPID(PID);
3a0584e6 462 break;
463
464 case -2112: // n-bar
465 track->SetCharge(0);
2ca95bbe 466 PID[AliAODTrack::kUnknown] = 1.;
467 track->SetPID(PID);
3a0584e6 468 break;
469
470 case -3122: // anti-Lambda
471 track->SetCharge(0);
2ca95bbe 472 PID[AliAODTrack::kUnknown] = 1.;
473 track->SetPID(PID);
3a0584e6 474 break;
475
476 case -3222: // anti-Sigma-
477 track->SetCharge(-1);
2ca95bbe 478 PID[AliAODTrack::kUnknown] = 1.;
479 track->SetPID(PID);
3a0584e6 480 break;
481
482 case -3212: // anti-Sigma0
483 track->SetCharge(0);
2ca95bbe 484 PID[AliAODTrack::kUnknown] = 1.;
485 track->SetPID(PID);
3a0584e6 486 break;
487
488 case -3112: // anti-Sigma+
489 track->SetCharge(+1);
2ca95bbe 490 PID[AliAODTrack::kUnknown] = 1.;
491 track->SetPID(PID);
3a0584e6 492 break;
493
494 case -3322: // anti-Xi0
495 track->SetCharge(0);
2ca95bbe 496 PID[AliAODTrack::kUnknown] = 1.;
497 track->SetPID(PID);
3a0584e6 498 break;
499
500 case -3312: // anti-Xi+
501 track->SetCharge(+1);
502 break;
503
2ca95bbe 504 case -3334: // anti-Omega+
3a0584e6 505 track->SetCharge(+1);
2ca95bbe 506 PID[AliAODTrack::kUnknown] = 1.;
507 track->SetPID(PID);
3a0584e6 508 break;
509
510 case 411: // D+
511 track->SetCharge(+1);
2ca95bbe 512 PID[AliAODTrack::kUnknown] = 1.;
513 track->SetPID(PID);
3a0584e6 514 break;
515
516 case -411: // D-
517 track->SetCharge(-1);
2ca95bbe 518 PID[AliAODTrack::kUnknown] = 1.;
519 track->SetPID(PID);
3a0584e6 520 break;
521
522 case 421: // D0
523 track->SetCharge(0);
2ca95bbe 524 PID[AliAODTrack::kUnknown] = 1.;
525 track->SetPID(PID);
3a0584e6 526 break;
527
528 case -421: // anti-D0
529 track->SetCharge(0);
2ca95bbe 530 PID[AliAODTrack::kUnknown] = 1.;
531 track->SetPID(PID);
3a0584e6 532 break;
533
534 default : // unknown
535 track->SetCharge(-99);
2ca95bbe 536 PID[AliAODTrack::kUnknown] = 1.;
537 track->SetPID(PID);
538 }
3a0584e6 539
540 return;
541}
542
543
544void SetVertexType(TParticle *part, AliAODVertex *vertex) {
545 // this whole thing doesn't make much sense. but anyhow...
546
547 TParticle *mother = stack->Particle(part->GetFirstMother());
548 Int_t pdgMother = mother->GetPdgCode();
549 Int_t pdgPart = part->GetPdgCode();
550
551 // kinks
552 if (mother->GetNDaughters() == 2) {
553 Int_t firstPdgCode = stack->Particle(mother->GetFirstDaughter())->GetPdgCode();
554 Int_t lastPdgCode = stack->Particle(mother->GetLastDaughter())->GetPdgCode();
555
556 if (!(pdgMother == 22 || pdgMother == 111 || pdgMother == 130 ||
2ca95bbe 557 TMath::Abs(pdgMother) == 2112 || pdgMother == 310 || pdgMother == 221 ||
3a0584e6 558 TMath::Abs(pdgMother) == 3122 || TMath::Abs(pdgMother) == 3322 ||
2ca95bbe 559 pdgMother == -3212 || TMath::Abs(pdgMother) == 421 ||
560 TMath::Abs(pdgMother) == 311) // not neutral
3a0584e6 561 && (((firstPdgCode == 22 || firstPdgCode == 111 || firstPdgCode == 130 ||
2ca95bbe 562 TMath::Abs(firstPdgCode) == 2112 || firstPdgCode == 310 ||
3a0584e6 563 firstPdgCode == 221 || TMath::Abs(firstPdgCode) == 3122 ||
564 TMath::Abs(firstPdgCode) == 3322 || firstPdgCode == -3212 ||
2ca95bbe 565 TMath::Abs(firstPdgCode) == 421 || TMath::Abs(pdgMother) == 311) // neutral
3a0584e6 566 && !(lastPdgCode == 22 || lastPdgCode == 111 || lastPdgCode == 130 ||
2ca95bbe 567 TMath::Abs(lastPdgCode) == 2112 || lastPdgCode == 310 ||
3a0584e6 568 lastPdgCode == 221 || TMath::Abs(lastPdgCode) == 3122 ||
569 TMath::Abs(lastPdgCode) == 3322 || lastPdgCode == -3212 ||
2ca95bbe 570 TMath::Abs(lastPdgCode) == 421 || TMath::Abs(pdgMother) == 311)) // not neutral
3a0584e6 571 || !((firstPdgCode == 22 || firstPdgCode == 111 || firstPdgCode == 130 ||
2ca95bbe 572 TMath::Abs(firstPdgCode) == 2112 || firstPdgCode == 310 ||
3a0584e6 573 firstPdgCode == 221 || TMath::Abs(firstPdgCode) == 3122 ||
574 TMath::Abs(firstPdgCode) == 3322 || firstPdgCode == -3212 ||
2ca95bbe 575 TMath::Abs(firstPdgCode) == 421 || TMath::Abs(pdgMother) == 311) // not neutral
3a0584e6 576 && (lastPdgCode == 22 || lastPdgCode == 111 || lastPdgCode == 130 ||
2ca95bbe 577 TMath::Abs(lastPdgCode) == 2112 || lastPdgCode == 310 ||
3a0584e6 578 lastPdgCode == 221 || TMath::Abs(lastPdgCode) == 3122 ||
579 TMath::Abs(lastPdgCode) == 3322 || lastPdgCode == -3212 ||
2ca95bbe 580 TMath::Abs(lastPdgCode) == 421 || TMath::Abs(pdgMother) == 311)))) { // neutral
3a0584e6 581
582 vertex->SetType(AliAODVertex::kKink);
583 jKinks++;
584 }
585 }
586
587 // V0
588 else if (mother->GetNDaughters() == 2) {
589 Int_t firstPdgCode = stack->Particle(mother->GetFirstDaughter())->GetPdgCode();
590 Int_t lastPdgCode = stack->Particle(mother->GetLastDaughter())->GetPdgCode();
591
592 if ((pdgMother == 22 || pdgMother == 111 || pdgMother == 130 ||
2ca95bbe 593 TMath::Abs(pdgMother) == 2112 || pdgMother == 310 ||
3a0584e6 594 pdgMother == 221 || TMath::Abs(pdgMother) == 3122 ||
595 TMath::Abs(pdgMother) == 3322 || pdgMother == -3212 ||
2ca95bbe 596 TMath::Abs(pdgMother) == 421 || TMath::Abs(pdgMother) == 311) // neutral
3a0584e6 597 && !(lastPdgCode == 22 || lastPdgCode == 111 || lastPdgCode == 130 ||
2ca95bbe 598 TMath::Abs(lastPdgCode) == 2112 || lastPdgCode == 310 ||
3a0584e6 599 lastPdgCode == 221 || TMath::Abs(lastPdgCode) == 3122 ||
600 TMath::Abs(lastPdgCode) == 3322 || lastPdgCode == -3212 ||
2ca95bbe 601 TMath::Abs(lastPdgCode) == 421 || TMath::Abs(pdgMother) == 311) // not neutral
3a0584e6 602 && !(firstPdgCode == 22 || firstPdgCode == 111 || firstPdgCode == 130 ||
2ca95bbe 603 TMath::Abs(firstPdgCode) == 2112 || firstPdgCode == 310 ||
3a0584e6 604 firstPdgCode == 221 || TMath::Abs(firstPdgCode) == 3122 ||
605 TMath::Abs(firstPdgCode) == 3322 || firstPdgCode == -3212 ||
2ca95bbe 606 TMath::Abs(firstPdgCode) == 421 || TMath::Abs(pdgMother) == 311)) { // not neutral
3a0584e6 607
608 vertex->SetType(AliAODVertex::kV0);
609 jV0s++;
610 }
611 }
612
613 // Cascade
614 else if (mother->GetNDaughters() == 2) {
615 Int_t firstPdgCode = stack->Particle(mother->GetFirstDaughter())->GetPdgCode();
616 Int_t lastPdgCode = stack->Particle(mother->GetLastDaughter())->GetPdgCode();
617
2ca95bbe 618 if ((TMath::Abs(pdgMother) == 3334 || TMath::Abs(pdgMother) == 3312 || TMath::Abs(pdgMother) == 3322) &&
3a0584e6 619 (TMath::Abs(pdgPart) == 3122 || TMath::Abs(pdgPart) == 211 || TMath::Abs(pdgPart) == 321)
620 && ((!(firstPdgCode == 22 || firstPdgCode == 111 || firstPdgCode == 130 ||
2ca95bbe 621 TMath::Abs(firstPdgCode) == 2112 || firstPdgCode == 310 ||
3a0584e6 622 firstPdgCode == 221 || TMath::Abs(firstPdgCode) == 3122 ||
623 TMath::Abs(firstPdgCode) == 3322 || firstPdgCode == -3212 ||
2ca95bbe 624 TMath::Abs(firstPdgCode) == 421 || TMath::Abs(pdgMother) == 311) // not neutral
3a0584e6 625 && TMath::Abs(lastPdgCode) == 3122) // labmda or anti-lambda
626 || ((!(lastPdgCode == 22 || lastPdgCode == 111 || lastPdgCode == 130 ||
2ca95bbe 627 TMath::Abs(lastPdgCode) == 2112 || lastPdgCode == 310 ||
3a0584e6 628 lastPdgCode == 221 || TMath::Abs(lastPdgCode) == 3122 ||
629 TMath::Abs(lastPdgCode) == 3322 || lastPdgCode == -3212 ||
2ca95bbe 630 TMath::Abs(lastPdgCode) == 421 || TMath::Abs(pdgMother) == 311) // not neutral
3a0584e6 631 && TMath::Abs(firstPdgCode) == 3122)))) { // lambda or anti-lambda
632 vertex->SetType(AliAODVertex::kCascade);
633 jCascades++;
634 }
635 }
636
637 // Multi
638 else if (mother->GetNDaughters() > 2) {
639
640 vertex->SetType(AliAODVertex::kMulti);
641 jMultis++;
642 }
643
644 else {
645 vertex->SetType(AliAODVertex::kUndef);
646 }
647}
648// LocalWords: SetCharge