JG ROOT Tools libraries  version 5.0 - august 2014
RGHistoPlotModeSelect.hh
Go to the documentation of this file.
1 //======================================================================
2 /*! \file RGHistoPlotModeSelect.hh
3  *
4  * Include file for class RGHistoPlotModeSelect
5  */
6 //======================================================================
7 
8 #ifndef RG_HISTO_PLOT_MODE_SELECT_HH
9 #define RG_HISTO_PLOT_MODE_SELECT_HH
10 
11 #include "RBaseFunctions.hh"
12 #include "ROptionString.hh"
13 
14 // ROOT include files
15 #include <TH1.h>
16 #include <TPad.h>
17 #include <TGLabel.h>
18 #include <TGComboBox.h>
19 
20 ///! RGHistoPlotModeSelect widget options
22 {
23  rgHPMSHisto1D = 0x00000000,
24  rgHPMSHisto2D = 0x00000001,
25  rgHPMSHisto3D = 0x00000002,
26  rgHPMSHistoDim = 0x00000003,
27 
28  // suppression des modes 2D/3D
29  rgHPMSNo2DView = 0x00000010,
30  rgHPMSNo3DView = 0x00000020
31 };
32 
33 ///! Histogram plot options
35 {
36  // 1D histogrammes plot modes
37  rPlot1DHisto = 0x00000001,
38  rPlot1DLine = 0x00000002,
39  rPlot1DCurve = 0x00000003,
40  rPlot1DMarker = 0x00000004, // option cumulable avec les précédentes
41 
42  // 2D histogrammes plot modes
43  // - 2D view
44  rPlot2DScatter = 0x00000001, // option cumulable avec les 2 suivantes
45  rPlot2DColor = 0x00000002,
46  rPlot2DColorZ = 0x00000004,
47  rPlot2DCont = 0x00000008,
48 
49  // - 3D view
50  rPlot2DSurf = 0x00000100,
51  rPlot2DSurfColor = 0x00000200,
52  rPlot2DSurfShade = 0x00000400,
53  rPlot2DLego = 0x00000800,
54  rPlot2DLegoColor = 0x00000900,
55 
56  // 3D histogrammes plot modes
57  rPlot3DScatter = 0x00000100,
58  rPlot3DBox = 0x00000200,
59 
60  // catégories
61  rPlot2DView = 0x000000FF,
62  rPlot3DView = 0x0000FF00
63 };
64 
65 
66 //======================================================================
67 /*! class RGHistoPlotModeSelect
68  *
69  * Widget for plot mode selection of an histogram
70  * (1D, 2D or 3D).
71  *
72  * Options:
73  * - \b rgHPMSHisto1D: plot modes of a 1D histogram (défaut)
74  * - \b rgHPMSHisto2D: plot modes of a 2D histogram
75  * - \b rgHPMSHisto3D: plot modes of a 3D histogram
76  *
77  * The following options can be used for 2D histograms (note that
78  * 1D histograms are plotted in 2D views, and 3D histograms in 3D views):
79  * - \b rgHPMSNo2DView: do not include 2D plot modes
80  * - \b rgHPMSNo3DView: do not include 3D plot modes
81  */
82 class RGHistoPlotModeSelect : public TGVerticalFrame
83 {
84  //------------------------------------------------------------
85  /*! \object_doc{RGHistoPlotModeSelect} */
87  //------------------------------------------------------------
88 
89  protected:
90  UInt_t options; ///< Options;
91 
92  Int_t histo_dim; ///< Histogram dimension
93 
94  // the plot modes are defined in the constructor, when calling
95  // InitModes function: they are different for 1D, 2D and 3D histograms
96  Int_t mode_num; ///< Number of plot modes
97 #ifndef __MAKECINT__
98  string * mode_list; ///< Array of plot mode names
99  Int_t * mode_val; ///< Array of plot mode values
100 #endif
101 
102  Int_t plot_mode; ///< Initial plot mode
103 
104  TGComboBox * w_mode_select; ///< Selection widget
105 
106  //------------------------------------------------------------
107  // Constructors / affectation / destructor
108  public:
109  RGHistoPlotModeSelect ( TGWindow * p = NULL,
110  const Int_t mode = 0,
111  UInt_t opt = 0 );
112 
113  private:
114  RGHistoPlotModeSelect ( const RGHistoPlotModeSelect &original );
115 
116  public:
117  virtual ~RGHistoPlotModeSelect ( );
118 
119  //------------------------------------------------------------
120  protected:
121  virtual void Construct ( );
122 
123  public:
124  //------------------------------------------------------------
125  // Functions
126  virtual void InitModes ( );
127  virtual void ChangeDimension ( const Int_t dim );
128  virtual Int_t GetDimension ( ) const;
129 
130  virtual void SetState ( const Bool_t b = kTRUE );
131 
132  virtual Int_t GetPlotMode ( ) const;
133  virtual string GetPlotOption ( ) const;
134  static string GetPlotOption ( const Int_t dim, const Int_t mode );
135 
136  static Int_t DrawHisto ( TH1 * hptr, const Int_t mode, const string &add_opts, TPad * padptr, const Int_t copy = 1, const Double_t norm = 1. );
137  virtual Int_t DrawHisto ( TH1 * hptr, const string &add_opts, TPad * padptr, const Int_t copy, const Double_t norm = 1. ) const;
138  virtual Int_t DrawHisto ( TH1 * hptr, const string &add_opts = "", TPad * padptr = NULL ) const;
139  virtual Int_t DrawHistoCopy ( TH1 * hptr, const string &add_opts = "", TPad * padptr = NULL ) const;
140  virtual Int_t DrawHistoNormalized ( TH1 * hptr, const Double_t norm, const string &add_opts = "", TPad * padptr = NULL ) const;
141 
142  virtual void SelectMode ( const Int_t mode, const Bool_t emit = kTRUE );
143 
144  //------------------------------------------------------------
145  // Signals
146  virtual void ModeSelected ( Int_t m ); // *SIGNAL*
147 
148  //------------------------------------------------------------
149  /*! For ROOT dictionary.*/
151 };
152 
153 //----------------------------------------------------------------------
154 // Inline functions
156 
157 //======================================================================
158 #endif
159 
Int_t histo_dim
Histogram dimension.
Definition: RGHistoPlotModeSelect.hh:92
TGComboBox * w_mode_select
Selection widget.
Definition: RGHistoPlotModeSelect.hh:104
virtual Int_t GetDimension() const
Definition: RGHistoPlotModeSelect.icc:19
UInt_t options
Options;.
Definition: RGHistoPlotModeSelect.hh:90
virtual void SelectMode(const Int_t mode, const Bool_t emit=kTRUE)
Definition: RGHistoPlotModeSelect.cpp:572
RHistoPlotModeOptions
! Histogram plot options
Definition: RGHistoPlotModeSelect.hh:34
virtual ~RGHistoPlotModeSelect()
Definition: RGHistoPlotModeSelect.cpp:53
virtual Int_t DrawHistoCopy(TH1 *hptr, const string &add_opts="", TPad *padptr=NULL) const
Definition: RGHistoPlotModeSelect.icc:55
virtual void ChangeDimension(const Int_t dim)
Definition: RGHistoPlotModeSelect.cpp:189
Definition: RGHistoPlotModeSelect.hh:82
Int_t * mode_val
Array of plot mode values.
Definition: RGHistoPlotModeSelect.hh:99
Int_t plot_mode
Initial plot mode.
Definition: RGHistoPlotModeSelect.hh:102
virtual Int_t DrawHistoNormalized(TH1 *hptr, const Double_t norm, const string &add_opts="", TPad *padptr=NULL) const
Definition: RGHistoPlotModeSelect.icc:65
virtual string GetPlotOption() const
Definition: RGHistoPlotModeSelect.icc:15
virtual void ModeSelected(Int_t m)
Definition: RGHistoPlotModeSelect.icc:72
ClassDef(RGHistoPlotModeSelect, 0)
static Int_t DrawHisto(TH1 *hptr, const Int_t mode, const string &add_opts, TPad *padptr, const Int_t copy=1, const Double_t norm=1.)
Definition: RGHistoPlotModeSelect.cpp:405
RGHistoPlotModeSelect(TGWindow *p=NULL, const Int_t mode=0, UInt_t opt=0)
Definition: RGHistoPlotModeSelect.cpp:21
virtual Int_t GetPlotMode() const
Definition: RGHistoPlotModeSelect.icc:11
virtual void SetState(const Bool_t b=kTRUE)
Definition: RGHistoPlotModeSelect.cpp:262
virtual void Construct()
Definition: RGHistoPlotModeSelect.cpp:226
Int_t mode_num
Number of plot modes.
Definition: RGHistoPlotModeSelect.hh:96
GObject(RGHistoPlotModeSelect)
virtual void InitModes()
Definition: RGHistoPlotModeSelect.cpp:66
string * mode_list
Array of plot mode names.
Definition: RGHistoPlotModeSelect.hh:98
RGHistoPlotModeSelectOptions
! RGHistoPlotModeSelect widget options
Definition: RGHistoPlotModeSelect.hh:21