Index: /trunk/MagicSoft/Mars/mhist/MH.cc
===================================================================
--- /trunk/MagicSoft/Mars/mhist/MH.cc	(revision 2411)
+++ /trunk/MagicSoft/Mars/mhist/MH.cc	(revision 2412)
@@ -700,12 +700,15 @@
 // Also layout the two statistic boxes and a legend.
 //
-void MH::Draw(TH1 &hist1, TH1 &hist2, const TString title)
+void MH::Draw(TH1 &hist1, TH1 &hist2, const TString title, TVirtualPad *pad)
 {
     //
     // Draw first histogram
     //
-    hist1.Draw();
-    gPad->SetBorderMode(0);
-    gPad->Update();
+    if (!pad)
+        pad = gPad;
+
+    MParContainer::DrawTS(&hist1, pad);
+    pad->SetBorderMode(0);
+    pad->Update();
 
     if (hist1.GetEntries()>0 && hist2.GetEntries()>0)
@@ -726,5 +729,5 @@
     }
 
-    TPaveText *t = (TPaveText*)gPad->FindObject("title");
+    TPaveText *t = (TPaveText*)pad->FindObject("title");
     if (t)
     {
@@ -738,6 +741,6 @@
         // (see THistPainter::PaintTitle) title
         //
-        gPad->Modified();  // indicates a change
-        gPad->Update();    // recreates the original title
+        pad->Modified();  // indicates a change
+        pad->Update();    // recreates the original title
         t->Pop();          // bring our title on top
     }
@@ -747,5 +750,5 @@
     //
     // Where to get the TPaveStats depends on the root version
-    TPaveStats *s1 = (TPaveStats*)gPad->FindObject("stats");
+    TPaveStats *s1 = (TPaveStats*)pad->FindObject("stats");
     if (!s1)
         s1 = (TPaveStats*)hist1.GetListOfFunctions()->FindObject("stats");
@@ -763,6 +766,6 @@
     // Draw second histogram
     //
-    hist2.Draw("sames");
-    gPad->Update();
+    MParContainer::DrawTS(&hist2, pad, "sames");
+    pad->Update();
 
     //
@@ -770,5 +773,5 @@
     //
     // Where to get the TPaveStats depends on the root version
-    TPaveStats *s2 = (TPaveStats*)gPad->FindObject("stats");
+    TPaveStats *s2 = (TPaveStats*)pad->FindObject("stats");
     if (!s2)
         s2 = (TPaveStats*)hist2.GetListOfFunctions()->FindObject("stats");
@@ -787,5 +790,5 @@
         l.SetBorderSize(s2->GetBorderSize());
         l.SetBit(kCanDelete);
-        l.Draw();
+        MParContainer::DrawTS(&l, pad);
     }
 }
@@ -830,26 +833,56 @@
 // to the present pad. The kCanDelete bit is set for the clone.
 //
+TObject *MH::DrawCloneTS(TVirtualPad *pad, Option_t *opt, Int_t w, Int_t h) const
+{
+    TString option(opt);
+
+    //gLog << dbg << "DrawCloneTS: Arg=" << pad << " " << gPad << endl;
+
+    TVirtualPad *p = GetNewPad(option) || pad ? pad : NULL;
+    //gLog << dbg << "DrawCloneTS: nonew&&gpad=" << p << " " << opt << endl;
+    if (!p)
+        p = MakeDefCanvas(this, w, h);
+    else
+    /*{
+        gLog << dbg << "--> Clear" << endl;*/
+        p->Clear();
+    //}
+    //gLog << dbg << "DrawCloneTS: " << p << endl;
+
+    TObject *o = MParContainer::DrawCloneTS(pad, option);
+    o->SetBit(kCanDelete);
+    return o;
+}
+/*
+// --------------------------------------------------------------------------
+//
+// If the opt string contains 'nonew' or gPad is not given a new canvas
+// with size w/h is created. Otherwise the object is cloned and drawn
+// to the present pad. The kCanDelete bit is set for the clone.
+//
 TObject *MH::DrawClone(Option_t *opt, Int_t w, Int_t h) const
 {
     TString option(opt);
 
-    TVirtualPad *p = GetNewPad(option);
+    gLog << dbg << "DrawCloneTS: Arg=" << gPad << endl;
+
+    TVirtualPad *p = GetNewPad(option) ? gPad : NULL;
+    gLog << dbg << "DrawCloneTS: nonew&&gpad=" << p << " " << opt << endl;
     if (!p)
         p = MakeDefCanvas(this, w, h);
     else
         p->Clear();
-
-    gROOT->SetSelectedPad(NULL);
-
-    TObject *o = MParContainer::DrawClone(option);
+    gLog << dbg << "DrawCloneTS: " << p << endl;
+
+    TObject *o = Clone(option);
     o->SetBit(kCanDelete);
     return o;
 }
-
+*/
 // --------------------------------------------------------------------------
 //
 // Check whether a class inheriting from MH overwrites the Draw function
 //
-Bool_t MH::OverwritesDraw(TClass *cls) const
+Bool_t MH::OverwritesDraw(TClass *cls, const char *ext) const
 {
     if (!cls)
@@ -865,5 +898,7 @@
     // Check whether the class cls overwrites Draw
     //
-    if (cls->GetMethodAny("Draw"))
+    TString name("Draw");
+    name += ext;
+    if (cls->GetMethodAny(name))
         return kTRUE;
 
@@ -875,5 +910,5 @@
     while ((base=(TBaseClass*)NextBase()))
     {
-        if (OverwritesDraw(base->GetClassPointer()))
+        if (OverwritesDraw(base->GetClassPointer(), ext))
             return kTRUE;
     }
Index: /trunk/MagicSoft/Mars/mhist/MH.h
===================================================================
--- /trunk/MagicSoft/Mars/mhist/MH.h	(revision 2411)
+++ /trunk/MagicSoft/Mars/mhist/MH.h	(revision 2412)
@@ -22,5 +22,5 @@
     MH(const char *name=NULL, const char *title=NULL);
 
-    Bool_t OverwritesDraw(TClass *cls=NULL) const;
+    Bool_t OverwritesDraw(TClass *cls=NULL, const char *ext="") const;
 
     virtual Bool_t SetupFill(const MParList *pList) { return kTRUE; }
@@ -64,13 +64,23 @@
 
     static void DrawCopy(const TH1 &hist1, const TH1 &hist2, const TString title);
-    static void Draw(TH1 &hist1, TH1 &hist2, const TString title);
+    static void Draw(TH1 &hist1, TH1 &hist2, const TString title, TVirtualPad *pad=NULL);
 
     TObject *Clone(const char *name="") const;
 
+    // FIXME: Rename Draw-->Draw2 and remove this workaround...
     void Draw(Option_t *o="") { MParContainer::Draw(o); }
-    TObject *DrawClone(Option_t *opt, Int_t w, Int_t h) const;
+
+    TObject *DrawClone(Option_t *opt, Int_t w, Int_t h) const
+    {
+        return MH::DrawCloneTS(NULL, opt, 625, 440);
+    }
     TObject *DrawClone(Option_t *opt="") const
     {
-        return MH::DrawClone(opt, 625, 440);
+        return MH::DrawCloneTS(NULL, opt, 625, 440);
+    }
+    TObject *DrawCloneTS(TVirtualPad *pad, Option_t *opt, Int_t w, Int_t h) const;
+    TObject *DrawCloneTS(TVirtualPad *pad=NULL, Option_t *opt="") const
+    {
+        return MH::DrawCloneTS(pad, opt, 625, 440);
     }
 
