# Storing 2D vector \[--\> vector\<vector\<...\> \>\] into a TTree

**URL:** <https://root-forum.cern.ch/t/storing-2d-vector-vector-vector-into-a-ttree/14331>\
**Category:** ROOT\
**Created:** [May 22, 2012, 12:44pm UTC](https://root-forum.cern.ch/t/storing-2d-vector-vector-vector-into-a-ttree/14331 "2012-05-22T12:44:43Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![bvormwald](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/b/839c29/32.png) [@bvormwald](https://root-forum.cern.ch/u/bvormwald)\
**Post date:** [May 22, 2012, 12:44pm UTC](https://root-forum.cern.ch/t/storing-2d-vector-vector-vector-into-a-ttree/14331/1 "2012-05-22T12:44:43Z")

</div>

Hi ROOT experts!

I want to store a 2D vector into a ROOT Tree. I tried to find some information about this, but all I found didn’t really help.

This is more or less what I am doing:

```auto
  std::vector<std::vector<float> > _parFloatVal = std::vector<std::vector<float> >();
  tree->Branch("pafv", &_parFloatVal) ;

  for (int i=0; i<10; i++){
    for (int j=0; j<10; j++){
      std::vector<float> floatVec = std::vector<float>();
      floatVec.push_back(2.222); //just an example
      floatVec.push_back(3.333); //just an example
      _parFloatVal.push_back(floatVec);
    }
    tree->Fill();
  }
```

I also already tried to include at the beginning of my class definition

```auto

```

but this also didn’t work out.

I need to have the code compiled without CINT, but with the normal GCC compiler. Compiling seems to be no problems, at least I get no error messages. But if I check the saved tree after a successful run the branch “pafv” simply doesn’t exist. Currently I am using ROOT 5.18.

Is there anything I do wrongly? How can this be done correctly?

---

_[View the full topic](https://root-forum.cern.ch/t/storing-2d-vector-vector-vector-into-a-ttree/14331)._
