# TTree::Scan/Draw an element of a std::vector over entries

**URL:** <https://root-forum.cern.ch/t/ttree-scan-draw-an-element-of-a-std-vector-over-entries/50311>\
**Category:** Newbie\
**Created:** [June 8, 2022, 12:22pm UTC](https://root-forum.cern.ch/t/ttree-scan-draw-an-element-of-a-std-vector-over-entries/50311 "2022-06-08T12:22:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Crisps](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/crisps/32/39101_2.png) [@Crisps](https://root-forum.cern.ch/u/Crisps)\
**Post date:** [June 8, 2022, 12:22pm UTC](https://root-forum.cern.ch/t/ttree-scan-draw-an-element-of-a-std-vector-over-entries/50311/1 "2022-06-08T12:22:26Z")

</div>

Dear experts

I tried to Scan (and Draw) a certain element of a std::vector in a Tree, but failed to use std::at(), like

```auto
tree->Scan("x0.at(pos)")

```

where pos is another value saved in the tree (int). Is there any way to reach the certain element of std::vectors?

---

<div class="post-metadata">

**Author:** ![FoxWise](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/foxwise/32/37588_2.png) [@FoxWise](https://root-forum.cern.ch/u/FoxWise)\
**Post date:** [June 8, 2022, 2:04pm UTC](https://root-forum.cern.ch/t/ttree-scan-draw-an-element-of-a-std-vector-over-entries/50311/2 "2022-06-08T14:04:05Z")

</div>

Does accessing with `[]` work?

`tree->Draw("x0[pos]")`

---

<div class="post-metadata">

**Author:** ![Crisps](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/crisps/32/39101_2.png) [@Crisps](https://root-forum.cern.ch/u/Crisps)\
**Post date:** [June 8, 2022, 2:11pm UTC](https://root-forum.cern.ch/t/ttree-scan-draw-an-element-of-a-std-vector-over-entries/50311/3 "2022-06-08T14:11:43Z")

</div>

It works! Thank you 🙂
