Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 3364)
+++ trunk/MagicSoft/Mars/Changelog	(revision 3365)
@@ -4,4 +4,11 @@
 
                                                  -*-*- END OF LINE -*-*-
+ 2004/03/01: Wolfgang Wittek
+  
+   * mhist/MHStarMap.[h,cc]
+     - remove bugs
+     - change GetRotationAngle() such that it can be called from outside
+
+
  2004/03/01: Thomas Bretz
 
Index: trunk/MagicSoft/Mars/mhist/MHStarMap.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHStarMap.cc	(revision 3364)
+++ trunk/MagicSoft/Mars/mhist/MHStarMap.cc	(revision 3365)
@@ -54,4 +54,5 @@
 #include "MParList.h"
 
+#include "MAstro.h"
 #include "MGeomCam.h"
 #include "MHillas.h"
@@ -187,4 +188,7 @@
     fCosLat = TMath::Cos(obs->GetPhi());
 
+    *fLog << "fSinLat, fCosLat = " << fSinLat << ",  "
+          << fCosLat << endl;
+
     return kTRUE;
 }
@@ -200,8 +204,7 @@
 // (see TDAS 00-11, eqs. (18) and (20))
 //
-void MHStarMap::GetRotationAngle(Double_t &cosal, Double_t &sinal)
-{
-    const Double_t theta = fMcEvt->GetTelescopeTheta();
-    const Double_t phi   = fMcEvt->GetTelescopePhi();
+void MHStarMap::GetRotationAngle(const Double_t &theta, const Double_t &phi,
+                                 Double_t &cosal, Double_t &sinal)
+{
 
     const Double_t sint = TMath::Sin(theta);
@@ -216,6 +219,6 @@
     const Double_t denom =  1./ TMath::Sqrt(v1*v1 + v2*v2);
 
-    cosal = (fSinLat * sint) + fCosLat * cost * cosp * denom;
-    sinal = (fCosLat * sinp) * denom;
+    cosal =  (fSinLat * sint - fCosLat * cost * cosp) * denom;
+    sinal =   fCosLat * sinp                          * denom;
 }
 
@@ -261,7 +264,11 @@
     //   - and perform a rotation to compensate the rotation of the
     //     sky image in the camera
+
+    const Double_t theta = fMcEvt->GetTelescopeTheta();
+    const Double_t phi   = fMcEvt->GetTelescopePhi();
+
     Double_t cosal;
     Double_t sinal;
-    GetRotationAngle(cosal, sinal);
+    GetRotationAngle(theta, phi, cosal, sinal);
 
     if (m>-1 && m<1)
Index: trunk/MagicSoft/Mars/mhist/MHStarMap.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHStarMap.h	(revision 3364)
+++ trunk/MagicSoft/Mars/mhist/MHStarMap.h	(revision 3365)
@@ -30,5 +30,4 @@
     void Paint(Option_t *opt="");
 
-    void GetRotationAngle(Double_t &cosangle, Double_t &sinangle);
 
     Bool_t SetupFill(const MParList *pList);
@@ -47,4 +46,7 @@
     TH2F *GetHist() { return fStarMap; }
 
+    void GetRotationAngle(const Double_t &thetatel, const Double_t &phitel,
+                          Double_t &cosangle, Double_t &sinangle);
+
     void Draw(Option_t *opt=NULL);
     TObject *DrawClone(Option_t *opt=NULL) const;
