# Merging 2 trees contents event-by-event

**URL:** <https://root-forum.cern.ch/t/merging-2-trees-contents-event-by-event/56215>\
**Category:** ROOT\
**Created:** [August 30, 2023, 6:49am UTC](https://root-forum.cern.ch/t/merging-2-trees-contents-event-by-event/56215 "2023-08-30T06:49:25Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![pcanal](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pcanal/32/12439_2.png) [@pcanal](https://root-forum.cern.ch/u/pcanal)\
**Post date:** [September 12, 2023, 4:28pm UTC](https://root-forum.cern.ch/t/merging-2-trees-contents-event-by-event/56215/7 "2023-09-12T16:28:49Z")

</div>

> [@mmaneyro](#):
>
> Exacly, what I’m looking for is T3 with branches A’ B’ C’, where A’=A+D and so on.

If the data inside the branch needs to be ‘merged’ in any way, you will need to create a new `TTree` based on the original `TTree` and its `Friend` using a tool that let you express the type of merging operation you mean (I.e. addition of value or concatenation of collections, etc.).

For this I recommend you investigate the use of [`SnapShot`](https://root.cern.ch/doc/master/classROOT_1_1RDF_1_1RInterface.html#ac5903d3acec8c52f13cbd405371f7fb7) in [`RDF`](https://root.cern.ch/doc/master/classROOT_1_1RDataFrame.html)

---

_[View the full topic](https://root-forum.cern.ch/t/merging-2-trees-contents-event-by-event/56215)._
