/************************************************************************** * Copyright(c) 1998-2010, ALICE Experiment at CERN, All rights reserved. * * * * Author: The ALICE Off-line Project. * * Contributors are mentioned in the code where appropriate. * * * * Permission to use, copy, modify and distribute this software and its * * documentation strictly for non-commercial purposes is hereby granted * * without fee, provided that the above copyright notice appears in all * * copies and that both the copyright notice and this permission notice * * appear in the supporting documentation. The authors make no claims * * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ /* $Id$ */ ///////////////////////////////////////////////////////////// // // Base class for cuts on AOD reconstructed heavy-flavour decay // // Author: A.Dainese, andrea.dainese@pd.infn.it ///////////////////////////////////////////////////////////// #include #include "AliVEvent.h" #include "AliESDEvent.h" #include "AliAODEvent.h" #include "AliVVertex.h" #include "AliESDVertex.h" #include "AliLog.h" #include "AliAODVertex.h" #include "AliESDtrack.h" #include "AliAODTrack.h" #include "AliESDtrackCuts.h" #include "AliCentrality.h" #include "AliAODRecoDecayHF.h" #include "AliAnalysisVertexingHF.h" #include "AliAODMCHeader.h" #include "AliAODMCParticle.h" #include "AliVertexerTracks.h" #include "AliRDHFCuts.h" #include "AliAnalysisManager.h" #include "AliInputEventHandler.h" #include "AliPIDResponse.h" ClassImp(AliRDHFCuts) //-------------------------------------------------------------------------- AliRDHFCuts::AliRDHFCuts(const Char_t* name, const Char_t* title) : AliAnalysisCuts(name,title), fMinVtxType(3), fMinVtxContr(1), fMaxVtxRedChi2(1e6), fMaxVtxZ(10.), fMinSPDMultiplicity(0), fTriggerMask(AliVEvent::kAnyINT), fUseOnlyOneTrigger(kFALSE), fTriggerClass("CINT1"), fTrackCuts(0), fnPtBins(1), fnPtBinLimits(1), fPtBinLimits(0), fnVars(1), fVarNames(0), fnVarsForOpt(0), fVarsForOpt(0), fGlobalIndex(1), fCutsRD(0), fIsUpperCut(0), fUsePID(kFALSE), fUseAOD049(kFALSE), fPidHF(0), fWhyRejection(0), fEvRejectionBits(0), fRemoveDaughtersFromPrimary(kFALSE), fRecomputePrimVertex(kFALSE), fUseMCVertex(kFALSE), fUsePhysicsSelection(kTRUE), fOptPileup(0), fMinContrPileup(3), fMinDzPileup(0.6), fUseCentrality(0), fMinCentrality(0.), fMaxCentrality(100.), fFixRefs(kFALSE), fIsSelectedCuts(0), fIsSelectedPID(0), fMinPtCand(-1.), fMaxPtCand(100000.), fKeepSignalMC(kFALSE), fIsCandTrackSPDFirst(kFALSE), fMaxPtCandTrackSPDFirst(0.) { // // Default Constructor // } //-------------------------------------------------------------------------- AliRDHFCuts::AliRDHFCuts(const AliRDHFCuts &source) : AliAnalysisCuts(source), fMinVtxType(source.fMinVtxType), fMinVtxContr(source.fMinVtxContr), fMaxVtxRedChi2(source.fMaxVtxRedChi2), fMaxVtxZ(source.fMaxVtxZ), fMinSPDMultiplicity(source.fMinSPDMultiplicity), fTriggerMask(source.fTriggerMask), fUseOnlyOneTrigger(source.fUseOnlyOneTrigger), fTriggerClass(source.fTriggerClass), fTrackCuts(0), fnPtBins(source.fnPtBins), fnPtBinLimits(source.fnPtBinLimits), fPtBinLimits(0), fnVars(source.fnVars), fVarNames(0), fnVarsForOpt(source.fnVarsForOpt), fVarsForOpt(0), fGlobalIndex(source.fGlobalIndex), fCutsRD(0), fIsUpperCut(0), fUsePID(source.fUsePID), fUseAOD049(source.fUseAOD049), fPidHF(0), fWhyRejection(source.fWhyRejection), fEvRejectionBits(source.fEvRejectionBits), fRemoveDaughtersFromPrimary(source.fRemoveDaughtersFromPrimary), fRecomputePrimVertex(source.fRecomputePrimVertex), fUseMCVertex(source.fUseMCVertex), fUsePhysicsSelection(source.fUsePhysicsSelection), fOptPileup(source.fOptPileup), fMinContrPileup(source.fMinContrPileup), fMinDzPileup(source.fMinDzPileup), fUseCentrality(source.fUseCentrality), fMinCentrality(source.fMinCentrality), fMaxCentrality(source.fMaxCentrality), fFixRefs(source.fFixRefs), fIsSelectedCuts(source.fIsSelectedCuts), fIsSelectedPID(source.fIsSelectedPID), fMinPtCand(source.fMinPtCand), fMaxPtCand(source.fMaxPtCand), fKeepSignalMC(source.fKeepSignalMC), fIsCandTrackSPDFirst(source.fIsCandTrackSPDFirst), fMaxPtCandTrackSPDFirst(source.fMaxPtCandTrackSPDFirst) { // // Copy constructor // cout<<"Copy constructor"<=kCentInvalid){ AliWarning("Centrality estimator not valid"); return 3; }else{ Float_t centvalue=GetCentrality((AliAODEvent*)event); if (centvalue<-998.){//-999 if no centralityP return 0; }else{ if (centvaluefMaxCentrality){ return 2; } } } return 0; } //--------------------------------------------------------------------------- Bool_t AliRDHFCuts::IsEventSelected(AliVEvent *event) { // // Event selection // //if(fTriggerMask && event->GetTriggerMask()!=fTriggerMask) return kFALSE; fWhyRejection=0; fEvRejectionBits=0; Bool_t accept=kTRUE; if(fRecomputePrimVertex){ Bool_t vertOK= RecomputePrimaryVertex((AliAODEvent*)event); if(!vertOK){ fWhyRejection=6; return kFALSE; } } // check if it's MC Bool_t isMC=kFALSE; TClonesArray *mcArray = (TClonesArray*)((AliAODEvent*)event)->GetList()->FindObject(AliAODMCParticle::StdBranchName()); if(mcArray) {isMC=kTRUE;fUseAOD049=kFALSE;} // settings for the TPC dE/dx BB parameterization if(fPidHF && fPidHF->GetOldPid()) { // pp, from LHC10d onwards if((event->GetRunNumber()>121693 && event->GetRunNumber()<136851) || event->GetRunNumber()>139517) fPidHF->SetOnePad(kTRUE); // pp, 2011 low energy run if((event->GetRunNumber()>=146686 && event->GetRunNumber()<=146860)){ fPidHF->SetppLowEn2011(kTRUE); fPidHF->SetOnePad(kFALSE); } // PbPb LHC10h if(event->GetRunNumber()>=136851 && event->GetRunNumber()<=139517) fPidHF->SetPbPb(kTRUE); // MC if(isMC) fPidHF->SetMC(kTRUE); if(isMC && (event->GetRunNumber()>=146686 && event->GetRunNumber()<=146860)) fPidHF->SetMClowenpp2011(kTRUE); fPidHF->SetBetheBloch(); } else if(fPidHF && !fPidHF->GetOldPid()) { if(fPidHF->GetPidResponse()==0x0){ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); AliInputEventHandler *inputHandler=(AliInputEventHandler*)mgr->GetInputEventHandler(); AliPIDResponse *pidResp=inputHandler->GetPIDResponse(); fPidHF->SetPidResponse(pidResp); } } // trigger class TString firedTriggerClasses=((AliAODEvent*)event)->GetFiredTriggerClasses(); // don't do for MC and for PbPb 2010 data if(!isMC && (event->GetRunNumber()<136851 || event->GetRunNumber()>139517)) { if(!firedTriggerClasses.Contains(fTriggerClass.Data())) { fWhyRejection=5; fEvRejectionBits+=1<FixReferences((AliAODEvent*)event); // delete fixer; // } // // physics selection requirements if(fUsePhysicsSelection){ Bool_t isSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & fTriggerMask); if(!isSelected) { if(accept) fWhyRejection=7; fEvRejectionBits+=1<GetInputEventHandler()))->IsEventSelected()!=fTriggerMask){ if(accept) fWhyRejection=7; fEvRejectionBits+=1<GetPrimaryVertex(); if(!vertex){ accept=kFALSE; fEvRejectionBits+=1<GetTitle(); if(title.Contains("Z") && fMinVtxType>1){ accept=kFALSE; fEvRejectionBits+=1<2){ accept=kFALSE; fEvRejectionBits+=1<GetNContributors()GetZ())>fMaxVtxZ) { fEvRejectionBits+=1<IsPileupFromSPD(cutc,cutz,3.,2.,10.)) { if(accept) fWhyRejection=1; fEvRejectionBits+=1<1){ if(accept) fWhyRejection=rejection; fEvRejectionBits+=1<GetNDaughters(); AliAODVertex *vAOD = d->GetPrimaryVtx(); Double_t pos[3],cov[6]; vAOD->GetXYZ(pos); vAOD->GetCovarianceMatrix(cov); const AliESDVertex vESD(pos,cov,100.,100); Bool_t retval=kTRUE; for(Int_t idg=0; idgGetDaughter(idg); if(!dgTrack) {retval = kFALSE; continue;} //printf("charge %d\n",dgTrack->Charge()); if(dgTrack->Charge()==0) continue; // it's not a track, but a V0 if(fIsCandTrackSPDFirst && d->Pt()HasPointOnITSLayer(0)) { retval = kFALSE; continue; } } if(!IsDaughterSelected(dgTrack,&vESD,fTrackCuts)) retval = kFALSE; } return retval; } //--------------------------------------------------------------------------- Bool_t AliRDHFCuts::IsDaughterSelected(AliAODTrack *track,const AliESDVertex *primary,AliESDtrackCuts *cuts) const { // // Convert to ESDtrack, relate to vertex and check cuts // if(!cuts) return kTRUE; if(cuts->GetFlagCutTOFdistance()) cuts->SetFlagCutTOFdistance(kFALSE); Bool_t retval=kTRUE; // convert to ESD track here AliESDtrack esdTrack(track); // set the TPC cluster info esdTrack.SetTPCClusterMap(track->GetTPCClusterMap()); esdTrack.SetTPCSharedMap(track->GetTPCSharedMap()); esdTrack.SetTPCPointsF(track->GetTPCNclsF()); // needed to calculate the impact parameters esdTrack.RelateToVertex(primary,0.,3.); if(!cuts->IsSelected(&esdTrack)) retval = kFALSE; if(fOptPileup==kRejectTracksFromPileupVertex){ // to be implemented // we need either to have here the AOD Event, // or to have the pileup vertex object } return retval; } //--------------------------------------------------------------------------- void AliRDHFCuts::SetPtBins(Int_t nPtBinLimits,Float_t *ptBinLimits) { // Set the pt bins if(fPtBinLimits) { delete [] fPtBinLimits; fPtBinLimits = NULL; printf("Changing the pt bins\n"); } if(nPtBinLimits != fnPtBins+1){ cout<<"Warning: ptBinLimits dimention "< "<=kCentInvalid) AliWarning("Centrality estimator not valid"); return; } //--------------------------------------------------------------------------- void AliRDHFCuts::SetCuts(Int_t nVars,Int_t nPtBins,Float_t **cutsRD) { // // store the cuts // if(nVars!=fnVars) { printf("Wrong number of variables: it has to be %d\n",fnVars); AliFatal("exiting"); } if(nPtBins!=fnPtBins) { printf("Wrong number of pt bins: it has to be %d\n",fnPtBins); AliFatal("exiting"); } if(!fCutsRD) fCutsRD = new Float_t[fGlobalIndex]; for(Int_t iv=0; iv=fGlobalIndex) { cout<<"Overflow, exit..."< 0) ? "Yes" : "No"); if(fOptPileup==1) printf(" -- Reject pileup event"); if(fOptPileup==2) printf(" -- Reject tracks from pileup vtx"); if(fUseCentrality>0) { TString estimator=""; if(fUseCentrality==1) estimator = "V0"; if(fUseCentrality==2) estimator = "Tracks"; if(fUseCentrality==3) estimator = "Tracklets"; if(fUseCentrality==4) estimator = "SPD clusters outer"; printf("Centrality class considered: %.1f-%.1f, estimated with %s",fMinCentrality,fMaxCentrality,estimator.Data()); } if(fIsCandTrackSPDFirst) printf("Check for candidates with pt < %2.2f, that daughters fullfill kFirst criteria\n",fMaxPtCandTrackSPDFirst); if(fVarNames){ cout<<"Array of variables"<GetList()->FindObject(AliAODMCParticle::StdBranchName()); if(mcArray) {fUseAOD049=kFALSE;} AliAODHeader *header=aodEvent->GetHeader(); AliCentrality *centrality=header->GetCentralityP(); Float_t cent=-999.; Bool_t isSelRun=kFALSE; Int_t selRun[5]={138364, 138826, 138828, 138836, 138871}; if(!centrality) return cent; else{ if (estimator==kCentV0M){ cent=(Float_t)(centrality->GetCentralityPercentile("V0M")); if(cent<0){ Int_t quality = centrality->GetQuality(); if(quality<=1){ cent=(Float_t)centrality->GetCentralityPercentileUnchecked("V0M"); }else{ Int_t runnum=aodEvent->GetRunNumber(); for(Int_t ir=0;ir<5;ir++){ if(runnum==selRun[ir]){ isSelRun=kTRUE; break; } } if((quality==8||quality==9)&&isSelRun)cent=(Float_t)centrality->GetCentralityPercentileUnchecked("V0M"); } } //temporary fix for AOD049 outliers if(fUseAOD049&¢>=0){ Float_t v0=0; AliAODVZERO* aodV0 = aodEvent->GetVZEROData(); v0+=aodV0->GetMTotV0A(); v0+=aodV0->GetMTotV0C(); if(cent==0&&v0<19500)return -1;//filtering issue Float_t tkl = (Float_t)(aodEvent->GetTracklets()->GetNumberOfTracklets()); Float_t val= 1.30552 + 0.147931 * v0; Float_t tklSigma[101]={176.644, 156.401, 153.789, 153.015, 142.476, 137.951, 136.127, 129.852, 127.436, 124.86, 120.788, 115.611, 113.172, 110.496, 109.127, 104.421, 102.479, 99.9766, 97.5152, 94.0654, 92.4602, 89.3364, 87.1342, 83.3497, 82.6216, 81.1084, 78.0793, 76.1234, 72.9434, 72.1334, 68.0056, 68.2755, 66.0376, 62.9666, 62.4274, 59.65, 58.3776, 56.6361, 54.5184, 53.4224, 51.932, 50.8922, 48.2848, 47.912, 46.5717, 43.4114, 43.2083, 41.3065, 40.1863, 38.5255, 37.2851, 37.5396, 34.4949, 33.8366, 31.8043, 31.7412, 30.8392, 30.0274, 28.8793, 27.6398, 26.6488, 25.0183, 25.1489, 24.4185, 22.9107, 21.2002, 21.6977, 20.1242, 20.4963, 19.0235, 19.298, 17.4103, 16.868, 15.2939, 15.2939, 16.0295, 14.186, 14.186, 15.2173, 12.9504, 12.9504, 12.9504, 15.264, 12.3674, 12.3674, 12.3674, 12.3674, 12.3674, 18.3811, 13.7544, 13.7544, 13.7544, 13.7544, 13.7544, 13.7544, 13.7544, 13.7544, 13.7544, 13.7544, 13.7544, 13.7544}; if ( TMath::Abs(tkl-val) > 6.*tklSigma[(Int_t)cent] )return -1;//outlier } } else { if (estimator==kCentTRK) { cent=(Float_t)(centrality->GetCentralityPercentile("TRK")); if(cent<0){ Int_t quality = centrality->GetQuality(); if(quality<=1){ cent=(Float_t)centrality->GetCentralityPercentileUnchecked("TRK"); }else{ Int_t runnum=aodEvent->GetRunNumber(); for(Int_t ir=0;ir<5;ir++){ if(runnum==selRun[ir]){ isSelRun=kTRUE; break; } } if((quality==8||quality==9)&&isSelRun)cent=(Float_t)centrality->GetCentralityPercentileUnchecked("TRK"); } } } else{ if (estimator==kCentTKL){ cent=(Float_t)(centrality->GetCentralityPercentile("TKL")); if(cent<0){ Int_t quality = centrality->GetQuality(); if(quality<=1){ cent=(Float_t)centrality->GetCentralityPercentileUnchecked("TKL"); }else{ Int_t runnum=aodEvent->GetRunNumber(); for(Int_t ir=0;ir<5;ir++){ if(runnum==selRun[ir]){ isSelRun=kTRUE; break; } } if((quality==8||quality==9)&&isSelRun)cent=(Float_t)centrality->GetCentralityPercentileUnchecked("TKL"); } } } else{ if (estimator==kCentCL1){ cent=(Float_t)(centrality->GetCentralityPercentile("CL1")); if(cent<0){ Int_t quality = centrality->GetQuality(); if(quality<=1){ cent=(Float_t)centrality->GetCentralityPercentileUnchecked("CL1"); }else{ Int_t runnum=aodEvent->GetRunNumber(); for(Int_t ir=0;ir<5;ir++){ if(runnum==selRun[ir]){ isSelRun=kTRUE; break; } } if((quality==8||quality==9)&&isSelRun)cent=(Float_t)centrality->GetCentralityPercentileUnchecked("CL1"); } } } else { AliWarning("Centrality estimator not valid"); } } } } } return cent; } //------------------------------------------------------------------- Bool_t AliRDHFCuts::CompareCuts(const AliRDHFCuts *obj) const { // // Compare two cuts objects // Bool_t areEqual=kTRUE; if(fMinVtxType!=obj->fMinVtxType) { printf("Minimum vtx type %d %d\n",fMinVtxType,obj->fMinVtxType); areEqual=kFALSE;} if(fMinVtxContr!=obj->fMinVtxContr) { printf("Minimum vtx contr %d %d\n",fMinVtxContr,obj->fMinVtxContr); areEqual=kFALSE;} if(TMath::Abs(fMaxVtxRedChi2-obj->fMaxVtxRedChi2)>1.e-10) { printf("Max vtx red chi2 %f %f\n",fMaxVtxRedChi2,obj->fMaxVtxRedChi2);areEqual=kFALSE;} if(fMinSPDMultiplicity!=obj->fMinSPDMultiplicity) { printf("Min SPD mult %d\n %d",fMinSPDMultiplicity,obj->fMinSPDMultiplicity);areEqual=kFALSE;} if(fUsePID!=obj->fUsePID) { printf("Use PID %d %d\n",(Int_t)fUsePID,(Int_t)obj->fUsePID); areEqual=kFALSE;} if(fRemoveDaughtersFromPrimary!=obj->fRemoveDaughtersFromPrimary) {printf("Remove daughters from vtx %d %d\n",(Int_t)fRemoveDaughtersFromPrimary,(Int_t)obj->fRemoveDaughtersFromPrimary); areEqual=kFALSE;} if(fTrackCuts){ if(fTrackCuts->GetMinNClusterTPC()!=obj->fTrackCuts->GetMinNClusterTPC()) {printf("MinNClsTPC %d %d\n",fTrackCuts->GetMinNClusterTPC(),obj->fTrackCuts->GetMinNClusterTPC()); areEqual=kFALSE;} if(fTrackCuts->GetMinNClustersITS()!=obj->fTrackCuts->GetMinNClustersITS()) {printf("MinNClsITS %d %d\n",fTrackCuts->GetMinNClustersITS(),obj->fTrackCuts->GetMinNClustersITS()); areEqual=kFALSE;} if(TMath::Abs(fTrackCuts->GetMaxChi2PerClusterTPC()-obj->fTrackCuts->GetMaxChi2PerClusterTPC())>1.e-10) {printf("MaxChi2ClsTPC %f %f\n",fTrackCuts->GetMaxChi2PerClusterTPC(),obj->fTrackCuts->GetMaxChi2PerClusterTPC()); areEqual=kFALSE;} if(fTrackCuts->GetClusterRequirementITS(AliESDtrackCuts::kSPD)!=obj->fTrackCuts->GetClusterRequirementITS(AliESDtrackCuts::kSPD)) {printf("ClusterReq SPD %d %d\n",fTrackCuts->GetClusterRequirementITS(AliESDtrackCuts::kSPD),obj->fTrackCuts->GetClusterRequirementITS(AliESDtrackCuts::kSPD)); areEqual=kFALSE;} } if(fCutsRD) { for(Int_t iv=0;ivfCutsRD[GetGlobalIndex(iv,ib)])>1.e-10) { cout<<"fCutsRD["<fCutsRD[GetGlobalIndex(iv,ib)]<<"\n"; areEqual=kFALSE; } } } } return areEqual; } //--------------------------------------------------------------------------- void AliRDHFCuts::MakeTable() const { // // print cuts values in table format // TString ptString = "pT range"; if(fVarNames && fPtBinLimits && fCutsRD){ TString firstLine(Form("* %-15s",ptString.Data())); for (Int_t ivar=0; ivarRemoveDaughtersFromPrimaryVtx(aod); if(!recvtx){ AliDebug(2,"Removal of daughter tracks failed"); return kFALSE; } //set recalculed primary vertex d->SetOwnPrimaryVtx(recvtx); delete recvtx; return kTRUE; } //-------------------------------------------------------------------------- Bool_t AliRDHFCuts::SetMCPrimaryVtx(AliAODRecoDecayHF *d,AliAODEvent *aod) const { // // Recalculate primary vertex without daughters // if(!aod) { AliError("Can not get MC vertex without AOD event"); return kFALSE; } // load MC header AliAODMCHeader *mcHeader = (AliAODMCHeader*)aod->GetList()->FindObject(AliAODMCHeader::StdBranchName()); if(!mcHeader) { AliError("Can not get MC vertex without AODMCHeader event"); return kFALSE; } Double_t pos[3]; Double_t covmatrix[6]={0.,0.,0.,0.,0.,0.}; mcHeader->GetVertex(pos); AliAODVertex *recvtx=new AliAODVertex(pos,covmatrix); if(!recvtx){ AliDebug(2,"Removal of daughter tracks failed"); return kFALSE; } //set recalculed primary vertex d->SetOwnPrimaryVtx(recvtx); d->RecalculateImpPars(recvtx,aod); delete recvtx; return kTRUE; } //-------------------------------------------------------------------------- void AliRDHFCuts::CleanOwnPrimaryVtx(AliAODRecoDecayHF *d, AliAODEvent *aod, AliAODVertex *origownvtx) const { // // Clean-up own primary vertex if needed // if(fRemoveDaughtersFromPrimary || fUseMCVertex) { d->UnsetOwnPrimaryVtx(); if(origownvtx) { d->SetOwnPrimaryVtx(origownvtx); delete origownvtx; origownvtx=NULL; } d->RecalculateImpPars(d->GetPrimaryVtx(),aod); } else { if(origownvtx) { delete origownvtx; origownvtx=NULL; } } return; } //-------------------------------------------------------------------------- Bool_t AliRDHFCuts::IsSignalMC(AliAODRecoDecay *d,AliAODEvent *aod,Int_t pdg) const { // // Checks if this candidate is matched to MC signal // if(!aod) return kFALSE; // get the MC array TClonesArray *mcArray = (TClonesArray*)((AliAODEvent*)aod)->GetList()->FindObject(AliAODMCParticle::StdBranchName()); if(!mcArray) return kFALSE; // try to match Int_t label = d->MatchToMC(pdg,mcArray); if(label>=0) { //printf("MATCH!\n"); return kTRUE; } return kFALSE; } //-------------------------------------------------------------------------- Bool_t AliRDHFCuts::RecomputePrimaryVertex(AliAODEvent* event) const{ // recompute event primary vertex from AOD tracks AliVertexerTracks *vertexer = new AliVertexerTracks(event->GetMagneticField()); vertexer->SetITSMode(); vertexer->SetMinClusters(3); AliAODVertex* pvtx=event->GetPrimaryVertex(); if(strstr(pvtx->GetTitle(),"VertexerTracksWithConstraint")) { Float_t diamondcovxy[3]; event->GetDiamondCovXY(diamondcovxy); Double_t pos[3]={event->GetDiamondX(),event->GetDiamondY(),0.}; Double_t cov[6]={diamondcovxy[0],diamondcovxy[1],diamondcovxy[2],0.,0.,10.*10.}; AliESDVertex *diamond = new AliESDVertex(pos,cov,1.,1); vertexer->SetVtxStart(diamond); delete diamond; diamond=NULL; } AliESDVertex* vertexESD = (AliESDVertex*)vertexer->FindPrimaryVertex(event); if(!vertexESD) return kFALSE; if(vertexESD->GetNContributors()<=0) { //AliDebug(2,"vertexing failed"); delete vertexESD; vertexESD=NULL; return kFALSE; } delete vertexer; vertexer=NULL; // convert to AliAODVertex Double_t pos[3],cov[6],chi2perNDF; vertexESD->GetXYZ(pos); // position vertexESD->GetCovMatrix(cov); //covariance matrix chi2perNDF = vertexESD->GetChi2toNDF(); delete vertexESD; vertexESD=NULL; pvtx->SetPosition(pos[0],pos[1],pos[2]); pvtx->SetChi2perNDF(chi2perNDF); pvtx->SetCovMatrix(cov); return kTRUE; }