Is it a bug or a feature

From: Marek Kowalski (kowalski@hpion-1.ifj.edu.pl)
Date: Mon Jan 18 1999 - 09:03:19 MET


I am afraid my mail have been cut. I am sending it once more.


Dear Rooters,

I have found the following problem. I work with several histograms and to be 
able to keep them for a while on the display I use the fake reading of a single 
character.

Below is a part of the function I call.

void r_macro(Float_t gain, Int_t row, Int_t zero, Float_t noise)
{
 char *s = new char[1];
 gSystem->Load("resolution/resolution.sl");
 resolution(gain,row,zero,noise);
 TH1F *h1 = (TH1F*)gROOT->FindObject("resy");
 TH1F *h2 = (TH1F*)gROOT->FindObject("resz");
 TH1F *h3 = (TH1F*)gROOT->FindObject("cluy");
 TH1F *h4 = (TH1F*)gROOT->FindObject("cluz"); 
 
  h1->Draw();
 h1->Fit("gaus");
 
 
 gets(s);

 h2->Draw();
 h2->Fit("gaus");
 

 gets(s);
 
 ................}
 
 
 
 The result is:
 
 
 1. the canvas for h1 is opened, but nothing is drawn
 2. h1 is fitted, the parameters are printed, nothing is drawn
 3. after entering the character "s" h2 is fitted and drawn.
 
 
 So I have modified my function in the following way, forcing the canvas
 update
 
 
 void r_macro(Float_t gain, Int_t row, Int_t zero, Float_t noise)
{
 char *s = new char[1];
 gSystem->Load("resolution/resolution.sl");
 resolution(gain,row,zero,noise);
 TH1F *h1 = (TH1F*)gROOT->FindObject("resy");
 TH1F *h2 = (TH1F*)gROOT->FindObject("resz");
 TH1F *h3 = (TH1F*)gROOT->FindObject("cluy");
 TH1F *h4 = (TH1F*)gROOT->FindObject("cluz"); 

TCanvas *c = new TCanvas("c","histograms");
 c->cd();
 h1->Draw();
 h1->Fit("gaus");
 c->Update();
 
 gets(s);

 h2->Draw();
 h2->Fit("gaus");
 c->Update();

 gets(s);
 
 ...............}
 
 
 Now it works fine. Is it a bug or I just have to like it?
 
 Regards, Marek Kowalski
 
 
 
 



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:28 MET