Index: trunk/MagicSoft/Mars/mhbase/MH.cc
===================================================================
--- trunk/MagicSoft/Mars/mhbase/MH.cc	(revision 7151)
+++ trunk/MagicSoft/Mars/mhbase/MH.cc	(revision 7173)
@@ -1204,5 +1204,5 @@
 // --------------------------------------------------------------------------
 //
-// M.Gaug added this withouz Documentation
+// 
 //
 TH1I* MH::ProjectArray(const TArrayF &array, Int_t nbins, 
@@ -1251,5 +1251,5 @@
 // --------------------------------------------------------------------------
 //
-// M.Gaug added this withouz Documentation
+// 
 //
 TH1I* MH::ProjectArray(const TArrayD &array, Int_t nbins, const char* name, const char* title)
@@ -1297,5 +1297,5 @@
 // --------------------------------------------------------------------------
 //
-// M.Gaug added this withouz Documentation
+// 
 //
 TH1I* MH::ProjectArray(const MArrayF &array, Int_t nbins, 
@@ -1307,5 +1307,5 @@
 // --------------------------------------------------------------------------
 //
-// M.Gaug added this withouz Documentation
+// 
 //
 TH1I* MH::ProjectArray(const MArrayD &array, Int_t nbins, const char* name, const char* title)
@@ -1324,2 +1324,141 @@
     *fLog << "%) Evts skipped: " << str << endl;
 }
+
+// --------------------------------------------------------------------------
+//
+// Calls gStyle->SetPalette. Allowed palettes are:
+//  pretty
+//  deepblue:  darkblue -> lightblue
+//  lightblue: black -> blue -> white
+//  greyscale: black -> white
+//  glow1:     black -> darkred -> orange -> yellow -> white
+//  glow2:
+//  glowsym:   lightblue -> blue -> black -> darkred -> orange -> yellow -> white
+//  redish:    darkred -> lightred
+//  bluish:    darkblue -> lightblue
+//  small1:
+//
+// If the palette name contains 'inv' the order of the colors is inverted.
+//
+// The second argument determines the number of colors for the palette.
+// The default is 50. 'pretty' always has 50 colors.
+//
+// (Remark: Drawing 3D object like TH2D with surf3 allows a maximum
+//          of 99 colors)
+//
+void MH::SetPalette(TString paletteName, Int_t ncol)
+{
+    Bool_t found=kFALSE;
+
+    paletteName.ToLower();
+
+    const Bool_t inverse = paletteName.Contains("inv");
+
+    if (paletteName.Contains("pretty"))
+    {
+        gStyle->SetPalette(1, 0);
+        ncol=50;
+        found=kTRUE;
+    }
+
+    if (paletteName.Contains("deepblue"))
+    {
+        Double_t s[5] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
+        Double_t r[5] = { 0.00, 0.09, 0.18, 0.09, 0.00 };
+        Double_t g[5] = { 0.01, 0.02, 0.39, 0.68, 0.97 };
+        Double_t b[5] = { 0.17, 0.39, 0.62, 0.79, 0.97 };
+        gStyle->CreateGradientColorTable(5, s, r, g, b, ncol);
+        found=kTRUE;
+    }
+
+    if (paletteName.Contains("lightblue"))
+    {
+        Double_t s[5] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
+        Double_t r[5] = { 0.00, 0.09, 0.18, 0.09, 0.00 };
+        Double_t g[5] = { 0.00, 0.02, 0.40, 0.70, 1.00 };
+        Double_t b[5] = { 0.00, 0.27, 0.51, 0.81, 1.00 };
+        gStyle->CreateGradientColorTable(5, s, r, g, b, ncol);
+        found=kTRUE;
+    }
+
+    if (paletteName.Contains("greyscale"))
+    {
+        double s[2] = {0.00, 1.00};
+        double r[2] = {0.00, 1.00};
+        double g[2] = {0.00, 1.00};
+        double b[2] = {0.00, 1.00};
+        gStyle->CreateGradientColorTable(2, s, r, g, b, ncol);
+        found=kTRUE;
+    }
+
+    if (paletteName.Contains("glow1"))
+    {
+        double s[5] = {0., 0.10, 0.45, 0.75, 1.00};
+        double r[5] = {0., 0.35, 0.85, 1.00, 1.00};
+        double g[5] = {0., 0.10, 0.20, 0.73, 1.00};
+        double b[5] = {0., 0.03, 0.06, 0.00, 1.00};
+        gStyle->CreateGradientColorTable(5, s, r, g, b, ncol);
+        found=kTRUE;
+    }
+
+    if (paletteName.Contains("glow2"))
+    {
+        double s[4] = {0.00, 0.50, 0.75, 1.00};
+        double r[4] = {0.24, 0.67, 1.00, 1.00};
+        double g[4] = {0.03, 0.04, 0.80, 1.00};
+        double b[4] = {0.03, 0.04, 0.00, 1.00};
+        gStyle->CreateGradientColorTable(4, s, r, g, b, ncol);
+        found=kTRUE;
+    }
+
+    if (paletteName.Contains("glowsym"))
+    {
+        double s[8] = {0.00, 0.17, 0.39, 0.50, 0.55, 0.72, 0.88, 1.00};
+        double r[8] = {0.09, 0.18, 0.09, 0.00, 0.35, 0.85, 1.00, 1.00};
+        double g[8] = {0.70, 0.40, 0.02, 0.00, 0.10, 0.20, 0.73, 1.00};
+        double b[8] = {0.81, 0.51, 0.27, 0.00, 0.03, 0.06, 0.00, 1.00};
+        gStyle->CreateGradientColorTable(8, s, r, g, b, ncol);
+        found=kTRUE;
+    }
+
+    if (paletteName.Contains("redish"))
+    {
+        double s[3] = {0., 0.5, 1.};
+        double r[3] = {0., 1.0, 1.};
+        double g[3] = {0., 0.0, 1.};
+        double b[3] = {0., 0.0, 1.};
+        gStyle->CreateGradientColorTable(3, s, r, g, b, ncol);
+        found=kTRUE;
+    }
+
+    if (paletteName.Contains("bluish"))
+    {
+        double s[3] = {0., 0.5, 1.};
+        double r[3] = {0., 0.0, 1.};
+        double g[3] = {0., 0.0, 1.};
+        double b[3] = {0., 1.0, 1.};
+        gStyle->CreateGradientColorTable(3, s, r, g, b, ncol);
+        found=kTRUE;
+    }
+
+    if (paletteName.Contains("small1"))
+    {
+        double s[4] = {0.00, 0.50, 0.95, 1.};
+        double r[4] = {0.04, 0.28, 0.98, 1.};
+        double g[4] = {0.28, 0.93, 0.03, 1.};
+        double b[4] = {0.79, 0.11, 0.03, 1.};
+        gStyle->CreateGradientColorTable(4, s, r, g, b, ncol);
+        found=kTRUE;
+    }
+
+    if (inverse)
+    {
+        TArrayI c(ncol);
+        for (int i=0; i<ncol; i++)
+            c[ncol-i-1] = gStyle->GetColorPalette(i);
+        gStyle->SetPalette(ncol, c.GetArray());
+    }
+
+    if (!found)
+        gLog << warn << "MH::SetPalette: Palette " << paletteName << " unknown... ignored." << endl;
+}
Index: trunk/MagicSoft/Mars/mhbase/MH.h
===================================================================
--- trunk/MagicSoft/Mars/mhbase/MH.h	(revision 7151)
+++ trunk/MagicSoft/Mars/mhbase/MH.h	(revision 7173)
@@ -117,4 +117,6 @@
     static TObject *FindObjectInPad(const char *name, TVirtualPad *pad=NULL);
 
+    static void SetPalette(TString paletteName, Int_t ncol=50);
+
     ClassDef(MH, 2) //A base class for Mars histograms
 };
