Re: [ROOT] bug in TGraph::RemovePoint(Int_t ipoint) ?

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon Jan 06 2003 - 09:37:07 MET


Hi David,

You have an error in your code.
Replace the line:
  for (int i=graph->GetN()-lastPoints; i<graph->GetN(); i++)
by
  Int_t i2 = graph->GetN();
  Int_t i1 = i2-lastPoints;
  for (int i=i1; i<i2; i++)

Rene Brun

On Mon, 6 Jan 2003, David d'Enterria wrote:

> Hi ROOT team,
> 
> I seem not to be able to remove the last point of a TGraph(Errors) in a 
> systematic way using RemovePoint(i):
> 
> The attached macro shows the case ...
> 
> root [19] .x /home/enterria/removeLastPoints.C(1)
> x[0]=5, y[0]=5, ex[0]=0.01, ey[0]=0
> x[1]=7, y[1]=7, ex[1]=0.02, ey[1]=0
> x[2]=9, y[2]=10, ex[2]=0.02, ey[2]=0
> x[3]=13, y[3]=14, ex[3]=0.01, ey[3]=0
> x[4]=15, y[4]=16, ex[4]=0.01, ey[4]=0
>  <I> Removing point 4 of the graph   // <--- here it works as expected ...
> 
> x[0]=5, y[0]=5, ex[0]=0.01, ey[0]=0
> x[1]=7, y[1]=7, ex[1]=0.02, ey[1]=0
> x[2]=9, y[2]=10, ex[2]=0.02, ey[2]=0
> x[3]=13, y[3]=14, ex[3]=0.01, ey[3]=0
> 
> root [20] .x /home/enterria/removeLastPoints.C(2)
> x[0]=5, y[0]=5, ex[0]=0.01, ey[0]=0
> x[1]=7, y[1]=7, ex[1]=0.02, ey[1]=0
> x[2]=9, y[2]=10, ex[2]=0.02, ey[2]=0
> x[3]=13, y[3]=14, ex[3]=0.01, ey[3]=0
> x[4]=15, y[4]=16, ex[4]=0.01, ey[4]=0
>  <I> Removing point 3 of the graph    // <-- what about point 4 ?
> 
> x[0]=5, y[0]=5, ex[0]=0.01, ey[0]=0
> x[1]=7, y[1]=7, ex[1]=0.02, ey[1]=0
> x[2]=9, y[2]=10, ex[2]=0.02, ey[2]=0
> x[3]=15, y[3]=16, ex[3]=0.01, ey[3]=0
> 
> Is this the expected behaviour of the function or I'm missing something 
> here ?
> 
> Thanks in advance,
> 
> --
>  David D'ENTERRIA                     PostDoctoral Research Scientist
>  Nevis Labs                  http://www.nevis.columbia.edu/~denterria
>  Columbia University, NY          mailto:denterria@nevis.columbia.edu
>  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>  PHENIX Group (Bldg 510C)                        tel: +1 631 344 7053
>  Brookhaven National Lab, Upton, NY 11973        fax: +1 631 344 3253
>  http://www.phenix.bnl.gov/~enterria          mailto:denterri@bnl.gov
>  ---------------------------------------------------------------------
> 
> 



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