Create files with MakeSelector to analyse a tree

Hi,
I would like to use the MakeSelector method to analyse trees. I create a simple tree to check. Inside a root session i did:
t->MakeSelector(“test”).
First i did not have any message indicating creation of text.C and test.h. However they are produced, but when looking on it especially the test.h, i can see that in comparison to what is described in some tutorials

https://www.slac.stanford.edu/BFROOT/www/doc/workbook/root3/histAnalysis-orig.h

Declaration of leaf types, as well as List of branches are missing. In the same file the code for the branch addresses and branch pointers definition in the init subroutine are also missing.

So finally i can’t process the analysis with the tree->process(“test”) command

does somebody have some idea to help me ? (sorry i am root’s beginner)

gerard

What is your ROOT version?

Post here the output of:
t->Print();

Try with the ROOT’s “hsimple.root” (with ROOT 5, you should see a message: “Files: test.h and test.C generated from TTree: ntuple”): { TFile *f = TFile::Open(gSystem->ExpandPathName("$(ROOTSYS)/tutorials/hsimple.root")); if ((!f) || f->IsZombie()) { delete f; return; } // just a precaution // f->ls(); TTree *t; f->GetObject("ntuple", t); if (!t) { delete f; return; } // just a precaution // t->Print(); t->MakeSelector("test"); }

1 Like

Also note that, according to the URL of your example, it refers to ROOT 3 (!!).
MakeSelector, in newer versions of ROOT, produces TTreeReaderValues instead of SetBranchAddress calls.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.