Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TH1Editor.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/ged:$Id$
0002 // Author: Carsten Hof 16/08/04
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TH1Editor
0013 #define ROOT_TH1Editor
0014 
0015 
0016 #include "TGedFrame.h"
0017 
0018 
0019 class TH1;
0020 class TGComboBox;
0021 class TGNumberEntry;
0022 class TGCheckButton;
0023 class TGButtonGroup;
0024 class TGHButtonGroup;
0025 class TString;
0026 class TGRadioButton;
0027 class TGDoubleHSlider;
0028 class TGHSlider;
0029 class TGTextEntry;
0030 class TGNumberEntryField;
0031 class TGTextButton;
0032 
0033 class TH1Editor : public TGedFrame {
0034 
0035 protected:
0036    TH1                 *fHist;            ///< histogram object
0037    Bool_t               fSameOpt;         ///< flag for option "same"
0038    TGCompositeFrame    *fBin;             ///< Contains the Binning Widgets
0039    Int_t                fTitlePrec;       ///< font precision level
0040    TGTextEntry         *fTitle;           ///< histogram title input field
0041    TGHButtonGroup      *fDimGroup;        ///< Radiobuttongroup to change 2D <-> 3D-Plot
0042    TGRadioButton       *fDim;             ///< 2D-Plot RadioButton
0043    TGRadioButton       *fDim0;            ///< 3D-Plot RadioButton
0044    TGLayoutHints       *fDimlh;           ///< layout hints for 2D-Plot RadioButton
0045    TGLayoutHints       *fDim0lh;          ///< layout hints for 3D-Plot RadioButton
0046    TGComboBox          *fTypeCombo;       ///< histogram type combo box
0047    TGComboBox          *fCoordsCombo;     ///< Coordinate System combo box
0048    TGComboBox          *fErrorCombo;      ///< Error combo box
0049    TGCheckButton       *fHistOnOff;       ///< Draw a simple histogram with default options
0050    TGCheckButton       *fAddMarker;       ///< Draw a Marker on top of each bin
0051    TGCheckButton       *fAddB;            ///< Draw a Bar Chart
0052    TGCheckButton       *fAddBar;          ///< Bar Option
0053    TGCheckButton       *fAdd;             ///< Activate more Options
0054    TGCheckButton       *fMakeHBar;        ///< Draw Horizontal Bar Chart
0055    TGCheckButton       *fAddSimple;       ///< Draw a simple histogram  (==HIST draw option)
0056    TGNumberEntry       *fBarWidth;        ///< Change the Bar Width
0057    TGNumberEntry       *fBarOffset;       ///< Change the Bar Offset
0058    TGComboBox          *fAddCombo;        ///< Add Lines, Bars, Fill
0059    TGComboBox          *fPercentCombo;    ///< Percentage of the Bar which is drawn in a different color
0060    TGCompositeFrame    *f3;               ///< Contains Histogram Type
0061    TGCompositeFrame    *f6;               ///< Contains the Add-ComboBox (Style)
0062    TGCompositeFrame    *f7;               ///< Contains the Marker OnOff CheckBox
0063    TGCompositeFrame    *f8;               ///< Contains the Bar Chart CheckBox
0064    TGCompositeFrame    *f9;               ///< Contains the Bar Option CheckBox
0065    TGCompositeFrame    *f10;              ///< Contains the Bar Option Title
0066    TGCompositeFrame    *f11;              ///< Contains the Bar Width/Offset NumberEntries
0067    TGCompositeFrame    *f12;              ///< Contains fPercentCombo, fMakeHBar
0068    TGCompositeFrame    *f15;              ///< Contains outer line CheckBox
0069    TGCompositeFrame    *fBinCont;         ///< Contains the Rebin Widgets for case 1
0070    TGCompositeFrame    *fBinCont1;        ///< Contains the Rebin Widgets for case 2
0071    TGHSlider           *fBinSlider;       ///< Slider to set rebinning integer value
0072    TGHSlider           *fBinSlider1;      ///< Slider to set rebinning integer value for ntuple histogram
0073    TGNumberEntryField  *fBinNumberEntry;  ///< Label which shows the rebinned bin number
0074    TGNumberEntryField  *fBinNumberEntry1; ///< Label which shows the rebinned bin number for ntuple histogram
0075    TGHSlider           *fBinOffsetSld;    ///< Add an offset to the origin of the histogram
0076    TGNumberEntryField  *fOffsetNumberEntry;///< Shows the offset to the origin of the histogram
0077    TGDoubleHSlider     *fSlider;          ///< Slider to set x-axis range
0078    TGNumberEntryField  *fSldMin;          ///< Contains the minimum value of the x-Axis
0079    TGNumberEntryField  *fSldMax;          ///< Contains the maximum value of the x-Axis
0080    TGCheckButton       *fDelaydraw;       ///< Delayed drawing of the new axis range
0081    TGTextButton        *fApply;           ///< Apply-Button to accept the rebinned histogram
0082    TGTextButton        *fCancel;          ///< Cancel-Button to reprobate the rebinned histogram
0083 
0084    static  TGComboBox *BuildHistTypeComboBox(TGFrame *parent, Int_t id);       // builts the Type ComboBox
0085    static  TGComboBox *BuildHistCoordsComboBox(TGFrame *parent, Int_t id);     // builts the Coordinate ComboBox
0086    static  TGComboBox *BuildHistErrorComboBox(TGFrame *parent, Int_t id);      // builts the Error ComboBox
0087    static  TGComboBox *BuildHistAddComboBox(TGFrame *parent, Int_t id);        // builts the Add ComboBox
0088    static  TGComboBox *BuildPercentComboBox(TGFrame *parent, Int_t id);        // builts the ComboBox for setting the Bar options bar1,..., bar4
0089 
0090    virtual void  ConnectSignals2Slots();   // connect the signals to the slots
0091    void CreateBinTab();                           // Creates the Bin Tab (part of the SetGedEditor)
0092 
0093 
0094 private:
0095    Bool_t               fMake;            // Veto Variable
0096    Bool_t               fMakeB;           // avoid execution of Bar Slots
0097    Int_t                fPx1old,          // save the coordinates of the "virtual box" in delay draw mode (2D Plot)
0098                         fPy1old,
0099                         fPx2old,
0100                         fPy2old;
0101    Float_t              fP1NDCold[3],     // save the coordinates of the "virtual box" in delay draw mode
0102                         fP2NDCold[3],
0103                         fP3NDCold[3],
0104                         fP4NDCold[3];
0105    Float_t              fP1old[3],        // save the coordinates of the "virtual box" in delay draw mode (3D plot)
0106                         fP2old[3],
0107                         fP3old[3],
0108                         fP4old[3],
0109                         fP5old[3],
0110                         fP6old[3],
0111                         fP7old[3],
0112                         fP8old[3];
0113    TH1                 *fBinHist;         // Cloned histogram for rebin
0114    Double_t             fOldOffset;       // save the old offset of the histogram
0115 
0116    TString              GetHistTypeLabel();       // Get the Histogram Type = String which contains the Histogram Draw Option
0117    TString              GetHistCoordsLabel();     // Get the histogram coordinate system (CYL, SPH, PSR, ..)
0118    TString              GetHistErrorLabel();      // Get the histogram Error type (E1, .., E4)
0119    TString              GetHistAddLabel();        // Get the histogram addon (smooth line, simple line, ..)
0120    void ChangeErrorCombo(Int_t i);
0121 
0122 
0123 public:
0124    TH1Editor(const TGWindow *p = nullptr,
0125                Int_t width = 140, Int_t height = 30,
0126                UInt_t options = kChildFrame,
0127                Pixel_t back = GetDefaultFrameBackground());
0128    ~TH1Editor() override;
0129 
0130    Bool_t AcceptModel(TObject* model) override;
0131    void   SetModel(TObject* obj) override;
0132 
0133    virtual void DoTitle(const char *text);
0134    virtual void DoAddMarker(Bool_t on);
0135    virtual void DoAddBar(Bool_t);
0136    virtual void DoAddB(Bool_t);
0137    virtual void DoAddSimple(Bool_t on);
0138    virtual void DoHistSimple();
0139    virtual void DoHistComplex();
0140    virtual void DoHistChanges();
0141    virtual void DoHistView();
0142    virtual void DoBarOffset();
0143    virtual void DoBarWidth();
0144    virtual void DoPercent();
0145    virtual void DoHBar(Bool_t on);
0146    virtual void DoSliderMoved();
0147    virtual void DoSliderPressed();
0148    virtual void DoSliderReleased();
0149    virtual void DoAxisRange();
0150    virtual void DoBinMoved(Int_t number);
0151    virtual void DoBinReleased();
0152    virtual void DoBinPressed();
0153    virtual void DoBinLabel();
0154    virtual void DoBinReleased1();
0155    virtual void DoBinMoved1();
0156    virtual void DoBinLabel1();
0157    virtual void DoOffsetMoved(Int_t num);
0158    virtual void DoOffsetReleased();
0159    virtual void DoOffsetPressed();
0160    virtual void DoBinOffset();
0161    virtual void DoApply();
0162    virtual void DoCancel();
0163    virtual void PaintBox3D(Float_t *p1, Float_t *p2,Float_t *p3, Float_t *p4);
0164    Int_t* Dividers(Int_t n);
0165    void RecursiveRemove(TObject* obj) override;
0166 
0167 
0168    ClassDefOverride(TH1Editor,0)  // TH1 editor
0169 };
0170 
0171 #endif