+//----------------------------------------------------------------------------
+Int_t AliAODRecoCascadeHF::MatchToMC(Int_t pdgabs,Int_t pdgabs2prong,
+ TClonesArray *mcArray) const
+{
+ //
+ // Check if this candidate is matched to a MC signal
+ // If no, return -1
+ // If yes, return label (>=0) of the AliAODMCParticle
+ //
+
+ if(pdgabs!=413) {
+ printf("Only D*+ implemented\n");
+ return -1;
+ }
+
+ Int_t ndg=GetNDaughters();
+ if(!ndg) {
+ AliError("No daughters available");
+ return -1;
+ }
+
+ AliAODRecoDecayHF2Prong *the2Prong = Get2Prong();
+ Int_t lab2Prong = the2Prong->MatchToMC(pdgabs2prong,mcArray);
+
+ if(lab2Prong<0) return -1;
+
+ Int_t dgLabels[10];
+
+ // loop on daughters and write labels
+ for(Int_t i=0; i<ndg; i++) {
+ AliVTrack *trk = (AliVTrack*)GetDaughter(i);
+ Int_t lab = trk->GetLabel();
+ if(lab==-1) { // this daughter is the 2prong
+ lab=lab2Prong;
+ } else if(lab<-1) {
+ printf("daughter with negative label\n");
+ continue;
+ }
+ dgLabels[i] = lab;
+ }
+
+ return AliAODRecoDecay::MatchToMC(pdgabs,mcArray,dgLabels,ndg);
+}