Re: [ROOT] graph array problem

From: Silvio Orsi (silvio@gluon.particle.kth.se)
Date: Thu Oct 10 2002 - 20:13:17 MEST


Hi Avdhesh,

Unfortunately you did not include in the email your classes data members.
It might be a trivial question, but did you specify gr to be a vector?
 TGraphErrors *gr[nent];

Cheers,
	Silvio



On Thu, 10 Oct 2002, Avdhesh Chandra wrote:

> 
> Hi,
>     I am trying to make graph array, so i can use it.
> 
>  programe looks like(where i am defining graph array)
> 
>  for(int i = 0 ; i < nent ; i++)
>    {
>      cout << "  Col[i]  " << Col[i] << endl;
>      gr[i] = new TGraphErrors(n,Z,Ent[i],Ez,Eent[i]);
>      gr[i]->SetMarkerColor(Col[i]);
>      gr[i]->SetMarkerStyle(Sty[i]);
>    }
> 
> when i am running my code  i am getting following message
> 
> ---------------------------------------------------
>   Col[i]  7
>   Col[i]  6
> Error: Array index out of range gr -> [1]  valid upto gr FILE:test.C
> LINE:156
> 
>  *** Break *** segmentation violation
> ---------------------------------------------------
> 
> 
> Which shows that when it goes secound time in the loop it having problem.
> Please let me know what i am doing worng.
> 
> Thanks for any help
> Avdhesh
> 



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