# Is possible update TFile root in the same TTree?

**URL:** <https://root-forum.cern.ch/t/is-possible-update-tfile-root-in-the-same-ttree/28762>\
**Category:** ROOT\
**Created:** [April 20, 2018, 10:54pm UTC](https://root-forum.cern.ch/t/is-possible-update-tfile-root-in-the-same-ttree/28762 "2018-04-20T22:54:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andre](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/andre/32/16576_2.png) [@Andre](https://root-forum.cern.ch/u/Andre)\
**Post date:** [April 20, 2018, 10:54pm UTC](https://root-forum.cern.ch/t/is-possible-update-tfile-root-in-the-same-ttree/28762/1 "2018-04-20T22:54:28Z")

</div>

- ROOT 6.13/03 Built for linuxx8664gcc From heads/master@v6-13-02-109-g95bf30d, Mar 26 2018, 19:59:29

Hi,

I’m trying to save many output in the same TTree or the same TBranch.

1. What is happening:

```auto
TTree Apr 20 19:00 2018 T "Tree"
  px "px/D" 13122
  py "py/D" 13122
  pz "pz/D" 13122
  pt "pt/D" 13122
  e "e/D" 13121
  id "id/I" 6594
  Eta "Eta/D" 13123
  Phi "Phi/D" 13123
TTree Apr 20 18:55 2018 T "Tree"
  px "px/D" 11474
  py "py/D" 11474
  pz "pz/D" 11474
  pt "pt/D" 11474
  e "e/D" 11473
  id "id/I" 5770
  Eta "Eta/D" 11475
  Phi "Phi/D" 11475
TTree Apr 20 19:00 2018 T1 "Tree1"
  gama "gama/D" 869
  bx "bx/D" 867
  by "by/D" 867
  bz "bz/D" 867
  Nparticles "Nparticles/I" 475
TTree Apr 20 18:55 2018 T1 "Tree1"
  gama "gama/D" 869
  bx "bx/D" 867
  by "by/D" 867
  bz "bz/D" 867
  Nparticles "Nparticles/I" 475

```

The TTrees(`T,T,T1,T1`) is break in two, I would like that to be only (T,T1)one.

or I would like to put the second part in the final of the TBranch (`T,T1`) of the first.

this is like:

```auto
FILE *fout;
  fout = fopen(filename,"a");  

// "a" == save the output at the end of the file

```

What I’m using:

```auto
TFile *file = TFile::Open("pytHIa.root","UPDATE");

// UPDATE == result in what is describe in 
(1 item, above), break in two.

```

Is possible to do this? how can I do this?

Cheers, Andre

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [April 21, 2018, 6:32am UTC](https://root-forum.cern.ch/t/is-possible-update-tfile-root-in-the-same-ttree/28762/2 "2018-04-21T06:32:34Z")

</div>

> [@Aux;1 aux;2 aux3;](https://root-forum.cern.ch/t/aux-1-aux-2-aux3/13345/2):
>
> Search for “cycle” and/or “namecycle”, for example in: In a Nutshell: [Input and Output](https://root.cern.ch/d/input-and-output) . ROOT User’s Guide: [Input/Output](https://root.cern.ch/root/htmldoc/guides/users-guide/ROOTUsersGuide.html#inputoutput) : [Retrieving Objects from Disk](https://root.cern.ch/root/htmldoc/guides/users-guide/ROOTUsersGuide.html#retrieving-objects-from-disk) , [Subdirectories and Navigation](https://root.cern.ch/root/htmldoc/guides/users-guide/ROOTUsersGuide.html#subdirectories-and-navigation) . Just for reference: [some additional notes about GetObject, Get, FindObjectAny, FindKeyAny, ReadObj, ReadObjAny](https://root-forum.cern.ch/t/broken-tdirectoryfile-findobjectany-and-tdirectoryfile-findkeyany/20943/16) .

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [May 5, 2018, 6:32am UTC](https://root-forum.cern.ch/t/is-possible-update-tfile-root-in-the-same-ttree/28762/3 "2018-05-05T06:32:38Z")

</div>

Closed on May 5, 2018, 6:32am UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
