Index: trunk/MagicSoft/Mars/mhbase/MH3.cc
===================================================================
--- trunk/MagicSoft/Mars/mhbase/MH3.cc	(revision 5603)
+++ trunk/MagicSoft/Mars/mhbase/MH3.cc	(revision 5620)
@@ -103,7 +103,7 @@
 //
 MH3::MH3(const unsigned int dim)
-    : fDimension(dim>3?3:dim), fHist(NULL),
+    : fDimension(dim>3?3:dim), fHist(NULL)/*,
     fNameProfX(Form("ProfX_%p", this)),
-    fNameProfY(Form("ProfY_%p", this))
+    fNameProfY(Form("ProfY_%p", this))*/
 {  
     switch (fDimension)
@@ -205,5 +205,5 @@
 //
 MH3::MH3(const char *memberx, const char *membery)
-    : fDimension(2), fNameProfX(Form("ProjX_%p", this)), fNameProfY(Form("ProjY_%p", this))
+    : fDimension(2)/*, fNameProfX(Form("ProjX_%p", this)), fNameProfY(Form("ProjY_%p", this))*/
 {
     fHist = new TH2F;
@@ -507,14 +507,11 @@
 void MH3::Paint(Option_t *o)
 {
+    /*
+     *fLog << all << fHist << " " << gPad->GetName() << " ----> Paint " << o << endl;
+     TListIter Next(gPad->GetListOfPrimitives()); TObject *obj;
+     while ((obj=Next())) *fLog << obj << " " << obj->GetName() << " " << obj->ClassName() << " " << Next.GetOption() << " " << (int)obj->TestBit(kCanDelete) << endl;
+     */
+    /*
     TString str(o);
-
-    // FIXME: Do it in Paint()
-    /*
-     if (str.Contains("COL", TString::kIgnoreCase))
-    {
-        SetColors();
-        return;
-    }
-    */
 
     if (str.Contains("log", TString::kIgnoreCase))
@@ -536,5 +533,52 @@
         if ((h0 = (TProfile*)gPad->FindObject(fNameProfY)))
             ((TH2*)fHist)->ProfileY(fNameProfY, -1, 9999, "s");
-    }
+            }
+            */
+
+    fHist->SetFillStyle(4000);
+
+    TString str(o);
+    str = str.Strip(TString::kBoth);
+
+    Bool_t only = str.Contains("ONLY", TString::kIgnoreCase) && fDimension==2;
+    Bool_t same = str.Contains("SAME", TString::kIgnoreCase) && fDimension==2;
+    Bool_t blue = str.Contains("BLUE", TString::kIgnoreCase) && fDimension==2;
+
+    // FIXME: We may have to remove all our own options from str!
+    if (!only && !gPad->GetListOfPrimitives()->FindObject(fHist))
+        fHist->Draw(str);
+
+    if (str.Contains("PROFX", TString::kIgnoreCase) && fDimension==2)
+    {
+        TProfile *p = ((TH2*)fHist)->ProfileX("ProfX", -1, 9999, "s");
+        if (!gPad->GetListOfPrimitives()->FindObject(p))
+        {
+            p->UseCurrentStyle();
+            p->SetLineColor(blue ? kBlue : fHist->GetLineColor());
+            p->SetBit(kCanDelete);
+            p->SetDirectory(NULL);
+            p->SetXTitle(fHist->GetXaxis()->GetTitle());
+            p->SetYTitle(fHist->GetYaxis()->GetTitle());
+            p->Draw(only&&!same?"":"same");
+        }
+    }
+    if (str.Contains("PROFY", TString::kIgnoreCase) && fDimension==2)
+    {
+        TProfile *p = ((TH2*)fHist)->ProfileY("ProfY", -1, 9999, "s");
+        if (!gPad->GetListOfPrimitives()->FindObject(p))
+        {
+            p->UseCurrentStyle();
+            p->SetLineColor(blue ? kBlue : fHist->GetLineColor());
+            p->SetBit(kCanDelete);
+            p->SetDirectory(NULL);
+            p->SetYTitle(fHist->GetXaxis()->GetTitle());
+            p->SetXTitle(fHist->GetYaxis()->GetTitle());
+            p->Draw(only&&!same?"":"same");
+        }
+    }
+
+    if (fHist->TestBit(kIsLogx) && fHist->GetEntries()>0) gPad->SetLogx();
+    if (fHist->TestBit(kIsLogy) && fHist->GetEntries()>0) gPad->SetLogy();
+    if (fHist->TestBit(kIsLogz) && fHist->GetEntries()>0) gPad->SetLogz();
 }
 
@@ -559,5 +603,8 @@
     TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(fHist);
     pad->SetBorderMode(0);
-
+    AppendPad(opt);
+
+    return;
+/*
     fHist->SetFillStyle(4000);
 
@@ -597,5 +644,5 @@
     }
 
-    AppendPad("log");
+    AppendPad("log");*/
 }
 
Index: trunk/MagicSoft/Mars/mhbase/MH3.h
===================================================================
--- trunk/MagicSoft/Mars/mhbase/MH3.h	(revision 5603)
+++ trunk/MagicSoft/Mars/mhbase/MH3.h	(revision 5620)
@@ -26,6 +26,6 @@
     Double_t    fScale[3];       // Scale for the three axis (eg unit)
 
-    TString     fNameProfX;      //! This should make sure, that gROOT doen't confuse the profile with something else
-    TString     fNameProfY;      //! This should make sure, that gROOT doen't confuse the profile with something else
+    // TString     fNameProfX;      //! This should make sure, that gROOT doen't confuse the profile with something else
+    // TString     fNameProfY;      //! This should make sure, that gROOT doen't confuse the profile with something else
 
     void StreamPrimitive(ofstream &out) const;
@@ -36,4 +36,7 @@
         kIsLogz = BIT(19)
     };
+
+//    Int_t DistancetoPrimitive(Int_t px, Int_t py);
+//    void  ExecuteEvent(Int_t event, Int_t px, Int_t py);
 
 public:
