catch interpreter errors
authorjgrosseo <jgrosseo@cern.ch>
Mon, 17 Mar 2014 14:48:07 +0000 (15:48 +0100)
committerjgrosseo <jgrosseo@cern.ch>
Mon, 17 Mar 2014 14:48:07 +0000 (15:48 +0100)
PWGCF/Correlations/DPhi/AliAnalysisTaskPhiCorrelations.cxx

index 0cfa98a..2257908 100644 (file)
@@ -16,6 +16,7 @@
 /* $Id:$ */
 
 #include <TROOT.h>
+#include <TInterpreter.h>
 #include <TChain.h>
 #include <TFile.h>
 #include <TList.h>
@@ -1062,7 +1063,10 @@ void  AliAnalysisTaskPhiCorrelations::AnalyseDataMode()
 //       fAOD->GetHeader()->Dump();
 //       Printf("%p %p %d", dynamic_cast<AliNanoAODHeader*> (fAOD->GetHeader()), dynamic_cast<AliNanoAODHeader*> ((TObject*) (fAOD->GetHeader())), 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;
+      Int_t error = 0;
+      centrality = (Float_t) gROOT->ProcessLine(Form("100.0 + 100.0 * ((AliNanoAODHeader*) %p)->GetCentrality(\"%s\")", fAOD->GetHeader(), fCentralityMethod.Data()), &error) / 100 - 1.0;
+      if (error != TInterpreter::kNoError)
+       centrality = -1;
     }
     else
     {