// ferhue, September 2017 #ifndef TH2VIEWER_H #define TH2VIEWER_H TH2VIEWER_H #include "RQ_OBJECT.h" #include "TGFrame.h" #include //forward declarations class TRootEmbeddedCanvas; class TGStatusBar; class TGCheckButton; class TGRadioButton; class TGNumberEntry; class TGHSlider; class TGDoubleSlider; class TGHorizontalFrame; class TGLabel; class TextedHSlider; class TextedDoubleSlider; class TH1; class TH2; class TBox; class TH2Viewer : public TGMainFrame { RQ_OBJECT("TH2Viewer") ///< for classes not derived from TQObject, RQ_OBJECT macro should be used public: TH2Viewer(const std::vector h2s);///< Class constructor, generates the GUI. \param h2s a vector of all 2D histograms to analyse. Histograms should have same number of bins. ~TH2Viewer();///< Destructor /** * \brief Handles key press events for going forward or backward * \param event the type of event * \param px the key character * \param py the key symbol/address * \param sel the object selected where event happens * \note It has to be public! */ void CaptureEvent(Int_t event, Int_t px, Int_t py, TObject *sel); void DoRadio();///< Handles the radio button click void Redraw2D(const UShort_t id);///< Redraws the 2D histogram selected (id) void RedrawBorderBoxX();///< Redraws the 2D x border box void RedrawBorderBoxY();///< Redraws the 2D y border box void RedrawX();///< Redraws the 1D x projections void RedrawY();///< Redraws the 1D y projections void ZoomX();///< Zooms x axis void ZoomY();///< Zooms y axis void MovePalette();///< Moves and resizes color scale palette void ReplaceData(std::vector newData, const UShort_t xbins, const UShort_t ybins);///< Replaces the current 2D histograms stored with another set of exactly the same size/shape. Faster than deleting class and regenerating. \param h2s a vector of all new 2D histograms protected: void CloseWindow(); ///< Closes the GUI. Automatically called private: TRootEmbeddedCanvas* fCanvas2; ///< The main 2D canvas TRootEmbeddedCanvas* fCanvasX; ///< The x projection canvas TRootEmbeddedCanvas* fCanvasY; ///< The y projection canvas std::vector fH2; ///< All 2D histograms available std::vector fHx; ///< All 1D x projections available std::vector fHy; ///< All 1D y projections available TGStatusBar* fStatusBar; ///< Event status bar TGHorizontalFrame* fRow1; ///< Horizontal container first row TGHorizontalFrame* fRow2; ///< Horizontal container second row TGVerticalFrame* fVertical; ///< Vertical container TGVerticalFrame* fHistList; ///< Container of list of histograms std::vector fSelect1;///< Check which 1D histograms have to be drawn std::vector fSelect2;///< Check which 2D histogram has to be drawn TextedDoubleSlider* fBorderX; ///