Adding TGraph to a Directory

From: Christian Vogel <>
Date: Thu, 10 Mar 2005 11:03:21 +0100

Hi Root-Talk,

I don't know if this is a bug or I don't fully understand the semantics of root very well, but let me explain:

I put some values in a TErrorGraph and want to store that in the current Directory which works, but when I draw it into an empty canvas with its own axes, it complains about a replaced histogram and then it is gone from my directory. Try this:

	root [0] TGraphErrors *ge=new TGraphErrors(3);
	root [1] ge->SetName("mygraph");
	root [2] gDirectory->Add(ge);

	/* fill in some points */

	<TCanvas::MakeDefCanvas>: created default TCanvas with name c1
	Warning in <TH1::Build>: Replacing existing histogram: mygraph (Potential memory leak).
	root [10] .ls
	TROOT*          Rint    The ROOT of EVERYTHING
	root [11]

so to me it seems that root is creating a temporary histogram with the same name as my graph, deletes it again, and there goes my pretty graph :-(.

What's the lists oppinion? This is Root 4.00/08 on Gentoo linux.

	root [13] gROOT->GetVersion()
	(const char* 0x8478f5c)"4.00/08"

Greetings from Erlangen,


Everything is gone;
Your life's work has been destroyed.
Squeeze trigger (yes/no)?
-- David Carlson
Received on Thu Mar 10 2005 - 11:04:00 MET

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:05 MET