Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 4432)
+++ trunk/MagicSoft/Mars/Changelog	(revision 4433)
@@ -19,4 +19,20 @@
 
                                                  -*-*- END OF LINE -*-*-
+
+ 2004/07/30: Robert Wagner
+
+   * mastro/MAstroCamera.[h,cc]
+     - Added method FillStarList() which fills a TList with objects
+       of type MStarLocalPos for all stars found from the catalog
+       matching specified criteria (FOV, magnitude limit, position)
+
+   * mtemp/MStarLocalPos.[h,cc]
+     - Added handling of the minuit error matrix elements to
+       MStarLocalPos::MSetFitValues
+     - Added member variables to hold error matrix elements
+     - Added getters for error matrix elements
+     - Expected star position is painted by Paint, too.
+     - Error matrix elements are printed by Print, too.
+
 
  2004/07/28: Javi Lopez
Index: trunk/MagicSoft/Mars/mastro/MAstroCamera.cc
===================================================================
--- trunk/MagicSoft/Mars/mastro/MAstroCamera.cc	(revision 4432)
+++ trunk/MagicSoft/Mars/mastro/MAstroCamera.cc	(revision 4433)
@@ -11,5 +11,5 @@
 ! * provided that the above copyright notice appear in all copies and
 ! * that both that copyright notice and this permission notice appear
-! * in supporting documentation. It is provided "as is" without express
+! * in supporting documentation. It is provided "as is" without expressed
 ! * or implied warranty.
 ! *
@@ -45,5 +45,5 @@
 // Algorithm:
 // ----------
-// The caluclation of the position of the reflection in the camera is
+// The calculation of the position of the reflection in the camera is
 // done by:
 //   - Rotation of the star-field such that the camera is looking into
@@ -92,5 +92,5 @@
                       // HOW TO GET RID OF IT? Move MHCamera to mgeom?
 
-//#include "MStarLocalPos.h"
+#include "MStarLocalPos.h"
 
 ClassImp(MAstroCamera);
@@ -133,6 +133,6 @@
     if (arr.GetClass()!=MGeomMirror::Class())
     {
-        cout << "ERROR - TClonesArray doesn't contain objects of type MGeomMirror... ignored." << endl;
-        return;
+      cout << "ERROR - TClonesArray doesn't contain objects of type MGeomMirror... ignored." << endl;
+      return;
     }
 
@@ -148,4 +148,5 @@
 
 }
+
 
 // --------------------------------------------------------------------------
@@ -301,5 +302,5 @@
     if (!fTime || !fObservatory || !fMirrors)
     {
-        cout << "Missing data..." << endl;
+      cout << "Missing data..." << endl;
         return;
     }
@@ -405,5 +406,4 @@
         mean *= 1./num;
         DrawStar(mean(0), mean(1), *radec, hasmean?kBlack:-1, Form("x=%.1fmm y=%.1fmm", mean(0), mean(1)), resize);
-
         if (hasnull)
         {
@@ -418,56 +418,58 @@
 }
 
