Index: trunk/Mars/mhist/MHCamEvent.cc
===================================================================
--- trunk/Mars/mhist/MHCamEvent.cc	(revision 13388)
+++ trunk/Mars/mhist/MHCamEvent.cc	(revision 13393)
@@ -59,4 +59,7 @@
 #include "MHCamEvent.h"
 
+#include <TF1.h>
+#include <TPaveStats.h>
+
 #include "MLog.h"
 #include "MLogManip.h"
@@ -323,5 +326,5 @@
 }
 
-void MHCamEvent::Paint(Option_t *)
+void MHCamEvent::Paint(Option_t *opt)
 {
     TVirtualPad *pad = gPad;
@@ -333,4 +336,29 @@
         if (h->GetMaximum()>0)
             gPad->SetLogy();
+
+        if (TString(opt).Contains("gaus", TString::kIgnoreCase))
+        {
+            // Create a copy of the function if it is not yet there
+            if (!h->GetFunction("gaus"))
+                h->Fit("gaus", "q");
+
+            TF1 *f = h->GetFunction("gaus");
+            if (f)
+            {
+                f->SetParameters(h->GetMean(), h->GetRMS(), h->GetMaximum());
+                f->SetLineWidth(1);
+                h->Fit("gaus", "q");
+            }
+
+            TPaveStats *s1 = dynamic_cast<TPaveStats*>(h->GetListOfFunctions()->FindObject("stats"));
+            if (s1)
+            {
+                if (s1->GetOptStat()==1111)
+                    s1->SetOptStat(1000000001);
+                if (s1->GetOptFit()==1)
+                    s1->SetOptFit(1111);
+            }
+
+        }
     }
 
@@ -350,5 +378,5 @@
 }
 
-void MHCamEvent::Draw(Option_t *)
+void MHCamEvent::Draw(Option_t *opt)
 {
     TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
@@ -356,5 +384,5 @@
     pad->SetBorderMode(0);
 
-    AppendPad();
+    AppendPad(opt);
 
     TString name = MString::Format("%s_1", pad->GetName());
