Difference between Windows and Mac

Hello.

When I run a macro on mac’s root and windows’s root respectively, there is a difference in the generated histograms. I expect it to work like the windows. What is the problem with my macro?

-M1 2020 Mac Ventura 13.0.1, root_v6.26.06
-Windows 10, root_v5.34.38 (Binary distribution)

(I wanted to upload the histo images and data, but the forum doesn’t allow me to upload any files because I’m newbe…)

Thanks!

void fit_test(){
	gROOT->Reset();

	TCanvas *c2 = new TCanvas("Fit","Gaussian Fitting", 0, 0, 630, 670);
	gStyle->SetOptStat(kFALSE);

	TH1F *hp2 = new TH1F("hp2","test",1000,0.,1000);
	c2->ToggleEventStatus();

	ifstream fin("data.txt");
	double x;
	double i=0;
	while (fin >> x ){
  	hp2->Fill(i,x);
		i++;
	}
	fin.close();
	hp2->Draw();
	c2->SetLogy();
	hp2->SetMinimum(1);
	c2->Update();

	gStyle->SetOptFit();
	gStyle->SetOptFit(1111);

}

hp2->Draw("HIST");

BTW. Instead of “hp2->Fill(i,x);” use “hp2->SetBinContent(i + 1, x);

It worked. Thank you!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.