FACT++  1.0
AltAz MPointing::CalcAnAw ( const AltAz p,
Int_t  sign 
) const
private

Definition at line 422 of file MPointing.cc.

References AltAz::Alt(), and AltAz::Az().

423 {
424  // Corrections for AN and AW without approximations
425  // as done by Patrick Wallace. The approximation cannot
426  // be used for MAGIC because the correctioon angle
427  // AW (~1.5deg) is not small enough.
428 
429  // Vector in cartesian coordinates
430  TVector3 v1;
431 
432  // Set Azimuth and Elevation
433  v1.SetMagThetaPhi(1, TMath::Pi()/2-p.Alt(), p.Az());
434 
435 
436  TVector3 v2(v1);
437 // cout << sign << endl;
438 
439 // cout << "v1: " << v1.Theta()*TMath::RadToDeg() << " " << v1.Phi()*TMath::RadToDeg() << endl;
440 
441  // Rotate around the x- and y-axis
442  v1.RotateY(sign*fAn);
443  v1.RotateX(sign*fAw);
444 
445 // cout << "v1: " << v1.Theta()*TMath::RadToDeg() << " " << v1.Phi()*TMath::RadToDeg() << endl;
446 // cout << "v2: " << v2.Theta()*TMath::RadToDeg() << " " << v2.Theta()*TMath::RadToDeg() << endl;
447 
448  // cout << "dv: " << (v2.Theta()-v1.Theta())*TMath::RadToDeg() << " " << (v2.Phi()-v1.Phi())*TMath::RadToDeg() << endl;
449 
450  Double_t dalt = v1.Theta()-v2.Theta();
451  Double_t daz = v1.Phi() -v2.Phi();
452 
453  //cout << dalt*TMath::RadToDeg() << " " << daz*TMath::RadToDeg() << endl;
454 
455  if (daz>TMath::Pi())
456  daz -= TMath::TwoPi();
457  if (daz<-TMath::Pi())
458  daz += TMath::TwoPi();
459 
460 // if (daz>TMath::Pi()/2)
461 // {
462 // }
463 
464  AltAz d(dalt, daz);
465  return d;
466 
467  // Calculate Delta Azimuth and Delta Elevation
468  /*
469  AltAz d(TMath::Pi()/2-v1.Theta(), v1.Phi());
470 
471  cout << "p : " << p.Alt()*TMath::RadToDeg() << " " << p.Az()*TMath::RadToDeg() << endl;
472  cout << "d : " << d.Alt()*TMath::RadToDeg() << " " << d.Az()*TMath::RadToDeg() << endl;
473  d -= p;
474  cout << "d-p: " << d.Alt()*TMath::RadToDeg() << " " << d.Az()*TMath::RadToDeg() << endl;
475  d *= sign;
476  cout << "d* : " << d.Alt()*TMath::RadToDeg() << " " << d.Az()*TMath::RadToDeg() << endl;
477 
478 
479  cout << "p2: " << 90-p.Alt()*TMath::RadToDeg() << " " << p.Az()*TMath::RadToDeg() << endl;
480  cout << "d2: " << 90-d.Alt()*TMath::RadToDeg() << " " << d.Az()*TMath::RadToDeg() << endl;
481 
482  Int_t s1 = 90-d.Alt()*TMath::RadToDeg() < 0 ? -1 : 1;
483  Int_t s2 = 90-p.Alt()*TMath::RadToDeg() < 0 ? -1 : 1;
484 
485 
486  if (s1 != s2)
487  {
488  //90-d.Alt() <-- -90+d.Alt()
489 
490  d.Alt(d.Alt()-TMath::Pi());
491  cout << "Alt-" << endl;
492  }
493  cout << "d': " << 90-d.Alt()*TMath::RadToDeg() << " " << d.Az()*TMath::RadToDeg() << endl;*/
494  /*
495  // Fix 'direction' of output depending on input vector
496  if (TMath::Pi()/2-sign*p.Alt()<0)
497  {
498  d.Alt(d.Alt()-TMath::Pi());
499  cout << "Alt-" << endl;
500  }
501  //if (TMath::Pi()/2-sign*p.Alt()>TMath::Pi())
502  //{
503  // d.Alt(TMath::Pi()-d.Alt());
504  // cout << "Alt+" << endl;
505  //}
506 
507  // Align correction into [-180,180]
508  while (d.Az()>TMath::Pi())
509  {
510  d.Az(d.Az()-TMath::Pi()*2);
511  cout << "Az-" << endl;
512  }
513  while (d.Az()<-TMath::Pi())
514  {
515  d.Az(d.Az()+TMath::Pi()*2);
516  cout << "Az+" << endl;
517  }
518  */
519  return d;
520 }
double Alt() const
Definition: MPointing.h:40
Double_t fAn
Definition: MPointing.h:163
Double_t fAw
Definition: MPointing.h:164
double Az() const
Definition: MPointing.h:41

+ Here is the call graph for this function: