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");


.L MyClass.C
MyClass t

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.


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

MyClass c
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");


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

and it’s work.

To generate the code do

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