Index: trunk/MagicSoft/Mars/mhist/MHMcTriggerLvl2.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHMcTriggerLvl2.cc	(revision 1931)
+++ trunk/MagicSoft/Mars/mhist/MHMcTriggerLvl2.cc	(revision 1934)
@@ -16,7 +16,7 @@
 !
 !
-!   Author(s): Nicola Galante 2003 <mailto:nicola.galante@pi.infn.it>
-!!
-!   Copyright: MAGIC Software Development, 2000-2002
+!   Author(s): Nicola Galante, 2003 <mailto:nicola.galante@pi.infn.it>
+!
+!   Copyright: MAGIC Software Development, 2000-2003
 !
 !
@@ -51,4 +51,7 @@
 #include "MBinning.h"
 
+/*
+ Please, DON'T USE IFDEFS IN SUCH A CONTEXT, Thomas.
+ --------------------------------------------------
 #ifndef COLOR_LINELPS
 #define COLOR_LINELPS Int_t colorlps = 1
@@ -65,4 +68,14 @@
 COLOR_LINEPS;
 #endif
+*/
+
+/* Use this insteadif you want to have some value which is the same for all
+ your instances of MHMcTriggerLvl2, if not define the values in the constructor
+ and remove the 'static'
+ */
+
+Int_t MHMcTriggerLvl2::fColorLps = 1;
+Int_t MHMcTriggerLvl2::fColorSbc = 1;
+Int_t MHMcTriggerLvl2::fColorPs = 1;
 
 ClassImp(MHMcTriggerLvl2);
@@ -145,34 +158,29 @@
 // This method is called by the DrawClone method.
 //
-TObject *MHMcTriggerLvl2::DrawHist(TH1 *hist, TH1 *histNorm, const char *canvasname, Int_t *colore) const
-{
-  ++(*colore);
-
-  if((gROOT->FindObject(canvasname) != NULL)){
-    hist->SetLineColor(*colore);
-    ((TCanvas *)gROOT->FindObject(canvasname))->cd(1);
-    hist->DrawCopy("same");
-    
-    ((TCanvas *)gROOT->FindObject(canvasname))->cd(2);
-    histNorm->SetLineColor(*colore);
-    histNorm->DrawCopy("same");
-    ((TCanvas *)gROOT->FindObject(canvasname))->cd(2);
-    return gROOT->FindObject(canvasname);
-  }
-  else{
-    TCanvas *c3 = MakeDefCanvas(canvasname,canvasname, 800, 610);
-    c3->Divide(2,1);
-    c3->cd(1);
-    hist->SetLineColor(*colore);
-    hist->DrawCopy();
-
-    c3->cd(2);
-    histNorm->SetLineColor(*colore);
-    histNorm->DrawCopy();
-
-    return c3;
-  }
-}
- 
+TObject *MHMcTriggerLvl2::DrawHist(TH1 &hist, TH1 &histNorm, const TString &canvasname, Int_t &col) const
+{
+    col++;
+
+    TCanvas *c = (TCanvas*)gROOT->FindObject(canvasname);
+
+    Bool_t same = kTRUE;
+    if (!c)
+    {
+        c = MakeDefCanvas(canvasname,canvasname, 800, 610);
+        c->Divide(2,1);
+        same = kFALSE;
+    }
+
+    c->cd(1);
+    hist.SetLineColor(col);
+    hist.DrawCopy(same?"same":"");
+
+    c->cd(2);
+    histNorm.SetLineColor(col);
+    histNorm.DrawCopy(same?"same":"");
+
+    return c;
+}
+
 
 // --------------------------------------------------------------------------
@@ -191,20 +199,32 @@
 TObject *MHMcTriggerLvl2::DrawClone(Option_t *opt) const
 {
-  TString *def = new TString("ps");
-  TString str(opt);
-   
-  if(*opt == NULL) str = *def;  // Default option
-  
-  if (str.Contains("lps",TString::kIgnoreCase))
-    return this->DrawHist(hfLutPseudoSize,this->NormalizeHist(hfLutPseudoSizeNorm,hfLutPseudoSize),"CanvasLPS",&colorlps);
-  else if (str.Contains("sbc",TString::kIgnoreCase))
-    return this->DrawHist(hfSizeBiggerCell,this->NormalizeHist(hfSizeBiggerCellNorm,hfSizeBiggerCell),"CanvasSBC",&colorsbc);
-  else if (str.Contains("ps",TString::kIgnoreCase))
-    return this->DrawHist(hfPseudoSize,this->NormalizeHist(hfPseudoSizeNorm,hfPseudoSize),"CanvasPS",&colorps);
-  else{
-    *fLog << "ARGH!@! Possible options are \"lps\", \"sbc\", \"ps\" or NULL!" <<endl;
+    TString str(opt);
+
+    if (str.IsNull())
+        str = "ps";
+
+    if (!str.Contains("lps", TString::kIgnoreCase) &&
+        !str.Contains("sbc", TString::kIgnoreCase) &&
+        !str.Contains("ps",  TString::kIgnoreCase))
+    {
+        *fLog << "ARGH!@! Possible options are \"lps\", \"sbc\", \"ps\" or NULL!" <<endl;
+        return NULL;
+    }
+
+    TH1 *hist=NormalizeHist(hfLutPseudoSizeNorm, hfLutPseudoSize);
+
+    if (!hist)
+        return NULL;
+
+    if (str.Contains("lps",TString::kIgnoreCase))
+        return DrawHist(*hfLutPseudoSize, *hist, "CanvasLPS", fColorLps);
+
+    if (str.Contains("sbc",TString::kIgnoreCase))
+        return DrawHist(*hfSizeBiggerCell, *hist, "CanvasSBC", fColorSbc);
+
+    if (str.Contains("ps",TString::kIgnoreCase))
+        return DrawHist(*hfPseudoSize, *hist, "CanvasPS", fColorPs);
+
     return NULL;
-  }
-
 }
 
Index: trunk/MagicSoft/Mars/mhist/MHMcTriggerLvl2.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHMcTriggerLvl2.h	(revision 1931)
+++ trunk/MagicSoft/Mars/mhist/MHMcTriggerLvl2.h	(revision 1934)
@@ -25,4 +25,8 @@
 
     TF1* f1;                      // Function used to normalize histograms
+
+    static Int_t fColorLps;
+    static Int_t fColorSbc;
+    static Int_t fColorPs;
     
 public:
@@ -50,5 +54,5 @@
 private:
 
-    TObject *DrawHist(TH1 *hist, TH1 *histNorm, const char *canvasname, Int_t *colore) const;
+    TObject *DrawHist(TH1 &hist, TH1 &histNorm, const TString &canvasname, Int_t &colore) const;
 
 };
