message: PWGAA/GammaConv: More bug fixes with loop and checking for right number of daugter particles.
diff: @@ -781,34 +781,30 @@ void AliAnalysisTaskGammaPureMC::ProcessMCParticles()
  if(fIsK0 == 0) continue;
  if( particle->GetPdgCode() == kPdgK0Short){
  if (particle->GetNDaughters() != 2) continue; // only the two particle decays
  - for(Int_t k=0;k<2;k++){
  - TParticle *daughter=fMCStack->Particle(particle->GetDaughter(k));
  - if (!daughter) continue;
  UChar_t acceptanceGamma[2] = {0,0};
  Double_t energyGamma[2] = {0,0};
  Bool_t allOK[2] = {kFALSE,kFALSE};
  UChar_t gdAcceptanceGamma[4] = {0,0,0,0};
  Double_t gdEnergyGamma[4] = {0,0,0,0};
  Bool_t allGDOK[4] = {kFALSE, kFALSE, kFALSE,kFALSE};
  -
  + for(Int_t k=0;k<2;k++){
  + TParticle *daughter=fMCStack->Particle(particle->GetDaughter(k));
  + if (!daughter) continue;
  // Is Daughter a pi0?
  if (daughter->GetPdgCode() == kPdgPi0){
  allOK[k] = kTRUE;
  if(daughter->GetNDaughters() != 2) continue;
  -
  -
  for(Int_t h=0;h<2;h++){
  TParticle *granddaughter = fMCStack->Particle(daughter->GetDaughter(k));
  if(granddaughter->GetPdgCode() == 22) allGDOK[2*k + h] = kTRUE;
  if(IsInPCMAcceptance(granddaughter)) SETBIT(gdAcceptanceGamma[2*k+h], kPCMAcceptance);
  if(IsInEMCalAcceptance(granddaughter)) SETBIT(gdAcceptanceGamma[2*k+h], kEMCALAcceptance);
  gdEnergyGamma[2*k+h] = granddaughter->Energy();
  - }// end for
  -
  - }// end if
  - }// end for
  + }
  + }
  + }
  fHistPtYPi0FromKGG->Fill(particle->Pt(), particle->Y());
  @@ -848,6 +844,7 @@ void AliAnalysisTaskGammaPureMC::ProcessMCParticles()
  TESTBIT(gdAcceptanceGamma[2], kPCMAcceptance) && TESTBIT(gdAcceptanceGamma[3], kPCMAcceptance))||
  (TESTBIT(gdAcceptanceGamma[0], kPCMAcceptance) && TESTBIT(gdAcceptanceGamma[1], kPCMAcceptance) &&
  TESTBIT(gdAcceptanceGamma[2], kEMCALAcceptance) && TESTBIT(gdAcceptanceGamma[3], kEMCALAcceptance)))
  +
  fHistPtYPi0FromKGGEMCAccSamePi0->Fill(particle->Pt(),particle->Y());
  if ((TESTBIT(gdAcceptanceGamma[0], kEMCALAcceptance) && TESTBIT(gdAcceptanceGamma[2], kEMCALAcceptance)&&
  @@ -858,12 +855,9 @@ void AliAnalysisTaskGammaPureMC::ProcessMCParticles()
  TESTBIT(gdAcceptanceGamma[0], kPCMAcceptance) && TESTBIT(gdAcceptanceGamma[3], kPCMAcceptance))||
  (TESTBIT(gdAcceptanceGamma[1], kEMCALAcceptance) && TESTBIT(gdAcceptanceGamma[3], kEMCALAcceptance)&&
  TESTBIT(gdAcceptanceGamma[0], kPCMAcceptance) && TESTBIT(gdAcceptanceGamma[2], kPCMAcceptance)))
  - fHistPtYPi0FromKGGEMCAccDiffPi0->Fill(particle->Pt(),particle->Y());
  + fHistPtYPi0FromKGGEMCAccDiffPi0->Fill(particle->Pt(),particle->Y());
  }
  -
  -
  -
  }
  }
  