Gauss fitting in ROOT using minuit2

Hello,

I am overall fairly new at ROOT but have been trying for a while to solve a problem I am getting.

The idea is the following: Using GO4, I feed ‘events’ to ROOT. I am then attempting to apply a Gaussian fit to the data set passed through. I had found an example developed by L. Moneta and attempted to apply it to my set of data (instead of a random set of points). My issue is that the code returns more errors than results and I have no idea how to fix these.

I am aware that this might be a long shot but here are the error messages I get, with a bit of luck, maybe one of you will be able to help. If any more information is necessary please do ask.

Info in <Minuit2>: Minuit2Minimizer::Minimize : Covar was made pos def
Info in <Minuit2>: Minuit2Minimizer::Minimize : Minimization did NOT converge, Edm is above max
Info in <Minuit2>: Minuit2Minimizer::Minimize : Minimization did NOT converge, Hesse is not valid

The code I am using is roughly the following. Note that I very well might be using functions that I have no need for, as I said ROOT is fairly new to me and using it in this manner is, currently, far above my head.

//in a seperate file
histo = MakeTH1('I', "TimingDigital/GFch0vsGFch1","Gaussian Filter Ch0-Ch1",10000, -150., 150.);
//end seperate file 

         std::string type = "Minuit2";
	
	  TVirtualFitter::SetDefaultFitter(type.c_str() );

	  gStyle->SetOptStat(1111111);
	  gStyle->SetOptFit(1111111);    

	  for (int i = 0; i < n; ++i) { 
		 float x=gSelection[i];
		 histo->SetBinContent(i,x);
	  }
	  std::string cname = type + "Canvas" ;    
	  std::string ctitle = type + " Gaussian Fit" ;    
	  TCanvas *c1 = new TCanvas(cname.c_str(),cname.c_str(),10,10,900,900);
	  c1->Divide(2,2);
	
	  c1->cd(1);
	  cout << "\nDo Fit 1\n";
	  histo->Fit("gaus","Q"); 
	  histo->Draw();
	  float mean1=histo->GetFunction("gaus")->GetParameter(1);
return mean1;

Again, many thanks for any help offered.

Ronan

p.s: I have installed ROOT using ./configure --enable-minuit2