[ROOT] Bug in TGraphAsymmErrors

From: Matt Palmer (palmer@hep.phy.cam.ac.uk)
Date: Tue Apr 01 2003 - 17:51:48 MEST


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