Hi ,
Theta should be define between [0,PI) while Phi between (-PI,PI]
I cannot reproduce your problem. Can you send me your shortest running program producing this ?
You could also try to use the LorentzVector and 3D Vectors from mathcore.
I would be interested to know if you observe the same thing also in that case.
So if the momentum haz negativ sign, the theta and phi will be changed but not the sign of the momentum (in my calculation the sing of the momentum was strongly connected with the theta angle)
So here we come, this is what we have
Butthe question remains:
Is this as it should work?
Ah, now it is clear, you are setting nevative values of pt. The pt MUST BE grater than zero is defined as sqrt(px2+py2).
If you are doing that, you cannot expect then that the angle came out right.
If you sign the pt using for example the particle charge you should set in the TVector3 the module.
Maybe the classes could be protected against this, but it is probably un un-necessary overhead.