# Rooteventselector and multiple TTree with the same name

**URL:** <https://root-forum.cern.ch/t/rooteventselector-and-multiple-ttree-with-the-same-name/28096>\
**Category:** ROOT\
**Tags:** python, tree\
**Created:** [February 27, 2018, 11:15am UTC](https://root-forum.cern.ch/t/rooteventselector-and-multiple-ttree-with-the-same-name/28096 "2018-02-27T11:15:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Graipher](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/graipher/32/11624_2.png) [@Graipher](https://root-forum.cern.ch/u/Graipher)\
**Post date:** [February 27, 2018, 11:15am UTC](https://root-forum.cern.ch/t/rooteventselector-and-multiple-ttree-with-the-same-name/28096/1 "2018-02-27T11:15:10Z")

</div>

I want to use the nice commandline tool `rooteventselector` to apply a simple selection on a tree.

The file looks like this:

```auto
DYTuple/
    DecayTree;73
    DecayTree;72
    DecayTree;71

```

The different trees with the same name are of course the different revisions from writing the file. However, if I try to use this with `rooteventselector source.root:DYTuple/DecayTree dest.root`, it complains about those duplicate names and does not process them, instead of taking the most recent revision like all other ROOT tools I know of:

```auto
WARNING: Same name objects aren't supported: 'DYTuple/DecayTree' of 'source.root' won't be processed

```

Is there a way to specify that only the latest revision should be taken or a simple way to remove the redundant revisions (since I don’t actually need them)?

---

<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 27, 2018, 1:22pm UTC](https://root-forum.cern.ch/t/rooteventselector-and-multiple-ttree-with-the-same-name/28096/2 "2018-02-27T13:22:09Z")

</div>

just a guess, have you tried:

```auto
rooteventselector source.root:DYTuple/DecayTree;73 dest.root

```

?

---

<div class="post-metadata">

**Author:** ![Graipher](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/graipher/32/11624_2.png) [@Graipher](https://root-forum.cern.ch/u/Graipher)\
**Post date:** [February 27, 2018, 1:24pm UTC](https://root-forum.cern.ch/t/rooteventselector-and-multiple-ttree-with-the-same-name/28096/3 "2018-02-27T13:24:11Z")

</div>

Yes, I also tried that (quoting the file name because `;` has a special meaning in the shell). In that case it does not find the tree at all:

```auto
$ rooteventselector 'source.root:DYTuple/DecayTree;73' dest.root --selection "..."
WARNING: can't find DYTuple/DecayTree;73 in source.root

```

---

<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 27, 2018, 1:30pm UTC](https://root-forum.cern.ch/t/rooteventselector-and-multiple-ttree-with-the-same-name/28096/4 "2018-02-27T13:30:42Z")

</div>

Does `rootcp` has the same problem with your file ?

---

<div class="post-metadata">

**Author:** ![Graipher](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/graipher/32/11624_2.png) [@Graipher](https://root-forum.cern.ch/u/Graipher)\
**Post date:** [February 27, 2018, 1:33pm UTC](https://root-forum.cern.ch/t/rooteventselector-and-multiple-ttree-with-the-same-name/28096/5 "2018-02-27T13:33:24Z")

</div>

Yes, it does. Since they both use the [same underlying method](https://github.com/root-project/root/blob/master/main/python/cmdLineUtils.py#L478) to determine the source and destination, this is not very surprising, though.

---

<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 27, 2018, 1:40pm UTC](https://root-forum.cern.ch/t/rooteventselector-and-multiple-ttree-with-the-same-name/28096/6 "2018-02-27T13:40:22Z")

</div>

I was asking because `rootcp` help says:

_Note: If an object has been written to a file multiple times, rootcp will copy only the latest version of that object._

So I would have assumed `rooteventselector` does the same.

---

<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:** [March 13, 2018, 1:40pm UTC](https://root-forum.cern.ch/t/rooteventselector-and-multiple-ttree-with-the-same-name/28096/7 "2018-03-13T13:40:28Z")

</div>

Closed on March 13, 2018, 1:40pm UTC

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