- // other than for the track labels, negative values mean
- // no daughter/mother so preserve it
-
- if(d0<0 && d1<0){
- // no first daughter -> no second daughter
- // nothing to be done
- // second condition not needed just for sanity check at the end
- mcpart_tmp.SetDaughter(0,d0);
- mcpart_tmp.SetDaughter(1,d1);
- }
- else if(d1 < 0 && d0 >= 0){
- // Only one daughter
- // second condition not needed just for sanity check at the end
- if(fMCEventH->IsParticleSelected(d0)){
- mcpart_tmp.SetDaughter(0,fMCEventH->GetNewLabel(d0));
- }
- else{
- mcpart_tmp.SetDaughter(0,-1);
- }
- mcpart_tmp.SetDaughter(1,d1);
- }
- else if (d0 > 0 && d1 > 0 ){
- // we have two or more daughters loop on the stack to see if they are
- // selected
- Int_t d0_tmp = -1;
- Int_t d1_tmp = -1;
- for(int id = d0; id<=d1;++id){
- if(fMCEventH->IsParticleSelected(id)){
- if(d0_tmp==-1){
- // first time
- d0_tmp = fMCEventH->GetNewLabel(id);
- d1_tmp = d0_tmp; // this is to have the same schema as on the stack i.e. with one daugther d0 and d1 are the same
- }
- else d1_tmp = fMCEventH->GetNewLabel(id);
+ AliAODMCParticle mcpart_tmp(mcpart,i,flag);
+
+ mcpart_tmp.SetStatus(mcpart->Particle()->GetStatusCode());
+ //
+ Int_t d0 = mcpart_tmp.GetDaughter(0);
+ Int_t d1 = mcpart_tmp.GetDaughter(1);
+ Int_t m = mcpart_tmp.GetMother();
+
+ // other than for the track labels, negative values mean
+ // no daughter/mother so preserve it
+
+ if(d0<0 && d1<0){
+ // no first daughter -> no second daughter
+ // nothing to be done
+ // second condition not needed just for sanity check at the end
+ mcpart_tmp.SetDaughter(0,d0);
+ mcpart_tmp.SetDaughter(1,d1);
+ } else if(d1 < 0 && d0 >= 0) {
+ // Only one daughter
+ // second condition not needed just for sanity check at the end
+ if(fMCEventH->IsParticleSelected(d0)){
+ mcpart_tmp.SetDaughter(0,fMCEventH->GetNewLabel(d0));
+ } else {
+ mcpart_tmp.SetDaughter(0,-1);
+ }
+ mcpart_tmp.SetDaughter(1,d1);
+ }
+ else if (d0 > 0 && d1 > 0 ){
+ // we have two or more daughters loop on the stack to see if they are
+ // selected
+ Int_t d0_tmp = -1;
+ Int_t d1_tmp = -1;
+ for(int id = d0; id<=d1;++id){
+ if(fMCEventH->IsParticleSelected(id)){
+ if(d0_tmp==-1){
+ // first time
+ d0_tmp = fMCEventH->GetNewLabel(id);
+ d1_tmp = d0_tmp; // this is to have the same schema as on the stack i.e. with one daugther d0 and d1 are the same
+ }
+ else d1_tmp = fMCEventH->GetNewLabel(id);
+ }
+ }
+ mcpart_tmp.SetDaughter(0,d0_tmp);
+ mcpart_tmp.SetDaughter(1,d1_tmp);
+ } else {
+ AliError(Form("Unxpected indices %d %d",d0,d1));
+ }
+
+ if(m<0){
+ mcpart_tmp.SetMother(m);
+ } else {
+ if(fMCEventH->IsParticleSelected(m))mcpart_tmp.SetMother(fMCEventH->GetNewLabel(m));
+ else AliError(Form("PROBLEM Mother not selected %d \n", m));