# Attaching vector as a branch to an existing TTree

**URL:** <https://root-forum.cern.ch/t/attaching-vector-as-a-branch-to-an-existing-ttree/42193>\
**Category:** Newbie\
**Tags:** tree, root\
**Created:** [November 9, 2020, 11:57pm UTC](https://root-forum.cern.ch/t/attaching-vector-as-a-branch-to-an-existing-ttree/42193 "2020-11-09T23:57:49Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![jparlone](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/3e96dc/32.png) [@jparlone](https://root-forum.cern.ch/u/jparlone)\
**Post date:** [November 11, 2020, 4:11pm UTC](https://root-forum.cern.ch/t/attaching-vector-as-a-branch-to-an-existing-ttree/42193/5 "2020-11-11T16:11:12Z")

</div>

Hi Jakob,  
Thank you for the explanation on `RDataFrame`! It’s a tool I’ll definitely be using in the future. I believe this solution is being stopped from working by an error I encountered in previous code, but ignored on the basis it seemed to have no effect on my output. This error is detailed here: [Creating a TH1 type branch error](https://root-forum.cern.ch/t/creating-a-th1-type-branch-error/42239)

The error the `RDataFrame` produces looks like:

```auto
Error in <TBranchProxy::Read>: Unable to initialize BranchName
Error in <TTree::Branch>: Reference interface requires a valid object (for branch: BranchName!)
terminate called after throwing an instance of 'std::out_of_range'
  what(): vector::_M_range_check: __n (which is 1) >= this->size() (which is 1)

```

Best wishes,  
Jaiden

---

_[View the full topic](https://root-forum.cern.ch/t/attaching-vector-as-a-branch-to-an-existing-ttree/42193)._
