From 0df1f11b000453b22d200cd3a1f62c4633d09f90 Mon Sep 17 00:00:00 2001 From: jgrosseo Date: Tue, 11 Mar 2014 17:24:32 +0100 Subject: [PATCH] changed to nanoAOD production; fix in AliAODVertex::CloneWithoutRefts --- PWG/DevNanoAOD/AliNanoAODReplicator.cxx | 11 +---------- .../DPhi/AliAnalysisTaskPhiCorrelations.cxx | 9 +++++++++ STEER/AOD/AliAODVertex.cxx | 8 ++++++++ 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/PWG/DevNanoAOD/AliNanoAODReplicator.cxx b/PWG/DevNanoAOD/AliNanoAODReplicator.cxx index 4952fffd59d..15838fbefed 100644 --- a/PWG/DevNanoAOD/AliNanoAODReplicator.cxx +++ b/PWG/DevNanoAOD/AliNanoAODReplicator.cxx @@ -497,11 +497,9 @@ void AliNanoAODReplicator::ReplicateAndFilter(const AliAODEvent& source) AliAODTrack *aodtrack =(AliAODTrack*)track;// FIXME DYNAMIC CAST? if(!fTrackCut->IsSelected(aodtrack)) continue; - AliNanoAODTrack * special = new AliNanoAODTrack (aodtrack, fVarList); + AliNanoAODTrack * special = new((*fTracks)[ntracks++]) AliNanoAODTrack (aodtrack, fVarList); if(fCustomSetter) fCustomSetter->SetNanoAODTrack(aodtrack, special); - (*fTracks)[ntracks++] = special; - //new((*fTracks)[ntrac\ks++]) } //---------------------------------------------------------- @@ -514,15 +512,8 @@ void AliNanoAODReplicator::ReplicateAndFilter(const AliAODEvent& source) AliAODVertex* tmp = v->CloneWithoutRefs(); AliAODVertex* copiedVertex = new((*fVertices)[nvertices++]) AliAODVertex(*tmp); - // to insure the main vertex retains the ncontributors information - // (which is otherwise computed dynamically from - // references to tracks, which we do not keep in muon aods...) - // we set it here - copiedVertex->SetNContributors(v->GetNContributors()); - // fVertices->Delete(); - // delete copiedVertex; delete tmp; } diff --git a/PWGCF/Correlations/DPhi/AliAnalysisTaskPhiCorrelations.cxx b/PWGCF/Correlations/DPhi/AliAnalysisTaskPhiCorrelations.cxx index 21fc5157acf..6fa91f048d5 100644 --- a/PWGCF/Correlations/DPhi/AliAnalysisTaskPhiCorrelations.cxx +++ b/PWGCF/Correlations/DPhi/AliAnalysisTaskPhiCorrelations.cxx @@ -510,6 +510,9 @@ void AliAnalysisTaskPhiCorrelations::AnalyseCorrectionMode() Printf("WARNING: Centrality object is 0"); centrality = -1; } + + if (centrality == -1 && fAOD && fAOD->GetHeader()->InheritsFrom("AliNanoAODHeader")) + centrality = (Float_t) gROOT->ProcessLine(Form("100.0 + 100.0 * ((AliNanoAODHeader*) %p)->GetCentrality(\"%s\")", fAOD->GetHeader(), fCentralityMethod.Data())) / 100 - 1.0; } AliInfo(Form("Centrality is %f", centrality)); @@ -1065,6 +1068,12 @@ void AliAnalysisTaskPhiCorrelations::AnalyseDataMode() //centrality = centralityObj->GetCentralityPercentileUnchecked(fCentralityMethod); else centrality = -1; + +// fAOD->GetHeader()->Dump(); +// Printf("%p %d", dynamic_cast (fAOD->GetHeader()), fAOD->GetHeader()->InheritsFrom("AliNanoAODHeader")); + + if (centrality == -1 && fAOD && fAOD->GetHeader()->InheritsFrom("AliNanoAODHeader")) + centrality = (Float_t) gROOT->ProcessLine(Form("100.0 + 100.0 * ((AliNanoAODHeader*) %p)->GetCentrality(\"%s\")", fAOD->GetHeader(), fCentralityMethod.Data())) / 100 - 1.0; if (fAOD) { diff --git a/STEER/AOD/AliAODVertex.cxx b/STEER/AOD/AliAODVertex.cxx index 761ba7c33f2..50d011ae628 100644 --- a/STEER/AOD/AliAODVertex.cxx +++ b/STEER/AOD/AliAODVertex.cxx @@ -205,6 +205,14 @@ AliAODVertex* AliAODVertex::CloneWithoutRefs() const fType, 0); + v->SetName(GetName()); + // NOTE title is not allowed to be set, as GetNContributors + // relies on the title to use the references which are not copied here + + // to insure the main vertex retains the ncontributors information + // (which is otherwise computed dynamically from + // references to tracks, which is not kept in the returned object) + // we set it here v->SetNContributors(fNContributors); return v; -- 2.43.0