Browse MyClass in TTree

Dear ROOTers,
I’ve searched a lot for a solution, but I’ve found nothing!
I’ve created some classes which inherit from TObject:

[code]class MyTrack : public TObject {

vector coordinate;


class MyDetector : public TObject {

vector tracks;


class MyEvent : public TObject {

vector info;
vector detectors;


All classes do perfectly work inside ROOT.

My problem is that when I store a MyEvent class in a TTree, I can’t use the Draw method to Draw all the coordinates:


Warning in <TTreeFormula::DefinedVariable>: TTreeFormula support only 2 level of variables size collections. Assuming '@' notation for the collection coordinate. Error in <TTreeFormula::DefinedVariable>: coordinate is not a datamember of vector<MyTrack> Error in <TTreeFormula::Compile>: Bad numerical expression : "MyEvent.detectors.tracks.coordinate"

I don’t want ROOT to assume “’@’ notation for the collection coordinate”!

How can I create a TTree without loseing the Draw functionality?
Is it the only chance to create an entry for each coordinate?

Thanks a lot to everyone!


The only options to make this work in TTree::Draw is to fix some of the dimensions.
For example you can do:mytree->Draw("MyEvent.detectors[0].tracks.coordinate"); mytree->Draw("MyEvent.detectors[1].tracks.coordinate>>+htmp");

Probably better yet, if the number of dectectors is fixed, you might simply want to replace the vector by a fixed size array.


Thanks for the answer.

I’ve tryed to fix some of the indexes, but it returns the same error!
I’ve tryed also with an array in place of a vector, but it has the same behavior.



The last thing to try is:mytree->Draw(""); mytree->Draw(">>+htmp");


PS. Did you try with a fixed size array?