// histograms filled and drawn in a loop
void gaussex() {
//
// To see the output of this macro, click begin_html here end_html
//    Simple example illustrating how to use the C++ interpreter	
//    to fill histograms in a loop and show the graphics results
//Author: Rene Brun
  TCanvas *c1 = new TCanvas("c1","Primer Gauss",200,10,600,400);
  c1->SetGrid();
// Create some histograms.
  main   = new TH1F("Gauss","Gaussova distribucija",200,-5.5,5.5);
  main->SetFillColor(41);
// Fill histograms randomly
  gRandom->SetSeed(4344);
  Int_t niter=100;
  Float_t xmu=0.;
  Float_t xsig=1.;
  for ( Int_t  i=0; iGaus(xmu,xsig);
    main->Fill(xmain);
  }
  gStyle->SetOptFit(0111);
  main->Fit("gaus","ME");
  main->GetYaxis()->SetTitle("N");   
  main->GetXaxis()->SetTitle("x");   
  main->Draw();
  c1->Update();
  TPaveStats *stats1 = (TPaveStats*)main->GetListOfFunctions()->FindObject("stats");
  main->GetFunction("gaus")->SetLineColor(2);
  stats1->SetTextColor(2); 
  stats1->SetX1NDC(0.70); stats1->SetX2NDC(0.90); stats1->SetY1NDC(0.70);
  c1->Update();
  c1->Modified();
}