ROOT logo
#ifndef ALIBASECALIBVIEWERGUI_H
#define ALIBASECALIBVIEWERGUI_H

///////////////////////////////////////////////////////////////////////////////
//                                                                           //
//  Base class for the AliTPCCalibViewerGUI and AliTRDCalibViewerGUI         //
//  used for the calibration monitor                                         //
//                                                                           //
///////////////////////////////////////////////////////////////////////////////

#include <TGFrame.h>
#include <TGComboBox.h>

class TROOTt;
class TGWidget;
class TGFrame;
class TGButton;
class TGRadioButton;
class TGListBox;
class TGNumberEntry;
class TRootEmbeddedCanvas;
class TGSplitter;
class TGVSplitter;
class TGButtonGroup;
class TGTextButton;
class TGTextEntry;
class TGCheckButton;
class TGLabel;
class TGTab;
class TGCompositeFrame;
class TGWindow;
class TGGroupFrame;
class TString;
class AliBaseCalibViewer;

class AliBaseCalibViewerGUI : public TGCompositeFrame {

 public:
  AliBaseCalibViewerGUI(const TGWindow *p, UInt_t w, UInt_t h/*, char* fileName*/);  // constructor
  AliBaseCalibViewerGUI(const AliBaseCalibViewerGUI &c);                          // copy constructor
  AliBaseCalibViewerGUI &operator = (const AliBaseCalibViewerGUI &param);         // assignment operator

  virtual ~AliBaseCalibViewerGUI();

  void DrawGUI(const TGWindow *p, UInt_t w, UInt_t h);   // to be called by the costructor, here the windows is drawn

  void SetInitialValues();                                     // set the initial button states
  // initializes the GUI with default settings and opens tree for drawing
  virtual void Initialize(const char* fileName, const char* treeName = "tree") = 0; 
  // initializes the GUI with default settings and opens tree for drawing
  virtual void Initialize(AliBaseCalibViewer *viewer) = 0;
  // reload the viewer after it has been changed, e.g. added a new referenceTree, ...                  
  virtual void Reload() = 0;                          
  virtual void Reset() = 0;

  virtual TString* GetDrawString() = 0;                   // create the draw string out of selection
  virtual TString* GetCutString() = 0;                    // create the cut string out of selection
  virtual TString* GetSectorString() = 0;                 // create the sector string out of selection
  //virtual AliBaseCalibViewer* GetViewer() = 0;
  AliBaseCalibViewer* GetViewer() {return fViewer;}       // return the AliBaseCalibViewer pointer
  virtual Bool_t CreateDetailsTree(Int_t run, const Char_t* outFile, const Char_t* ocdbStorage="nothing") = 0;   // create a tree with pad level info for a given run

  TGTextEntry* GetDrawEntry() {return fComboCustom->GetTextEntry();}
  TGTextEntry* GetCutsEntry() {return fComboAddCuts->GetTextEntry();}
  TGTextEntry* GetDrawOptEntry() {return fComboAddDrawOpt->GetTextEntry();}
  TGTextEntry* GetFitEntry() {return fComboCustomFit->GetTextEntry();}

  void HandleButtonsGeneral(Int_t id = -1); // handles mutual radio button exclusions for general Tab
  void HandleButtons1D(Int_t id = -1);      // handles mutual radio button exclusions for 1D Tab
  void HandleButtonsStat(Int_t id = -1);    // handles statistic check boxes
  void HandleButtonsNoRedraw(Int_t id = -1);// handles label & scaling checkboxes without redrawing
  void ReplacePlaceHolders(TString &str);   // replace place holders of the draw variable and normalisation variable
  void DoNewSelection();                    // decides whether to redraw if user makes another selection
  virtual void DoDraw() = 0;                        // main method for drawing according to user selection
  void SavePicture();                       // method for saving
  void GetMinMax();                         // Read current Min & Max from the plot and set it to fTxtSetMin & fTxtSetMax
  void SetMinMaxLabel();                    // Set min, max and label without redrawing
  virtual void MouseMove(Int_t event, Int_t x, Int_t y, TObject *selected) = 0; 
  void UnchekAllStat();

 protected:   
  AliBaseCalibViewer   *fViewer;             // CalibViewer object used for drawing

  TGCompositeFrame    *fContTopBottom;      // container for all GUI elements, vertical divided
  TGCompositeFrame    *fContLCR;            // container for all GUI elements, horizontal divided
  TGCompositeFrame    *fContLeft;           // container for GUI elements on left side
  TGTab               *ftabLeft;            // Tabs on the left side for plot options
  TGCompositeFrame    *ftabLeft0;           // Tab 0 on the left side for general plot options
  TGCompositeFrame    *ftabLeft1;           // Tab 1 on the left side for 1D plot options
  TGTab               *ftabRight;           // Tabs on the right side
  TGCompositeFrame    *fTabRight0;          // Tab 0 on the right side for basic
  TGCompositeFrame    *fTabRight1;          // Tab 1 on the right side for advanced
  TGCompositeFrame    *fContRight;          // container for GUI elements on right side
  TGCompositeFrame    *fContCenter;         // container for GUI elements at the center
  TGCompositeFrame    *fContPlotOpt;        // container for plot options GUI elements
  TGCompositeFrame    *fContDrawOpt;        // container for draw options GUI elements
  TGCompositeFrame    *fContDrawOptSub1D2D; // container for 1D and 2D radio-button
  TGCompositeFrame    *fContNormalized;     // container for normalization options GUI elements
  TGCompositeFrame    *fContCustom;         // container for custom draw command GUI elements
  TGCompositeFrame    *fContCuts;           // container for cut options GUI elements  (drawn at TPC/TRD level)
  TGCompositeFrame    *fContAddCuts;        // container for additional cut command GUI elements
  TGCompositeFrame    *fContFit;            // container for fit GUI elements
  TGCompositeFrame    *fContAddFit;         // container for additional fit GUI elements
  TGCompositeFrame    *fContScaling;        // container for scaling GUI elements
  TGCompositeFrame    *fContSetMax;         // container for SetMaximum elements
  TGCompositeFrame    *fContSetMin;         // container for SetMinimum elements
  TGCompositeFrame    *fContAddDrawOpt;     // additional draw options container
  TGListBox           *fListVariables;      // listbox with possible variables
  TGTextButton        *fBtnDraw;            // draw button
  TGTextButton        *fBtnFit;             // fit button
  TGTextButton        *fBtnAddFitFunction;  // button to add fit function to normalization
  TGTextButton        *fBtnGetMinMax;       // GetMinMax-button
  TRootEmbeddedCanvas *fCanvMain;           // main drawing canvas
  TGRadioButton       *fRadioRaw;           // raw radio button
  TGRadioButton       *fRadioNormalized;    // normalized radio button
  TGRadioButton       *fRadioPredefined;    // predefined plot radio button
  TGRadioButton       *fRadioCustom;        // custom radio button
  TGRadioButton       *fRadio1D;            // 1D radio button
  TGRadioButton       *fRadio2D;            // 2D radio button
  TGComboBox          *fComboAddDrawOpt;    // additional draw options combo box
  TGCheckButton       *fChkAuto;            // automatic redraw checkbox
  TGCheckButton       *fChkAutoAppend;      // automatic appendign of "~" checkbox
  TGComboBox          *fComboMethod;        // normalization methods dropdown box
  TGListBox           *fListNormalization;  // listbox with possible normalization variables
  TGComboBox          *fComboCustom;        // combo box for custom draw commands
  TGLabel             *fLblCustomDraw;      // custom draw labal
  TGCheckButton       *fChkAddDrawOpt;      // additional draw options check box
  TGLabel             *fLblAddCuts;         // additional cuts label
  TGComboBox          *fComboAddCuts;       // additional cuts combo box
  TGComboBox          *fComboCustomFit;     // custom fit combo box
  TGCheckButton       *fChkSetMax;          // Set maximum check box
  TGCheckButton       *fChkSetMin;          // Set maximum check box
  TGCheckButton       *fChkGetMinMaxAuto;   // Get Min & Max automatically from plot
  TGTextEntry         *fTxtSetMax;          // custom maximum text box
  TGTextEntry         *fTxtSetMin;          // custom minimum text box
  TGGroupFrame        *fContDrawOpt1D;      // container in tabLeft1 
  TGCompositeFrame    *fcontDrawOpt1DSubLR; // container in tabLeft1 to divide L/R
  TGCompositeFrame    *fContDrawOpt1DSubNSC; // container in tabLeft1 for following radio buttons 
  TGRadioButton       *fRadioNorm;          // radio button for normal 1D drawing
  TGRadioButton       *fRadioSigma;         // radio button for sigma 1D drawing
  TGTextEntry         *fTxtSigmas;          // text box to specify sigmas
  TGCompositeFrame    *fContCumuLR;         // container in tabLeft1 for two colums for cumulative and integrative
  TGCompositeFrame    *fContCumLeft;        // container in tabLeft1 for cumulative, left
  TGCompositeFrame    *fContCumRight;       // container in tabLeft1 for cumulative, right
  TGLabel             *fLblSigmaMax;        // label to indicate sigmaMax
  TGTextEntry         *fTxtSigmaMax;        // text box to specify sigmaMax
  TGRadioButton       *fRadioCumulative;    // radio button for cumulative 1D drawing
  TGCheckButton       *fCheckCumulativePM;  // checkbox for plus/minus cumulative 1D drawing
  TGRadioButton       *fRadioIntegrate;     // radio button for integral 1D drawing
  TGCompositeFrame    *fContDrawOpt1DSubMML; // container in tabLeft1 for following check boxes
  TGCheckButton       *fChkMean;            // checkbox to plot mean
  TGCheckButton       *fChkMedian;          // checkbox to plot median
  TGCheckButton       *fChkLTM;             // checkbox to plot LTM
  TGGroupFrame        *fContStatOpt;        // container for statistic options in tabLeft1 
  TGCheckButton       *fChkStatName;        // checkbox to display histogram name in statistic legend
  TGCheckButton       *fChkStatEntries;     // checkbox to display entries in statistic legend
  TGCompositeFrame    *fContStatMean;       // container for mean and its error in stat opt
  TGCheckButton       *fChkStatMean;        // checkbox to display mean in statistic legend
  TGCheckButton       *fChkStatMeanPM;      // checkbox to display mean error in statistic legend
  TGCompositeFrame    *fContStatRMS;        // container for RMS and its error in stat opt
  TGCheckButton       *fChkStatRMS;         // checkbox to display RMS in statistic legend
  TGCheckButton       *fChkStatRMSPM;       // checkbox to display RMS error in statistic legend
  TGCheckButton       *fChkStatUnderflow;   // checkbox to display underflow error in statistic legend
  TGCheckButton       *fChkStatOverflow;    // checkbox to display overflow error in statistic legend
  TGCheckButton       *fChkStatIntegral;    // checkbox to display integral in statistic legend
  TGCompositeFrame    *fContStatSkew;       // container for skewness and its error in stat opt
  TGCheckButton       *fChkStatSkewness;    // checkbox to display skewness in statistic legend
  TGCheckButton       *fChkStatSkewnessPM;  // checkbox to display skewness error in statistic legend
  TGCompositeFrame    *fContStatKurt;       // container for kurtosis and its error in stat opt
  TGCheckButton       *fChkStatKurtosis;    // checkbox to display kurtosis in statistic legend
  TGCheckButton       *fChkStatKurtosisPM;  // checkbox to display kurtosis error in statistic legend
  TGButton            *fBtnUnchekAll;       // Button to uncheck all statistic entries
  TGGroupFrame        *fContLabeling;       // groupframe container for labeling
  TGCheckButton       *fChkLabelTitle;      // checkbox to display specified title
  TGTextEntry         *fTxtLabelTitle;      // text box to specify title
  TGCheckButton       *fChkLabelXaxis;      // checkbox to display specified xaxis label
  TGTextEntry         *fTxtLabelXaxis;      // text box to specify xaxis label
  TGCheckButton       *fChkLabelYaxis;      // checkbox to display specified yaxis label
  TGTextEntry         *fTxtLabelYaxis;      // text box to specify yaxis label
  TGCheckButton       *fChkLabelGetAuto;    // checkbox to get labels atuomatically from plot
  TGGroupFrame        *fContSave;           // container for save-button
  TGButton            *fBtnSave;            // Save button
  TGCompositeFrame    *fContAddSaveOpt;     // container for additional save options
  TGCheckButton       *fChkAddSaveOpt;      // checkbox for additional save options
  TGComboBox          *fComboAddSaveOpt;    // combobox for additional save options
  TGGroupFrame        *fContExport;         // container for cint-export
  TGCompositeFrame    *fContAddExport;      // container for dropdown list to enter export name
  TGComboBox          *fComboExportName;    // dropdownbox to enter a name for the exported CalPad
  TGTextButton        *fBtnExport;          // button to export a CalPad
  TGTextButton        *fBtnAddNorm;         // button to add a CalPad to the normalization
  TGCompositeFrame    *fContTree;           // container for tree functions
  TGTextButton        *fBtnDumpToFile;      // button to dump a new CalibTree to file
  TGTextButton        *fBtnLoadTree;        // button to load a new tree
  TGCheckButton       *fChkAddAsReference;  // checkbox to add a new tree as referenceTree
  TGTextEntry         *fTxtRefName;         // text box to specify the referenceTree's name
  
