Use TRef functionality to get daughters
authordainese <dainese@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 12 Nov 2008 14:10:10 +0000 (14:10 +0000)
committerdainese <dainese@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 12 Nov 2008 14:10:10 +0000 (14:10 +0000)
PWG3/vertexingHF/AliAnalysisTaskSESelectHF.cxx
PWG3/vertexingHF/ReadAODVertexingHF.C

index d61189a91678e4f99f76e72500a80161b56346f5..37bddcf63d3a4ec7773dd2e1059099e81c8b1690 100644 (file)
@@ -140,10 +140,12 @@ void AliAnalysisTaskSESelectHF::UserExec(Option_t */*option*/)
     Int_t okD0=0,okD0bar=0; 
     if(dIn->SelectD0(fD0toKpiCuts,okD0,okD0bar)) {
       // get daughter AOD tracks
-      AliAODTrack *trk0=aodIn->GetTrack(trkIDtoEntry[dIn->GetProngID(0)]);
-      AliAODTrack *trk1=aodIn->GetTrack(trkIDtoEntry[dIn->GetProngID(1)]);
-      // this will be replaced by 
-      //AliAODTrack *trk0 = (AliAODTrack*)(dIn->GetSecondaryVtx()->GetDaughter(0));
+      AliAODTrack *trk0 = (AliAODTrack*)dIn->GetDaughter(0);
+      AliAODTrack *trk1 = (AliAODTrack*)dIn->GetDaughter(1);
+      if(!trk0 || !trk1) {
+       trk0=aodIn->GetTrack(trkIDtoEntry[dIn->GetProngID(0)]);
+       trk1=aodIn->GetTrack(trkIDtoEntry[dIn->GetProngID(1)]);
+      }
       printf("pt of positive track: %f\n",trk0->Pt());
       printf("pt of negative track: %f\n",trk1->Pt());
       // HERE ONE COULD RECALCULATE THE VERTEX USING THE KF PACKAGE
@@ -151,13 +153,9 @@ void AliAnalysisTaskSESelectHF::UserExec(Option_t */*option*/)
       // clone candidate for output AOD
       AliAODVertex *v = new(verticesHFRef[iOutVerticesHF++]) 
        AliAODVertex(*(dIn->GetSecondaryVtx()));
-      Double_t px[2]={dIn->PxProng(0),dIn->PxProng(1)};
-      Double_t py[2]={dIn->PyProng(0),dIn->PyProng(1)};
-      Double_t pz[2]={dIn->PzProng(0),dIn->PzProng(1)};
-      Double_t d0[2]={dIn->Getd0Prong(0),dIn->Getd0Prong(1)};
-      Double_t d0err[2]={dIn->Getd0errProng(0),dIn->Getd0errProng(1)};
       AliAODRecoDecayHF2Prong *dOut=new(aodD0toKpiRef[iOutD0toKpi++]) 
-       AliAODRecoDecayHF2Prong(v,px,py,pz,d0,d0err,dIn->GetDCA());
+       AliAODRecoDecayHF2Prong(*dIn);
+      dOut->SetSecondaryVtx(v);
       dOut->SetOwnPrimaryVtx((AliAODVertex*)((dIn->GetOwnPrimaryVtx())->Clone()));
       v->SetParent(dOut);
     }
index 34bdd2caabd464538e7de23c6167141b5ab077b0..e03519330f4ab9010efd36e5efdb9060e0a43635 100644 (file)
@@ -112,14 +112,17 @@ void ReadAODVertexingHF(const char *aodFileName="AliAOD.root",
        hMass->Fill(d->InvMassD0bar(),0.5);
        hCPtaVSd0d0->Fill(1e8*d->Prodd0d0(),d->CosPointingAngle());
        hSecVtxZ->Fill(d->GetSecVtxZ());
-       //cout<<d->GetSecVtxZ() <<endl;
+       //cout<<d->GetSecVtxX() <<endl;
 
        // get daughter AOD tracks
-       AliAODTrack *trk0=aod->GetTrack(trkIDtoEntry[d->GetProngID(0)]);
-       AliAODTrack *trk1=aod->GetTrack(trkIDtoEntry[d->GetProngID(1)]);
+       AliAODTrack *trk0 = (AliAODTrack*)d->GetDaughter(0);
+       AliAODTrack *trk1 = (AliAODTrack*)d->GetDaughter(1);
+       if(!trk0 || !trk1) {
+         trk0=aod->GetTrack(trkIDtoEntry[d->GetProngID(0)]);
+         trk1=aod->GetTrack(trkIDtoEntry[d->GetProngID(1)]);
+         cout<<"references to standard AOD not available"<<endl;
+       }
        cout<<"pt of positive track: "<<trk0->Pt()<<endl;
-       // this will be replaced by 
-       //AliAODTrack *trk0 = (AliAODTrack*)(d->GetSecondaryVtx()->GetDaughter(0));
       }
       if(unsetvtx) d->UnsetOwnPrimaryVtx();
     }