//
// Works in the same way as the copy constructor.
//
+
TObject::operator=(event);
if (this == &event)
return *this;
if (!InputOK()) return;
Bool_t inputESD = IsESD();
-
- Int_t trueIndex;
- AliRsnDaughter::ERefType type;
- if (!ConvertAbsoluteIndex(index, trueIndex, type)) {
- AliError(Form("Failed to convert absolute index %d", index));
- return;
- }
- switch (type) {
- case AliRsnDaughter::kTrack:
- if (inputESD) {
- SetDaughterESDtrack(out, trueIndex);
-
- } else {
- SetDaughterAODtrack(out, trueIndex);
- }
- break;
- case AliRsnDaughter::kV0:
- if (inputESD) SetDaughterESDv0(out, trueIndex); else SetDaughterAODv0(out, trueIndex);
- break;
- case AliRsnDaughter::kCascade:
- if (inputESD) SetDaughterESDcascade(out, trueIndex); else SetDaughterAODcascade(out, trueIndex);
- break;
- default:
- AliError("Unrecognized daughter type");
- return;
- }
-
// if it is pure MC, the index tells what particle
// to be read in the stack of MC particles, otherwise
// it is converted into a real collection index
- if (fromMC) out.SetRef(out.GetRefMC());
+ if (fromMC) {
+ out.SetLabel(index);
+ Bool_t ok = (inputESD ? SetMCInfoESD(out) : SetMCInfoAOD(out));
+ if (ok) {
+ out.SetGood();
+ out.SetRef(out.GetRefMC());
+ }
+ } else {
+ Int_t trueIndex;
+ AliRsnDaughter::ERefType type;
+ if (!ConvertAbsoluteIndex(index, trueIndex, type)) {
+ AliError(Form("Failed to convert absolute index %d", index));
+ return;
+ }
+ switch (type) {
+ case AliRsnDaughter::kTrack:
+ if (inputESD) SetDaughterESDtrack(out, trueIndex); else SetDaughterAODtrack(out, trueIndex);
+ break;
+ case AliRsnDaughter::kV0:
+ if (inputESD) SetDaughterESDv0(out, trueIndex); else SetDaughterAODv0(out, trueIndex);
+ break;
+ case AliRsnDaughter::kCascade:
+ if (inputESD) SetDaughterESDcascade(out, trueIndex); else SetDaughterAODcascade(out, trueIndex);
+ break;
+ default:
+ AliError("Unrecognized daughter type");
+ return;
+ }
+ }
}
//_____________________________________________________________________________
AliAODEvent *aod = (AliAODEvent *)fRef;
if (i >= 0 && i < aod->GetNumberOfTracks()) {
- AliAODTrack *track = aod->GetTrack(i);
+ AliAODTrack *track = dynamic_cast<AliAODTrack*>(aod->GetTrack(i));
+ if(!track) AliFatal("Not a standard AOD");
if (track) {
out.SetRef(track);
out.SetGood();
// otherwise label remains '-1' --> fake V0
if (pp->GetFirstMother() == pn->GetFirstMother() && pp->GetFirstMother() >= 0) {
out.SetLabel(pp->GetFirstMother());
+ //patch for k0s/k0l
+ TParticle *mom = mc->Stack()->Particle(pn->GetFirstMother());
+ if(mom->GetPdgCode() == 310) {
+ //take the mother of the k0s which is a k0 (311)
+ out.SetLabel(mom->GetFirstMother());
+ }
SetMCInfoESD(out);
}
}
// if label too large --> failed
if (label >= nMC) {
- AliWarning(Form("Stack overflow: track label = %d -- stack maximum = %d", label, nMC));
+ AliDebug(4, Form("Stack overflow: track label = %d -- stack maximum = %d", label, nMC));
return kFALSE;
}
if (imum >= 0 && imum < nMC) {
AliMCParticle *mcMother = (AliMCParticle *)mc->GetTrack(imum);
if (mcMother) {
- out.SetMotherPDG(TMath::Abs(mcMother->Particle()->GetPdgCode()));
+ out.SetMotherPDG(mcMother->Particle()->GetPdgCode());
} else {
AliWarning(Form("Stack discontinuity: label mother %d refers to a NULL object", imum));
}
} else {
- AliWarning(Form("Stack overflow: mother label = %d -- stack maximum = %d", imum, nMC));
+ AliDebug(4, Form("Stack overflow: mother label = %d -- stack maximum = %d", imum, nMC));
}
return kTRUE;
// if label too large --> failed
if (label >= nMC) {
- AliWarning(Form("Stack overflow: track label = %d -- stack maximum = %d", label, nMC));
+ AliDebug(4, Form("Stack overflow: track label = %d -- stack maximum = %d", label, nMC));
return kFALSE;
}
if (imum >= 0 && imum < nMC) {
AliAODMCParticle *mcMother = (AliAODMCParticle *)mcArray->At(imum);
if (mcMother) {
- out.SetMotherPDG(TMath::Abs(mcMother->GetPdgCode()));
+ out.SetMotherPDG(mcMother->GetPdgCode());
} else {
AliWarning(Form("Stack discontinuity: label mother %d refers to a NULL object", imum));
}
} else if (imum >= nMC) {
- AliWarning(Form("Stack overflow: mother label = %d -- stack maximum = %d", imum, nMC));
+ AliDebug(4, Form("Stack overflow: mother label = %d -- stack maximum = %d", imum, nMC));
}
return kTRUE;