Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 8688)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 8689)
@@ -19,4 +19,12 @@
                                                  -*-*- END OF LINE -*-*-
 
+ 2007/08/21 Thomas Bretz
+
+   * mpointing/MHSrcPosCam.[h,cc]:
+     - we now buffer the events instead of average them. This removes
+       strange (fake) events near the camera center in wobble mode
+
+
+
  2007/08/21 Markus Meyer
 
@@ -25,8 +33,4 @@
        the large muon sample with time image cleaning and smaller 
        integration region (0.8 to 1.2)
-
-
-
- 2007/08/21 Markus Meyer
 
    * mmuon/MHMuonPar.cc
@@ -111,4 +115,7 @@
      - now the MC distribution from OriginalMC is read only once
      - added new tab showing the basic event distribution
+
+   * callisto.cc, star.cc, ganymed.cc, sponde.cc, mars.cc, showplot.cc:
+     - some improvements in case of wrong number of arguments
 
 
Index: /trunk/MagicSoft/Mars/NEWS
===================================================================
--- /trunk/MagicSoft/Mars/NEWS	(revision 8688)
+++ /trunk/MagicSoft/Mars/NEWS	(revision 8689)
@@ -204,4 +204,8 @@
      angle is now shown for off- AND on-data.
 
+   - ganymed: The contents of the source position plot are no longer
+     averaged, thus a lot of (fake) events between the two wobble 
+     positions have disappeared.
+
    - optim, sponde: should now properly support three off-regions.
      Just produce your ganymed summary files with three off-regions.
Index: /trunk/MagicSoft/Mars/mpointing/MHSrcPosCam.cc
===================================================================
--- /trunk/MagicSoft/Mars/mpointing/MHSrcPosCam.cc	(revision 8688)
+++ /trunk/MagicSoft/Mars/mpointing/MHSrcPosCam.cc	(revision 8689)
@@ -33,4 +33,5 @@
 #include "MHSrcPosCam.h"
 
+#include <TVector2.h>
 #include <TCanvas.h>
 #include <TEllipse.h>
@@ -57,5 +58,6 @@
 //
 MHSrcPosCam::MHSrcPosCam(Bool_t wobble, const char *name, const char *title)
-    : fTimeEffOn(NULL), fEffOnTime(NULL), fSourcePos(NULL)
+    : fTimeEffOn(NULL), fEffOnTime(NULL), fSourcePos(NULL),
+    fPositions("TVector2", 50000)
 {
     //
@@ -119,8 +121,7 @@
 
     fHist.Reset();
-    fXY            = TVector2();
-    fNum           = 0;
     fTimeLastEffOn = MTime();
     fConvMm2Deg    = geom->GetConvMm2Deg();
+    fNum           = 0;
 
     return kTRUE;
@@ -129,6 +130,10 @@
 // --------------------------------------------------------------------------
 //
-// 
-// 
+// All source positions are buffered until the time of the effective on
+// time time stamp changes. Then the observation time is split into
+// identical parts and the histogram is filled by these events. The
+// effective on time time stamp is reset and the buffered source positions
+// deleted.
+//
 Bool_t MHSrcPosCam::Fill(const MParContainer *par, const Stat_t w)
 {
@@ -140,9 +145,13 @@
     }
 
-//    if (fName=="MHSrcPosCam")
-//    {
-    fXY += cam->GetXY();
-    fNum++;
-
+    // Increase array size if necessary
+    if (fNum==fPositions.GetSize())
+        fPositions.Expand(fNum*2);
+
+    // buffer position into array (could be speed up a little bit more
+    // by using ExpandCreate and memcpy)
+    new (fPositions[fNum++]) TVector2(cam->GetXY()*fConvMm2Deg);
+
+    // Check if there is a new effective on time
     if (fTimeLastEffOn==MTime())
         fTimeLastEffOn=*fTimeEffOn;
@@ -151,18 +160,23 @@
         return kTRUE;
 
-    fXY *= fConvMm2Deg/fNum;
-
-    fHist.Fill(fXY.X(), fXY.Y(), fEffOnTime->GetVal());
-//    }
-//    else
-//        fHist.Fill(cam->GetX()*fConvMm2Deg, cam->GetY()*fConvMm2Deg);
-
-    fXY            = TVector2();
-    fNum           = 0;
+    // Split the observation time to all buffered events
+    const Double_t scale = fEffOnTime->GetVal()/fNum;
+
+    // Fill histogram from array
+    for (int i=0; i<fNum; i++)
+    {
+        const TVector2 &v = (TVector2&)*fPositions[i];
+        fHist.Fill(v.X(), v.Y(), scale);
+    }
+
+    // reset time stamp and remove all buffered positions
     fTimeLastEffOn = *fTimeEffOn;
+    fNum = 0;
 
     return kTRUE;
 }
 
+// --------------------------------------------------------------------------
+//
 void MHSrcPosCam::Paint(Option_t *)
 {
@@ -172,6 +186,4 @@
 // --------------------------------------------------------------------------
 //
-// 
-// 
 void MHSrcPosCam::Draw(Option_t *)
 {
Index: /trunk/MagicSoft/Mars/mpointing/MHSrcPosCam.h
===================================================================
--- /trunk/MagicSoft/Mars/mpointing/MHSrcPosCam.h	(revision 8688)
+++ /trunk/MagicSoft/Mars/mpointing/MHSrcPosCam.h	(revision 8689)
@@ -14,6 +14,6 @@
 #endif
 
-#ifndef ROOT_TVector2
-#include <TVector2.h>
+#ifndef ROOT_TClonesArray
+#include <TClonesArray.h>
 #endif
 
@@ -25,18 +25,16 @@
 {
 private:
-    TH2D          fHist;           //
+    TH2D          fHist;           // Histogram of observation time vs source position
 
-private:
-    MTime         fTimeLastEffOn;  //!
-    MTime        *fTimeEffOn;      //!
-    MParameterD  *fEffOnTime;      //!
-    MPointingPos *fSourcePos;      //!
+    MTime         fTimeLastEffOn;  //! Last time stamp of effective on time
+    MTime        *fTimeEffOn;      //! Current effective on time
+    MParameterD  *fEffOnTime;      //! Effective on time
+    MPointingPos *fSourcePos;      //! Pointing position of the telescope
 
-    TVector2      fXY;             //!
-    UInt_t        fNum;            //!
-    Double_t      fConvMm2Deg;     //!
+    Double_t      fConvMm2Deg;     //! Conversion factor from mm to deg
+    TClonesArray  fPositions;      //! Buffer to store source positions
+    Int_t         fNum;            //! Position in array
 
 public:
-    //MHSrcPosCam(const char *name=NULL, const char *title=NULL);
     MHSrcPosCam(Bool_t wobble=kFALSE, const char *name=NULL, const char *title=NULL);
 
