[ROOT] TGraphErrors and Clone

From: Shawn Kwang (skwang@wam.umd.edu)
Date: Thu Jul 26 2001 - 18:31:43 MEST


I am trying to make a copy of (two) TGraphErrors using the code below:

====
void regx(..., TGraphErrors *mean1, TGraphErrors *sigma1, char *name1, char *name2)

<snip>

  TGraphErrors* grmean = new TGraphErrors(nhitbins,x,y,ex,ey);

  TGraphErrors* grsigma = new TGraphErrors(nhitbins,x,sigmay,ex,errey);

  //copy graphs to passed variables
  mean1 =  grmean->Clone();		<-------Line # 268
  mean1->SetName(name1);
  sigma1 = grsigma->Clone();
  sigma1->SetName(name2);

</snip>
====

The error I get when running the function is:
Error: Incorrect assignment to mean1, wrong type 'TObject*' 
FILE:/home/skwang/CAPR/CAPR.C LINE:268
(class TObject*)0x890a910

Is there another/better/correct way of copying a TGraphErrors?  This
function basically creates two graphs (grmean and grsigma), but I want to
"return" them to the main program by way of mean1 and sigma1, since I need
to use this function 5 times.  mean1 and sigma1 are declared in the main
program as TGraphErrors.

Thanks in advance,
Shawn Kwang

--
					skwang@wam.umd.edu
					skwang@glue.umd.edu



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:53 MET