TTreeReader and TVector3

Hello, I cannot seem to get my TTreeReader to read TVector3s.

I’ve attached my code below.

I simply run:

 TChain* fChain = new TChain("T"); fChain->AddFile("anamuse.root");

And I get the error:

 Error in <TTreeReaderValueBase::GetBranchDataType()>: Unknown type and class combination: -1, TVector3
 Error in <TTreeReaderValueBase::CreateProxy()>: The branch recon_vertex contains data of type {UNDETERMINED TYPE}, which does not have a dictionary.

MuseSelector.C (2.2 KB)

I would really appreciate some help from fellow ROOTers

Hi Noah,

Sorry it took so long! I doubt that TTreeReader is able to convert a TVector3 to a TTreeReadArray<double>. Does it work if you declare it as TTreeReadValue<TVector3>?

Cheers, Axel.

I apologize, I uploaded the wrong piece of code, I have been declaring it as TTreeReaderArray and it still will not work. Thank you.

Sorry, my fingers didn’t do what my brain asked them to type. I meant to write TTreeReadValue<TVector3>. (I have edited my post.)

Does that help?

work, they both return the same error as in my original post.

Hmm too bad, Noah, time for me to spin up gdb and debug what’s happening. I’ll be back…

Even worse - it works for me:

 root.exe -l -b vec3.root
root [0]
Attaching file vec3.root as _file0...
(TFile *) 0x7f8fb8671e20
root [1] TTreeReader r("t")
(TTreeReader &) Name: TTreeReader Title: A simple interface to read trees
root [2] TTreeReaderValue<TVector3> v(r, "v3")
(TTreeReaderValue<TVector3> &) @0x106cea110
root [3] r.Next()
(bool) true
root [4] v->X()
(double) 0.1
root [5] v->Z()
(double) 0.3
root [6] t->Print()
*Tree    :t         : vec3                                                   *
*Entries :        1 : Total =             984 bytes  File  Size =        492 *
*        :          : Tree compression factor =   1.04                       *
*Br    0 :v3        : TVector3                                               *
*Entries :        1 : Total  Size=        599 bytes  File Size  =        114 *
*Baskets :        1 : Basket Size=      32000 bytes  Compression=   1.04     *

Can you send tree->Print() for your tree?

Cheers, Axel.

Yep, I get the same sort of output as you. Except TTreeReaderValue doesn’t work for me.

What Version of ROOT are you using? I’m using v6-08-06

Ha! Indeed, I can reproduce this issue in 6.08/06.

It works not only in the master, but also with e.g. 6.10.08. Can you upgrade?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.