Home | News | Documentation | Download

Read variables inside branch

Dear experts,

I’m trying to read output .root file from TMVA, but there is branch format, that I don’t know how to read.
Inside the tree there is branch BDTG, which contains several variables - outputs for different classes. How can I read them?
When I tried to setbranchaddress these as vector, root suggested to set as float, but in this case only first variable is read.

Solved: one should create struct:

 typedef struct {
        Float_t  bdt0;
        Float_t  bdt1;
        Float_t  bdt2;
       
    } bdt;

then declare the variable

bdt BDT;

then use it in SetBranchAddress:

t1->SetBranchAddress("BDTG",&BDT);
1 Like