[ROOT] Re: Bug in TGraphAsymmErrors

From: Matt Palmer (palmer@hep.phy.cam.ac.uk)
Date: Tue Apr 01 2003 - 18:14:49 MEST


Hi, Sorry there were a couple of bugs in that - heres what it should be:

void TGraphAsymmErrorsFix::Set(Int_t n) {
	if (n < 0) n = 0;
	if (n == fNpoints) return;
		
	TGraph::Set(n);
	
	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[i] = 0;
		exl[i] = 0;
		eyh[i] = 0;
		eyl[i] = 0;
	}
	delete [] fEXlow;
	delete [] fEXhigh;
	delete [] fEYlow;
	delete [] fEYhigh;
	
	fEXhigh = exh;
	fEXlow = exl;
	fEYhigh = eyh;
	fEYlow = eyl;
}

Matt Palmer wrote:
> Hi,
> 
> TGraphAsymmErrors should override TGraph::Set(Int_t n) with a function 
> that looks something like this:
> 



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