-// --------------------------------------------------------------------------
-//
-// Options:
-//
-//  '*' Draw the mean of the reflections on all mirrors
-//  '.' Draw a dot for the reflection on each individual mirror
-//  'h' To create a TH2D of the star-light which is displayed
-//  'c' Use the underlaying MHCamera as histogram
-//  '0' Draw the reflection on a virtual perfect mirror
-//
-// If the Pad contains an object MHCamera of type MHCamera it is used.
-// Otherwise a new object is created.
-//
-/*void MAstroCamera::FillStarList(TList *list)
-{
-    list->SetOwner();
-    list->Delete();
-
-    if (!fTime || !fObservatory || !fMirrors || !list)
-    {
-        cout << "Missing data..." << endl;
-        return;
-    }
-
-    const MAstroSky2Local s2l(*fTime, *fObservatory);
-    const TRotation trans(AlignCoordinates(rot*fRaDec));
-
-    // Return the correct rotation matrix
-    const TRotation rot = trans*s2l;
-
+
+// --------------------------------------------------------------------------
+//
+// Fills a TList with all stars found under current presets
+// (Coordinates, Time, FOV). The list is emptied before the filling is done.
+// Currently, the mean spot when averaging over all mirrors is used.
+//
+void MAstroCamera::FillStarList(TList* list)
+{
+    if (!fTime || !fObservatory || !fMirrors) {
+      cout << "Missing data..." << endl;
+      return;
+    }
+
+    if (!list) {
+      cout << "Missing storage list for stars found..." << endl;
+      return;
+    }
+
+    list->Delete(); // dump old list... (otherwise the same stars would pile up)
+   
+    const TRotation rot(GetGrid(kTRUE));
     MVector3 *radec;
     TIter Next(&fList);
 
-    while ((radec=(MVector3*)Next()))
-    {
-        const Double_t mag = radec->Magnitude();
-
-        TVector3 mean;
-	TVector3 star(*radec);
-	star *= rot;
-	const TVector3 spot = fMirror0->GetReflection(star, fGeom->GetCameraDist())*1000;
-
-	MStarLocalPos *starpos = new MStarLocalPos;
-	starpos->SetExpValues(mag,mean(0),mean(1));
-	list->Add(starpos);
-    }
-    // For MAGIC the distance of the mean of the light distribution
-    // to the Mirror0 reflection of the star (Abberation) can be
-    // expressed as:  dr = (0.0713 +/- 0.0002) * r = r/14.03
-    // with r = hypot(mean(0), mean(1))
-}
-*/
+    while ((radec=(MVector3*)Next())) {
+      const Double_t mag = radec->Magnitude();
+      if (mag>GetLimMag())
+	continue;
+      TVector3 star(*radec);
+      // Rotate Star into telescope system
+      star *= rot;
+      TVector3 mean;
+      Int_t num = 0;
+      MGeomMirror *mirror = 0;
+      TIter NextM(fMirrors);
+      while ((mirror=(MGeomMirror*)NextM())) {
+	const TVector3 spot = mirror->GetReflection(star, fGeom->GetCameraDist())*1000;
+	mean += spot;
+	num++;
+      }
+      mean *= 1./num;
+      MStarLocalPos *starpos = new MStarLocalPos;
+      starpos->SetExpValues(mag,mean(0),mean(1));
+      
+      TString name = radec->GetName();
+      if (name.Length()==0) {
+	starpos->SetName("unknown"); 
+      } else {
+	starpos->SetName(radec->GetName());
+      }	 
+      list->Add(starpos);   
+    }
+}
 
 // ------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/mastro/MAstroCamera.h
===================================================================
--- trunk/MagicSoft/Mars/mastro/MAstroCamera.h	(revision 4432)
+++ trunk/MagicSoft/Mars/mastro/MAstroCamera.h	(revision 4433)
@@ -35,4 +35,6 @@
     void SetGeom(const MGeomCam &cam);
 
+    void FillStarList(TList *list);
+
     void GetDiffZdAz(Double_t x, Double_t y, Double_t &dzd, Double_t &daz);
 
Index: trunk/MagicSoft/Mars/mtemp/MStarLocalPos.cc
===================================================================
--- trunk/MagicSoft/Mars/mtemp/MStarLocalPos.cc	(revision 4432)
+++ trunk/MagicSoft/Mars/mtemp/MStarLocalPos.cc	(revision 4433)
@@ -11,5 +11,5 @@
 ! * provided that the above copyright notice appear in all copies and
 ! * that both that copyright notice and this permission notice appear
-! * in supporting documentation. It is provided "as is" without express
+! * in supporting documentation. It is provided "as is" without expressed
 ! * or implied warranty.
 ! *
@@ -17,4 +17,5 @@
 !
 !   Author(s): Javier López , 4/2004 <mailto:jlopez@ifae.es>
+!   Author(s): Robert Wagner, 7/2004 <mailto:rwagner@mppmu.mpg.de>
 !
 !   Copyright: MAGIC Software Development, 2000-2004
@@ -25,4 +26,5 @@
 
 #include <TEllipse.h>
+#include <TMarker.h>
 
 #include "MLog.h"
@@ -101,4 +103,13 @@
 }
 
+void MStarLocalPos::SetFitValues(Float_t mag, Float_t max, Float_t x, Float_t y, Float_t sigmaMinorAxis, Float_t sigmaMajorAxis, Float_t chiSquare, Int_t ndof, Float_t xx, Float_t xy, Float_t yy)
+{
+  SetFitValues(mag, max, x, y, sigmaMinorAxis, sigmaMajorAxis, chiSquare, ndof);
+  fXXErr = xx;
+  fYYErr = yy;
+  fXYErr = xy;
+}
+
+
 // --------------------------------------------------------------------------
 //