 protected:
  Bool_t fInitialized;                      // has the GUI already been initialized?
  
  ClassDef(AliBaseCalibViewerGUI, 0)
};
    
#endif
 AliBaseCalibViewerGUI.h:1
 AliBaseCalibViewerGUI.h:2
 AliBaseCalibViewerGUI.h:3
 AliBaseCalibViewerGUI.h:4
 AliBaseCalibViewerGUI.h:5
 AliBaseCalibViewerGUI.h:6
 AliBaseCalibViewerGUI.h:7
 AliBaseCalibViewerGUI.h:8
 AliBaseCalibViewerGUI.h:9
 AliBaseCalibViewerGUI.h:10
 AliBaseCalibViewerGUI.h:11
 AliBaseCalibViewerGUI.h:12
 AliBaseCalibViewerGUI.h:13
 AliBaseCalibViewerGUI.h:14
 AliBaseCalibViewerGUI.h:15
 AliBaseCalibViewerGUI.h:16
 AliBaseCalibViewerGUI.h:17
 AliBaseCalibViewerGUI.h:18
 AliBaseCalibViewerGUI.h:19
 AliBaseCalibViewerGUI.h:20
 AliBaseCalibViewerGUI.h:21
 AliBaseCalibViewerGUI.h:22
 AliBaseCalibViewerGUI.h:23
 AliBaseCalibViewerGUI.h:24
 AliBaseCalibViewerGUI.h:25
 AliBaseCalibViewerGUI.h:26
 AliBaseCalibViewerGUI.h:27
 AliBaseCalibViewerGUI.h:28
 AliBaseCalibViewerGUI.h:29
 AliBaseCalibViewerGUI.h:30
 AliBaseCalibViewerGUI.h:31
 AliBaseCalibViewerGUI.h:32
 AliBaseCalibViewerGUI.h:33
 AliBaseCalibViewerGUI.h:34
 AliBaseCalibViewerGUI.h:35
 AliBaseCalibViewerGUI.h:36
 AliBaseCalibViewerGUI.h:37
 AliBaseCalibViewerGUI.h:38
 AliBaseCalibViewerGUI.h:39
 AliBaseCalibViewerGUI.h:40
 AliBaseCalibViewerGUI.h:41
 AliBaseCalibViewerGUI.h:42
 AliBaseCalibViewerGUI.h:43
 AliBaseCalibViewerGUI.h:44
 AliBaseCalibViewerGUI.h:45
 AliBaseCalibViewerGUI.h:46
 AliBaseCalibViewerGUI.h:47
 AliBaseCalibViewerGUI.h:48
 AliBaseCalibViewerGUI.h:49
 AliBaseCalibViewerGUI.h:50
 AliBaseCalibViewerGUI.h:51
 AliBaseCalibViewerGUI.h:52
 AliBaseCalibViewerGUI.h:53
 AliBaseCalibViewerGUI.h:54
 AliBaseCalibViewerGUI.h:55
 AliBaseCalibViewerGUI.h:56
 AliBaseCalibViewerGUI.h:57
 AliBaseCalibViewerGUI.h:58
 AliBaseCalibViewerGUI.h:59
 AliBaseCalibViewerGUI.h:60
 AliBaseCalibViewerGUI.h:61
 AliBaseCalibViewerGUI.h:62
 AliBaseCalibViewerGUI.h:63
 AliBaseCalibViewerGUI.h:64
 AliBaseCalibViewerGUI.h:65
 AliBaseCalibViewerGUI.h:66
 AliBaseCalibViewerGUI.h:67
 AliBaseCalibViewerGUI.h:68
 AliBaseCalibViewerGUI.h:69
 AliBaseCalibViewerGUI.h:70
 AliBaseCalibViewerGUI.h:71
 AliBaseCalibViewerGUI.h:72
 AliBaseCalibViewerGUI.h:73
 AliBaseCalibViewerGUI.h:74
 AliBaseCalibViewerGUI.h:75
 AliBaseCalibViewerGUI.h:76
 AliBaseCalibViewerGUI.h:77
 AliBaseCalibViewerGUI.h:78
 AliBaseCalibViewerGUI.h:79
 AliBaseCalibViewerGUI.h:80
 AliBaseCalibViewerGUI.h:81
 AliBaseCalibViewerGUI.h:82
 AliBaseCalibViewerGUI.h:83
 AliBaseCalibViewerGUI.h:84
 AliBaseCalibViewerGUI.h:85
 AliBaseCalibViewerGUI.h:86
 AliBaseCalibViewerGUI.h:87
 AliBaseCalibViewerGUI.h:88
 AliBaseCalibViewerGUI.h:89
 AliBaseCalibViewerGUI.h:90
 AliBaseCalibViewerGUI.h:91
 AliBaseCalibViewerGUI.h:92
 AliBaseCalibViewerGUI.h:93
 AliBaseCalibViewerGUI.h:94
 AliBaseCalibViewerGUI.h:95
 AliBaseCalibViewerGUI.h:96
 AliBaseCalibViewerGUI.h:97
 AliBaseCalibViewerGUI.h:98
 AliBaseCalibViewerGUI.h:99
 AliBaseCalibViewerGUI.h:100
 AliBaseCalibViewerGUI.h:101
 AliBaseCalibViewerGUI.h:102
 AliBaseCalibViewerGUI.h:103
 AliBaseCalibViewerGUI.h:104
 AliBaseCalibViewerGUI.h:105
 AliBaseCalibViewerGUI.h:106
 AliBaseCalibViewerGUI.h:107
 AliBaseCalibViewerGUI.h:108
 AliBaseCalibViewerGUI.h:109
 AliBaseCalibViewerGUI.h:110
 AliBaseCalibViewerGUI.h:111
 AliBaseCalibViewerGUI.h:112
 AliBaseCalibViewerGUI.h:113
 AliBaseCalibViewerGUI.h:114
 AliBaseCalibViewerGUI.h:115
 AliBaseCalibViewerGUI.h:116
 AliBaseCalibViewerGUI.h:117
 AliBaseCalibViewerGUI.h:118
 AliBaseCalibViewerGUI.h:119
 AliBaseCalibViewerGUI.h:120
 AliBaseCalibViewerGUI.h:121
 AliBaseCalibViewerGUI.h:122
 AliBaseCalibViewerGUI.h:123
 AliBaseCalibViewerGUI.h:124
 AliBaseCalibViewerGUI.h:125
 AliBaseCalibViewerGUI.h:126
 AliBaseCalibViewerGUI.h:127
 AliBaseCalibViewerGUI.h:128
 AliBaseCalibViewerGUI.h:129
 AliBaseCalibViewerGUI.h:130
 AliBaseCalibViewerGUI.h:131
 AliBaseCalibViewerGUI.h:132
 AliBaseCalibViewerGUI.h:133
 AliBaseCalibViewerGUI.h:134
 AliBaseCalibViewerGUI.h:135
 AliBaseCalibViewerGUI.h:136
 AliBaseCalibViewerGUI.h:137
 AliBaseCalibViewerGUI.h:138
 AliBaseCalibViewerGUI.h:139
 AliBaseCalibViewerGUI.h:140
 AliBaseCalibViewerGUI.h:141
 AliBaseCalibViewerGUI.h:142
 AliBaseCalibViewerGUI.h:143
 AliBaseCalibViewerGUI.h:144
 AliBaseCalibViewerGUI.h:145
 AliBaseCalibViewerGUI.h:146
 AliBaseCalibViewerGUI.h:147
 AliBaseCalibViewerGUI.h:148
 AliBaseCalibViewerGUI.h:149
 AliBaseCalibViewerGUI.h:150
 AliBaseCalibViewerGUI.h:151
 AliBaseCalibViewerGUI.h:152
 AliBaseCalibViewerGUI.h:153
 AliBaseCalibViewerGUI.h:154
 AliBaseCalibViewerGUI.h:155
 AliBaseCalibViewerGUI.h:156
 AliBaseCalibViewerGUI.h:157
 AliBaseCalibViewerGUI.h:158
 AliBaseCalibViewerGUI.h:159
 AliBaseCalibViewerGUI.h:160
 AliBaseCalibViewerGUI.h:161
 AliBaseCalibViewerGUI.h:162
 AliBaseCalibViewerGUI.h:163
 AliBaseCalibViewerGUI.h:164
 AliBaseCalibViewerGUI.h:165
 AliBaseCalibViewerGUI.h:166
 AliBaseCalibViewerGUI.h:167
 AliBaseCalibViewerGUI.h:168
 AliBaseCalibViewerGUI.h:169
 AliBaseCalibViewerGUI.h:170
 AliBaseCalibViewerGUI.h:171
 AliBaseCalibViewerGUI.h:172
 AliBaseCalibViewerGUI.h:173
 AliBaseCalibViewerGUI.h:174
 AliBaseCalibViewerGUI.h:175
 AliBaseCalibViewerGUI.h:176
 AliBaseCalibViewerGUI.h:177
 AliBaseCalibViewerGUI.h:178
 AliBaseCalibViewerGUI.h:179
 AliBaseCalibViewerGUI.h:180
 AliBaseCalibViewerGUI.h:181
 AliBaseCalibViewerGUI.h:182
 AliBaseCalibViewerGUI.h:183
 AliBaseCalibViewerGUI.h:184
 AliBaseCalibViewerGUI.h:185
 AliBaseCalibViewerGUI.h:186
 AliBaseCalibViewerGUI.h:187
 AliBaseCalibViewerGUI.h:188
 AliBaseCalibViewerGUI.h:189
 AliBaseCalibViewerGUI.h:190
 AliBaseCalibViewerGUI.h:191
 AliBaseCalibViewerGUI.h:192
 AliBaseCalibViewerGUI.h:193
 AliBaseCalibViewerGUI.h:194
 AliBaseCalibViewerGUI.h:195
 AliBaseCalibViewerGUI.h:196
 AliBaseCalibViewerGUI.h:197
 AliBaseCalibViewerGUI.h:198
 AliBaseCalibViewerGUI.h:199
 AliBaseCalibViewerGUI.h:200
 AliBaseCalibViewerGUI.h:201
 AliBaseCalibViewerGUI.h:202
 AliBaseCalibViewerGUI.h:203