Re: [ROOT] Bug in TGraphAsymmErrors

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Apr 01 2003 - 19:44:08 MEST


Hi Matt,

Thanks for reporting this problem.
I have added your function (2nd version) in CVS.

Rene Brun

On Tue, 1 Apr 2003, Matt 
Palmer wrote:

> Hi,
> 
> TGraphAsymmErrors should override TGraph::Set(Int_t n) with a function 
> that looks something like this:
> 
> void TGraphAsymmErrors::Set(Int_t n) {
> 	TGraph::Set(n);
> 	
> 	if (n < 0) n = 0;
> 	if (n == fNpoints) return;
> 	Double_t *exh=0, *exl=0, *eyh=0, *eyl=0;
> 	if (n > 0) {
> 		exh = new Double_t[n];
> 		exl = new Double_t[n];
> 		eyh = new Double_t[n];
> 		eyl = new Double_t[n];
> 	}
> 	Int_t i;
> 	for (i=0; i<fNpoints && i<n;i++) {
> 		if (fEXlow) exl[i] = fEXlow[i];
> 		if (fEXhigh) exh[i] = fEXhigh[i];
> 		if (fEYlow) eyl[i] = fEYlow[i];
> 		if (fEYhigh) eyh [i] = fEYhigh[i];
> 	}
> 	for (i=fNpoints; i<n;i++) {
> 		exh = 0;
> 		exl = 0;
> 		eyh = 0;
> 		eyl = 0;
> 	}
> 	delete [] fEXlow;
> 	delete [] fEXhigh;
> 	delete [] fEYlow;
> 	delete [] fEYhigh;
> 	
> 	fEXhigh = exh;
> 	fEXlow = exl;
> 	fEYhigh = eyh;
> 	fEYlow = eyl;
> }
> 
> Thanks
> Matt
> 



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:10 MET