Problem with TBranchSTL

Hi all.

I have a function, buildTree, that takes a tree and analyses the branches. It loops over the branches in the tree, analyses their type via the GetExpectedType function from TBranchSTL and then does something with it, which doesn’t really matter for now. The problem I have is, that GetExpectedType(ctype, t) sets ctype to 0 for every branch in the tree and I do not really understand why.

Here’s the function:

#include <iostream>
#include <vector>
#include <map>
#include <string>

#include <TROOT.h>
#include <TLorentzVector.h>
#include <TBranch.h>
#include <TBranchSTL.h>
#include <TClass.h>
#include <TObjArray.h>
#include <TTree.h>
#include <TBits.h>
#include <TChain.h>

// [...]

void myClass::buildTree(TTree* tree) {

    TObjArray* branches =  tree -> GetListOfBranches();
    string name;

    EDataType t;
    TClass* cc;
    string type;

    for(int ib = 0; ib < branches -> GetEntries(); ++ib) {

        name = (string)( ((*branches)[ib]) -> GetName());
        ((TBranchSTL*)((*branches)[ib])) -> GetExpectedType(cc,t);

        // vector or container 
        if( t == -1 )
            type = (string)(cc -> GetName());

        std::cout << "for " << name << " we find the type " << cc << " (" << type << ") " << std::endl;

        // here we start doing something with it
        // [...]

   }
}

// [...]

This returns the full list of all branches in the tree, but at the place of cc it returns “0” and for type it returns nothing.

You have any idea on why this is?

Thank you in advance,
heico

The return of GetEntryType is 0 for all branches, i.e. it’s successful.
This suggests that it cannot make much of the data types in the tree I’m reading, no?
However, in the tree, there are only int and floats (and vectors thereof)…

heico

Sorry, due to time pressing on my shoulders today, I was a bit too quick with my post here. Meanwhile I found some ROOT experts in real life and they figured out the problem. The tree I am trying to read has been created with pyROOT, and the file types are missing apparently.

heico