# How can I access a tree with a whitespace in the name?

**URL:** <https://root-forum.cern.ch/t/how-can-i-access-a-tree-with-a-whitespace-in-the-name/51185>\
**Category:** ROOT\
**Created:** [August 14, 2022, 3:57pm UTC](https://root-forum.cern.ch/t/how-can-i-access-a-tree-with-a-whitespace-in-the-name/51185 "2022-08-14T15:57:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bouchamaouihichem](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bouchamaouihichem/32/30578_2.png) [@bouchamaouihichem](https://root-forum.cern.ch/u/bouchamaouihichem)\
**Post date:** [August 14, 2022, 3:57pm UTC](https://root-forum.cern.ch/t/how-can-i-access-a-tree-with-a-whitespace-in-the-name/51185/1 "2022-08-14T15:57:39Z")

</div>

Hi everyone,

I’m trying to access a tree “Tree 1” that has a whitespace in the name.  
“Tree 1-\>Scan()” is not working and google only returned a post from 6 years ago, so I was hoping there would be a fix by now. Cloning and renaming the tree is not convenient since I’m trying to peek at the data inside many large datasets that I’m not analyzing.  
Bonus question: Another issue I ran into is trees with the same name (e.g: Tree;1 Tree;2 Tree;3…). When doing “Tree-\>Scan()” I can only access the first tree. Is there a way to access the other trees?

Thank you,  
Hichem

---

<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:** [August 14, 2022, 7:31pm UTC](https://root-forum.cern.ch/t/how-can-i-access-a-tree-with-a-whitespace-in-the-name/51185/2 "2022-08-14T19:31:31Z")

</div>

```cpp
TTree *t;
gFile->GetObject("Tree 1", t); // or your_file->GetObject(...)
t->Scan("*");

```

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

---

<div class="post-metadata">

**Author:** ![bouchamaouihichem](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bouchamaouihichem/32/30578_2.png) [@bouchamaouihichem](https://root-forum.cern.ch/u/bouchamaouihichem)\
**Post date:** [August 18, 2022, 7:02pm UTC](https://root-forum.cern.ch/t/how-can-i-access-a-tree-with-a-whitespace-in-the-name/51185/3 "2022-08-18T19:02:49Z")

</div>

Hello,

Thank you for the reply, this fix solved my problem.

Hichem

---

<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:** [September 1, 2022, 7:03pm UTC](https://root-forum.cern.ch/t/how-can-i-access-a-tree-with-a-whitespace-in-the-name/51185/4 "2022-09-01T19:03:28Z")

</div>

Closed on September 1, 2022, 7:03pm UTC

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