Hi ROOTers,
I'm trying to use STL vectors in trees. Vectors are by FAR easier to work with than TClonesArrays, so I want to use them in our code. However, the resulting TTrees do not work with TTree::Draw commands. I'm using ROOT 5.13 and 5.14 for my tests.
Problem (1)
template<class T>
class Vector : public std::vector<T>, public TObject
{
....
}
Vector<Thing>* a;
tree->Branch("branch","Vector<Thing>",&a);
I make sure that Thing and Vector<Thing> are correctly built with rootcint. The resulting root tree, however, is pretty ugly:
tree->Print() throws errors of Error in <TStreamerInfo::BuildOld>: Could not find STL base class: vector<Thing> for Vector<Thing>
tree->Draw commands are not simple. If I have two vectors with
overlapping leaf names, then there is no way to specify which tree I
want to draw. That is,
tree->Draw("branch.mElement") doesn't work.
What does work is
tree->Draw("vector<Thing>.mElement")
but it gives inconsistent results! Subsequent draw commands, like
tree->Draw("vector<Thing>.mElement - 10")
will give different plots!
Problem (2)
template <class T>
class Vector : public TObject
{
...
private:
std::vector<T> mV
};
However, this gives a similar problem... you cannot address specific branches on the tree.
tree->Draw("branch.mV.mElement");
Error in <TTreeFormula::Compile>: Bad numerical expression :
"branch.mV.mElement"
tree->Draw("branch.mV[0].mElement");
Error in <TTreeFormula::Compile>: Bad numerical expression :
"branch.mV[0].mElement"
This is useless if you have two Vector objects with similarly-named mElement leaves.
Problem(3)
In all of these problems, I THINK it's because I have my splitlevel turned up quite high. I would like to keep this since it allows much faster data retrieval.
Any advice what I should try?
--Nathaniel Tagg Received on Fri Feb 23 2007 - 14:32:17 CET
This archive was generated by hypermail 2.2.0 : Fri Feb 23 2007 - 17:50:01 CET