Hello,
My problem is the following
#include <limits.h>
Int_t fit_problem()
{
TPostScript* ps_file=new TPostScript("file.ps");
const UInt_t n_histos=10;
const UInt_t n_entries=1000;
TH1F* h_gaus[n_histos];
UInt_t i,j;
Char_t histo_name[CHAR_MAX];
TCanvas* window=new TCanvas("window","fit_problem",5,5,500,500);
window->SetFillColor(10);
for(i=0;i<n_histos;i++){
sprintf(histo_name,"gaus %d",i+1);
h_gaus[i]=new TH1F(histo_name,"",100,-1,1);
for(j=0;j<n_entries;j++){
h_gaus[i]->Fill(gRandom->Gaus(0,0.1));
}
h_gaus[i]->Fit("gaus"); // <---
h_gaus[i]->SetFillColor(rand()%50);
h_gaus[i]->DrawCopy();
window->Update();
}
ps_file->Close();
for(i=0;i<n_histos;i++){
delete h_gaus[i];
}
return(0);
}
So the program creates 10 histos and prints each of them on a separate page in a postscript
file.The problem is that when I don’t fit the distributions I get 10 pages and when I fit them
I get 20 pages 10 with the histos and 10 empty.What is the right way of doing it?
Dimitar.