1 /*************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
17 // Implementation of a branch replicator
18 // to produce aods with only few branches.
20 // This replicator is in charge of replicating the nuclei primary vertices
21 // tracks identified as nuclei with Z>=2, secondary vertices in form of
22 // AliAODRecoDecayLF2Prong and their daughter tracks.
23 // These informations are stored into a reduced AODs (AliAOD.NuclEx.root)
25 // The vertices are filtered so that only the primary vertices make it
26 // to the output aods.
28 // The secondary vertices are recreated here, as a AliAODRecoDecayLF2Prong
29 // plus cuts that select secondary vericesoutside the primary vertex
31 // Authors: S. Bufalino (stefania.bufalino@cern.ch)
32 // R. Lea (ramona.lea@cern.ch)
33 // Based on AliAODMuonReplicator.cxx
35 //NOTE : This is a test on MC : no PID response only MC truth + select only 3LH
36 // daughters : NOT INTENDED for any efficiency!!
41 class AliAODRecoDecay;
44 #include "AliAODEvent.h"
45 #include "AliAODMCHeader.h"
46 #include "AliAODMCParticle.h"
47 #include "AliAODTZERO.h"
48 #include "AliAODTrack.h"
49 #include "AliAODVZERO.h"
50 //#include "AliAnalysisCuts.h"
52 #include "AliExternalTrackParam.h"
55 //#include "AliPIDResponse.h"
58 #include "AliESDtrack.h"
59 #include "TObjArray.h"
60 #include "AliAnalysisFilter.h"
61 #include "AliAODRecoDecay.h"
62 #include "AliAODRecoDecayLF.h"
63 #include "AliAODRecoDecayLF2Prong.h"
66 #include <TDatabasePDG.h>
70 #include "AliVEvent.h"
71 #include "AliVVertex.h"
72 #include "AliVTrack.h"
73 #include "AliVertexerTracks.h"
74 #include "AliKFVertex.h"
75 #include "AliESDEvent.h"
76 #include "AliESDVertex.h"
77 #include "AliESDtrackCuts.h"
78 #include "AliAODEvent.h"
79 #include "AliAnalysisFilter.h"
80 //#include "AliAnalysisVertexingLF.h"
81 #include "AliAnalysisManager.h"
82 #include "AliAODMCNuclExReplicator.h"
85 #include "AliInputEventHandler.h"
90 ClassImp(AliAODMCNuclExReplicator)
92 //_____________________________________________________________________________
93 AliAODMCNuclExReplicator::AliAODMCNuclExReplicator(const char* name, const char* title,
95 Int_t nsigmaTrk1, Int_t partType1,
96 Int_t nsigmaTrk2, Int_t partType2
98 :AliAODBranchReplicator(name,title),
109 fSecondaryVerices(0x0),
110 fDaughterTracks(0x0),
117 fReplicateHeader(kTRUE), //replicateHeader //to be fixed
118 fnSigmaTrk1(nsigmaTrk1),
119 fnSigmaTrk2(nsigmaTrk2),
120 fpartType1(partType1),
121 fpartType2(partType2),
122 fSecVtxWithKF(kFALSE),
123 fVertexerTracks(0x0),
132 //_____________________________________________________________________________
133 AliAODMCNuclExReplicator::~AliAODMCNuclExReplicator()
137 // delete fVertexCut;
141 //_____________________________________________________________________________
142 void AliAODMCNuclExReplicator::SelectParticle(Int_t i)
144 // taking the absolute values here, need to take care
145 // of negative daughter and mother
148 if (!IsParticleSelected(TMath::Abs(i)))
150 fParticleSelected.Add(TMath::Abs(i),1);
154 //_____________________________________________________________________________
155 Bool_t AliAODMCNuclExReplicator::IsParticleSelected(Int_t i)
157 // taking the absolute values here, need to take
158 // care with negative daughter and mother
160 return (fParticleSelected.GetValue(TMath::Abs(i))==1);
164 //_____________________________________________________________________________
165 void AliAODMCNuclExReplicator::CreateLabelMap(const AliAODEvent& source)
168 // this should be called once all selections are done
173 TClonesArray* mcParticles = static_cast<TClonesArray*>(source.FindListObject(AliAODMCParticle::StdBranchName()));
178 TIter next(mcParticles);
182 if (IsParticleSelected(i))
184 fLabelMap.Add(i,j++);
190 //_____________________________________________________________________________
191 Int_t AliAODMCNuclExReplicator::GetNewLabel(Int_t i)
193 // Gets the label from the new created Map
194 // Call CreatLabelMap before
195 // otherwise only 0 returned
196 return fLabelMap.GetValue(TMath::Abs(i));
200 //_____________________________________________________________________________
201 TList* AliAODMCNuclExReplicator::GetList() const
203 // return (and build if not already done) our internal list of managed objects
207 if ( fReplicateHeader )
209 fHeader = new AliAODHeader;
213 fSecondaryVerices = new TClonesArray("AliAODRecoDecayLF2Prong",30);
214 fSecondaryVerices->SetName("SecondaryVertices");
216 fVertices = new TClonesArray("AliAODVertex",2);
217 fVertices->SetName("vertices");
219 fNuclei = new TClonesArray("AliAODTrack",30);
220 fNuclei->SetName("Nuclei");
222 fDaughterTracks = new TClonesArray("AliAODTrack",30);
223 fDaughterTracks->SetName("DaughterTracks");
227 fList->SetOwner(kTRUE);
230 fList->Add(fVertices);
232 fList->Add(fSecondaryVerices);
233 fList->Add(fDaughterTracks);
238 fMCHeader = new AliAODMCHeader;
239 fMCParticles = new TClonesArray("AliAODMCParticle",1000);
240 fMCParticles->SetName(AliAODMCParticle::StdBranchName());
241 fList->Add(fMCHeader);
242 fList->Add(fMCParticles);
248 //_____________________________________________________________________________
249 void AliAODMCNuclExReplicator::ReplicateAndFilter(const AliAODEvent& source)
251 // Replicate (and filter if filters are there) the relevant parts we're interested in AODEvent
253 // cout<<"-------------------->QUESTO"<<endl;
255 //-----------------------------------------------
258 // AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
259 // AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
261 //--------------------------------------------------------
263 // printf("Execute NuclEx Replicator\n");
265 //---------------------------------
267 if (fReplicateHeader)
269 AliAODHeader * header = dynamic_cast<AliAODHeader*>(source.GetHeader());
270 if(!header) AliFatal("Not a standard AOD");
271 *fHeader = *(header);
274 fVertices->Clear("C");
278 fSecondaryVerices->Clear("C");
280 fDaughterTracks->Clear("C");
282 //----------------------------------
286 TClonesArray *arrayMC = 0;
287 AliAODMCHeader *mcHeader=0;
289 // Int_t mumpdgNeg=-100;
292 arrayMC = (TClonesArray*) source.GetList()->FindObject(AliAODMCParticle::StdBranchName());
294 Printf("Error: MC particles branch not found!\n");
299 // cout<<"Ho caricato array mc"<<endl;
301 mcHeader = (AliAODMCHeader*)source.GetList()->FindObject(AliAODMCHeader::StdBranchName());
303 printf("AliAnalysisTaskSEDs::UserExec: MC header branch not found!\n");
308 // cout<<"Ho caricato MC header"<<endl;
310 // cout<<"Centrality AOD source: "<<source.GetHeader()->GetCentrality()<<endl;
317 Double_t xdummy,ydummy;
319 AliAODRecoDecayLF2Prong *io2Prong = 0;
321 TObjArray *twoTrackArray = new TObjArray(2);
324 // cout<<"Qui"<<endl;
325 // cout<<source.GetMagneticField()<<endl;
327 AliAODVertex *vtx = source.GetPrimaryVertex();
329 // cout<<"Source "<<source<<endl;
330 // cout<<"vtx: "<<vtx<<endl;
332 // A Set of very loose cut for a weak strange decay
341 //----------------------------------------------------------
344 UShort_t *indices = 0;
345 const Int_t entries = source.GetNumberOfTracks();
347 Double_t pos[3],cov[6];
349 vtx->GetCovarianceMatrix(cov);
350 fV1 = new AliESDVertex(pos,cov,100.,100,vtx->GetName());
351 cout<<"fV1 pricipal loop: "<<fV1<<endl;
353 if(entries<=0) return;
354 indices = new UShort_t[entries];
355 memset(indices,0,sizeof(UShort_t)*entries);
356 fAODMapSize = 100000;
357 fAODMap = new Int_t[fAODMapSize];
358 memset(fAODMap,0,sizeof(Int_t)*fAODMapSize);
359 // cent=((AliAODEvent&)source)->GetCentrality();
361 //-------------------------------------------------------------
363 if(vtx->GetNContributors()<1) {
366 vtx =source.GetPrimaryVertexSPD();
368 if(vtx->GetNContributors()<1) {
369 Info("AliAnalysisTaskHelium3Pi","No good vertex, skip event");
370 return; // NO GOOD VERTEX, SKIP EVENT
374 Double_t xPrimaryVertex=0.,yPrimaryVertex=0.;
375 xPrimaryVertex=vtx->GetX();
376 yPrimaryVertex=vtx->GetY();
378 fBzkG=source.GetMagneticField();
379 fVertexerTracks=new AliVertexerTracks(fBzkG);
381 Double_t TrackNumber = source.GetNumberOfTracks();
386 TArrayI Track0(TrackNumber); //Pions
389 TArrayI Track1(TrackNumber); //Helium3
392 for(Int_t j=0; j<TrackNumber; j++){
394 // cout<<"Inside loop tracks"<<endl;
397 AliVTrack *track = (AliVTrack*)source.GetTrack(j);
399 AliAODTrack *aodtrack =(AliAODTrack*)track;
401 //-----------------------------------------------------------
403 if(aodtrack->GetTPCNcls() < 70 )continue;
404 if(aodtrack->Chi2perNDF() > 4 )continue;
406 if (!aodtrack->IsOn(AliAODTrack::kTPCrefit)) continue;
407 if (!aodtrack->IsOn(AliAODTrack::kTPCin)) continue;
408 if (aodtrack->IsOn(AliAODTrack::kITSpureSA)) continue;
410 //---------------------------------------------------------------
412 Double_t mom = aodtrack->P();
414 if(mom<0.150)continue;
416 label = TMath::Abs(aodtrack->GetLabel());
418 AliAODMCParticle *part = (AliAODMCParticle*) arrayMC->At(label);
420 Int_t PDGCode=part->GetPdgCode();
422 Int_t mumid = part->GetMother();
425 AliAODMCParticle *mother = (AliAODMCParticle*) arrayMC->At(mumid);
426 mumpdg = mother->GetPdgCode();
429 // if(mumpdg == 1010010030 ||mumpdg == -1010010030 ){
431 if(mumpdg == -1010010030){
433 if(PDGCode==-211 || PDGCode==+211){
434 // if(PDGCode==-211){
436 // if(aodtrack->Charge()>0)continue;
441 if(PDGCode==1000020030 ||PDGCode==-1000020030 ){
442 //if(PDGCode==1000020030){
444 // if(aodtrack->Charge()<0)continue;
447 // new((*fNuclei)[nnuclei++]) AliAODTrack(*aodtrack);
452 //Set Track Daughters
457 // cout<<"Track loops..."<<endl;
458 // cout<<"npos "<<nTrack1<<endl;
459 // cout<<"nneg "<<nTrack0<<endl;
462 AliAODTrack *postrackAOD = 0;
463 AliAODTrack *negtrackAOD = 0;
465 AliESDtrack *postrack = 0;
466 AliESDtrack *negtrack = 0;
470 for (Int_t i=0; i<nTrack1; i++){ //! He Tracks Loop
472 Int_t Track1idx=Track1[i];
474 AliVTrack *trackpos = (AliVTrack*)source.GetTrack(Track1idx);
476 postrackAOD = (AliAODTrack*)trackpos;
477 postrack = new AliESDtrack(trackpos);
481 Int_t labelpos = TMath::Abs(postrack->GetLabel());
482 AliAODMCParticle *partPos = (AliAODMCParticle*) arrayMC->At(labelpos);
483 Int_t mumidPos = partPos->GetMother();
485 // cout<<"\n\nmumidPos: "<<mumidPos <<endl;
487 //------------------------------
489 for (Int_t k=0; k <nTrack0 ; k++) { //! Pion Tracks Loop
491 Int_t Track0idx=Track0[k];
493 AliVTrack *trackneg = (AliVTrack*)source.GetTrack(Track0idx);
494 negtrackAOD =(AliAODTrack*)trackneg;
495 negtrack = new AliESDtrack(trackneg);
499 Int_t labelneg = TMath::Abs(negtrack->GetLabel());
500 AliAODMCParticle *partNeg = (AliAODMCParticle*) arrayMC->At(labelneg);
501 Int_t mumidNeg = partNeg->GetMother();
503 // cout<<"mumidNeg: "<<mumidNeg <<endl;
505 // AliAODMCParticle *motherNeg = (AliAODMCParticle*) arrayMC->At(mumidNeg);
506 // mumpdgNeg = motherNeg->GetPdgCode();
508 //------------------------------
509 // if(mumidPos == mumidNeg && mumidNeg > 0){
512 // if(mumidPos == mumidNeg && mumidNeg > 0 && mumpdgNeg == 1010010030)
513 if(mumidPos == mumidNeg && mumidNeg > 0)
516 twoTrackArray->AddAt(negtrack,0);
517 twoTrackArray->AddAt(postrack,1);
519 Double_t dcap1n1 = postrack->GetDCA(negtrack,fBzkG,xdummy,ydummy);
521 Double_t dcap1toPV = TMath::Abs(postrack->GetD(xPrimaryVertex, yPrimaryVertex,fBzkG));
522 Double_t dcan1toPV = TMath::Abs(negtrack->GetD(xPrimaryVertex, yPrimaryVertex,fBzkG));
524 if(dcap1n1>fDCAtracksMin)continue;
525 if((xdummy+ydummy)>fRmax )continue;
526 if((xdummy+ydummy)< fRmin)continue;
528 if ( dcan1toPV < fDNmin)
529 if ( dcap1toPV < fDPmin) continue;
531 // cout<<"dcap1n1: "<<dcap1n1<<endl;
533 AliAODVertex *vertexp1n1 = ReconstructSecondaryVertex(twoTrackArray,dispersion,kTRUE);
537 twoTrackArray->Clear();
543 io2Prong = Make2Prong(twoTrackArray,source,vertexp1n1,dcap1n1);
545 if(io2Prong->CosPointingAngle()<fCosMin)continue;
547 // cout<<"CPA: "<<io2Prong->CosPointingAngle()<<endl;
549 // AliAODTrack *trk0 = (AliAODTrack*)io2Prong->GetDaughter(0);
550 // AliAODTrack *trk1 = (AliAODTrack*)io2Prong->GetDaughter(1);
552 // cout<<"**********************************************"<<endl;
553 // cout<<trk0/*->GetID()*/<<" "<<negtrackAOD->GetID()<<endl;
554 // cout<<trk1/*->GetID()*/<<" "<<postrackAOD->GetID()<<endl;
555 // cout<<"d0 io2Prong: "<<io2Prong->GetProngID(1)<<endl;
556 // cout<<"d1 io2Prong: "<<io2Prong->GetProngID(0)<<endl;
557 // cout<<"**********************************************"<<endl;
559 // rd = new((*fSecondaryVerices)[nsv++]) AliAODRecoDecayLF2Prong(*io2Prong);
561 // cout<<"is ok??? "<<isOk<<endl;
563 new((*fSecondaryVerices)[nsv++]) AliAODRecoDecayLF2Prong(*io2Prong);
564 new((*fDaughterTracks)[ntracksD++]) AliAODTrack(*negtrackAOD);
565 new((*fDaughterTracks)[ntracksD++]) AliAODTrack(*postrackAOD);
568 // rd->SetSecondaryVtx(vertexp1n1);
569 // vertexp1n1->SetParent(rd);
570 // AddRefs(vertexp1n1,rd,source,twoTrackArray);
586 //----------------------------------------------------------
588 assert(fVertices!=0x0);
589 fVertices->Clear("C");
590 TIter nextV(source.GetVertices());
594 while ( ( v = static_cast<AliAODVertex*>(nextV()) ) )
596 if ( v->GetType() == AliAODVertex::kPrimary ||
597 v->GetType() == AliAODVertex::kMainSPD ||
598 v->GetType() == AliAODVertex::kPileupSPD ||
599 v->GetType() == AliAODVertex::kPileupTracks||
600 v->GetType() == AliAODVertex::kMainTPC )
603 AliAODVertex* tmp = v->CloneWithoutRefs();
604 //AliAODVertex* copiedVertex = new((*fVertices)[nvertices++]) AliAODVertex(*tmp);
605 new((*fVertices)[nvertices++]) AliAODVertex(*tmp);
607 // to insure the main vertex retains the ncontributors information
608 // (which is otherwise computed dynamically from
609 // references to tracks, which we do not keep in muon aods...)
612 //copiedVertex->SetNContributors(v->GetNContributors());
614 // fVertices->Delete();
615 // delete copiedVertex;
617 // printf("....Prendo il vertice primario...\n");
619 // printf("....Prendo il vertice primario...\n");
622 //printf("....Done NuclEx Replicator...\n");
624 AliDebug(1,Form("input mu tracks=%d tracks=%d vertices=%d nnuclei=%d",
625 input,fSecondaryVerices->GetEntries(),fVertices->GetEntries(),fNuclei->GetEntries()));
627 // cout<<"Delete..."<<endl;
630 //cout<<"Delete 1"<< endl;
632 if(io2Prong) {delete io2Prong; io2Prong=NULL;}
633 //cout<<"Delete 2"<< endl;
634 twoTrackArray->Delete(); delete twoTrackArray;
635 // cout<<"Delete 3"<< endl;
636 // vtx->Delete(); delete vtx;
637 // cout<<"Delete 4"<< endl;
638 if(fV1) { delete fV1; fV1=NULL; }
639 // cout<<"Delete 5"<< endl;
640 if(fAODMap) { delete [] fAODMap; fAODMap=NULL; }
642 // cout<<"Delete 6"<< endl;
643 delete fVertexerTracks;
645 // cout<<"Mi rompo alla fine. Perche???"<<endl;
649 //-----------------------------------------------------------------------------
651 AliAODVertex *AliAODMCNuclExReplicator::ReconstructSecondaryVertex(TObjArray *trkArray,
652 Double_t &dispersion,Bool_t useTRefArray) const
655 // Secondary vertex reconstruction with AliVertexerTracks or AliKFParticle
656 //AliCodeTimerAuto("",0);
658 AliESDVertex *vertexESD = 0;
659 AliAODVertex *vertexAOD = 0;
661 if(!fSecVtxWithKF) { // AliVertexerTracks
663 fVertexerTracks->SetVtxStart(fV1);
664 vertexESD = (AliESDVertex*)fVertexerTracks->VertexForSelectedESDTracks(trkArray);
666 if(!vertexESD) return vertexAOD;
669 Double_t vertRadius2=vertexESD->GetX()*vertexESD->GetX()+vertexESD->GetY()*vertexESD->GetY();
670 if(vertRadius2>200.){
671 // vertex outside beam pipe, reject candidate to avoid propagation through material
672 delete vertexESD; vertexESD=NULL;
676 } else { // Kalman Filter vertexer (AliKFParticle)
678 AliKFParticle::SetField(fBzkG);
680 AliKFVertex vertexKF;
682 Int_t nTrks = trkArray->GetEntriesFast();
683 for(Int_t i=0; i<nTrks; i++) {
684 AliESDtrack *esdTrack = (AliESDtrack*)trkArray->At(i);
685 AliKFParticle daughterKF(*esdTrack,211);
686 vertexKF.AddDaughter(daughterKF);
688 vertexESD = new AliESDVertex(vertexKF.Parameters(),
689 vertexKF.CovarianceMatrix(),
691 vertexKF.GetNContributors());
694 // convert to AliAODVertex
695 Double_t pos[3],cov[6],chi2perNDF;
696 vertexESD->GetXYZ(pos); // position
697 vertexESD->GetCovMatrix(cov); //covariance matrix
698 chi2perNDF = vertexESD->GetChi2toNDF();
699 dispersion = vertexESD->GetDispersion();
703 Int_t nprongs= (useTRefArray ? 0 : trkArray->GetEntriesFast());
704 vertexAOD = new AliAODVertex(pos,cov,chi2perNDF,0x0,-1,AliAODVertex::kUndef,nprongs);
706 // cout<<"------------------> Reconstruct vertexAOD: "<<vertexAOD<<endl;
713 //-----------------------------------------------------------------------------
715 AliAODRecoDecayLF2Prong* AliAODMCNuclExReplicator::Make2Prong(TObjArray *twoTrackArray,const AliAODEvent &evento,
716 AliAODVertex *secVert,Double_t dca)
721 //cout<<"Inside make 2 prong"<<endl;
724 charge[0]=1; //it was -1 //Ramona
727 // From AliAnalysisVertexingLF.cxx Method:Make2Prongs
729 fBzkG = evento.GetMagneticField();
731 Double_t px[2],py[2],pz[2],d0[2],d0err[2];
732 // Also this has been changed //Ramona
733 AliESDtrack *negtrack = (AliESDtrack*)twoTrackArray->UncheckedAt(0);
734 AliESDtrack *postrack = (AliESDtrack*)twoTrackArray->UncheckedAt(1);
736 //cout<<"negtrack: "<<negtrack<<" postrack: "<<postrack<<endl;
737 //cout<<"kVeryBig: "<<kVeryBig<<endl;
738 //cout<<"secVert: "<<secVert<<endl;
740 // // propagate tracks to secondary vertex, to compute inv. mass
742 postrack->PropagateToDCA(secVert,fBzkG,kVeryBig);
743 negtrack->PropagateToDCA(secVert,fBzkG,kVeryBig);
745 Double_t momentum[3];
747 negtrack->GetPxPyPz(momentum);
748 px[0] = charge[0]*momentum[0];
749 py[0] = charge[0]*momentum[1];
750 pz[0] = charge[0]*momentum[2];
752 postrack->GetPxPyPz(momentum);
753 px[1] = charge[1]*momentum[0];
754 py[1] = charge[1]*momentum[1];
755 pz[1] = charge[1]*momentum[2];
757 //cout<< px[0] <<" "<< " "<< py[0] << " "<< pz[0]<<endl;
758 // px[0] = momentum[0]; py[0] = momentum[1]; pz[0] = momentum[2];
759 //cout<< px[1] <<" "<< " "<< py[1] << " "<< pz[1]<<endl;
760 //px[1] = momentum[0]; py[1] = momentum[1]; pz[1] = momentum[2];
763 // primary vertex to be used by this candidate
764 AliAODVertex *primVertexAOD = evento.GetPrimaryVertex();
765 //cout<<"primVertexAOD "<<primVertexAOD<<endl;
766 if(!primVertexAOD) return 0x0;
768 Double_t d0z0[2],covd0z0[3];
777 d0err[0] = TMath::Sqrt(TMath::Abs(covd0z0[0]));
780 d0err[1] = TMath::Sqrt(TMath::Abs(covd0z0[0]));
782 // create the object AliAODRecoDecayLF2Prong
783 // AliAODRecoDecayLF2Prong *the2Prong = new AliAODRecoDecayLF2Prong(secVert,px,py,pz,d0,d0err,dcap1n1);
784 AliAODRecoDecayLF2Prong *the2Prong = new AliAODRecoDecayLF2Prong(secVert,px,py,pz,d0,d0err,dca);
785 the2Prong->SetOwnPrimaryVtx(primVertexAOD);
787 // the2Prong->SetProngIDs(2,{-999,999});
788 // UShort_t id0[2]={99999,999999};
789 // the2Prong->SetProngIDs(2,id0);
791 UShort_t id[2]={(UShort_t)postrack->GetID(),(UShort_t)negtrack->GetID()};
792 the2Prong->SetProngIDs(2,id);
794 // cout<<"\n\n\nMake 2 Prong: id[0]"<<id[0]<<" id[1]: "<<id[1]<<endl;
795 // cout<<"Get: 1 "<<the2Prong->GetProngID(0)<<" 2 "<<the2Prong->GetProngID(1)<<endl;
796 // cout<<"Get: 3 "<<the2Prong->GetProngID(2)<<" 4 "<<the2Prong->GetProngID(3)<<endl<<endl<<endl;
797 //delete primVertexAOD; primVertexAOD=NULL;
799 if(postrack->Charge()!=0 && negtrack->Charge()!=0) {
801 AddDaughterRefs(secVert,(AliAODEvent&)evento,twoTrackArray);
802 // AddDaughterRefs(secVert,(AliAODEvent*)evento,twoTrackArray);
811 //----------------------------------------------------------------------------
812 void AliAODMCNuclExReplicator::AddDaughterRefs(AliAODVertex *v,
813 const AliAODEvent &event,
814 const TObjArray *trkArray) const
817 // Add the AOD tracks as daughters of the vertex (TRef)
818 // AliCodeTimerAuto("",0);
819 // cout<<"Inside AddDaughterRefs "<<endl;
821 Int_t nDg = v->GetNDaughters();
824 if(nDg) dg = v->GetDaughter(0);
825 if(dg) return; // daughters already added
827 Int_t nTrks = trkArray->GetEntriesFast();
829 AliExternalTrackParam *track = 0;
830 AliAODTrack *aodTrack = 0;
833 for(Int_t i=0; i<nTrks; i++) {
834 track = (AliExternalTrackParam*)trkArray->UncheckedAt(i);
836 id = (Int_t)track->GetID();
837 // printf("---> %d\n",id);
838 if(id<0) continue; // this track is a AliAODRecoDecay
840 aodTrack = (AliAODTrack*)event.GetTrack(fAODMap[id]);
841 v->AddDaughter(aodTrack);
845 //----------------------------------------------------------------------------
847 void AliAODMCNuclExReplicator::AddRefs(AliAODVertex *v,AliAODRecoDecayLF *rd,
848 const AliAODEvent &event,
849 const TObjArray *trkArray) const
852 // Add the AOD tracks as daughters of the vertex (TRef)
853 // Also add the references to the primary vertex and to the cuts
854 //AliCodeTimerAuto("",0);
856 AddDaughterRefs(v,event,trkArray);
857 rd->SetPrimaryVtxRef((AliAODVertex*)event.GetPrimaryVertex());
861 //---------------------------------------------------------------------------
863 void AliAODMCNuclExReplicator::Terminate(){