# Tree splited when saving to root files

**URL:** <https://root-forum.cern.ch/t/tree-splited-when-saving-to-root-files/15674>\
**Category:** ROOT\
**Created:** [February 18, 2013, 7:35pm UTC](https://root-forum.cern.ch/t/tree-splited-when-saving-to-root-files/15674 "2013-02-18T19:35:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![SongofHeaven](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/a5b964/32.png) [@SongofHeaven](https://root-forum.cern.ch/u/SongofHeaven)\
**Post date:** [February 18, 2013, 7:35pm UTC](https://root-forum.cern.ch/t/tree-splited-when-saving-to-root-files/15674/1 "2013-02-18T19:35:03Z")

</div>

Hi,all:  
I currently keeps geting problems creating trees to store the data from muDST files.

in my script, I create only one tree to store the data,

```auto
 TFile *f = new TFile(outroot, "RECREATE");
 TTree *tpc = new TTree("tpc","Reconst ntuple");
 tpc->Branch("ePVz", &ePVz);
 tpc->Branch("eMult",&eMult);
 tpc->Branch("tPhi", &tPhi);
 tpc->Branch("tEta", &tEta);
 tpc->Branch("tPt", &tPt);
 tpc->Branch("tCharge", &tCharge);
//do stuff
f=tpc->GetCurrentFile();
tpc->Write();
f->Close();
```

but in the final root files, there would be two trees having the same name “tpc” with number tags.

I really don’t know what’s wrong with the code.  
Can anyone give any suggestion?

Regards.

---

<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:** [February 18, 2013, 7:39pm UTC](https://root-forum.cern.ch/t/tree-splited-when-saving-to-root-files/15674/2 "2013-02-18T19:39:17Z")

</div>

[url][Aux;1 aux;2 aux3;](https://root-forum.cern.ch/t/aux-1-aux-2-aux3/13345/1)
