Problem with TTRee::MakeClass

I’ve a problem with TTRee::MakeClass. I’m using the SVN version with a fixed problem, it substitues the “,” with “_” , but the class doesn’t work. I attach my TTree. What I do is:

TString nameFile = "decaytree.root"

TFile f(nameFile);
TDirectory* dir = (TDirectory*) f.Get("DsDs");
TTree* t = (TTree*) dir->Get("Selection");

t->MakeClass("MyClass");

.L MyClass.C
MyClass t
t.GetEntry(12);

and I get a segmentation fault and a lot of errors.
decaytree.root (1.18 MB)

I forgot to replace the comma when generating teh code for the branch declaration. Now fixed in SVN. I tested that it works with your example. Thanks for the report.

Rene

I think there is another problem to be fixed: the directory. If you try the code

MyClass c
c.GetEntry(12)
c.eventnumber // this and all other variables are equal to zero!

If you browse my file you see that there is a directory calles DsDs, and the script MyClass doesn’t open it. I’ve changed this line:

tree = (TTree*)gDirectory->Get("Selection");

with:

TDirectory* dir = (TDirectory*) f.Get("DsDs");
      tree = (TTree*) dir->Get("Selection");

and it’s work.

To generate the code do

TFile f("decaytree.root"); DsDs.cd(); Selection.MakeClass("MyClass")
Rene