Tvector3 unary - operator no worky in pyroot

root version 5.16 compiled from source on ubuntu gutsy:

[craigb@cygnus kinematics]$ python
Python 2.5.1 (r251:54863, Oct 5 2007, 13:36:32)
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.

import ROOT
blah = ROOT.TVector3(1,2,3)
boring = -blah
Traceback (most recent call last):
File “”, line 1, in
TypeError: bad operand type for unary -: ‘TVector3’

nothing mission critical but if i am doing something wrong i’d like to know in case it crops up elsewhere. tia.

Hi,

my mistake: PyROOT binds unary - to sub instead of neg. I’ll get that fixed, but for yourself to be able to use “-blah” now, do:

ROOT.TVector3.neg = ROOT.TVector3.sub

and all should work as expected from there …

Thanks for reporting!

Cheers,
Wim