RE: TTree::Draw()/Scan() with deeply nested std::vectors

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Tue, 15 Nov 2005 10:02:37 -0600


Hi Stan,

TTree::Draw can only only 2 levels of variable size arrays within an event (the equivalent of a total of 3 nested loops including the loop over the events).

After your reach the 2nd variable size arrays within an event, the automatic unrolling of the container is diabled (because it would not be able to plot them anyway).

The error message indicates that TTree::Draw has not automatically unrolled the 3rd vector and is looking for the next information (foo4) directly on the vector instead of its content.

Cheers,
Philippe.

-----Original Message-----
From: owner-roottalk_at_pcroot.cern.ch [mailto:owner-roottalk_at_pcroot.cern.ch] On Behalf Of Stan Seibert
Sent: Tuesday, November 15, 2005 9:26 AM To: roottalk_at_pcroot.cern.ch
Subject: [ROOT] TTree::Draw()/Scan() with deeply nested std::vectors

I recently stumbled on a problem using TTree::Draw()/TTree::Scan() with a TTree that contains a branch of objects with deeply nested vectors.

For example, I have a branch in my TTree which contains C1 objects. Each C1 object contains a vector of C2 objects, and each C2 object contains a vector of C3 objects, and each C3 object contains a vector of C4 objects. If I try to Draw() or Scan() a member variable in C1, C2, or C3, I get the expected behavior. (That is, it iterates over all the nested lists down to the variable I have requested.)

However, if I try to Draw() or Scan() a member of C4, I receive the following error:

Error in <TTreeFormula::DefinedVariable>: foo4 is not a datamember of vector<C4>

*ERROR 30 :
Bad numerical expression : "c1.c2.c3.c4.foo4"

This is curious, since foo4 is a member of C4, but clearly not a member of vector<C4>. I can confirm this behavior on ROOT 4.04.02g and 5.06.00.

I have attached a simplified script which reproduces this error. Since it uses vectors of user-defined objects, you have to run it with ACLiC:

root nest.C+

---
Stan Seibert
Received on Tue Nov 15 2005 - 17:03:57 MET

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:13 MET