Re: [ROOT] TGraph

From: Oliver Mang (mang@ifkas1.ifkhep.uni-kiel.de)
Date: Wed Feb 28 2001 - 03:25:28 MET


Hi Angela,

as you don't give an example of your code, I can only make a rough guess.
I assume your macro looks like this:
{
  TGraph mygraph(...);
  [...]
  mygraph->Draw();  
}
In this case, the TGraph is created on the stack and exists only inside
the macro, i.e. it will disappear when the macro finishes execution. This
is normal C/C++ behaviour.
If you change your macro to

TGraph mygraph();
{
  [...]
}
then mygraph will be a global object and 'survive' the end of macro
execution (even without being drawn). You should be able to locate it with
gROOT->FindObject() _if_ you named your TGraph with SetName() (TGraphs
have to have their names explicitly set).

HTH,
Oliver
-- 
Oliver Mang
HEGRA - High Energy Gamma Ray Astronomy
Institut fuer Experimentelle und Angewandte Physik, CAU Kiel
Phone: ++49/431/880-2482	E-Mail: mang@ifkhep.uni-kiel.de
---------------------------------------------------------------
"The future is not what it used to be"



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