ROOT Printf Function

Hello Root Experts,

I’m looking for some information on the ROOT Print function, the special ROOT version of printf. My goal is to read the results of printing a TTree’s branches into a string (so I can get the branch names), so I was trying to find out where Printf prints to. I tried reading cout into a buffer and it didn’t work.

If somebody could point me to some documentation or provide help, that would be great!


If you goals is to get the names of the branches, you are much better off getting it directly rather than through Printf:

// For the top level branches: TIter next( tree->GetListOfBranches() ); while( (TBranch *br = (TBranch*)next() ) { br->GetName(); }and if you are interested in the sub branches, you can recurse of the br->GetListOfBranches().


PS. You can grab the content of the printf by installing your own error message handler:

void myErrorHandler(int level, Bool_t abort, const char *location, const char *msg); ... SetErrorHandler(myErrorHandler);

See DefaultErrorHandler in TError.cxx for the implementation of the default version.