# TTreeFormula support only 2 level of variables size collecti

**URL:** <https://root-forum.cern.ch/t/ttreeformula-support-only-2-level-of-variables-size-collecti/15219>\
**Category:** ROOT\
**Created:** [November 8, 2012, 7:12pm UTC](https://root-forum.cern.ch/t/ttreeformula-support-only-2-level-of-variables-size-collecti/15219 "2012-11-08T19:12:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![faustus123](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/faustus123/32/19754_2.png) [@faustus123](https://root-forum.cern.ch/u/faustus123)\
**Post date:** [November 8, 2012, 7:12pm UTC](https://root-forum.cern.ch/t/ttreeformula-support-only-2-level-of-variables-size-collecti/15219/1 "2012-11-08T19:12:29Z")

</div>

Hi,

I have a hierarchy of data classes I would like to represent in a ROOT tree. One class has an STL vector in it that holds objects of another class which contains an STL vector of a 3rd class. The 3rd class has an STL vector of integers.

The problem is that it seems ROOT is limited to at most 2 levels of nested containers. The code compiles and runs OK, but when I try accessing this 3rd level container in the ROOT file, it gives the message below. I also noticed that it comments out lines related to these 3rd level containers in code generated by TTree::MakeSelector().

I’m wondering if there is a way to get around this limitation so I could have more levels of containers? Is the issue tied to using STL vectors as opposed to TClonesArray? Any advice would be appreciated.

I’ve attached a tarball with minimal example code that illustrates the problem.

[quote]\>root -l test.root  
Executing ~/.rootlogon.C  
root [0]  
Attaching file test.root as \_file0…  
Warning in TClass::TClass: no dictionary for class Event is available  
Warning in TClass::TClass: no dictionary for class Vertex is available  
Warning in TClass::TClass: no dictionary for class Particle is available  
root [1] tr-\>Draw(“verticies.particles.daughters”)  
Warning in TTreeFormula::DefinedVariable: TTreeFormula support only 2 level of variables size collections. Assuming ‘@’ notation for the collection daughters.  
Info in TCanvas::MakeDefCanvas: created default TCanvas with name c1  
Warning in TSelectorDraw::ProcessFillObject: Not implemented for vector  
root [2] [/quote]  
[ROOT\_Tree\_nested\_containers.tgz](https://root-forum.cern.ch/uploads/default/original/2X/2/28026cf684117a5bf57f841556c010a3328be3ee.tgz) (1.24 KB)

---

<div class="post-metadata">

**Author:** ![pcanal](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pcanal/32/12439_2.png) [@pcanal](https://root-forum.cern.ch/u/pcanal)\
**Post date:** [October 1, 2013, 12:27am UTC](https://root-forum.cern.ch/t/ttreeformula-support-only-2-level-of-variables-size-collecti/15219/2 "2013-10-01T00:27:52Z")

</div>

[quote]The problem is that it seems ROOT is limited to at most 2 levels of nested containers. [/quote]Yes, this is a hard limit in TTreeFormula. To work around it you will need to use the TTree::Draw that takes a script as input, or TTree::MakeProxy or TTree::MakeSelector.

Cheers,  
Philippe.
