Use ROOT::Math::VectorUtils functions in TTree::CopyTree

Hi Rooters,

I use ROOT 5.22.
I am trying to copy a TTree applying a selection using the method TTree::CopyTree.
The string parsing of the selection works perfectly, but i cannot use for example the functions present in the ROOT::Math::VectorUtils namespace and i get a “Error in TTreeFormula::Compile: Bad numerical expression”.

Any suggestions?

Danilo

Hi Danilo,

Currently TTreeFormula (and hence TTree::Draw) can only use function and member functions that takes simple numerical object (i.e. no pointer to or reference to objects).

Cheers,
Philippe

Hello Philippe,

thanks for your fast feedback.
Indeed, I am interested in the function ROOT::Math::VectorUtil::Phi_mpi_pi, whose signature is double Phi_mpi_pi(double phi).
I think that my problem lies in the way in which I call the symbol and not in the arguments.
What do you think?

All the best,
Danilo

Hi Danilo,

The dictionary for ROOT::Math::VectorUtil::Phi_mpi_pi has not been generated. To work around the problem do:

root [] .L $ROOTSYS/include/Math/GenVector/VectorUtil.h+ or use TTree::MakeProxy instead of TTree::Draw.

Cheers,
Philippe.

Hello,

thank you for the hint: it works fine now.
As a side remark, for a compiled C++ program, I managed to exploit this namespace including the header math/GenVector.h and adding a -l GenVector to the gcc command line.

Cheers,
Danilo

Ciao Danilo,

the dictionary for this functions is now available in the ROOT trunk version
Thank you for reporting this issue,
Lorenzo