Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 2475)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 2476)
@@ -3,23 +3,23 @@
   2003/11/05: Wolfgang Wittek
 
-  * macros/CT1Analysis.C
-          /ONOFFCT1Analysis.C
-    - current versions of the macros for the analysis of CT1 data
-
-  * manalysis/MMarquardt.[h,cc]
-    - very pleliminary version of a class performing a minimization 
-      using the Marquardt method
-
-  * mimage/M2dimFunctionFit.[h,cc]
-    - very pleliminary version of a class which fits a 2-dim function to the
-      shower image using the maximum likelihood method 
-
-  * mimage/M2dimFunction.[h,cc]
-    - very pleliminary version of a container which contains the parameters
-      of the 2-dim function describing the shower image
-
-  * mimage/MH2dimFunction.[h,cc]
-    - very pleliminary version of a container holding the histograms
-      for the parameters of the 2-dim function describing the shower image
+   * macros/CT1Analysis.C, macros/ONOFFCT1Analysis.C
+     - current versions of the macros for the analysis of CT1 data
+ 
+   * manalysis/MMarquardt.[h,cc]
+     - very pleliminary version of a class performing a minimization 
+       using the Marquardt method
+
+   * mimage/M2dimFunctionFit.[h,cc]
+     - very pleliminary version of a class which fits a 2-dim function
+       to the shower image using the maximum likelihood method 
+
+   * mimage/M2dimFunction.[h,cc]
+     - very pleliminary version of a container which contains the
+       parameters of the 2-dim function describing the shower image
+
+   * mimage/MH2dimFunction.[h,cc]
+     - very pleliminary version of a container holding the histograms
+       for the parameters of the 2-dim function describing the shower
+       image
 
 
@@ -28,16 +28,18 @@
   
    * mmontecarlo/MMcWeightEnergySpecCalc.[h,cc]
-     - Now, if the new spectrum for the MC showers is a power law, we don't
-       convert it to a TF1 function.
-     - Changed the constructor for the case in which the new spectrum is 
-       passed as a TF1 function. Now we pass the TF1 object by reference.
-     - Thanks to the suggestions of T. Bretz, added three more constructors to
-       give the possibility of passing the shape of the new spectrum in other 
-       different ways. Now, if the new spectrum that you want for the MC 
-       showers is different from a power law, you can especify its shape either
-       with a TF1 function, with a string (char*), or with a general C++ 
-       function defined by your own. 
-     - In function Reinit(): added a sanity check to prevent from dividing 
-       by zero.
+     - Now, if the new spectrum for the MC showers is a power law, we
+       don't convert it to a TF1 function.
+     - Changed the constructor for the case in which the new spectrum
+       is passed as a TF1 function. Now we pass the TF1 object by
+       reference.
+     - Thanks to the suggestions of T. Bretz, added three more
+       constructors to give the possibility of passing the shape of the
+       new spectrum in other different ways. Now, if the new spectrum
+       that you want for the MC showers is different from a power law,
+       you can specify its shape either with a TF1 function, with a
+       string (char*), or with a general C++ function defined by your
+       own. 
+     - In function Reinit(): added a sanity check to prevent from
+       dividing by zero.
      - In PreProcess(): removed an unnecessary sentence.
      - Fixed a compiling error which appeared under gcc 3.3
@@ -52,4 +54,8 @@
    * mbase/MTask.cc:
      - initialize fSerialNumber=0
+
+   * mhist/MHCamera.cc:
+     - removed some obsolete IsUsed(idx) checks when filling the histogram
+     - ExecuteEvent now plots in the same canvas all the time
 
 
Index: /trunk/MagicSoft/Mars/mhist/MHCamera.cc
===================================================================
--- /trunk/MagicSoft/Mars/mhist/MHCamera.cc	(revision 2475)
+++ /trunk/MagicSoft/Mars/mhist/MHCamera.cc	(revision 2476)
@@ -671,5 +671,4 @@
 //
 // Call this function to add a MCamEvent on top of the present contents.
-// Only 'used' pixels are added.
 //
 void MHCamera::AddCamContent(const MCamEvent &event, Int_t type)
@@ -682,5 +681,5 @@
     {
         Double_t val=0;
-        if (event.GetPixelContent(val, idx, *fGeomCam, type) && !IsUsed(idx))
+        if (event.GetPixelContent(val, idx, *fGeomCam, type)/* && !IsUsed(idx)*/)
             SetUsed(idx);
 
@@ -693,5 +692,4 @@
 //
 // Call this function to add a MHCamera on top of the present contents.
-// Only 'used' pixels are added.
 // Type:
 //  0) bin content
@@ -731,5 +729,4 @@
 //
 // Call this function to add a TArrayD on top of the present contents.
-// Only 'used' pixels are added.
 //
 void MHCamera::AddCamContent(const TArrayD &event, const TArrayC *used)
@@ -745,5 +742,5 @@
         Fill(idx, const_cast<TArrayD&>(event)[idx]); // FIXME: Slow!
 
-        if (used && (*const_cast<TArrayC*>(used))[idx])
+        if (!used || (*const_cast<TArrayC*>(used))[idx])
             SetUsed(idx);
     }
@@ -764,6 +761,6 @@
     for (Int_t idx=0; idx<fNcells-2; idx++)
     {
-        Double_t val=0;
-        if (event.GetPixelContent(val, idx, *fGeomCam, type) && !IsUsed(idx))
+        Double_t val=threshold;
+        if (event.GetPixelContent(val, idx, *fGeomCam, type)/* && !IsUsed(idx)*/)
             SetUsed(idx);
 
@@ -1128,6 +1125,28 @@
     if (fNotify && fNotify->GetSize()>0)
     {
-        new TCanvas;
+        // FIXME: Is there a simpler and more convinient way?
+
+        // The name which is created here depends on the instance of
+        // MHCamera and on the pad on which it is drawn --> The name
+        // is unique. For ExecuteEvent gPad is always correctly set.
+        const TString name = Form("%p;%p;PixelContent", this, gPad);
+
+        TCanvas *old = (TCanvas*)gROOT->GetListOfCanvases()->FindObject(name);
+        if (old)
+            old->cd();
+        else
+            new TCanvas(name);
+
+        /*
+         TIter Next(gPad->GetListOfPrimitives());
+         TObject *o;
+         while (o=Next()) cout << o->GetName() << " " << o->IsA()->GetName() << endl;
+         */
+
+        // FIXME: Make sure, that the old histograms are really deleted.
+        //        Are they already deleted?
         fNotify->ForEach(MCamEvent, DrawPixelContent)(idx);
+        gPad->Modified();
+        gPad->Update();
     }
 }
