[ROOT] strange graph->Fit() behaviour

From: payman hosseini (phossein@midway.uchicago.edu)
Date: Sun Nov 17 2002 - 21:27:44 MET


hi
i have function that graphs a bunch of lines and then fits them
the first time i call this function, it works properly
it draws the graph and draws the fit

the second time i call it(with new points to draw), it draws the
points, but
when it fits them, the fit function deletes everything under it
it deletes the axix tic marks and the grid under it

this is very strange behaviour. am i doing something wrong?
i am using MSVC++ under win2000
thank you

here is the function

void draw_psychometric_function(TCanvas * psychometric_final,Int_t
big_contrast_array_len,Float_t * psychometric_x,Float_t *
psychometric_y,Float_t * psychometric_err,const char * file_title,Int_t
msg)
{
	psychometric_final->SetGrid();
	psychometric_final->SetTitle(file_title);
	TGraphErrors *gr1_1 = new TGraphErrors(big_contrast_array_len,
psychometric_x, psychometric_y, 0, psychometric_err);
	gr1_1->ResetAttFill();
	gr1_1->Draw("AP*");
	gr1_1->SetMaximum(1);
	gr1_1->SetMinimum(0);
	
	gr1_1->SetTitle(file_title);
	gr1_1->GetXaxis()->SetTitle("Contrast");
	gr1_1->GetYaxis()->SetTitle("Probability of Coherent Judgment");
	gr1_1->GetXaxis()->CenterTitle();
	gr1_1->GetYaxis()->CenterTitle();
	
	TF1 *func = new TF1("fitf",fitf,-150,150,2);
	func->SetParameters(5,22);
	func->SetParNames("Mean_value","Sigma");
	gr1_1->Fit(func,"rem");//,"same");

	//gr1_1->Draw("AP*");

	psychometric_final->Update();

}

Paymon Hosseini



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:18 MET