From 9143eca7aa65aa80696107804b56d8870def0551 Mon Sep 17 00:00:00 2001
From: Rene Brun <Rene.Brun@cern.ch>
Date: Wed, 8 Nov 2006 13:12:36 +0000
Subject: [PATCH] From Olivier: Mods in view of the new spectrumpainter from
 Miroslav Morhac

git-svn-id: http://root.cern.ch/svn/root/trunk@16709 27541ba8-7e3a-0410-8455-c3a389f83636
---
 histpainter/inc/Hoption.h        |  3 ++-
 histpainter/src/THistPainter.cxx | 43 ++++++++++++++++++++++++--------
 2 files changed, 34 insertions(+), 12 deletions(-)

diff --git a/histpainter/inc/Hoption.h b/histpainter/inc/Hoption.h
index 6126780ddac..9a49abf7228 100644
--- a/histpainter/inc/Hoption.h
+++ b/histpainter/inc/Hoption.h
@@ -1,4 +1,4 @@
-/* @(#)root/histpainter:$Name:  $:$Id: Hoption.h,v 1.6 2004/10/05 10:28:24 brun Exp $ */
+/* @(#)root/histpainter:$Name:  $:$Id: Hoption.h,v 1.7 2006/02/13 09:52:33 couet Exp $ */
 
 /*************************************************************************
  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
@@ -60,6 +60,7 @@ typedef struct Hoption_t {
                     //  = 3 to get a Sinusoidal ptojection
                     //  = 4 to get a Parabolic ptojection
    int AxisPos;     //  Axis position
+   int Spec;        // TSpectrum graphics
 
    // the following structure members are set to 1 if the corresponding option
    // in the current style is selected.
diff --git a/histpainter/src/THistPainter.cxx b/histpainter/src/THistPainter.cxx
index 1dc576a72c2..4f9dc0332bd 100644
--- a/histpainter/src/THistPainter.cxx
+++ b/histpainter/src/THistPainter.cxx
@@ -1,4 +1,4 @@
-// @(#)root/histpainter:$Name:  $:$Id: THistPainter.cxx,v 1.269 2006/09/20 11:46:13 couet Exp $
+// @(#)root/histpainter:$Name:  $:$Id: THistPainter.cxx,v 1.270 2006/09/20 14:23:36 couet Exp $
 // Author: Rene Brun   26/08/99
 
 /*************************************************************************
@@ -16,6 +16,7 @@
 
 #include "Riostream.h"
 #include "TROOT.h"
+#include "TSystem.h"
 #include "THistPainter.h"
 #include "TH3.h"
 #include "TH2.h"
@@ -614,6 +615,7 @@ Int_t THistPainter::MakeChopt(Option_t *choptin)
    Hoption.Char = Hoption.Color  = Hoption.Contour = Hoption.Logx  = 0;
    Hoption.Logy = Hoption.Logz   = Hoption.Lego    = Hoption.Surf  = 0;
    Hoption.Off  = Hoption.Tri    = Hoption.Proj    = Hoption.AxisPos = 0;
+   Hoption.Spec = 0;
 
    //    special 2-D options
    Hoption.List     = 0;
@@ -633,6 +635,13 @@ Int_t THistPainter::MakeChopt(Option_t *choptin)
    if (fFunctions->First()) Hoption.Func = 2;
    if (fH->GetSumw2N() && fH->GetDimension() == 1) Hoption.Error = 2;
 
+   l = strstr(chopt,"SPEC");
+   if (l) {
+      Hoption.Scat = 0;
+      Hoption.Spec = 1; strncpy(l,"    ",4);
+      return 1;
+   }
+
    l = strstr(chopt,"GL");
    if (l) {
       strncpy(l,"  ",2);
@@ -1052,7 +1061,7 @@ void THistPainter::Paint(Option_t *option)
    // option use TH1::GetOption.
    //
    // Setting line, fill, marker, and text attributes
-   // =====================================
+   // ===============================================
    // The histogram classes inherit from the attribute classes:
    //    TAttLine, TAttFill, TAttMarker and TAttText.
    // See the description of these classes for the list of options.
@@ -1080,7 +1089,7 @@ void THistPainter::Paint(Option_t *option)
    //
    //
    //  Giving titles to the X, Y and Z axis
-   //  =================================
+   //  ====================================
    //    h->GetXaxis()->SetTitle("X axis title");
    //    h->GetYaxis()->SetTitle("Y axis title");
    //  The histogram title and the axis titles can be any TLatex string.
@@ -1136,7 +1145,7 @@ void THistPainter::Paint(Option_t *option)
    //
    //
    // Statistics Display
-   // ======================================
+   // ==================
    // The type of information shown in the histogram statistics box
    //  can be selected with gStyle->SetOptStat(mode).
    //
@@ -1255,26 +1264,26 @@ void THistPainter::Paint(Option_t *option)
    //End_Html
    //
    //  The SCATter plot option (default for 2-D histograms)
-   // =======================
+   //  =======================
    //  For each cell (i,j) a number of points proportional to the cell content is drawn.
    //  A maximum of 500 points per cell are drawn. If the maximum is above 500
    //  contents are normalized to 500.
    //
    //
-   //  The ARRow option.  Shows gradient between adjacent cells
+   //  The ARRow option.
    //  ================
+   //  Shows gradient between adjacent cells.
    //    For each cell (i,j) an arrow is drawn
    //    The orientation of the arrow follows the cell gradient
    //
    //
-   //
    //  The BOX option
    //  ==============
-   //    For each cell (i,j) a box is drawn with surface proportional to contents
+   //  For each cell (i,j) a box is drawn with surface proportional to contents
    //
    //
    //  The COLor option
-   //  ==============
+   //  ================
    //  For each cell (i,j) a box is drawn with a color proportional
    //    to the cell content.
    //    The color table used is defined in the current style (gStyle).
@@ -1368,8 +1377,8 @@ void THistPainter::Paint(Option_t *option)
    //End_Html
    //
    //
-   //   The "SURFace" options
-   //   =====================
+   //  The "SURFace" options
+   //  =====================
    //  In a surface plot, cell contents are represented as a mesh.
    //     The height of the mesh is proportional to the cell content.
    //
@@ -1395,6 +1404,10 @@ void THistPainter::Paint(Option_t *option)
    */
    //End_Html
    //
+   //  The SPEC option
+   //  ===============
+   //  This option allows to use the TSpectrum2Painter tools. See full
+   //  documentation in TSpectrum2Painter::PaintSpectrum.
    //
    //  Option "Z" : Adding the color palette on the right side of the pad
    //  ==================================================================
@@ -1477,6 +1490,14 @@ void THistPainter::Paint(Option_t *option)
 
    if (!MakeChopt(option)) return; //check options and fill Hoption structure
 
+   // Paint using TSpectrum2Painter
+   if (Hoption.Spec) {
+      if (!TableInit()) return;
+      if (!gROOT->GetClass("TSpectrum2Painter")) gSystem->Load("libSpectrumPainter");
+      gROOT->ProcessLineFast(Form("TSpectrum2Painter::PaintSpectrum((TH2F*)0x%x,\"%s\")",fH,option));
+      return;
+   }
+
    fXbuf  = new Double_t[kNMAX];
    fYbuf  = new Double_t[kNMAX];
    if (fH->GetDimension() > 2) {
-- 
GitLab