Re: [ROOT] Problem drawing functions

From: Ray Fliller III (rfliller@bnl.gov)
Date: Tue Jul 23 2002 - 15:46:12 MEST


On 23 Jul 2002, Fons Rademakers wrote:

Actually, I have a similar problem.  It seems to be in the TCanvas class
(TPad or TVirtualPad maybe??)  It I do

TCanvas *c=TCanvas("c","foo")

I get the same message <<Warning in <TCanvas::ResizePad>: c1 height
changed from 0 to 10>>.  And no canvas drawn.

 I an using v 3.03/07 as of today on Mandrake Linux.  I am installing 
v 3.02/07 to see if it presists there.



> Does this still not work? Could be an AFS cache issue.
> 
> Cheers, Fons.
> 
> 
> On Fri, 2002-07-19 at 19:35, Alberto Garcia Raboso wrote:
> > Hi,
> > 
> > I'm trying two draw two functions in the same Pad using the code given
> > below. 5 minutes ago, it worked. But now, without changing anything, it
> > doesn't. I get the message <<Warning in <TCanvas::ResizePad>: c1 height
> > changed from 0 to 10>> and no graph.
> > 
> > I've got not to get the error dropping out the option "same" when
> > drawing fun.
> > 
> > I'm running v. 3.03/02 on lxplus.
> > 
> > Any idea? Thanks in advance.
> > 
> > Alberto
> > 
> > THE CODE:
> > 
> > #include "TMath.h"
> > #include "TF1.h"
> > #include "TCanvas.h"
> > 
> > void fit()
> > {
> > 	// Parameters of the function
> > 	Double_t par[5] = {145.0, 145.0, 295.0, 8550.0, 5200.0};
> > 	Double_t parAnt[3] = {-17.649, 4.905, 4.020};
> > 	// Create canvas
> > 	TCanvas *c1 = new TCanvas("c1","Fitting functions",1000,800);
> > 	// Function
> > 	TF1 *fun = new TF1("fitfun",TrajFunc,-700,700,5);
> > 	TF1 *fun2 = new TF1("fitant",TrajAnt,-700,700,3);
> > 	fun->SetParameters(par);
> > 	fun2->SetParameters(parAnt);
> > 	// Draw function
> > 	c1->SetGridx();
> > 	c1->SetGridy();
> > 	fun2->SetLineColor(6);
> > 	fun2->Draw();
> > //	fun->Draw("same");
> > 	c1->Update();
> > }
> > 
> > Double_t TrajFunc(Double_t *x, Double_t *par)
> > {
> > 		Double_t Raiz, Term1, Term2, Term3, Val;
> > 		
> > 		Raiz = TMath::Sqrt( par[3] * par[3] - TMath::Power((par[2] - par[3]) *
> > TMath::Sin(x[0]/512), 2) );
> > 		Term1 = - par[0] * TMath::Tan(x[0]/512);
> > 		Term2 = par[1] * TMath::Sin(x[0]/512) / ( Raiz * TMath::Abs(par[2] -
> > par[3]) );
> > 		Term3 = TMath::Sin(x[0]/512) * ( par[2]  * par[2] - 2 * par[2] *
> > par[3]) / ( par[3] * TMath::Cos(x[0]/512) + Raiz );
> > 		Val = - TMath::ATan((Term1 + Term2 + Term3) / par[4]);
> > 
> > 		return Val;
> > }
> > 
> > 
> > Double_t TrajAnt(Double_t *x, Double_t *par)
> > {
> > 		if(TMath::Abs(x[0]) < 10e-6)
> > 			return 0.0;
> > 
> >         Double_t Phi1, Phi2, Val;
> > 
> > 		Phi2 = TMath::ACos( (par[0] + par[1] * par[1]) / ( (par[1] *
> > TMath::Sqrt( TMath::Power((par[2] -
> > par[0]/par[2])/(2*TMath::Sin(x[0]/512)), 2) + par[0] ) ) ) ); 
> > 		Phi1 = TMath::ACos( (par[0] + par[2] * par[2]) / ( (par[2] *
> > TMath::Sqrt( TMath::Power((par[2] -
> > par[0]/par[2])/(2*TMath::Sin(x[0]/512)), 2) + par[0] ) ) ) );
> > 		Val = -TMath::Sign(1.0, x[0]) * (Phi2 - Phi1);
> > 
> > 		return Val;
> > }
> 

-- 

 RAINMAN
      "How much does a piece of gum cost Ray?"
      "About $100."
      "How much does a new car cost Ray?"
      "`Bout $100."
      "There goes working for NASA!"

==================================================================
Ray Fliller: rfliller@bnl.gov      Office Phone: (631)-344-6124 
C-A Accelerator Physics            Dept. Fax: (631)-344-5954
Building 911B
Brookhaven National Lab
Upton, NY 11973                    Office: Room 211

http://www.agsrhichome.bnl.gov/People/rfliller/
==================================================================



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:00 MET