Changeset 9578 for trunk/MagicSoft/Mars/mastro
- Timestamp:
- 05/05/10 09:51:51 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mastro/MAstro.cc
r9314 r9578 376 376 Double_t MAstro::AngularDistance(Double_t theta0, Double_t phi0, Double_t theta1, Double_t phi1) 377 377 { 378 TVector3 v0(1); 379 v0.Rotate(phi0, theta0); 380 381 TVector3 v1(1); 382 v1.Rotate(phi1, theta1); 383 384 return v0.Angle(v1); 378 // v1 = theta0/phi0 --> theta0 / 0 379 // v2 = theta1/phi1 --> theta1 / phi1-phi0 380 // acos(alpha) = v1*v2/|v1||v2| |v1|*|v2|=1 381 const Double_t sin2 = TMath::Sin(theta0)*TMath::Sin(theta1); 382 const Double_t cos2 = TMath::Cos(theta0)*TMath::Cos(theta1); 383 384 return TMath::ACos(sin2*TMath::Cos(phi1-phi0) + cos2); 385 /* 386 TVector3 v0; 387 v0.SetMagThetaPhi(1, theta0, phi0); 388 389 TVector3 v1; 390 v1.SetMagThetaPhi(1, theta0, phi0); 391 392 return v0.Angle(v1); 393 */ 385 394 } 386 395
Note:
See TracChangeset
for help on using the changeset viewer.