# Tree;1 and tree;2 in ROOT files

**URL:** <https://root-forum.cern.ch/t/tree-1-and-tree-2-in-root-files/14941>\
**Category:** ROOT\
**Created:** [September 17, 2012, 11:28am UTC](https://root-forum.cern.ch/t/tree-1-and-tree-2-in-root-files/14941 "2012-09-17T11:28:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![emitc2h](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/e/ebca7d/32.png) [@emitc2h](https://root-forum.cern.ch/u/emitc2h)\
**Post date:** [September 17, 2012, 11:28am UTC](https://root-forum.cern.ch/t/tree-1-and-tree-2-in-root-files/14941/1 "2012-09-17T11:28:05Z")

</div>

Hi,

I am creating a bunch of root files in which I create two trees: lh\_train and lh\_test. When I open these files, instead of just finding lh\_train and lh\_test, I find:

`root [0] 
Attaching file LHProcessor.PowHegPythia_ggH125_tautaulh.mc11c.root as _file0...
root [1] .ls
TFile** LHProcessor.PowHegPythia_ggH125_tautaulh.mc11c.root	
 TFile* LHProcessor.PowHegPythia_ggH125_tautaulh.mc11c.root	
  KEY: TTree	lh_train;2	
  KEY: TTree	lh_train;1	
  KEY: TTree	lh_test;2	
  KEY: TTree	lh_test;1`

And I find different numbers of events in ;1 and ;2. What is going on here? Why is ROOT splitting my trees in half? Do I need to consider all events found in ;1 and ;2, or is only one of these two real? I find that if I do

```auto

```

The number of events I see correspond to the number of events in lh\_train;2, the events in lh\_train;1 being completely dismissed. If I want access to the events in lh\_train;1, I need to call it explicitly:

```auto

```

Should I even bother retrieving events in lh\_train;1?

Cheers and thanks,  
Michel.

---

<div class="post-metadata">

**Author:** ![Pepe\_Le\_Pew](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pepe_le_pew/32/12365_2.png) [@Pepe\_Le\_Pew](https://root-forum.cern.ch/u/Pepe_Le_Pew)\
**Post date:** [September 17, 2012, 11:30am UTC](https://root-forum.cern.ch/t/tree-1-and-tree-2-in-root-files/14941/2 "2012-09-17T11:30:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![emitc2h](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/e/ebca7d/32.png) [@emitc2h](https://root-forum.cern.ch/u/emitc2h)\
**Post date:** [September 17, 2012, 12:16pm UTC](https://root-forum.cern.ch/t/tree-1-and-tree-2-in-root-files/14941/3 "2012-09-17T12:16:13Z")

</div>

Thanks! I suspected this has been discussed before, but I didn’t really know how to search for it…

---

<div class="post-metadata">

**Author:** ![emitc2h](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/e/ebca7d/32.png) [@emitc2h](https://root-forum.cern.ch/u/emitc2h)\
**Post date:** [September 17, 2012, 12:31pm UTC](https://root-forum.cern.ch/t/tree-1-and-tree-2-in-root-files/14941/4 "2012-09-17T12:31:32Z")

</div>

So if I understand correctly, a new cycle is created whenever I hit Tree-\>Write(). So I closely inspected my code to find out if I happened to call Write more than once for each tree, and I don’t. Another thing that happens however, is that these ntuples of mine are generated in parallel, and then I use hadd to combine them. Is it possible hadd creates more than one cycle?

---

<div class="post-metadata">

**Author:** ![Pepe\_Le\_Pew](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pepe_le_pew/32/12365_2.png) [@Pepe\_Le\_Pew](https://root-forum.cern.ch/u/Pepe_Le_Pew)\
**Post date:** [September 17, 2012, 1:24pm UTC](https://root-forum.cern.ch/t/tree-1-and-tree-2-in-root-files/14941/5 "2012-09-17T13:24:28Z")

</div>

[url][Tree copy after hadd](https://root-forum.cern.ch/t/tree-copy-after-hadd/13755/1)
