From 8cc72c7c4b68ad668f884f0350b9030610fb1b28 Mon Sep 17 00:00:00 2001
From: adrien-matta <a.matta@surrey.ac.uk>
Date: Fri, 29 May 2015 17:20:41 +0100
Subject: [PATCH] * Fixing error with Root 6.03.04 and Mac OS X 6.3 command
 line tool

---
 NPLib/Maya/TMayaHisto.cxx | 17 ++++++-----------
 NPLib/Maya/TMayaHisto.h   |  3 ++-
 2 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/NPLib/Maya/TMayaHisto.cxx b/NPLib/Maya/TMayaHisto.cxx
index d97199c45..fb06cb2f3 100644
--- a/NPLib/Maya/TMayaHisto.cxx
+++ b/NPLib/Maya/TMayaHisto.cxx
@@ -19,7 +19,7 @@
  *                                                                           *
  *****************************************************************************/
 #include "TMayaHisto.h"
-
+#include "TFormula.h"
 //______________________________________________________________________________
 //                     TMayaHisto methods
 //  TMayaHisto a 2-D histogram with four bytes per cell (float)
@@ -1559,17 +1559,12 @@ Double_t TMayaHisto::FindRange(Int_t ID, Option_t *o, Double_t xo, Double_t yo)
 			if (opt.Contains("Fit")) {
 				if (strcmp(fRangeFunction->GetName(), "_dfltRangeFunction_")
 						== 0) {
-					fRangeFunction->SetParameter(fRangeFunction->GetParNumber(
-							"base"), emax);
-					fRangeFunction->SetParLimits(fRangeFunction->GetParNumber(
-							"base"), emax / 2., emax);
-					fRangeFunction->SetParameter(fRangeFunction->GetParNumber(
-							"slope"), lmax != 0 ? -emax / lmax : 0);
+					fRangeFunction->SetParameter(((TFormula*)fRangeFunction)->GetParNumber("base"), emax);
+					fRangeFunction->SetParLimits(((TFormula*)fRangeFunction)->GetParNumber("base"), emax / 2., emax);
+					fRangeFunction->SetParameter(((TFormula*)fRangeFunction)->GetParNumber("slope"), lmax != 0 ? -emax / lmax : 0);
 				}
-				fRangeFunction->SetParLimits(fRangeFunction->GetParNumber(
-						"range"), 0, lmax);
-				fRangeFunction->SetParameter(fRangeFunction->GetParNumber(
-						"range"), lmax / 2.);
+				fRangeFunction->SetParLimits(((TFormula*)fRangeFunction)->GetParNumber("range"), 0, lmax);
+				fRangeFunction->SetParameter(((TFormula*)fRangeFunction)->GetParNumber("range"), lmax / 2.);
 				h->Fit(fRangeFunction, "b");
 				range = fRangeFunction->GetParameter("range");
 			}
diff --git a/NPLib/Maya/TMayaHisto.h b/NPLib/Maya/TMayaHisto.h
index 568209abb..6c814274e 100644
--- a/NPLib/Maya/TMayaHisto.h
+++ b/NPLib/Maya/TMayaHisto.h
@@ -27,6 +27,8 @@
 #include "TFile.h"
 #include "TCutG.h"
 #include "TH2F.h"
+#include "TF1.h"
+#include "TFormula.h"
 #include "TArrayF.h"
 #include "TClonesArray.h"
 #include "TMath.h"
@@ -34,7 +36,6 @@
 #include "TString.h"
 #include "TStyle.h"
 #include "TPad.h"
-#include "TF1.h"
 //#include "TGraph.h"
 #include "TGraphErrors.h"
 #include "TDirectory.h"
-- 
GitLab