TH1Editor.h

Go to the documentation of this file.
00001 // @(#)root/ged:$Id: TH1Editor.h 20882 2007-11-19 11:31:26Z rdm $
00002 // Author: Carsten Hof 16/08/04
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TH1Editor
00013 #define ROOT_TH1Editor
00014 
00015 //////////////////////////////////////////////////////////////////////////
00016 //                                                                      //
00017 //  TH1Editor                                                           //
00018 //                                                                      //
00019 //  Editor changing histogram attributes (Type, Coords, Error, Style)   //
00020 //                                                                      //
00021 //////////////////////////////////////////////////////////////////////////
00022 
00023 #ifndef ROOT_TGedFrame
00024 #include "TGedFrame.h"
00025 #endif
00026 
00027 
00028 class TH1;
00029 class TGComboBox;
00030 class TGNumberEntry;
00031 class TGCheckButton;
00032 class TGButtonGroup;
00033 class TGHButtonGroup;
00034 class TString;
00035 class TGRadioButton;
00036 class TGDoubleHSlider;
00037 class TGHSlider;
00038 class TGTextEntry;
00039 class TGNumberEntryField;
00040 class TGTextButton;
00041 
00042 class TH1Editor : public TGedFrame {
00043 
00044 protected:
00045    TH1                 *fHist;            // histogram object
00046    Bool_t               fSameOpt;         // flag for option "same"
00047    TGCompositeFrame    *fBin;             // Contains the Binning Widgets
00048    Int_t                fTitlePrec;       // font precision level
00049    TGTextEntry         *fTitle;           // histogram title input field
00050    TGHButtonGroup      *fDimGroup;        // Radiobuttongroup to change 2D <-> 3D-Plot
00051    TGRadioButton       *fDim;             // 2D-Plot RadioButton
00052    TGRadioButton       *fDim0;            // 3D-Plot RadioButton
00053    TGLayoutHints       *fDimlh;           // layout hints for 2D-Plot RadioButton
00054    TGLayoutHints       *fDim0lh;          // layout hints for 3D-Plot RadioButton
00055    TGComboBox            *fTypeCombo;       // histogram type combo box
00056    TGComboBox           *fCoordsCombo;     // Coordinate System combo box
00057    TGComboBox           *fErrorCombo;      // Error combo box
00058    TGCheckButton       *fHistOnOff;       // Draw a simple histogram with default options
00059    TGCheckButton       *fAddMarker;       // Draw a Marker on top of each bin
00060    TGCheckButton       *fAddB;            // Draw a Bar Chart
00061    TGCheckButton       *fAddBar;          // Bar Option
00062    TGCheckButton       *fAdd;             // Activate more Options
00063    TGCheckButton       *fMakeHBar;        // Draw Horizontal Bar Chart
00064    TGCheckButton       *fAddSimple;       // Draw a simple histogram  (==HIST draw option)
00065    TGNumberEntry       *fBarWidth;        // Change the Bar Width
00066    TGNumberEntry       *fBarOffset;       // Change the Bar Offset
00067    TGComboBox          *fAddCombo;        // Add Lines, Bars, Fill
00068    TGComboBox          *fPercentCombo;    // Percentage of the Bar which is drawn in a different color
00069    TGCompositeFrame    *f3;               // Contains Histogram Type
00070    TGCompositeFrame    *f6;               // Contains the Add-ComboBox (Style)
00071    TGCompositeFrame    *f7;               // Contains the Marker OnOff CheckBox
00072    TGCompositeFrame    *f8;               // Contains the Bar Chart CheckBox
00073    TGCompositeFrame    *f9;               // Contains the Bar Option CheckBox
00074    TGCompositeFrame    *f10;              // Contains the Bar Option Title
00075    TGCompositeFrame    *f11;              // Contains the Bar Width/Offset NumberEntries
00076    TGCompositeFrame    *f12;              // Contains fPercentCombo, fMakeHBar
00077    TGCompositeFrame    *f15;              // Contains outer line CheckBox
00078    TGCompositeFrame    *fBinCont;         // Contains the Rebin Widgets for case 1
00079    TGCompositeFrame    *fBinCont1;        // Contains the Rebin Widgets for case 2
00080    TGHSlider           *fBinSlider;       // Slider to set rebinning integer value
00081    TGHSlider           *fBinSlider1;      // Slider to set rebinning integer value for ntuple histogram
00082    TGNumberEntryField  *fBinNumberEntry;  // Label which shows the rebinned bin number
00083    TGNumberEntryField  *fBinNumberEntry1; // Label which shows the rebinned bin number for ntuple histogram
00084    TGHSlider           *fBinOffsetSld;    // Add an offset to the origin of the histogram
00085    TGNumberEntryField  *fOffsetNumberEntry;// Shows the offset to the origin of the histogram
00086    TGDoubleHSlider     *fSlider;          // Slider to set x-axis range
00087    TGNumberEntryField  *fSldMin;          // Contains the minimum value of the x-Axis
00088    TGNumberEntryField  *fSldMax;          // Contains the maximum value of the x-Axis
00089    TGCheckButton       *fDelaydraw;       // Delayed drawing of the new axis range
00090    TGTextButton        *fApply;           // Apply-Button to accept the rebinned histogram
00091    TGTextButton        *fCancel;          // Cancel-Button to reprobate the rebinned histogram
00092 
00093    static  TGComboBox *BuildHistTypeComboBox(TGFrame *parent, Int_t id);       // builts the Type ComboBox
00094    static  TGComboBox *BuildHistCoordsComboBox(TGFrame *parent, Int_t id);     // builts the Coordinate ComboBox
00095    static  TGComboBox *BuildHistErrorComboBox(TGFrame *parent, Int_t id);      // builts the Error ComboBox
00096    static  TGComboBox *BuildHistAddComboBox(TGFrame *parent, Int_t id);        // builts the Add ComboBox
00097    static  TGComboBox *BuildPercentComboBox(TGFrame *parent, Int_t id);        // builts the ComboBox for setting the Bar options bar1,..., bar4
00098 
00099    virtual void  ConnectSignals2Slots();   // connect the signals to the slots
00100    void CreateBinTab();                           // Creates the Bin Tab (part of the SetGedEditor)
00101 
00102 
00103 private:
00104    Bool_t               fMake;            // Veto Variable
00105    Bool_t               fMakeB;           // avoid execution of Bar Slots
00106    Int_t                fPx1old,          // save the coordinates of the "virtual box" in delay draw mode (2D Plot)
00107                         fPy1old,
00108                         fPx2old,
00109                         fPy2old;
00110    Float_t              fP1NDCold[3],     // save the coordinates of the "virtual box" in delay draw mode
00111                         fP2NDCold[3],
00112                         fP3NDCold[3],
00113                         fP4NDCold[3];
00114    Float_t              fP1old[3],        // save the coordinates of the "virtual box" in delay draw mode (3D plot)
00115                         fP2old[3],
00116                         fP3old[3],
00117                         fP4old[3],
00118                         fP5old[3],
00119                         fP6old[3],
00120                         fP7old[3],
00121                         fP8old[3];
00122    TH1                 *fBinHist;         // Cloned histogram for rebin
00123    Double_t             fOldOffset;       // save the old offset of the histogram
00124 
00125    TString              GetHistTypeLabel();       // Get the Histogram Type = String which contains the Histogram Draw Option
00126    TString              GetHistCoordsLabel();     // Get the histogram coordinate system (CYL, SPH, PSR, ..)
00127    TString              GetHistErrorLabel();      // Get the histogram Error type (E1, .., E4)
00128    TString              GetHistAddLabel();        // Get the histogram addon (smooth line, simple line, ..)
00129    void ChangeErrorCombo(Int_t i);
00130 
00131 
00132 public:
00133    TH1Editor(const TGWindow *p = 0, 
00134                Int_t width = 140, Int_t height = 30,
00135                UInt_t options = kChildFrame,
00136                Pixel_t back = GetDefaultFrameBackground());
00137    virtual ~TH1Editor();
00138 
00139    virtual Bool_t AcceptModel(TObject* model);
00140    virtual void   SetModel(TObject* obj);
00141 
00142    virtual void DoTitle(const char *text);
00143    virtual void DoAddMarker(Bool_t on);
00144    virtual void DoAddBar(Bool_t);
00145    virtual void DoAddB(Bool_t);
00146    virtual void DoAddSimple(Bool_t on);
00147    virtual void DoHistSimple();
00148    virtual void DoHistComplex();
00149    virtual void DoHistChanges();
00150    virtual void DoHistView();
00151    virtual void DoBarOffset();
00152    virtual void DoBarWidth();
00153    virtual void DoPercent();
00154    virtual void DoHBar(Bool_t on);
00155    virtual void DoSliderMoved();
00156    virtual void DoSliderPressed();
00157    virtual void DoSliderReleased();
00158    virtual void DoAxisRange();
00159    virtual void DoBinMoved(Int_t number);
00160    virtual void DoBinReleased();
00161    virtual void DoBinPressed();
00162    virtual void DoBinLabel();
00163    virtual void DoBinReleased1();
00164    virtual void DoBinMoved1();
00165    virtual void DoBinLabel1();
00166    virtual void DoOffsetMoved(Int_t num);
00167    virtual void DoOffsetReleased();
00168    virtual void DoOffsetPressed();
00169    virtual void DoBinOffset();
00170    virtual void DoApply();
00171    virtual void DoCancel();
00172    virtual void PaintBox3D(Float_t *p1, Float_t *p2,Float_t *p3, Float_t *p4);
00173    Int_t* Dividers(Int_t n);
00174 
00175    ClassDef(TH1Editor,0)  // TH1 editor
00176 };
00177 
00178 #endif

Generated on Tue Jul 5 14:19:25 2011 for ROOT_528-00b_version by  doxygen 1.5.1