# Read variables inside branch

**URL:** <https://root-forum.cern.ch/t/read-variables-inside-branch/41619>\
**Category:** Newbie\
**Tags:** tree, root\
**Created:** [September 27, 2020, 7:13pm UTC](https://root-forum.cern.ch/t/read-variables-inside-branch/41619 "2020-09-27T19:13:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stepennov](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/85e7bf/32.png) [@Stepennov](https://root-forum.cern.ch/u/Stepennov)\
**Post date:** [September 27, 2020, 7:13pm UTC](https://root-forum.cern.ch/t/read-variables-inside-branch/41619/1 "2020-09-27T19:13:09Z")

</div>

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.

 ![Screen Shot 2020-09-27 at 10.08.38 PM](https://root-forum.cern.ch/uploads/default/original/3X/2/a/2af2312a6d9c2997822ff67f6950631c39bea879.png)

---

<div class="post-metadata">

**Author:** ![Stepennov](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/85e7bf/32.png) [@Stepennov](https://root-forum.cern.ch/u/Stepennov)\
**Post date:** [September 27, 2020, 7:36pm UTC](https://root-forum.cern.ch/t/read-variables-inside-branch/41619/2 "2020-09-27T19:36:54Z")

</div>

Solved: one should create struct:

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

```

then declare the variable

```auto
bdt BDT;

```

then use it in SetBranchAddress:

```auto
t1->SetBranchAddress("BDTG",&BDT);

```
