Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:12:08

0001 // @(#)root/ged:$Id$
0002 // Author: Carsten Hof 08/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_TH2Editor
0013 #define ROOT_TH2Editor
0014 
0015 
0016 #include "TGedFrame.h"
0017 
0018 class TH2;
0019 class TGComboBox;
0020 class TGLabel;
0021 class TGTextEntry;
0022 class TGCheckButton;
0023 class TString;
0024 class TGDoubleHSlider;
0025 class TGHSlider;
0026 class TGNumberEntry;
0027 class TGHButtonGroup;
0028 class TGRadioButton;
0029 class TGNumberEntryField;
0030 class TGColorSelect;
0031 class TGedPatternSelect;
0032 class TGTextButton;
0033 
0034 class TH2Editor : public TGedFrame {
0035 
0036 protected:
0037    TH2                 *fHist;            ///< histogram object
0038    TGCompositeFrame    *fBin;             ///< Contains the Binning Widgets
0039    TGCompositeFrame    *fFit;             ///< Contains the Fitting Widgets
0040    TGTextEntry         *fTitle;           ///< histogram title input field
0041    TGComboBox          *fTypeCombo;       ///< histogram type combo box
0042    TGComboBox          *fCoordsCombo;     ///< Coordinate System combo box
0043    TGComboBox          *fContCombo;       ///< Contour selecting combo box
0044    TGLabel             *fColContLbl;      ///< No. of Contours Label 1
0045    TGLabel             *fColContLbl1;     ///< No. of Contours Label 2
0046    Int_t                fTitlePrec;       ///< font precision level
0047    TGHButtonGroup      *fDimGroup;        ///< Radiobuttongroup to change 2D <-> 3D-Plot
0048    TGRadioButton       *fDim;             ///< 2D-Plot RadioButton
0049    TGRadioButton       *fDim0;            ///< 3D-Plot RadioButton
0050    TGLayoutHints       *fDimlh;           ///< layout hints for 2D-Plot RadioButton
0051    TGLayoutHints       *fDim0lh;          ///< layout hints for 3D-Plot RadioButton
0052    TGCompositeFrame    *f6;               ///< Frame that contains the 2D CheckBox DrawOptions
0053    TGCompositeFrame    *f9;               ///< Frame that contains the 3D CheckBox DrawOptions
0054    TGCompositeFrame    *f12;              ///< Frame that contains the Bar-Title
0055    TGCompositeFrame    *f13;              ///< Frame that contains the Bar Width/Offset NumberEntries
0056    TGCompositeFrame    *f38;              ///< Frame that contains the Frame Fill widgets
0057    TGCheckButton       *fAddError;        ///< CheckBox connected to error bars
0058    TGCheckButton       *fAddPalette;      ///< CheckBox connected to Z option (2D)
0059    TGCheckButton       *fAddPalette1;     ///< CheckBox connected to Z option (3D)
0060    TGCheckButton       *fAddArr;          ///< CheckBox connected to Arr-Option
0061    TGCheckButton       *fAddBox;          ///< CheckBox connected to Box-Option
0062    TGCheckButton       *fAddScat;         ///< CheckBox connected to Scat-Option
0063    TGCheckButton       *fAddCol;          ///< CheckBox connected to Col-Option
0064    TGCheckButton       *fAddFB;           ///< Draw front box (or not)
0065    TGCheckButton       *fAddBB;           ///< Draw back box (or not)
0066    TGCheckButton       *fAddText;         ///< Draw bin contents as text
0067    TGNumberEntry       *fContLevels;      ///< Set number of contour levels
0068    TGNumberEntry       *fContLevels1;     ///< Set number of contour levels
0069    TGNumberEntry       *fBarWidth;        ///< Set bar width of histogram
0070    TGNumberEntry       *fBarOffset;       ///< Set bar offset of histogram
0071    TGCompositeFrame    *fBinXCont;        ///< Contains the rebin widgets for case 1
0072    TGHSlider           *fBinXSlider;      ///< Slider to set rebinning x integer value
0073    TGNumberEntryField  *fBinXNumberEntry; ///< Label which shows the rebinned bin number
0074    TGHSlider           *fBinYSlider;      ///< Slider to set rebinning y integer value
0075    TGNumberEntryField  *fBinYNumberEntry; ///< Label which shows the rebinned bin number
0076    TGTextButton        *fApply;           ///< Apply-Button to accept the rebinned histogram
0077    TGTextButton        *fCancel;          ///< Cancel-Button to reprobate the rebinned histogram
0078    TGCompositeFrame    *fBinXCont1;       ///< Contains the X Rebin Widgets for case 2
0079    TGHSlider           *fBinXSlider1;     ///< Slider to set x rebinning integer value
0080    TGNumberEntryField  *fBinXNumberEntry1;///< Label which shows the rebinned x bin number
0081    TGNumberEntryField  *fXOffsetNumberEntry; ///< Shows the offset to the x origin of the histogram
0082    TGHSlider           *fXBinOffsetSld;   ///< Add an x-offset to the origin of the histogram
0083 
0084    TGCompositeFrame    *fBinYCont1;       ///< Contains the Y Rebin Widgets for case 2
0085    TGHSlider           *fBinYSlider1;     ///< Slider to set y rebinning integer value
0086    TGNumberEntryField  *fBinYNumberEntry1;///< Label which shows the rebinned y bin number
0087    TGNumberEntryField  *fYOffsetNumberEntry; ///< Shows the offset to the y origin of the histogram
0088    TGHSlider           *fYBinOffsetSld;   ///< Add an y-offset to the origin of the histogram
0089    TGDoubleHSlider     *fSliderX;         ///< Slider to set x-axis range
0090    TGNumberEntryField  *fSldXMin;         ///< Contains the minimum value of the x-Axis
0091    TGNumberEntryField  *fSldXMax;         ///< Contains the maximum value of the x-Axis
0092    TGDoubleHSlider     *fSliderY;         ///< Slider to set y-axis range
0093    TGNumberEntryField  *fSldYMin;         ///< Contains the minimum value of the y-Axis
0094    TGNumberEntryField  *fSldYMax;         ///< Contains the maximum value of the y-Axis
0095    TGCheckButton       *fDelaydraw;       ///< Delayed drawing of the new axis range
0096    TGColorSelect       *fFrameColor;      ///< Select the Frame Color
0097    TGedPatternSelect   *fFramePattern;    ///< Select the Frame Pattern Style
0098    TString              fCutString;       ///< Contais info about graphical cuts (if any)
0099 
0100    static  TGComboBox *BuildHistTypeComboBox(TGFrame *parent, Int_t id);
0101    static  TGComboBox *BuildHistCoordsComboBox(TGFrame *parent, Int_t id);
0102    static  TGComboBox *BuildHistContComboBox(TGFrame* parent, Int_t id);
0103 
0104    virtual void   ConnectSignals2Slots();
0105            void   CreateBinTab();       // Creates the Bin Tab (part of the SetGedEditor)
0106 
0107 private:
0108    void    PaintBox3D(Float_t *p1, Float_t *p2,Float_t *p3, Float_t *p4);
0109    TString GetHistTypeLabel();
0110    TString GetHistCoordsLabel();
0111    TString GetHistContLabel();
0112    TString GetHistAdditiveLabel();
0113    TString GetCutOptionString();
0114 
0115    Int_t     fPx1old,
0116              fPy1old,
0117              fPx2old,
0118              fPy2old;
0119    Float_t   fP1oldx[3],
0120              fP2oldx[3],
0121              fP3oldx[3],
0122              fP4oldx[3],
0123              fP5oldx[3],
0124              fP6oldx[3],
0125              fP7oldx[3],
0126              fP8oldx[3];
0127    Float_t   fP1oldy[3],
0128              fP2oldy[3],
0129              fP3oldy[3],
0130              fP4oldy[3],
0131              fP5oldy[3],
0132              fP6oldy[3],
0133              fP7oldy[3],
0134              fP8oldy[3];
0135    TH2      *fBinHist;         // Cloned histogram for rebin
0136    Double_t  fOldXOffset;      // saves the old x offset of the histogram
0137    Double_t  fOldYOffset;      // saves the old y offset of the histogram
0138 
0139 public:
0140    TH2Editor(const TGWindow *p = nullptr,
0141              Int_t width = 140, Int_t height = 30,
0142              UInt_t options = kChildFrame,
0143              Pixel_t back = GetDefaultFrameBackground());
0144    ~TH2Editor() override;
0145 
0146    Bool_t AcceptModel(TObject* model) override;
0147    void   SetModel(TObject* obj) override;
0148    void   ActivateBaseClassEditors(TClass* cl) override;
0149 
0150    virtual void DoTitle(const char *text);
0151    virtual void DoHistView();
0152    virtual void DoHistSimple();
0153    virtual void DoHistComplex();
0154    virtual void DoHistChanges();
0155    virtual void DoAddArr(Bool_t on);
0156    virtual void DoAddBox(Bool_t on);
0157    virtual void DoAddCol(Bool_t on);
0158    virtual void DoAddScat(Bool_t on);
0159    virtual void DoAddText(Bool_t on);
0160    virtual void DoAddError(Bool_t on);
0161    virtual void DoAddPalette(Bool_t on);
0162    virtual void DoAddFB();
0163    virtual void DoAddBB();
0164    virtual void DoContLevel();
0165    virtual void DoContLevel1();
0166    virtual void DoBarWidth();
0167    virtual void DoBarOffset();
0168    virtual void DoBinPressed();
0169    virtual void DoBinMoved();
0170    virtual void DoBinReleased();
0171    virtual void DoBinLabel();
0172    virtual void DoApply();
0173    virtual void DoCancel();
0174    virtual void DoBinReleased1();
0175    virtual void DoBinMoved1();
0176    virtual void DoBinLabel1();
0177    virtual void DoOffsetMoved();
0178    virtual void DoOffsetReleased();
0179    virtual void DoOffsetPressed();
0180    virtual void DoBinOffset();
0181    virtual void DoSliderXMoved();
0182    virtual void DoSliderXPressed();
0183    virtual void DoSliderXReleased();
0184    virtual void DoXAxisRange();
0185    virtual void DoSliderYMoved();
0186    virtual void DoSliderYPressed();
0187    virtual void DoSliderYReleased();
0188    virtual void DoYAxisRange();
0189    virtual void DoFillColor(Pixel_t);
0190    virtual void DoFillPattern(Style_t);
0191 
0192    Int_t* Dividers(Int_t n);
0193 
0194    void RecursiveRemove(TObject* obj) override;
0195 
0196    ClassDefOverride(TH2Editor,0)  // TH2 editor
0197 };
0198 
0199 #endif
0200