changed to nanoAOD production; fix in AliAODVertex::CloneWithoutRefts
authorjgrosseo <jgrosseo@cern.ch>
Tue, 11 Mar 2014 16:24:32 +0000 (17:24 +0100)
committerjgrosseo <jgrosseo@cern.ch>
Tue, 11 Mar 2014 16:24:32 +0000 (17:24 +0100)
PWG/DevNanoAOD/AliNanoAODReplicator.cxx
PWGCF/Correlations/DPhi/AliAnalysisTaskPhiCorrelations.cxx
STEER/AOD/AliAODVertex.cxx

index 4952fff..15838fb 100644 (file)
@@ -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;
     }
   
index 21fc515..6fa91f0 100644 (file)
@@ -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<AliNanoAODHeader*> (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)
       {
index 761ba7c..50d011a 100644 (file)
@@ -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;