]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG3/vertexingHF/AliCFVertexingHF.cxx
Fixed coverty 'defects'
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / AliCFVertexingHF.cxx
CommitLineData
379592af 1/**************************************************************************
2 * Copyright(c) 1998-2009, 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// Class for HF corrections as a function of many variables and step
18// Author : C. Zampolli, CERN
19// D. Caffarri, Univ & INFN Padova caffarri@pd.infn.it
20// Base class for HF Unfolding - agrelli@uu.nl
21//-----------------------------------------------------------------------
22
23#include "TParticle.h"
24#include "TClonesArray.h"
25#include "AliAODMCParticle.h"
26#include "AliAODRecoDecayHF.h"
27#include "AliAODRecoDecayHF2Prong.h"
28#include "AliAODRecoDecayHF3Prong.h"
29#include "AliAODRecoDecayHF4Prong.h"
30#include "AliAODMCHeader.h"
31#include "AliAODEvent.h"
32#include "AliLog.h"
33#include "AliESDtrackCuts.h"
34#include "AliESDtrack.h"
35
36#include "AliCFVertexingHF.h"
37
38//___________________________________________________________
39AliCFVertexingHF::AliCFVertexingHF() :
40 fmcArray(0x0),
41 fRecoCandidate(0),
42 fmcPartCandidate(0x0),
43 fNDaughters(0),
44 fNVar(0),
45 fzPrimVertex(0),
46 fzMCVertex(0),
47 fFillFromGenerated(0),
48 fOriginDselection(0),
49 fKeepDfromB(kFALSE),
50 fKeepDfromBOnly(kFALSE),
51 fmcLabel(0),
6e2e4f50 52 fProngs(-1),
53 fLabelArray(0x0)
379592af 54{
f2703bd2 55 //
56 // constructor
57 //
58
6e2e4f50 59
379592af 60 return;
61}
62
63
64
65//_____________________________________________________
66AliCFVertexingHF::AliCFVertexingHF(TClonesArray *mcArray, UShort_t originDselection) :
67 fmcArray(mcArray),
68 fRecoCandidate(0),
69 fmcPartCandidate(0x0),
70 fNDaughters(0),
71 fNVar(0),
72 fzPrimVertex(0),
73 fzMCVertex(0),
74 fFillFromGenerated(0),
75 fOriginDselection(0),
76 fKeepDfromB(kFALSE),
77 fKeepDfromBOnly(kFALSE),
78 fmcLabel(0),
6e2e4f50 79 fProngs(-1),
80 fLabelArray(0x0)
379592af 81{
f2703bd2 82 //
83 // constructor with mcArray
84 //
85
86 SetDselection(originDselection);
87 return;
379592af 88}
89
379592af 90//_______________________________________________________
91AliCFVertexingHF::~AliCFVertexingHF()
92{
f2703bd2 93 //
94 // destructor
95 //
379592af 96
f2703bd2 97 if (fmcArray) fmcArray = 0x0;
98 if (fRecoCandidate) fRecoCandidate = 0x0;
99 if (fmcPartCandidate) fmcPartCandidate = 0x0;
6e2e4f50 100 if (fLabelArray){
101 delete [] fLabelArray;
102 fLabelArray = 0x0;
103 }
f2703bd2 104}
379592af 105
106//_____________________________________________________
f2703bd2 107AliCFVertexingHF& AliCFVertexingHF::operator=(const AliCFVertexingHF& c)
108{
109 //
110 // assigment operator
111 //
112
379592af 113 if (this!= &c){
114 TObject::operator=(c);
115 fmcArray = c.fmcArray;
116 fRecoCandidate = c.fRecoCandidate;
117 fmcPartCandidate = c.fmcPartCandidate;
118 fNDaughters = c.fNDaughters;
119 fNVar = c.fNVar;
120 fzPrimVertex = c.fzPrimVertex;
121 fzMCVertex = c.fzMCVertex;
122 fFillFromGenerated = c.fFillFromGenerated;
123 fOriginDselection = c.fOriginDselection;
124 fKeepDfromB = c.fKeepDfromB;
125 fKeepDfromBOnly = c.fKeepDfromBOnly;
126 fmcLabel = c.fmcLabel;
6e2e4f50 127 fProngs=c.fProngs;
128 if (fProngs > 0){
129 fLabelArray = new Int_t[fProngs];
130 for(Int_t iP=0; iP<fProngs; iP++)fLabelArray[iP]=c.fLabelArray[iP];
131 }
379592af 132 }
133
134 return *this;
135}
136
137//____________________________________________________
138AliCFVertexingHF::AliCFVertexingHF(const AliCFVertexingHF &c) :
139 TObject(c),
140 fmcArray(c.fmcArray),
141 fRecoCandidate(c.fRecoCandidate),
142 fmcPartCandidate(c.fmcPartCandidate),
143 fNDaughters(c.fNDaughters),
144 fNVar(c.fNVar),
145 fzPrimVertex(c.fzPrimVertex),
146 fzMCVertex(c.fzMCVertex),
147 fFillFromGenerated(c.fFillFromGenerated),
148 fOriginDselection (c.fOriginDselection),
149 fKeepDfromB (c.fKeepDfromB),
150 fKeepDfromBOnly (c.fKeepDfromBOnly),
151 fmcLabel(c.fmcLabel),
6e2e4f50 152 fProngs(c.fProngs),
153 fLabelArray(0x0)
f2703bd2 154{
155 //
156 //copy constructor
157 //
6e2e4f50 158 if (fProngs > 0){
159 fLabelArray = new Int_t[fProngs];
160 if (c.fLabelArray) memcpy(fLabelArray,c.fLabelArray,fProngs*sizeof(Int_t));
161 }
379592af 162}
163
164//___________________________________________________________
f2703bd2 165void AliCFVertexingHF::SetDselection(UShort_t originDselection)
166{
167 // setting the way the D0 will be selected
168 // 0 --> only from c quarks
169 // 1 --> only from b quarks
170 // 2 --> from both c quarks and b quarks
171
172 fOriginDselection = originDselection;
173
174 if (fOriginDselection == 0) {
175 fKeepDfromB = kFALSE;
176 fKeepDfromBOnly = kFALSE;
177 }
178
179 if (fOriginDselection == 1) {
180 fKeepDfromB = kTRUE;
181 fKeepDfromBOnly = kTRUE;
182 }
183
184 if (fOriginDselection == 2) {
185 fKeepDfromB = kTRUE;
186 fKeepDfromBOnly = kFALSE;
187 }
188
189 return;
379592af 190}
191
192//______________________________________________________
f2703bd2 193void AliCFVertexingHF::SetMCCandidateParam(Int_t label)
194{
195 //
196 // setting the parameters (candidate and n. daughters)
197 //
379592af 198
f2703bd2 199 fmcPartCandidate = dynamic_cast <AliAODMCParticle*> (fmcArray->At(label));
200 fNDaughters = fmcPartCandidate->GetNDaughters();
201 return;
379592af 202}
203
379592af 204//____________________________________________________________
f2703bd2 205Int_t AliCFVertexingHF::MCcquarkCounting(AliAODMCParticle* mcPart) const
206{
207 //
208 // counting the c-quarks
209 //
210
211 Int_t cquarks = 0;
212 if (mcPart->GetPdgCode() == 4) cquarks++;
213 if (mcPart->GetPdgCode() == -4) cquarks++;
214 if (!mcPart) {
215 AliWarning("Particle not found in tree, skipping\n");
216 return cquarks;
217 }
218
219 return cquarks;
379592af 220}
221
379592af 222//________________________________________________________
f2703bd2 223Bool_t AliCFVertexingHF::CheckMCPartFamily(AliAODMCParticle */*mcPart*/, TClonesArray */*mcArray*/) const
224{
225 //
226 //checking the family
227 //
228
229 Int_t pdgGranma = CheckOrigin();
230 if (pdgGranma == -9999){
231 AliDebug(2,"This particle come from a B decay channel but according to the settings of the task, we keep only the prompt charm particles\n");
f2703bd2 232 return kFALSE;
233 }
234
235 if (pdgGranma == -999){
236 AliDebug(2,"This particle come from a prompt charm particles but according to the settings of the task, we want only the ones coming from B\n");
f2703bd2 237 return kFALSE;
238 }
239
240 if (!CheckMCDaughters()) {
6e2e4f50 241 AliDebug(3, "CheckMCDaughters false");
f2703bd2 242 return kFALSE;
243 }
244 if (!CheckMCChannelDecay()) {
6e2e4f50 245 AliDebug(3,"CheckMCChannelDecay false");
f2703bd2 246 return kFALSE;
247 }
248 return kTRUE;
379592af 249}
250
251//_________________________________________________________________________________________________
f2703bd2 252Int_t AliCFVertexingHF::CheckOrigin() const
253{
254 //
255 // checking whether the mother of the particles come from a charm or a bottom quark
256 //
257
258 Int_t pdgGranma = 0;
259 Int_t mother = 0;
260 mother = fmcPartCandidate->GetMother();
261 Int_t istep = 0;
262 while (mother >0 ){
263 istep++;
264 AliDebug(2,Form("mother at step %d = %d", istep, mother));
265 AliAODMCParticle* mcGranma = dynamic_cast<AliAODMCParticle*>(fmcArray->At(mother));
266 pdgGranma = mcGranma->GetPdgCode();
267 AliDebug(2,Form("Pdg mother at step %d = %d", istep, pdgGranma));
268 Int_t abspdgGranma = TMath::Abs(pdgGranma);
269 if ((abspdgGranma > 500 && abspdgGranma < 600) || (abspdgGranma > 5000 && abspdgGranma < 6000)) {
270 if (!fKeepDfromB) return -9999; //skip particle if come from a B meson.
271
272 else{
273 return pdgGranma;
274 }
275 }
276 else {
277 if (fKeepDfromBOnly) return -999;
278 }
279
280 mother = mcGranma->GetMother();
281 }
282
379592af 283 return pdgGranma;
379592af 284}
285
286
287//___________________________________________
f2703bd2 288Bool_t AliCFVertexingHF::CheckMCDaughters()const
289{
290 //
291 // checking the daughters
292 // at MC level
379592af 293
f2703bd2 294 AliAODMCParticle *mcPartDaughter;
295 Bool_t checkDaughters = kFALSE;
296
297 Int_t label0 = fmcPartCandidate->GetDaughter(0);
298 Int_t label1 = fmcPartCandidate->GetDaughter(1);
6e2e4f50 299 AliDebug(3,Form("label0 = %d, label1 = %d",label0,label1));
f2703bd2 300 if (label1==0 || label0 == 0){
6e2e4f50 301 AliDebug(2, Form("The MC particle doesn't have correct daughters, skipping!!"));
f2703bd2 302 return checkDaughters;
303 }
379592af 304
6e2e4f50 305 if (fLabelArray == 0x0) {
306 return checkDaughters;
307 }
308
f2703bd2 309 for (Int_t iProng = 0; iProng<fProngs; iProng++){
6e2e4f50 310 mcPartDaughter = dynamic_cast<AliAODMCParticle*>(fmcArray->At(fLabelArray[iProng]));
f2703bd2 311 if (!mcPartDaughter) {
312 AliWarning("At least one Daughter Particle not found in tree, skipping");
313 return checkDaughters;
314 }
315 }
316
317 checkDaughters = kTRUE;
318 return checkDaughters;
319}
379592af 320
321//______________________________________________________
322Bool_t AliCFVertexingHF::FillMCContainer(Double_t *containerInputMC)
323{
f2703bd2 324 //
325 // fill the container for Generator level selection
326 //
379592af 327
f2703bd2 328 Bool_t mcContainerFilled = kFALSE;
329
330 Double_t* vectorMC = new Double_t[fNVar];
331 for (Int_t iVar = 0; iVar<fNVar; iVar++) vectorMC[iVar]= 9999.;
332
333 if (GetGeneratedValuesFromMCParticle(&vectorMC[0])){
334 for (Int_t iVar = 0; iVar<fNVar; iVar++){
335 containerInputMC[iVar] = vectorMC[iVar];
336 }
337 mcContainerFilled = kTRUE;
338 }
339 delete [] vectorMC;
340 vectorMC = 0x0;
341 return mcContainerFilled;
379592af 342}
343
344//______________________________________________________
f2703bd2 345Bool_t AliCFVertexingHF::FillRecoContainer(Double_t *containerInput)
346{
347 //
348 // fill the container for Reconstrucred level selection
349 //
350
351 Bool_t recoContainerFilled = kFALSE;
352 Double_t* vectorValues = new Double_t[fNVar];
353 Double_t* vectorReco = new Double_t[fNVar];
354
355 for (Int_t iVar = 0; iVar<fNVar; iVar++) {
356 vectorValues[iVar]= 9999.;
357 vectorReco[iVar]=9999.;
358 }
359
360 if(fFillFromGenerated){
361 //filled with MC values
362 if (GetGeneratedValuesFromMCParticle(&vectorValues[0])){
363 for (Int_t iVar = 0; iVar<fNVar; iVar++){
364 containerInput[iVar] = vectorValues[iVar];
365 }
366 recoContainerFilled = kTRUE;
379592af 367 }
368 }
369 else{
f2703bd2 370 //filled with Reco values
379592af 371
372 if (GetRecoValuesFromCandidate(&vectorReco[0])){
373 for (Int_t iVar = 0; iVar<fNVar; iVar++){
374 containerInput[iVar] = vectorReco[iVar];
375 }
376 recoContainerFilled = kTRUE;
377 }
378 }
f2703bd2 379
380 delete [] vectorValues;
381 delete [] vectorReco;
382 vectorValues = 0x0;
383 vectorReco = 0x0;
384 return recoContainerFilled;
379592af 385}
386
387//_____________________________________________________
388Bool_t AliCFVertexingHF::MCAcceptanceStep() const
389{
f2703bd2 390 //
391 // checking the MC acceptance step
392 //
393
394 Bool_t bMCAccStep = kFALSE;
395
396 AliAODMCParticle *mcPartDaughter;
397 Int_t label0 = fmcPartCandidate->GetDaughter(0);
398 Int_t label1 = fmcPartCandidate->GetDaughter(1);
399 if (label1==0 || label0 == 0){
400 AliDebug(2, Form("The MC particle doesn't have correct daughters, skipping!!"));
401 return bMCAccStep;
402 }
403
6e2e4f50 404 if (fLabelArray == 0x0) {
405 return bMCAccStep;
406 }
407
f2703bd2 408 for (Int_t iProng = 0; iProng<fProngs; iProng++){
6e2e4f50 409 mcPartDaughter = dynamic_cast<AliAODMCParticle*>(fmcArray->At(fLabelArray[iProng]));
f2703bd2 410 if (!mcPartDaughter) {
411 AliWarning("At least one Daughter Particle not found in tree, skipping");
412 return bMCAccStep;
413 }
414 Double_t eta = mcPartDaughter->Eta();
415 Double_t pt = mcPartDaughter->Pt();
416
417 //set values of eta and pt in the constructor.
418 if (TMath::Abs(eta) > 0.9 || pt < 0.1){
419 AliDebug(3,"At least one daughter has eta>0.9 or pt < 0.1 \n");
420 return bMCAccStep;
421 }
422 }
423 bMCAccStep = kTRUE;
424 return bMCAccStep;
425
426}
f2703bd2 427 //_____________________________________________________
379592af 428Bool_t AliCFVertexingHF::MCRefitStep(AliAODEvent *aodEvent, AliESDtrackCuts *trackCuts) const
429{
f2703bd2 430 //
431 // check on the kTPCrefit and kITSrefit conditions of the daughters
432 //
379592af 433 Bool_t bRefitStep = kFALSE;
f2703bd2 434
379592af 435 Int_t label0 = fmcPartCandidate->GetDaughter(0);
436 Int_t label1 = fmcPartCandidate->GetDaughter(1);
f2703bd2 437
379592af 438 if (label1==0 || label0 == 0){
f2703bd2 439 AliDebug(2, Form("The MC particle doesn't have correct daughters, skipping!!"));
440 return bRefitStep;
379592af 441 }
f2703bd2 442
6e2e4f50 443 if (fLabelArray == 0x0) {
444 return bRefitStep;
445 }
f2703bd2 446
379592af 447 Int_t foundDaughters = 0;
6e2e4f50 448 Int_t* temp = new Int_t[fProngs];
449 for (Int_t ilabel = 0; ilabel<fProngs; ilabel++){
450 temp[ilabel] = fLabelArray[ilabel];
451 }
452
379592af 453 if (trackCuts->GetRequireTPCRefit() || trackCuts->GetRequireITSRefit()){
f2703bd2 454
379592af 455 for(Int_t iaod =0; iaod<aodEvent->GetNumberOfTracks(); iaod++){
456 AliAODTrack *track = (AliAODTrack*)aodEvent->GetTrack(iaod);
6e2e4f50 457 if(track->GetStatus()&AliESDtrack::kITSpureSA) continue;
458 Bool_t foundTrack = kFALSE;
459 for (Int_t ilabel = 0; ilabel<fProngs; ilabel++){
460 AliDebug(3,Form("fLabelArray[%d] = %d, track->GetLabel() = %d",ilabel,fLabelArray[ilabel],track->GetLabel()));
461 if (track->GetLabel() == temp[ilabel]) {
462 foundTrack = kTRUE;
463 temp[ilabel] = -1;
464 break;
465 }
466 }
467 if (foundTrack){
379592af 468 foundDaughters++;
f2703bd2 469 AliDebug(4,Form("daughter %d \n",foundDaughters));
379592af 470 if(trackCuts->GetRequireTPCRefit()){
f2703bd2 471 if(track->GetStatus()&AliESDtrack::kTPCrefit) {
379592af 472 bRefitStep = kTRUE;
473 }
474 else {
475 AliDebug(3, "Refit cut not passed , missing TPC refit\n");
6e2e4f50 476 delete [] temp;
477 temp = 0x0;
379592af 478 return kFALSE;
479 }
480 }
481
482 if (trackCuts->GetRequireITSRefit()) {
f2703bd2 483 if(track->GetStatus()&AliESDtrack::kITSrefit){
379592af 484 bRefitStep = kTRUE;
485 }
486 else {
487 AliDebug(3, "Refit cut not passed , missing ITS refit\n");
6e2e4f50 488 delete [] temp;
489 temp = 0x0;
490 return kFALSE;
379592af 491 }
492 }
493 }
f2703bd2 494 if (foundDaughters == fProngs){
379592af 495 break;
f2703bd2 496 }
497 }
6e2e4f50 498 }
499 delete [] temp;
500 temp = 0x0;
f2703bd2 501 if (foundDaughters== fProngs) return bRefitStep;
502 else return kFALSE;
379592af 503}
504
505//____________________________________________________________________________
506
507Bool_t AliCFVertexingHF::RecoStep()
379592af 508{
f2703bd2 509 //
510 //check also vertex and ITS Refit and TPC Refit
511 //
379592af 512
f2703bd2 513 Bool_t bRecoStep = kFALSE;
514 Int_t mcLabel = GetMCLabel();
515
516 if (mcLabel == -1) {
517 AliDebug(2,"No MC particle found");
518 return bRecoStep;
519 }
520 else{
521 fmcPartCandidate = (AliAODMCParticle*)fmcArray->At(mcLabel);
522 if (!fmcPartCandidate){
523 AliWarning("Could not find associated MC in AOD MC tree");
524 return bRecoStep;
525 }
526 }
527
528 Int_t pdgGranma = CheckOrigin();
529
530 if (pdgGranma == -9999){
531 AliDebug(2,"This particle come from a B decay channel but according to the settings of the task, we keep only prompt charm particles\n");
532 return bRecoStep;
533 }
534
535 if (pdgGranma == -999){
536 AliDebug(2,"This particle come from a prompt charm particle but according to the settings of the task, we want only the ones coming from B\n");
537 return bRecoStep;
538 }
379592af 539
f2703bd2 540 bRecoStep=kTRUE;
541 return bRecoStep;
379592af 542}
543//____________________________________________
f2703bd2 544Double_t AliCFVertexingHF::GetEtaProng(Int_t iProng) const
545{
546 //
547 // getting eta of the prong
548 //
549
550 if (fRecoCandidate){
551 Double_t etaProng = fRecoCandidate->EtaProng(iProng);
552 return etaProng;
553 }
554 return 999999;
379592af 555}
556//______________________________________________________
f2703bd2 557Double_t AliCFVertexingHF::GetPtProng(Int_t iProng) const
558{
559 //
560 // getting pt of the prong
561 //
379592af 562
f2703bd2 563 if (fRecoCandidate){
564 Double_t ptProng = fRecoCandidate->PtProng(iProng);
565 return ptProng;
566 }
567 return 999999;
568
379592af 569}
570
571//____________________________________________________________________
572
573Bool_t AliCFVertexingHF::RecoAcceptStep(AliESDtrackCuts *trackCuts) const
574{
f2703bd2 575 //
576 // reco Acceptance step
577 //
578
579 Bool_t bRecoAccStep = kFALSE;
580
581 Float_t etaCutMin, ptCutMin, etaCutMax, ptCutMax;
582 trackCuts->GetEtaRange(etaCutMin, etaCutMax);
583 trackCuts->GetPtRange(ptCutMin, ptCutMax);
584
585 Float_t etaProng=0., ptProng=0.;
586
587 for (Int_t iProng =0; iProng<fProngs; iProng++){
588
589 etaProng = GetEtaProng(iProng);
590 ptProng = GetPtProng(iProng);
591
592 Bool_t acceptanceProng = (etaProng>etaCutMin && etaProng<etaCutMax && ptProng>ptCutMin && ptProng<ptCutMax);
593 if (!acceptanceProng) {
594 AliDebug(2,"At least one reconstructed prong isn't in the acceptance\n");
595 return bRecoAccStep;
596 }
597 }
598
599 bRecoAccStep=kTRUE;
600 return bRecoAccStep;
379592af 601}
602//___________________________________________________________
603
f2703bd2 604Bool_t AliCFVertexingHF::FillUnfoldingMatrix(Double_t *fill) const
605{
606 //
607 // filling the unfolding matrix
608 //
609
610 fill = new Double_t[4];
611
612 if(fmcPartCandidate){
613
614 fill[0] = GetPtCand();
615 fill[1] = GetYCand();
616
617 fill[2] = fmcPartCandidate->Pt();
618 fill[3] = fmcPartCandidate->Y();
619
620 return kTRUE;
621 }
622
623 delete [] fill;
624 fill = 0x0;
625 return kFALSE;
379592af 626}
f2703bd2 627//___________________________________________________________
379592af 628
f2703bd2 629Int_t AliCFVertexingHF::CheckReflexion()
630{
631 //
632 // check for reflexion (particle/antiparticle)
633 //
379592af 634
f2703bd2 635 Int_t mcLabel = GetMCLabel();
636
637 if (mcLabel == -1) {
638 AliDebug(2,"No MC particle found");
639 return 0;
640 }
641 else{
642 fmcPartCandidate = (AliAODMCParticle*)fmcArray->At(mcLabel);
643 if (!fmcPartCandidate){
644 AliWarning("Could not find associated MC in AOD MC tree");
645 return 0;
646 }
647 }
648
649 if(fmcPartCandidate->GetPdgCode()>0) return 1; // particle
650 else if(fmcPartCandidate->GetPdgCode()<0) return 2; // antiparticle
651 else return 0; // ....shouldn't be...
652}
6e2e4f50 653//___________________________________________________________
654
655Bool_t AliCFVertexingHF::SetLabelArray()
656{
657 //
658 // setting the label arrays
659 //
660
661 Bool_t bLabelArray = kFALSE;
662
663 fLabelArray = new Int_t[fProngs];
664
665 AliAODMCParticle *mcPartDaughter;
666 Int_t label0 = fmcPartCandidate->GetDaughter(0);
667 Int_t label1 = fmcPartCandidate->GetDaughter(1);
668 AliDebug(2,Form("label0 = %d, label1 = %d",label0,label1));
669 if (label1==0 || label0 == 0){
670 AliDebug(2, Form("The MC particle doesn't jave correct daughters, skipping!!"));
671 delete [] fLabelArray;
672 fLabelArray = 0x0;
673 return bLabelArray;
674 }
675
676 if (label1 - label0 == fProngs-1){
677 for (Int_t iProng = 0; iProng<fProngs; iProng++){
678 mcPartDaughter = dynamic_cast<AliAODMCParticle*>(fmcArray->At(label0+iProng));
679 fLabelArray[iProng] = mcPartDaughter->GetLabel();
680 }
681
682 }
683 // resonant decay channel
684 else if (label1 - label0 == fProngs-2 && fProngs > 2){
685 Int_t labelFirstDau = fmcPartCandidate->GetDaughter(0);
686 Int_t foundDaughters = 0;
687 for(Int_t iDau=0; iDau<fProngs-1; iDau++){
688 Int_t iLabelDau = labelFirstDau+iDau;
689 AliAODMCParticle* part = dynamic_cast<AliAODMCParticle*>(fmcArray->At(iLabelDau));
690 Int_t pdgCode=TMath::Abs(part->GetPdgCode());
691 if(pdgCode==211 || pdgCode==321 || pdgCode==2212){
692 fLabelArray[foundDaughters] = part->GetLabel();
693 foundDaughters++;
694 }
695 else{
696 Int_t nDauRes=part->GetNDaughters();
697 if(nDauRes!=2) {
698 delete [] fLabelArray;
699 fLabelArray = 0x0;
700 return bLabelArray;
701 }
702 Int_t labelFirstDauRes = part->GetDaughter(0);
9e6f6c1a 703 for(Int_t iDauRes=0; iDauRes<nDauRes; iDauRes++){
6e2e4f50 704 Int_t iLabelDauRes = labelFirstDauRes+iDauRes;
705 AliAODMCParticle* dauRes = dynamic_cast<AliAODMCParticle*>(fmcArray->At(iLabelDauRes));
706 fLabelArray[foundDaughters] = dauRes->GetLabel();
707 foundDaughters++;
708 }
709 }
710 }
711 if (foundDaughters != fProngs){
712 delete [] fLabelArray;
713 fLabelArray = 0x0;
714 return bLabelArray;
715 }
716 }
717 // wrong correspondance label <--> prongs
718 else{
719 delete [] fLabelArray;
720 fLabelArray = 0x0;
721 return bLabelArray;
722 }
723 bLabelArray = kTRUE;
724 return bLabelArray;
725}