Dynamic array of TVector3 in an Class in a Tree?

Hi ROOTers,

I think I am missing something obvious here and would appreciate a pointer in the right direction.

I am trying to implement a class with a dynamic array of TVector3s for use in a tree and have run into an odd problem. Basically, any calls to Draw bomb with “Warning in TSelectorDraw::ProcessFillObject: Not implemented for TVector3”. Here is the class :

//TData.h:
#include "TObject.h"
#include "TVector3.h"
class TData:public TObject{
 public:
  TData(){};
  virtual ~TData(){};
  TVector3  fV0[2];
  int cnt;
  TVector3  *fV1;   //[cnt]
  ClassDef(TData,1)
};
//TData.cpp:
#include "TData.h"
ClassImp(TData)

and here is the tree code (test.C), which just makes a tree and writes it.

//test.C:
{
  #include "TData.h"
  TFile *of = new TFile("out.root","RECREATE");
  TTree * t = new TTree("t","Test Tree");
  TData dat;
  dat.cnt = 2;
  dat.fV1 = new TVector3[dat.cnt];
  
  t->Branch("dat", &dat);
  dat.fV1[0].SetXYZ(0,0,0);
  dat.fV1[1].SetXYZ(1,1,1);
  dat.fV0[0].SetXYZ(0,0,0);
  dat.fV0[1].SetXYZ(1,1,1);
  
  t->Fill();
  of->Write();
} 

This is all run like so:

root TData.cpp+
root[1] .x test.C

which generates the proper out.root file. Opening this file and trying to draw things is where the problem lies:
t->Draw(“fV0.fX”) => works fine

t->Draw(“fV1.fX”) => bombs with the error above.

Any tips??

Thanks!

 t->Draw("fV1:fX")

works fine for me.

Can you try this:

(accessing the fX member, rather than cross-plotting)?

BTW, I am using 5.34.36

Update - same error in ROOT 6.06.

If I use splitlevel 0 in the tree, then the error changes to:

[b]root [3] t->Draw(“dat.fV1.fX”)
Error in TTreeFormula::DefinedVariable: fV1.fX is a datamember of TData BUT is not yet of a supported type (501)
Error in TTreeFormula::Compile: Part of the Variable “dat.fV1.fX” exists but some of it is not accessible or useable
Info in TSelectorDraw::AbortProcess: Variable compilation failed: {dat.fV1.fX,}

[/b]

I recommend you try using a std::vector or a TClonesArray there of.

Cheers,
Philippe.