Hi,
I have a problem reading a tree that I have created. To demonstrate the “feature” I have created an example macro:
[code]#include “TObject.h”
#include “TTree.h”
#include “TFile.h”
class testclass : public TObject {
public:
testclass () { n=0; test_array=0; }
virtual ~testclass () { delete[] test_array; }
void Clear (Option_t* opt="") { delete[] test_array; n=0; test_array=0; }
Int_t n;
Double_t *test_array; //[n]
ClassDef (testclass,1); // Test class
};
void makeerror () {
TFile::Open(“tmp.root”, “RECREATE”);
testclass *test = new testclass ();
TTree* tree = new TTree(“tree”, “tree”);
tree->Branch(“test”, &test);
for (int i=0; i<1000; i++) {
test->Clear();
test->n = 400;
test->test_array = new Double_t[test->n];
for (int i=0; in; i++)
test->test_array[i] = i;
tree->Fill ();
}
TFile *out = TFile::Open(“makeerror.root”, “RECREATE”);
tree->Write();
out->Close();
}
[/code]
I run this with:
which correctly creates the file makeerror.root.
Now I try to do a plot with this tree like this:
$ root -l makeerror.root
root [1] tree->Draw("test_array")
<TCanvas::MakeDefCanvas>: created default TCanvas with name c1
Error: Symbol G__exception is not defined in current scope (tmpfile):1:
Error: type G__exception not defined FILE:(tmpfile) LINE:1
(void)0
*** Interpreter error recovered ***
root [2] .q
Does anyone know the solution to this problem? (by the way the error message is not very useful…)
Pierre-François