(no subject)

From: Federico Carminati (Federico.Carminati@cern.ch)
Date: Tue Mar 02 1999 - 16:08:48 MET


Rene, Fons, 

  consider this piece of macro

Double_t expo (Double_t *xx, Double_t *){return TMath::Exp(-(*xx));}

void fca() {
 gROOT->Reset();
 TF1 *fun = new TF1("expo",expo,0,2,0);
 fun->Draw();
 //c1->Update();
 TH1F *hist = fun->GetHistogram();
 hist->Draw("same");
}


If you do 

.L fca.C
 
and then type the content of the macro everything works as expected. If
you execute the macro it does not work. If you uncomment the update it
works.

The reason is simple. The fHistogram is created and filled by the Paint
method of TF1. This is called either at every return at the keyboard or by
the Update function of the canvas. But the behaviour is quite unexpected.
Somehow one would expect simple commands to behave the same way in a macro
or typed in...

Thanks to M.Kowalski for spotting this.

Ciao,


                                            Federico Carminati


==============================================================================
||                                                                          ||
||                _/_/_/_/_/_/_/        _/_/_/_/           _/               ||
||               _/                   _/      _/         _/ _/              ||
||              _/                  _/                 _/   _/              ||
||             _/_/_/_/_/_/       _/                 _/     _/              ||
||            _/                 _/                _/       _/              ||
||           _/                 _/               _/ _/_/_/_/_/              ||
||          _/                  _/       _/    _/           _/              ||
||         _/                    _/_/_/_/    _/             _/              ||
||                                                                          ||
==============================================================================
|| Federico Carminati             ||  Tel.: +41.22.767.4959                 ||
|| CERN-EP                        ||  Fax.: +41.22.767.9075                 ||
|| 1211 Geneva 23                 ||                                        ||
|| Switzerland                    ||                                        ||
==============================================================================



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