vector.SetTheta()

From: Alexander Mann <alex_at_letmethink.co.uk>
Date: Thu, 5 Mar 2009 13:45:29 +0000


Hi,

When I try and use the SetTheta() function (http://root.cern.ch/root/html/TVector3.html) with negative numbers it seems to use the modulus. This isn't what I want..!

It's quite possible I'm missing something here and, if I am, I'd be grateful to anyone who can point it out.

An example of my problem can be found below.

Cheers
Alex

This shows my problem: http://pastebin.com/f5951ad30

void vtest(void) {         

	Double_t theta;
	Double_t phi;
	
	TVector3 v(1,2,3);
		
	theta = v.Theta();
	phi   = v.Phi();	
	cout << "theta = " << theta << ", phi = " << phi << "\n";
	
	v.SetTheta(-0.1);

	theta = v.Theta();
	phi   = v.Phi();	
	cout << "theta = " << theta << ", phi = " << phi << "  <- Why is
theta positive?\n";

        v.SetPhi(-0.1);

	theta = v.Theta();
	phi   = v.Phi();	
	cout << "theta = " << theta << ", phi = " << phi << "  <- Setting phi
seems to work\n";         

} Received on Thu Mar 05 2009 - 14:46:45 CET

This archive was generated by hypermail 2.2.0 : Thu Mar 05 2009 - 17:50:02 CET