# Duplicated names in ROOT file

**URL:** <https://root-forum.cern.ch/t/duplicated-names-in-root-file/20536>\
**Category:** ROOT\
**Created:** [February 2, 2016, 3:50pm UTC](https://root-forum.cern.ch/t/duplicated-names-in-root-file/20536 "2016-02-02T15:50:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![yuraic](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/y/d9b06d/32.png) [@yuraic](https://root-forum.cern.ch/u/yuraic)\
**Post date:** [February 2, 2016, 3:50pm UTC](https://root-forum.cern.ch/t/duplicated-names-in-root-file/20536/1 "2016-02-02T15:50:33Z")

</div>

Hello,

I have some code that dumps a TTree object to a file. Do you know why I am seeing three trees when open the file?

```auto
root [1] .ls
TFile** output_electrons_v1.root
 TFile* output_electrons_v1.root
  KEY: TTree	JINRTree_Run2;19	HWW tree BDT
  KEY: TTree	JINRTree_Run2;18	HWW tree BDT
  KEY: TTree	JINRTree_Run2;17	HWW tree BDT
  KEY: TDirectoryFile	Environment;1	Environment
```

Thank you!  
Yuriy

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [February 2, 2016, 4:04pm UTC](https://root-forum.cern.ch/t/duplicated-names-in-root-file/20536/2 "2016-02-02T16:04:50Z")

</div>

search for “cycle” in :  
[root.cern.ch/root/htmldoc/guide … utput.html](https://root.cern.ch/root/htmldoc/guides/users-guide/InputOutput.html)

---

<div class="post-metadata">

**Author:** ![alexander.tuna](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/b5e925/32.png) [@alexander.tuna](https://root-forum.cern.ch/u/alexander.tuna)\
**Post date:** [July 11, 2017, 6:22pm UTC](https://root-forum.cern.ch/t/duplicated-names-in-root-file/20536/3 "2017-07-11T18:22:04Z")

</div>

Hi couet,

I think I don’t understand the documentation. I have multiple TTrees appearing in the output TFile, and this is confusing to anyone who opens the file but hasn’t read this forum. Am I supposed to live with this? Or am I missing the way of resolving it?

---

<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:** [July 11, 2017, 6:33pm UTC](https://root-forum.cern.ch/t/duplicated-names-in-root-file/20536/4 "2017-07-11T18:33:44Z")

</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:** ![alexander.tuna](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/b5e925/32.png) [@alexander.tuna](https://root-forum.cern.ch/u/alexander.tuna)\
**Post date:** [July 11, 2017, 7:15pm UTC](https://root-forum.cern.ch/t/duplicated-names-in-root-file/20536/5 "2017-07-11T19:15:36Z")

</div>

Thanks Wile. I saw this solution with TObject::kOverwrite, too. But I also noticed that for TTrees, we are explicitly told to call Write only on the TTree’s GetCurrentFile, and not on the TTree itself:

[https://root.cern.ch/doc/master/classTTree.html#TTree:ChangeFile](https://root.cern.ch/doc/master/classTTree.html#TTree:ChangeFile)

These seem like conflicting suggestions.