@@ -108,9 +119,14 @@
 {
   //Print a cross in the expected position
+  
+  TMarker mexp(fXExp, fYExp, 29);
+  mexp.SetMarkerSize(3);
+  mexp.SetMarkerColor(94);
+  mexp.Paint(); 
 
   if (fSigmaMinorAxisCalc>0. && fSigmaMajorAxisCalc>0.)
     {
       TEllipse ecalc(fMeanXCalc, fMeanYCalc, fSigmaMinorAxisCalc, fSigmaMajorAxisCalc, 0, 360, 0);
-      ecalc.SetLineWidth(2);
+      ecalc.SetLineWidth(3);
       ecalc.SetLineColor(kRed);
       ecalc.Paint();
@@ -120,5 +136,5 @@
     {
       TEllipse efit(fMeanXFit, fMeanYFit, fSigmaMinorAxisFit, fSigmaMajorAxisFit, 0, 360, 0);
-      efit.SetLineWidth(2);
+      efit.SetLineWidth(3);
       efit.SetLineColor(kBlack);
       efit.Paint();
@@ -129,7 +145,14 @@
 {
   TString o = opt;
+
+  if (o.Contains("name", TString::kIgnoreCase) || opt == NULL)
+    {
+      *fLog << inf << "Star Name: \"" << this->GetName() << "\"" << endl;
+    }
+    
   
   if (o.Contains("mag", TString::kIgnoreCase) || opt == NULL)
     {
+  
       *fLog << inf << "Star maginitude:" << endl;
       *fLog << inf << " Expected \t" << setw(4) << fMagExp << endl;
@@ -165,3 +188,11 @@
       *fLog << inf << " ChiSquare/Ndof \t " << setw(3) << fChiSquare << "/" << fNdof << endl;
     }
+
+  if (o.Contains("err", TString::kIgnoreCase) || opt == NULL)
+    {
+      *fLog << inf << "Minuit Error Matrix:" << endl;
+      *fLog << inf << " xx,xy,yy \t " << setw(3) << fXXErr << ", " << fXYErr << ", " << fYYErr << endl;
+    }
+
+
 }
Index: trunk/MagicSoft/Mars/mtemp/MStarLocalPos.h
===================================================================
--- trunk/MagicSoft/Mars/mtemp/MStarLocalPos.h	(revision 4432)
+++ trunk/MagicSoft/Mars/mtemp/MStarLocalPos.h	(revision 4433)
@@ -34,4 +34,7 @@
     Float_t fSigmaMajorAxisFit;  //[mm]
     Float_t fChiSquare;
+    Float_t fXXErr;              //minuit error matrix elements
+    Float_t fXYErr;
+    Float_t fYYErr;
     Int_t   fNdof;
 
@@ -66,4 +69,8 @@
     Float_t GetSigmaMinorAxis() {return fSigmaMinorAxisFit!=0?fSigmaMinorAxisFit:fSigmaMinorAxisCalc;}
     Float_t GetSigmaMajorAxis() {return fSigmaMajorAxisFit!=0?fSigmaMajorAxisFit:fSigmaMajorAxisCalc;}
+    
+    Float_t GetXXErr() {return fXXErr;}
+    Float_t GetXYErr() {return fXYErr;}
+    Float_t GetYYErr() {return fYYErr;}
 
     void Reset();
@@ -72,4 +79,5 @@
     void SetCalcValues(Float_t mag, Float_t max, Float_t x, Float_t y, Float_t sigmaMinorAxis, Float_t sigmaMajorAxis);
     void SetFitValues(Float_t mag, Float_t max, Float_t x, Float_t y, Float_t sigmaMinorAxis, Float_t sigmaMajorAxis, Float_t chi, Int_t ndof);
+    void SetFitValues(Float_t mag, Float_t max, Float_t x, Float_t y, Float_t sigmaMinorAxis, Float_t sigmaMajorAxis, Float_t chi, Int_t ndof, Float_t xx, Float_t xy, Float_t yy);
 
     void Paint(Option_t *opt=NULL);
