I have several vectors in xyz space, vector1, vector2, vector3, etc.
I need to rotate the whole system so that the z-axis of my new system points in the direction of vector1. Is there a good way to do this? I have found the following from RotateAxes, but not sure how to define the newX and newY. I’d assume my newZ is my vector1.
vector1.SetPxPyPzE( px1, py1,pz1, ee1 );
vector2.SetPxPyPzE( px2, py2,pz2, ee2 );
vector3.SetPxPyPzE( px3, py3,pz3, ee2 );
TVector3 newX(0,1,0); //not sure what should come here
TVector3 newY(0,0,1); //nor here.
TVector3 newZ(vector1);
a.RotateAxes(newX,newY,newZ);
What is a in this case? It’s not specified in the documentation, and when passing a vector it returns
error: ‘class TVector3’ has no member named ‘RotateAxes’;
I’m sorry, I am new to this. From this documentation:
“TVector3 objects can be rotated by objects of the TRotation class using the Transform()member functions,”
And when checking the TRotation class I again find the function I have tried to use:
Rotation of local axes
Member function RotateAxes() adds a rotation of local axes to the current rotation and returns the result:
Hover the mouse over it and you’ll see it’s a TArc, with a link. With the pop-up tips it’s not always easy to click on those links, but eventually you should get to this example and then the TArc documentation.
I am also quite a new to Root and therefor my help might not be as good as others, but I think you have a simpler problem. You have to create a TRotation “a” and can afterwards apply this “a” to a vector. I think it should be something like:
This code should just permutate the coordinates. “a” is a matrix (a Rotation Object) and has to be defined with RotateAxes. Afterwards it can be applied to a Vector with Transform or simply by multiplying.
Hope that helps.