AliRoot Core  ee782a0 (ee782a0)
AliBaseCalibViewerGUI.cxx
Go to the documentation of this file.
1 // //
3 // Base class for the AliTPCCalibViewer and AliTRDCalibViewer //
4 // used for the calibration monitor //
5 // //
6 // Authors: Marian Ivanov (Marian.Ivanov@cern.ch) //
7 // Jens Wiechula (Jens.Wiechula@cern.ch) //
8 // Ionut Arsene (iarsene@cern.ch) //
9 // //
11 
12 #include <TCanvas.h>
13 #include <TPad.h>
14 #include <TVirtualPad.h>
15 #include <TROOT.h>
16 #include <TObjArray.h>
17 #include <TObjString.h>
18 #include <TVector.h>
19 #include <string.h>
20 #include <TH1.h>
21 #include <TStyle.h>
22 #include <TGFileDialog.h>
23 #include <TGInputDialog.h>
24 #include <TGWidget.h>
25 #include <TGFrame.h>
26 #include <TGButton.h>
27 #include <TGListBox.h>
28 #include <TGComboBox.h>
29 #include <TGNumberEntry.h>
30 #include <TRootEmbeddedCanvas.h>
31 #include <TGSplitter.h>
32 #include <TGButtonGroup.h>
33 #include <TGLabel.h>
34 #include <TGTab.h>
35 #include <TString.h>
36 
37 #include "AliBaseCalibViewerGUI.h"
38 
39 ClassImp(AliBaseCalibViewerGUI)
40 
41 //________________________________________________________________________________________
42 AliBaseCalibViewerGUI::AliBaseCalibViewerGUI(const TGWindow *p, UInt_t w, UInt_t h)
43  : TGCompositeFrame(p, w, h),
44  fViewer(0),
45  fContTopBottom(0),
46  fContLCR(0),
47  fContLeft(0),
48  ftabLeft(0),
49  ftabLeft0(0),
50  ftabLeft1(0),
51  ftabRight(0),
52  fTabRight0(0),
53  fTabRight1(0),
54  fContRight(0),
55  fContCenter(0),
56  fContPlotOpt(0),
57  fContDrawOpt(0),
58  fContDrawOptSub1D2D(0),
59  fContNormalized(0),
60  fContCustom(0),
61  fContCuts(0),
62  fContAddCuts(0),
63  fContFit(0),
64  fContAddFit(0),
65  fContScaling(0),
66  fContSetMax(0),
67  fContSetMin(0),
68  fContAddDrawOpt(0),
69  fListVariables(0),
70  fBtnDraw(0),
71  fBtnFit(0),
72  fBtnAddFitFunction(0),
73  fBtnGetMinMax(0),
74  fCanvMain(0),
75  fRadioRaw(0),
76  fRadioNormalized(0),
77  fRadioPredefined(0),
78  fRadioCustom(0),
79  fRadio1D(0),
80  fRadio2D(0),
81  fComboAddDrawOpt(0),
82  fChkAuto(0),
83  fChkAutoAppend(0),
84  fComboMethod(0),
85  fListNormalization(0),
86  fComboCustom(0),
87  fLblCustomDraw(0),
88  fChkAddDrawOpt(0),
89  fLblAddCuts(0),
90  fComboAddCuts(0),
91  fComboCustomFit(0),
92  fChkSetMax(0),
93  fChkSetMin(0),
94  fChkGetMinMaxAuto(0),
95  fTxtSetMax(0),
96  fTxtSetMin(0) ,
97  fContDrawOpt1D(0),
98  fcontDrawOpt1DSubLR(0),
99  fContDrawOpt1DSubNSC(0),
100  fRadioNorm(0),
101  fRadioSigma(0),
102  fTxtSigmas(0),
103  fContCumuLR(0),
104  fContCumLeft(0),
105  fContCumRight(0),
106  fLblSigmaMax(0),
107  fTxtSigmaMax(0),
108  fRadioCumulative(0),
109  fCheckCumulativePM(0),
110  fRadioIntegrate(0),
111  fContDrawOpt1DSubMML(0),
112  fChkMean(0),
113  fChkMedian(0),
114  fChkLTM(0),
115  fContStatOpt(0),
116  fChkStatName(0),
117  fChkStatEntries(0),
118  fContStatMean(0),
119  fChkStatMean(0),
120  fChkStatMeanPM(0),
121  fContStatRMS(0),
122  fChkStatRMS(0),
123  fChkStatRMSPM(0),
124  fChkStatUnderflow(0),
125  fChkStatOverflow(0),
126  fChkStatIntegral(0),
127  fContStatSkew(0),
128  fChkStatSkewness(0),
129  fChkStatSkewnessPM(0),
130  fContStatKurt(0),
131  fChkStatKurtosis(0),
132  fChkStatKurtosisPM(0),
133  fBtnUnchekAll(0),
134  fContLabeling(0),
135  fChkLabelTitle(0),
136  fTxtLabelTitle(0),
137  fChkLabelXaxis(0),
138  fTxtLabelXaxis(0),
139  fChkLabelYaxis(0),
140  fTxtLabelYaxis(0),
141  fChkLabelGetAuto(0),
142  fContSave(0),
143  fBtnSave(0),
144  fContAddSaveOpt(0),
145  fChkAddSaveOpt(0),
146  fComboAddSaveOpt(0),
147  fContExport(0),
148  fContAddExport(0),
149  fComboExportName(0),
150  fBtnExport(0),
151  fBtnAddNorm(0),
152  fContTree(0),
153  fBtnDumpToFile(0),
154  fBtnLoadTree(0),
155  fChkAddAsReference(0),
156  fTxtRefName(0),
157  fInitialized(0)
158 {
159  //
160  // AliBaseCalibViewerGUI constructor; fileName specifies the ROOT tree used for drawing
161  //
162 }
163 
164 //________________________________________________________________________________________
165 void AliBaseCalibViewerGUI::DrawGUI(const TGWindow */*p*/, UInt_t w, UInt_t h) {
166  //
167  // draw the GUI
168  //
169  // ======================================================================
170  // ************************* Display everything *************************
171  // ======================================================================
172 
173  SetCleanup(kDeepCleanup);
174 
175  // *****************************************************************************
176  // ************************* content of this MainFrame *************************
177  // *****************************************************************************
178  // top level container with horizontal layout
179  fContTopBottom = new TGCompositeFrame(this, w, h, kVerticalFrame | kFixedWidth | kFixedHeight);
180  AddFrame(fContTopBottom, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
181 
182  fContLCR = new TGCompositeFrame(fContTopBottom, w, h, kHorizontalFrame | kFixedWidth | kFixedHeight);
183  fContTopBottom->AddFrame(fContLCR, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
184 
185  // ***********************************************************************
186  // ************************* content of fContLCR *************************
187  // ***********************************************************************
188  // left container
189  fContLeft = new TGCompositeFrame(fContLCR, 200, 200, kVerticalFrame | kFixedWidth | kFitHeight);
190  fContLCR->AddFrame(fContLeft, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandY, 5, 3, 3, 3));
191 
192  // left vertical splitter
193  TGVSplitter *splitLeft = new TGVSplitter(fContLCR);
194  splitLeft->SetFrame(fContLeft, kTRUE);
195  fContLCR->AddFrame(splitLeft, new TGLayoutHints(kLHintsLeft | kLHintsExpandY, 0, 0, 0, 0));
196 
197  // right container
198  fContRight = new TGCompositeFrame(fContLCR, 200, 200, kVerticalFrame | kFixedWidth | kFitHeight);
199  fContLCR->AddFrame(fContRight, new TGLayoutHints(kLHintsTop | kLHintsRight | kLHintsExpandY, 3, 5, 3, 3));
200 
201  // center container
202  fContCenter = new TGCompositeFrame(fContLCR, 200, 200, kVerticalFrame | kFixedWidth | kFitHeight);
203  fContLCR->AddFrame(fContCenter, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
204 
205  // right vertical splitter
206  TGVSplitter *splitRight = new TGVSplitter(fContLCR);
207  splitRight->SetFrame(fContRight, kFALSE);
208  fContLCR->AddFrame(splitRight, new TGLayoutHints(kLHintsLeft | kLHintsExpandY, 0, 0, 0, 0));
209 
210 
211  // ========================================================================
212  // ************************* content of fContLeft *************************
213  // ========================================================================
214  // --- draw button and tabLeft ---
215  // draw button
216  fBtnDraw = new TGTextButton(fContLeft, "&Draw");
217  fContLeft->AddFrame(fBtnDraw, new TGLayoutHints(kLHintsExpandX, 10, 10, 0, 0));
218  //fBtnDraw->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoTest(=\"fBtnDraw clicked\")");
219  fBtnDraw->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "DoDraw()");
220  fBtnDraw->SetToolTipText("Press here to draw according to selections.");
221 
222  // tabs on the left side:
223  ftabLeft = new TGTab(fContLeft);
224  fContLeft->AddFrame(ftabLeft, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 8, 0));
225  ftabLeft0 = ftabLeft->AddTab("General");
226  ftabLeft1 = ftabLeft->AddTab("More plot options");
227 
228 
229  // **************************** content of tabLeft0 *******************************
230 
231  // draw options container *** fcontDrawOpt *** " Plot options "
232  fContDrawOpt = new TGGroupFrame(ftabLeft0, "Plot options", kVerticalFrame | kFitWidth | kFitHeight);
233  ftabLeft0->AddFrame(fContDrawOpt, new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0));
234  fContDrawOptSub1D2D = new TGCompositeFrame(fContDrawOpt, 200, 23, kHorizontalFrame | kFitWidth | kFixedHeight);
235  fContDrawOpt->AddFrame(fContDrawOptSub1D2D, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
236 
237  // ------------------------- content of fContDrawOpt -------------------------
238  // -- radio1D, radio2D, chkAuto
239  // 1D radio button
240  fRadio1D = new TGRadioButton(fContDrawOptSub1D2D, "1D", 30);
241  fContDrawOptSub1D2D->AddFrame(fRadio1D, new TGLayoutHints(kLHintsNormal, 0, 2, 0, 0));
242  fRadio1D->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsGeneral()");
243  fRadio1D->SetToolTipText("1D drawing \nSelect this if you want to have the full control for the custom draw.");
244 
245  // 2D radio button
246  fRadio2D = new TGRadioButton(fContDrawOptSub1D2D, "2D", 31);
247  fContDrawOptSub1D2D->AddFrame(fRadio2D, new TGLayoutHints(kLHintsNormal, 2, 2, 0, 0));
248  fRadio2D->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsGeneral()");
249  fRadio2D->SetToolTipText("2D drawing");
250 
251  // additional draw options container
252  fContAddDrawOpt = new TGCompositeFrame(fContDrawOpt, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
253  fContDrawOpt->AddFrame(fContAddDrawOpt, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
254 
255  // content of --- fContAddDrawOpt ---
256  // addition draw options label
257  fChkAddDrawOpt = new TGCheckButton(fContAddDrawOpt, "Draw options:");
258  //fChkAddDrawOpt->SetTextJustify(kTextLeft);
259  fContAddDrawOpt->AddFrame(fChkAddDrawOpt, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
260  fChkAddDrawOpt->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "DoNewSelection()");
261  fChkAddDrawOpt->SetToolTipText("Enter additional draw options like 'prof' or 'colz' here.\nBe careful with the option 'same' for 2D drawings as it will crash (ROOT feature).");
262 
263  // additional draw options combo box
264  fComboAddDrawOpt = new TGComboBox(fContAddDrawOpt);
265  fComboAddDrawOpt->Resize(0, fBtnDraw->GetDefaultHeight());
266  fComboAddDrawOpt->EnableTextInput(kTRUE);
267  fContAddDrawOpt->AddFrame(fComboAddDrawOpt, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
268  fComboAddDrawOpt->Connect("ReturnPressed()", "AliBaseCalibViewerGUI", this, "HandleButtonsGeneral(=14)");
269  fComboAddDrawOpt->Connect("Selected(Int_t)", "AliBaseCalibViewerGUI", this, "DoNewSelection()");
270 
271  // automatic redraw check button
272  fChkAuto = new TGCheckButton(fContDrawOpt, "Auto redraw");
273  fContDrawOpt->AddFrame(fChkAuto, new TGLayoutHints(kLHintsNormal, 0, 2, 0, 0));
274  fChkAuto->SetToolTipText("Decide if you want an automatic redraw on each new selection.\nNot recommended on a slow machine, during remote connection or if your draw option is 'same'.");
275 
276  // automatic append ending check button
277  fChkAutoAppend = new TGCheckButton(fContDrawOpt, "Auto add appending");
278  fContDrawOpt->AddFrame(fChkAutoAppend, new TGLayoutHints(kLHintsNormal, 0, 2, 0, 0));
279  fChkAutoAppend->SetToolTipText("Tries to repair your custom draw string or custom cut string, if you forgot '~' or '.fElements' \nThis function may be buggy!");
280 
281 
282  // *** predefined radio button *** " Predefined "
283  fRadioPredefined = new TGRadioButton(ftabLeft0, "Predefined: ", 13);
284  ftabLeft0->AddFrame(fRadioPredefined, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
285  fRadioPredefined->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsGeneral()");
286  fRadioPredefined->SetToolTipText("Draw predefined variables according to selection.");
287 
288  // list of variables
289  fListVariables = new TGListBox(ftabLeft0);
290  ftabLeft0->AddFrame(fListVariables, new TGLayoutHints(kLHintsNormal | kLHintsExpandX | kLHintsExpandY, 10, 0, 0, 0));
291  fListVariables->Connect("Selected(Int_t)", "AliBaseCalibViewerGUI", this, "DoNewSelection()");
292 
293 
294  // normalization options container *** fContPlotOpt ***
295  //fContPlotOpt = new TGCompositeFrame(fContLeft, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
296  fContPlotOpt = new TGGroupFrame(ftabLeft0, "Normalization options", kVerticalFrame | kFitWidth | kFitHeight);
297  ftabLeft0->AddFrame(fContPlotOpt, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10, 0, 0, 0));
298 
299  // ------------------------- content of fContPlotOpt -------------------------
300  // raw radio button
301  fRadioRaw = new TGRadioButton(fContPlotOpt, "Raw", 10);
302  fContPlotOpt->AddFrame(fRadioRaw, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
303  fRadioRaw->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsGeneral()");
304  fRadioRaw->SetToolTipText("Plot without normalization");
305 
306  // normalized radio button
307  fRadioNormalized = new TGRadioButton(fContPlotOpt, "Normalized", 11);
308  fContPlotOpt->AddFrame(fRadioNormalized, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
309  fRadioNormalized->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsGeneral()");
310  fRadioNormalized->SetToolTipText("Normalize data");
311 
312  // normalized options container *** fContNormalized ***
313  fContNormalized = new TGCompositeFrame(fContPlotOpt, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
314  fContPlotOpt->AddFrame(fContNormalized, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 15, 0, 0, 0));
315 
316  // --- content of fContNormalized ---
317  // --- combo box to select 'subtract' or 'divide', list of normalization variables
318  // method drop down combo box
319  fComboMethod = new TGComboBox(fContNormalized);
320  fComboMethod->Resize(0, fBtnDraw->GetDefaultHeight());
321  fContNormalized->AddFrame(fComboMethod, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
322  fComboMethod->Connect("Selected(Int_t)", "AliBaseCalibViewerGUI", this, "DoNewSelection()");
323 
324  // list of normalization variables
325  fListNormalization = new TGListBox(fContNormalized);
326  fContNormalized->AddFrame(fListNormalization, new TGLayoutHints(kLHintsNormal | kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
327  fListNormalization->Connect("Selected(Int_t)", "AliBaseCalibViewerGUI", this, "DoNewSelection()");
328 
329  // custom radio button
330  fRadioCustom = new TGRadioButton(ftabLeft0, "Custom: ", 12);
331  ftabLeft0->AddFrame(fRadioCustom, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
332  fRadioCustom->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsGeneral()");
333  fRadioCustom->SetToolTipText("Draw data according to user specific text entry in the 'Custom Draw' line. Remember '~' (= '.fElements')!");
334  // custom options container is located further down
335 
336  // **************************** content of tabLeft1 *******************************
337 
338  // draw options container *** fcontDrawOpt1D *** " Plot options "
339  fContDrawOpt1D = new TGGroupFrame(ftabLeft1, "1D Plot options", kVerticalFrame | kFitWidth | kFitHeight);
340  ftabLeft1->AddFrame(fContDrawOpt1D, new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0));
341 
342  fcontDrawOpt1DSubLR = new TGCompositeFrame(fContDrawOpt1D, 1, 1, kVerticalFrame | kFitWidth | kFitHeight);
343  fContDrawOpt1D->AddFrame(fcontDrawOpt1DSubLR, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
344 
345  // ***** content of fContDrawOpt1DSubLR *****
346  fContDrawOpt1DSubNSC = new TGCompositeFrame(fcontDrawOpt1DSubLR, 200, 23, kVerticalFrame | kFitWidth | kFitHeight);
347  fcontDrawOpt1DSubLR->AddFrame(fContDrawOpt1DSubNSC, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
348 
349  // --------------------------- content of fContDrawOpt1DSubNSC -----------------
350  fRadioNorm = new TGRadioButton(fContDrawOpt1DSubNSC, "Normal", 110);
351  fContDrawOpt1DSubNSC->AddFrame(fRadioNorm, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
352  fRadioNorm->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtons1D()");
353  fRadioNorm->SetToolTipText("Produce a normal 1D plot, a histogram of the selected data.");
354 
355  fRadioSigma = new TGRadioButton(fContDrawOpt1DSubNSC, "Sigma", 111);
356  fContDrawOpt1DSubNSC->AddFrame(fRadioSigma, new TGLayoutHints(kLHintsNormal, 0, 0, 5, 0));
357  fRadioSigma->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtons1D()");
358  fRadioSigma->SetToolTipText("Draw a normal histogram, but also lines that indicate the mean/median/LTM \nand sigmas of the selected data.");
359 
360  fTxtSigmas = new TGTextEntry(fContDrawOpt1DSubNSC, "2; 4; 6", 111);
361  fContDrawOpt1DSubNSC->AddFrame(fTxtSigmas, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 10, 15, 0, 0));
362  fTxtSigmas->Connect("ReturnPressed()", "AliBaseCalibViewerGUI", this, "HandleButtons1D(=111)");
363  fTxtSigmas->SetToolTipText("Enter sigma intervals you would like to be indicated by lines. \nExample: '2; 4; 6'");
364 
365  fContCumuLR = new TGCompositeFrame(fContDrawOpt1DSubNSC, 200, 23, kHorizontalFrame | kFitWidth | kFitHeight);
366  fContDrawOpt1DSubNSC->AddFrame(fContCumuLR, new TGLayoutHints(kLHintsExpandX, 0, 0, 5, 0));
367 
368  fContCumLeft = new TGCompositeFrame(fContCumuLR, 200, 23, kVerticalFrame | kFitWidth | kFitHeight);
369  fContCumuLR->AddFrame(fContCumLeft, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
370 
371  fRadioCumulative = new TGRadioButton(fContCumLeft, "Cumulative", 112);
372  fContCumLeft->AddFrame(fRadioCumulative, new TGLayoutHints(kLHintsNormal, 0, 10, 0, 0));
373  fRadioCumulative->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtons1D()");
374  fRadioCumulative->SetToolTipText("Draw the cumulative (SigmaCut) of the given selection. \nThe data distribution is integrated, starting from the mean/median/LTM.");
375 
376  fCheckCumulativePM = new TGCheckButton(fContCumLeft, "Plus/Minus");
377  fContCumLeft->AddFrame(fCheckCumulativePM, new TGLayoutHints(kLHintsNormal, 10, 15, 0, 0));
378  fCheckCumulativePM->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtons1D()");
379  fCheckCumulativePM->SetToolTipText("Decide whether you want the cumulative integration for each direction (+/-) \nor only for the absolute distance to the mean/median/LTM value.");
380 
381  fRadioIntegrate = new TGRadioButton(fContCumLeft, "Integrate", 113);
382  fContCumLeft->AddFrame(fRadioIntegrate, new TGLayoutHints(kLHintsNormal, 0, 0, 5, 0));
383  fRadioIntegrate->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtons1D()");
384  fRadioIntegrate->SetToolTipText("Draw the integral of the given selection.");
385 
386  fContCumRight = new TGCompositeFrame(fContCumuLR, 200, 23, kVerticalFrame | kFitWidth | kFitHeight);
387  fContCumuLR->AddFrame(fContCumRight, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
388 
389  fLblSigmaMax = new TGLabel(fContCumRight, "SigmaMax:");
390  fLblSigmaMax->SetTextJustify(kTextLeft);
391  fContCumRight->AddFrame(fLblSigmaMax, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 5, 0, 0, 0));
392 
393  fTxtSigmaMax = new TGTextEntry(fContCumRight, "5", 112);
394  fContCumRight->AddFrame(fTxtSigmaMax, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 10, 15, 0, 0));
395  fTxtSigmaMax->Connect("ReturnPressed()", "AliBaseCalibViewerGUI", this, "HandleButtons1D(=112)");
396  fTxtSigmaMax->SetToolTipText("Enter up to which multiple of sigma you want to integrate.");
397 
398 
399  fContDrawOpt1DSubMML = new TGCompositeFrame(fcontDrawOpt1DSubLR, 200, 23, kHorizontalFrame | kFitWidth | kFitHeight);
400  fcontDrawOpt1DSubLR->AddFrame(fContDrawOpt1DSubMML, new TGLayoutHints(kLHintsExpandX, 0, 0, 5, 0));
401 
402  // -------------- content of fcontDrawOpt1DSubLR
403  fChkMean = new TGCheckButton(fContDrawOpt1DSubMML, "Mean");
404  fContDrawOpt1DSubMML->AddFrame(fChkMean, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
405  fChkMean->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtons1D()");
406  fChkMean->SetToolTipText("Activate Mean for Sigma/Cumulative/Integrate");
407 
408  fChkMedian = new TGCheckButton(fContDrawOpt1DSubMML, "Median");
409  fContDrawOpt1DSubMML->AddFrame(fChkMedian, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
410  fChkMedian->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtons1D()");
411  fChkMedian->SetToolTipText("Activate Median for Sigma/Cumulative/Integrate");
412 
413  fChkLTM = new TGCheckButton(fContDrawOpt1DSubMML, "LTM");
414  fContDrawOpt1DSubMML->AddFrame(fChkLTM, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
415  fChkLTM->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtons1D()");
416  fChkLTM->SetToolTipText("Activate LTM for Sigma/Cumulative/Integrate");
417 
418 
419  // statistic options container *** fcontStatOpt1D *** " Statistic options "
420  fContStatOpt = new TGGroupFrame(ftabLeft1, "Statistic options", kVerticalFrame | kFitWidth | kFitHeight);
421  ftabLeft1->AddFrame(fContStatOpt, new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0));
422 
423  fChkStatName = new TGCheckButton(fContStatOpt, "Name");
424  fContStatOpt->AddFrame(fChkStatName, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
425  fChkStatName->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsStat()");
426  fChkStatName->SetToolTipText("Display the name in the statistics legend.");
427 
428  fChkStatEntries = new TGCheckButton(fContStatOpt, "Entries");
429  fContStatOpt->AddFrame(fChkStatEntries, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
430  fChkStatEntries->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsStat()");
431  fChkStatEntries->SetToolTipText("Display the number of entries in the statistics legend.");
432 
433  fContStatMean = new TGCompositeFrame(fContStatOpt, 1, 1, kHorizontalFrame | kFitWidth | kFitHeight);
434  fContStatOpt->AddFrame(fContStatMean, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
435 
436  fChkStatMean = new TGCheckButton(fContStatMean, "Mean");
437  fContStatMean->AddFrame(fChkStatMean, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
438  fChkStatMean->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsStat()");
439  fChkStatMean->SetToolTipText("Display the mean value of the data in the statistics legend.");
440 
441  fChkStatMeanPM = new TGCheckButton(fContStatMean, "+- Error");
442  fContStatMean->AddFrame(fChkStatMeanPM, new TGLayoutHints(kLHintsNormal, 10, 0, 0, 0));
443  fChkStatMeanPM->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsStat()");
444  fChkStatMeanPM->SetToolTipText("Display the mean value's error in the statistics legend.");
445 
446  fContStatRMS = new TGCompositeFrame(fContStatOpt, 1, 1, kHorizontalFrame | kFitWidth | kFitHeight);
447  fContStatOpt->AddFrame(fContStatRMS, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
448 
449  fChkStatRMS = new TGCheckButton(fContStatRMS, "RMS");
450  fContStatRMS->AddFrame(fChkStatRMS, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
451  fChkStatRMS->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsStat()");
452  fChkStatRMS->SetToolTipText("Display the RMS value of the data in the statistics legend.");
453 
454  fChkStatRMSPM = new TGCheckButton(fContStatRMS, "+- Error");
455  fContStatRMS->AddFrame(fChkStatRMSPM, new TGLayoutHints(kLHintsNormal, 10, 0, 0, 0));
456  fChkStatRMSPM->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsStat()");
457  fChkStatRMSPM->SetToolTipText("Display the RMS value's error in the statistics legend.");
458 
459  fChkStatUnderflow = new TGCheckButton(fContStatOpt, "Underflow");
460  fContStatOpt->AddFrame(fChkStatUnderflow, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
461  fChkStatUnderflow->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsStat()");
462  fChkStatUnderflow->SetToolTipText("Display the number of entries in the underflow bin.");
463 
464  fChkStatOverflow = new TGCheckButton(fContStatOpt, "Overflow");
465  fContStatOpt->AddFrame(fChkStatOverflow, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
466  fChkStatOverflow->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsStat()");
467  fChkStatOverflow->SetToolTipText("Display the number of entries in the overflow bin.");
468 
469  fChkStatIntegral = new TGCheckButton(fContStatOpt, "Integral");
470  fContStatOpt->AddFrame(fChkStatIntegral, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
471  fChkStatIntegral->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsStat()");
472  fChkStatIntegral->SetToolTipText("Display the integral of the data in the statistics legend.");
473 
474  fContStatSkew = new TGCompositeFrame(fContStatOpt, 1, 1, kHorizontalFrame | kFitWidth | kFitHeight);
475  fContStatOpt->AddFrame(fContStatSkew, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
476 
477  fChkStatSkewness = new TGCheckButton(fContStatSkew, "Skewness");
478  fContStatSkew->AddFrame(fChkStatSkewness, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
479  fChkStatSkewness->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsStat()");
480  fChkStatSkewness->SetToolTipText("Display the skewness of the data in the statistics legend. \nBe careful! Sometimes the skewness causes a floating point exception that hangs the GUI!");
481 
482  fChkStatSkewnessPM = new TGCheckButton(fContStatSkew, "+- Error");
483  fContStatSkew->AddFrame(fChkStatSkewnessPM, new TGLayoutHints(kLHintsNormal, 10, 0, 0, 0));
484  fChkStatSkewnessPM->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsStat()");
485  fChkStatSkewnessPM->SetToolTipText("Display the skewness' error in the statistics legend.");
486 
487  fContStatKurt = new TGCompositeFrame(fContStatOpt, 1, 1, kHorizontalFrame | kFitWidth | kFitHeight);
488  fContStatOpt->AddFrame(fContStatKurt, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
489 
490  fChkStatKurtosis = new TGCheckButton(fContStatKurt, "Kurtosis");
491  fContStatKurt->AddFrame(fChkStatKurtosis, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
492  fChkStatKurtosis->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsStat()");
493  fChkStatKurtosis->SetToolTipText("Display the kurtosis of the data in the statistics legend.");
494 
495  fChkStatKurtosisPM = new TGCheckButton(fContStatKurt, "+- Error");
496  fContStatKurt->AddFrame(fChkStatKurtosisPM, new TGLayoutHints(kLHintsNormal, 10, 0, 0, 0));
497  fChkStatKurtosisPM->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsStat()");
498  fChkStatKurtosisPM->SetToolTipText("Display the kurtosis' error in the statistics legend.");
499 
500  fBtnUnchekAll = new TGTextButton(fContStatOpt, "&Uncheck all");
501  fContStatOpt->AddFrame(fBtnUnchekAll, new TGLayoutHints(kLHintsExpandX, 10, 10, 0, 0));
502  fBtnUnchekAll->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "UnchekAllStat()");
503  fBtnUnchekAll->SetToolTipText("Disable all statistics legend entries, \nno statistics legend.");
504 
505 
506  // custom options container
507  // --- fComboCustom --- the custom draw line on the very low
508  fContCustom = new TGCompositeFrame(fContTopBottom, 200, 200, kHorizontalFrame | kFitWidth | kFitHeight);
509  fContTopBottom->AddFrame(fContCustom, new TGLayoutHints(kLHintsExpandX, 10, 0, 0, 0));
510 
511  // ------------------------- content of fContCustom -------------------------
512  fLblCustomDraw = new TGLabel(fContCustom, "Custom draw: ");
513  fLblCustomDraw->SetTextJustify(kTextLeft);
514  fContCustom->AddFrame(fLblCustomDraw, new TGLayoutHints(kLHintsNormal, 5, 0, 0, 0));
515  // text field for custom draw command
516  fComboCustom = new TGComboBox(fContCustom);
517  fComboCustom->Resize(0, fBtnDraw->GetDefaultHeight());
518  fComboCustom->EnableTextInput(kTRUE);
519  fContCustom->AddFrame(fComboCustom, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
520  fComboCustom->Connect("ReturnPressed()", "AliBaseCalibViewerGUI", this, "HandleButtonsGeneral(=42)");
521  fComboCustom->Connect("Selected(Int_t)", "AliBaseCalibViewerGUI", this, "DoNewSelection()");
522 
523 
524  // additional cuts container
525  fContAddCuts = new TGCompositeFrame(fContTopBottom, 200, 200, kHorizontalFrame | kFitWidth | kFitHeight);
526  fContTopBottom->AddFrame(fContAddCuts, new TGLayoutHints(kLHintsExpandX, 10, 0, 0, 0));
527 
528  // ------------------------- content of fContAddCuts -------------------------
529  fLblAddCuts = new TGLabel(fContAddCuts, "Custom cuts: ");
530  fLblAddCuts->SetTextJustify(kTextLeft);
531  fContAddCuts->AddFrame(fLblAddCuts, new TGLayoutHints(kLHintsNormal, 5, 0, 0, 0));
532  // combo text field for additional cuts
533  fComboAddCuts = new TGComboBox(fContAddCuts);
534  fComboAddCuts->Resize(0, fBtnDraw->GetDefaultHeight());
535  fComboAddCuts->EnableTextInput(kTRUE);
536  fContAddCuts->AddFrame(fComboAddCuts, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
537  fComboAddCuts->Connect("Selected(Int_t)", "AliBaseCalibViewerGUI", this, "DoNewSelection()");
538 
539  // ==========================================================================
540  // ************************* content of fContCenter *************************
541  // ========================================================================
542  // main drawing canvas
543  fCanvMain = new TRootEmbeddedCanvas("Main_Canvas", fContCenter, 200, 200, kFitWidth | kFitHeight);
544  fContCenter->AddFrame(fCanvMain, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
545 
546  fCanvMain->GetCanvas()->Connect("ProcessedEvent(Int_t, Int_t, Int_t, TObject*)", "AliBaseCalibViewerGUI", this, "MouseMove(Int_t, Int_t, Int_t, TObject*)");
547 
548  fCanvMain->GetCanvas()->Connect("RangeAxisChanged()", "AliTPCCalibViewerGUI", this, "GetMinMax()");
549  fCanvMain->GetCanvas()->SetToolTipText("The Main_Canvas, here your plots are displayed.");
550 
551 
552  // =========================================================================
553  // ************************* content of fContRight *************************
554  // ========================================================================
555 
556  // tabs on the right side:
557  ftabRight = new TGTab(fContRight);
558  fContRight->AddFrame(ftabRight, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 8, 0));
559  fTabRight0 = ftabRight->AddTab("Basic");
560  fTabRight1 = ftabRight->AddTab("Advanced");
561 
562 
563  // **************************** content of tabLeft0 *******************************
564  // cut options container
565 
566  fContCuts = new TGGroupFrame(fTabRight0, "Cuts", kVerticalFrame | kFitWidth | kFitHeight);
567  fTabRight0->AddFrame(fContCuts, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
568 
569  // Scaling options container
570  fContScaling = new TGGroupFrame(fTabRight0, "Scaling", kVerticalFrame | kFitWidth | kFitHeight);
571  fTabRight0->AddFrame(fContScaling, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
572 
573  // ************************* content of fContScaling *************************
574  // SetMaximum container
575  fContSetMax = new TGCompositeFrame(fContScaling, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
576  fContScaling->AddFrame(fContSetMax, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
577 
578  // ------------------------- content of fContSetMax -------------------------
579  // SetMaximum - checkbox
580  fChkSetMax = new TGCheckButton(fContSetMax, "Set fixed max.");
581  fContSetMax->AddFrame(fChkSetMax, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
582  fChkSetMax->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsNoRedraw()");
583  fChkSetMax->SetToolTipText("Set the maximum fixed to the value specified here.");
584 
585  // text field for maximum value
586  fTxtSetMax = new TGTextEntry(fContSetMax, "", 41);
587  fContSetMax->AddFrame(fTxtSetMax, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
588  fTxtSetMax->Connect("ReturnPressed()", "AliBaseCalibViewerGUI", this, "HandleButtonsNoRedraw()");
589  fTxtSetMax->SetToolTipText("maximum value for the drawing");
590 
591  // SetMinimum container
592  fContSetMin = new TGCompositeFrame(fContScaling, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
593  fContScaling->AddFrame(fContSetMin, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
594 
595  // ------------------------- content of fContSetMin -------------------------
596  // SetMinimum - checkbox
597  fChkSetMin = new TGCheckButton(fContSetMin, "Set fixed min.");
598  fContSetMin->AddFrame(fChkSetMin, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
599  fChkSetMin->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsNoRedraw()");
600  fChkSetMin->SetToolTipText("Set the minimum fixed to the value specified here.");
601 
602  // text field for minimum value
603  fTxtSetMin = new TGTextEntry(fContSetMin, "", 40);
604  fContSetMin->AddFrame(fTxtSetMin, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
605  fTxtSetMin->Connect("ReturnPressed()", "AliBaseCalibViewerGUI", this, "HandleButtonsNoRedraw()");
606  fTxtSetMin->SetToolTipText("minimum value for the drawing");
607 
608  // get Min & Max from Plot - button
609  fBtnGetMinMax = new TGTextButton(fContScaling, "&Get scale from plot");
610  fContScaling->AddFrame(fBtnGetMinMax, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
611  fBtnGetMinMax->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "GetMinMax()");
612  fBtnGetMinMax->SetToolTipText("Get min and max from plot, e.g. after rescaling by dragging the palette. \nObsolete! The button's function will change to 'Unzoom all'.");
613 
614  // GetMinMaxAuto - checkbox
615  fChkGetMinMaxAuto = new TGCheckButton(fContScaling, "Get Min + Max auto.");
616  fContScaling->AddFrame(fChkGetMinMaxAuto, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
617  fChkGetMinMaxAuto->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsNoRedraw()");
618  fChkGetMinMaxAuto->SetToolTipText("Get minimum and maximum automatically from each new plot. \nDeactivate this, if you want to 'save' your specified minimum and maximum.");
619 
620  // labeling container *** fContLabeling *** " Labeling "
621  fContLabeling = new TGGroupFrame(fTabRight0, "Labeling", kVerticalFrame | kFitWidth | kFitHeight);
622  fTabRight0->AddFrame(fContLabeling, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
623 
624  fChkLabelTitle = new TGCheckButton(fContLabeling, "Set title:");
625  fContLabeling->AddFrame(fChkLabelTitle, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
626  fChkLabelTitle->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsNoRedraw()");
627  fChkLabelTitle->SetToolTipText("Set the plot title.");
628 
629  fTxtLabelTitle = new TGTextEntry(fContLabeling, "Title", 500);
630  fContLabeling->AddFrame(fTxtLabelTitle, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
631  fTxtLabelTitle->Connect("ReturnPressed()", "AliBaseCalibViewerGUI", this, "HandleButtonsNoRedraw(=50)");
632  fTxtLabelTitle->SetToolTipText("plot title");
633 
634  fChkLabelXaxis = new TGCheckButton(fContLabeling, "Set X-axis label:");
635  fContLabeling->AddFrame(fChkLabelXaxis, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
636  fChkLabelXaxis->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsNoRedraw()");
637  fChkLabelXaxis->SetToolTipText("Set the X-axis label.");
638 
639  fTxtLabelXaxis = new TGTextEntry(fContLabeling, "XaxisLabel", 500);
640  fContLabeling->AddFrame(fTxtLabelXaxis, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
641  fTxtLabelXaxis->Connect("ReturnPressed()", "AliBaseCalibViewerGUI", this, "HandleButtonsNoRedraw(=51)");
642  fTxtLabelXaxis->SetToolTipText("X-axis label");
643 
644  fChkLabelYaxis = new TGCheckButton(fContLabeling, "Set Y-axis label:");
645  fContLabeling->AddFrame(fChkLabelYaxis, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
646  fChkLabelYaxis->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsNoRedraw()");
647  fChkLabelYaxis->SetToolTipText("Set the Y-axis label.");
648 
649  fTxtLabelYaxis = new TGTextEntry(fContLabeling, "YaxisLabel", 500);
650  fContLabeling->AddFrame(fTxtLabelYaxis, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
651  fTxtLabelYaxis->Connect("ReturnPressed()", "AliBaseCalibViewerGUI", this, "HandleButtonsNoRedraw(=52)");
652  fTxtLabelYaxis->SetToolTipText("Y-axis label");
653 
654  fChkLabelGetAuto = new TGCheckButton(fContLabeling, "Get labels auto.");
655  fContLabeling->AddFrame(fChkLabelGetAuto, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
656  fChkLabelGetAuto->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsNoRedraw()");
657  fChkLabelGetAuto->SetToolTipText("Get labels automatically from each new plot \nDeactivate this, if you want to 'save' your specified labels.");
658 
659 
660  // **************************** content of ftabRight1 *******************************
661  // Save container
662  fContSave = new TGGroupFrame(fTabRight1, "Save", kVerticalFrame | kFitWidth | kFitHeight);
663  fTabRight1->AddFrame(fContSave, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
664  // save button
665  fBtnSave = new TGTextButton(fContSave, "&Save picture");
666  fContSave->AddFrame(fBtnSave, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
667  fBtnSave->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "SavePicture()");
668  fBtnSave->SetToolTipText("Open a 'Save as...' dialog to save the current plot as picture or macro.");
669 
670  // additional save options container
671  fContAddSaveOpt = new TGCompositeFrame(fContSave, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
672  fContSave->AddFrame(fContAddSaveOpt, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
673 
674  // content of --- fContAddSaveOpt ---
675  // addition save options label
676  fChkAddSaveOpt = new TGCheckButton(fContAddSaveOpt, "Save options:");
677  fContAddSaveOpt->AddFrame(fChkAddSaveOpt, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
678  fChkAddSaveOpt->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "DoNewSelection()");
679  fChkAddSaveOpt->SetToolTipText("Additional save options (see documentation for TPad::Print()).");
680 
681  // additional save options combo box
682  fComboAddSaveOpt = new TGComboBox(fContAddSaveOpt);
683  fContAddSaveOpt->AddFrame(fComboAddSaveOpt, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
684  fComboAddSaveOpt->Resize(0, fBtnDraw->GetDefaultHeight());
685  fComboAddSaveOpt->EnableTextInput(kTRUE);
686  fComboAddSaveOpt->Connect("ReturnPressed()", "AliBaseCalibViewerGUI", this, "SavePicture()");
687 
688  // calPad export container
689  fContExport = new TGGroupFrame(fTabRight1, "Export AliTPCCalPad", kVerticalFrame | kFitWidth | kFitHeight);
690  fTabRight1->AddFrame(fContExport, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
691  // ------------------------- content of fContExport -------------------------
692  // container for export name
693 
694  fContAddExport = new TGCompositeFrame(fContExport, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
695  fContExport->AddFrame(fContAddExport, new TGLayoutHints(kLHintsExpandX, -5, -5, 0, 0));
696 
697  fComboExportName = new TGComboBox(fContAddExport);
698  fComboExportName->Resize(0, fBtnDraw->GetDefaultHeight());
699  fContAddExport->AddFrame(fComboExportName, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
700  fComboExportName->AddEntry("calPad", 0); // first default value
701  fComboExportName->Select(0); // select default value before connecting
702  fComboExportName->EnableTextInput(kTRUE);
703 
704  // export button
705  fBtnExport = new TGTextButton(fContExport, "&Export to CINT");
706  fContExport->AddFrame(fBtnExport, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
707  fBtnExport->SetToolTipText("Lifeless button :(");
708 
709  // add to normalisation button
710  fBtnAddNorm = new TGTextButton(fContExport, "&Add to normalization");
711  fContExport->AddFrame(fBtnAddNorm, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
712  fBtnAddNorm->SetToolTipText("Lifeless button :(");
713 
714  // Tree container
715  fContTree = new TGGroupFrame(fTabRight1, "Tree", kVerticalFrame | kFitWidth | kFitHeight);
716  fTabRight1->AddFrame(fContTree, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
717 
718  // dump tree to file button
719  fBtnDumpToFile = new TGTextButton(fContTree, "&Dump to File");
720  fContTree->AddFrame(fBtnDumpToFile, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
721  fBtnDumpToFile->SetToolTipText("Lifeless button :(");
722 
723  // dump tree to file button
724  fBtnLoadTree = new TGTextButton(fContTree, "&Load Tree");
725  fContTree->AddFrame(fBtnLoadTree, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
726  fBtnLoadTree->SetToolTipText("Lifeless button :(");
727 
728  fChkAddAsReference = new TGCheckButton(fContTree, "as reference:");
729  fContTree->AddFrame(fChkAddAsReference, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
730  fChkAddAsReference->SetToolTipText("Lifeless button :(");
731 
732  fTxtRefName = new TGTextEntry(fContTree, "R", 500);
733  fContTree->AddFrame(fTxtRefName, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 15, 0, 0, 0));
734  fTxtRefName->SetToolTipText("Reference Name");
735 
736  // Fit options container
737  fContFit = new TGGroupFrame(fTabRight1, "Custom fit", kVerticalFrame | kFitWidth | kFitHeight);
738  fTabRight1->AddFrame(fContFit, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
739 
740  // ------------------------- content of fContFit -------------------------
741  // container for additional fits
742  fContAddFit = new TGCompositeFrame(fContFit, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
743  fContFit->AddFrame(fContAddFit, new TGLayoutHints(kLHintsExpandX, -5, -5, 0, 0));
744 
745  // --- content of fContAddFit ---
746  // text field for custom fit
747  fComboCustomFit = new TGComboBox(fContAddFit);
748  fComboCustomFit->Resize(0, fBtnDraw->GetDefaultHeight());
749  fComboCustomFit->EnableTextInput(kTRUE);
750  fContAddFit->AddFrame(fComboCustomFit, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
751 
752  // fit button
753  fBtnFit = new TGTextButton(fContAddFit, "&Fit");
754  fContAddFit->AddFrame(fBtnFit, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
755  fBtnFit->SetToolTipText("Lifeless button :(");
756 }
757 
758 //________________________________________________________________________________________
760 : TGCompositeFrame(c.fParent, c.fWidth, c.fHeight),
761  fViewer(0),
762  fContTopBottom(0),
763  fContLCR(0),
764  fContLeft(0),
765  ftabLeft(0),
766  ftabLeft0(0),
767  ftabLeft1(0),
768  ftabRight(0),
769  fTabRight0(0),
770  fTabRight1(0),
771  fContRight(0),
772  fContCenter(0),
773  fContPlotOpt(0),
774  fContDrawOpt(0),
776  fContNormalized(0),
777  fContCustom(0),
778  fContCuts(0),
779  fContAddCuts(0),
780  fContFit(0),
781  fContAddFit(0),
782  fContScaling(0),
783  fContSetMax(0),
784  fContSetMin(0),
785  fContAddDrawOpt(0),
786  fListVariables(0),
787  fBtnDraw(0),
788  fBtnFit(0),
790  fBtnGetMinMax(0),
791  fCanvMain(0),
792  fRadioRaw(0),
793  fRadioNormalized(0),
794  fRadioPredefined(0),
795  fRadioCustom(0),
796  fRadio1D(0),
797  fRadio2D(0),
798  fComboAddDrawOpt(0),
799  fChkAuto(0),
800  fChkAutoAppend(0),
801  fComboMethod(0),
803  fComboCustom(0),
804  fLblCustomDraw(0),
805  fChkAddDrawOpt(0),
806  fLblAddCuts(0),
807  fComboAddCuts(0),
808  fComboCustomFit(0),
809  fChkSetMax(0),
810  fChkSetMin(0),
812  fTxtSetMax(0),
813  fTxtSetMin(0),
814  fContDrawOpt1D(0),
817  fRadioNorm(0),
818  fRadioSigma(0),
819  fTxtSigmas(0),
820  fContCumuLR(0),
821  fContCumLeft(0),
822  fContCumRight(0),
823  fLblSigmaMax(0),
824  fTxtSigmaMax(0),
825  fRadioCumulative(0),
827  fRadioIntegrate(0),
829  fChkMean(0),
830  fChkMedian(0),
831  fChkLTM(0),
832  fContStatOpt(0),
833  fChkStatName(0),
834  fChkStatEntries(0),
835  fContStatMean(0),
836  fChkStatMean(0),
837  fChkStatMeanPM(0),
838  fContStatRMS(0),
839  fChkStatRMS(0),
840  fChkStatRMSPM(0),
842  fChkStatOverflow(0),
843  fChkStatIntegral(0),
844  fContStatSkew(0),
845  fChkStatSkewness(0),
847  fContStatKurt(0),
848  fChkStatKurtosis(0),
850  fBtnUnchekAll(0),
851  fContLabeling(0),
852  fChkLabelTitle(0),
853  fTxtLabelTitle(0),
854  fChkLabelXaxis(0),
855  fTxtLabelXaxis(0),
856  fChkLabelYaxis(0),
857  fTxtLabelYaxis(0),
858  fChkLabelGetAuto(0),
859  fContSave(0),
860  fBtnSave(0),
861  fContAddSaveOpt(0),
862  fChkAddSaveOpt(0),
863  fComboAddSaveOpt(0),
864  fContExport(0),
865  fContAddExport(0),
866  fComboExportName(0),
867  fBtnExport(0),
868  fBtnAddNorm(0),
869  fContTree(0),
870  fBtnDumpToFile(0),
871  fBtnLoadTree(0),
873  fTxtRefName(0),
874  fInitialized(0)
875 {
876  //
877  // dummy AliBaseCalibViewerGUI copy constructor
878  //
879 }
880 
881 //________________________________________________________________________________________
883  //
884  // dummy assignment operator
885  //
886  return (*this);
887 }
888 
889 //________________________________________________________________________________________
891  //
892  // Destructor
893  //
894  /*
895  if (fCanvMain && fCanvMain->GetCanvas()) {
896  for (Int_t i = 0; i < fCanvMain->GetCanvas()->GetListOfPrimitives()->GetEntries(); i++) {
897  if (strcmp(fCanvMain->GetCanvas()->GetListOfPrimitives()->At(i)->ClassName(), "TFrame") != 0)
898  fCanvMain->GetCanvas()->GetListOfPrimitives()->At(i)->Delete();
899  }
900  }
901  */
902  // Cleanup();
903 }
904 
905 //________________________________________________________________________________________
907  //
908  // Set the default button states
909  //
910  fChkAuto->SetState(kButtonUp);
911  fRadioPredefined->SetState(kButtonDown);
912  fRadioRaw->SetState(kButtonDown);
913  fRadio1D->SetState(kButtonDown);
914  fChkGetMinMaxAuto->SetState(kButtonDown);
915  fChkSetMin->SetState(kButtonUp);
916  fChkSetMax->SetState(kButtonUp);
917  fRadioNorm->SetState(kButtonDown);
918  fRadioSigma->SetState(kButtonUp);
919  fRadioCumulative->SetState(kButtonUp);
920  fChkMean->SetState(kButtonDown);
921  fCheckCumulativePM->SetState(kButtonUp);
922 
923  fChkLabelGetAuto->SetState(kButtonDown);
924 
925  Int_t statOpt = gStyle->GetOptStat();
926  if (statOpt == 1) statOpt = 1111;
927  if (statOpt / 200000000 >= 1) {
928  fChkStatKurtosis->SetState(kButtonDown);
929  fChkStatKurtosisPM->SetState(kButtonDown);
930  statOpt -= 200000000;
931  }
932  if (statOpt / 100000000 >= 1) {
933  fChkStatKurtosis->SetState(kButtonDown);
934  statOpt -= 100000000;
935  }
936  if (statOpt / 20000000 >= 1) {
937  fChkStatSkewness->SetState(kButtonDown);
938  fChkStatSkewnessPM->SetState(kButtonDown);
939  statOpt -= 20000000;
940  }
941  if (statOpt / 10000000 >= 1) {
942  fChkStatSkewness->SetState(kButtonDown);
943  statOpt -= 10000000;
944  }
945  if (statOpt / 1000000 >= 1) {
946  fChkStatIntegral->SetState(kButtonDown);
947  statOpt -= 1000000;
948  }
949  if (statOpt / 100000 >= 1) {
950  fChkStatOverflow->SetState(kButtonDown);
951  statOpt -= 100000;
952  }
953  if (statOpt / 10000 >= 1) {
954  fChkStatUnderflow->SetState(kButtonDown);
955  statOpt -= 10000;
956  }
957  if (statOpt / 2000 >= 1) {
958  fChkStatRMS->SetState(kButtonDown);
959  fChkStatRMSPM->SetState(kButtonDown);
960  statOpt -= 2000;
961  }
962  if (statOpt / 1000 >= 1) {
963  fChkStatRMS->SetState(kButtonDown);
964  statOpt -= 1000;
965  }
966  if (statOpt / 200 >= 1) {
967  fChkStatMean->SetState(kButtonDown);
968  fChkStatMeanPM->SetState(kButtonDown);
969  statOpt -= 200;
970  }
971  if (statOpt / 100 >= 1) {
972  fChkStatMean->SetState(kButtonDown);
973  statOpt -= 100;
974  }
975  if (statOpt / 10 >= 1) {
976  fChkStatEntries->SetState(kButtonDown);
977  statOpt -= 10;
978  }
979  if (statOpt / 1 >= 1) {
980  fChkStatName->SetState(kButtonDown);
981  statOpt -= 1;
982  }
983 
984  // fill fComboAddDrawOpt with some additional drawing options
985  fComboAddDrawOpt->AddEntry("same", 0);
986  fComboAddDrawOpt->AddEntry("profbox", 1);
987  fComboAddDrawOpt->AddEntry("profcolz", 2);
988  fComboAddDrawOpt->AddEntry("profcont0", 3);
989  fComboAddDrawOpt->AddEntry("proflego", 4);
990  fComboAddDrawOpt->AddEntry("proflego2", 5);
991  fComboAddDrawOpt->AddEntry("profsurf", 6);
992  fComboAddDrawOpt->AddEntry("profsurf1", 7);
993  fComboAddDrawOpt->AddEntry("profsurf2", 8);
994  fComboAddDrawOpt->AddEntry("box", 9);
995  fComboAddDrawOpt->AddEntry("colz", 10);
996  fComboAddDrawOpt->AddEntry("cont0", 11);
997  fComboAddDrawOpt->AddEntry("lego", 12);
998  fComboAddDrawOpt->AddEntry("lego2", 13);
999  fComboAddDrawOpt->AddEntry("surf", 14);
1000  fComboAddDrawOpt->AddEntry("surf1", 15);
1001  fComboAddDrawOpt->AddEntry("surf2", 16);
1002 
1003  // fill fComboAddSaveOpt with some additional drawing options
1004  fComboAddSaveOpt->AddEntry("Portrait", 0);
1005  fComboAddSaveOpt->AddEntry("Landscape", 1);
1006  fComboAddSaveOpt->AddEntry("Preview", 2);
1007  fComboAddSaveOpt->AddEntry("+50", 3);
1008 
1009  // fill fComboMethod
1010  fComboMethod->AddEntry("subtract", 0);
1011  fComboMethod->AddEntry("divide by", 1);
1012 
1013  // fill fComboExportName
1014  fBtnExport->SetEnabled(kFALSE);
1015  fBtnAddNorm->SetEnabled(kFALSE);
1016 
1017  // select initial variables
1018  fListVariables->Select(0);
1019  fListNormalization->Select(0);
1020  fComboMethod->Select(0);
1021 
1022  fListVariables->IntegralHeight(kFALSE); // naja
1023  fListNormalization->IntegralHeight(kFALSE); // naja
1024  fChkAuto->SetState(kButtonDown);
1025 }
1026 
1027 //________________________________________________________________________________________
1029  //
1030  // handles mutual radio button exclusions
1031  // for general Tab
1032  //
1033  if (id == -1) {
1034  TGButton *btn = (TGButton *) gTQSender;
1035  id = btn->WidgetId();
1036  }
1037 
1038  switch (id) {
1039  case 10: // fRadioRaw
1040  fRadioNormalized->SetState(kButtonUp);
1041  fRadioPredefined->SetState(kButtonDown);
1042  fRadioCustom->SetState(kButtonUp);
1043  break;
1044  case 11: // fRadioNormalized
1045  fRadioRaw->SetState(kButtonUp);
1046  fRadioPredefined->SetState(kButtonDown);
1047  fRadioCustom->SetState(kButtonUp);
1048  break;
1049  case 12: // fRadioCustom
1050  fRadioPredefined->SetState(kButtonUp);
1051  break;
1052  case 14: // select Draw options fComboAddDrawOpt
1053  fChkAddDrawOpt->SetState(kButtonDown);
1054  break;
1055  case 13: // fRadioPredefined
1056  fRadioCustom->SetState(kButtonUp);
1057  break;
1058  //--------
1059  case 30: // fRadio1D
1060  fRadio2D->SetState(kButtonUp);
1061  fBtnExport->SetEnabled(kFALSE);
1062  fBtnAddNorm->SetEnabled(kFALSE);
1063  break;
1064  case 31: // fRadio2D
1065  fRadio1D->SetState(kButtonUp);
1066  fBtnExport->SetEnabled(kTRUE);
1067  fBtnAddNorm->SetEnabled(kTRUE);
1068  break;
1069  case 42: // fComboCustom
1070  fRadioCustom->SetState(kButtonDown);
1071  fRadioPredefined->SetState(kButtonUp);
1072  break;
1073  }
1074  DoNewSelection();
1075 }
1076 
1077 //________________________________________________________________________________________
1079  //
1080  // handles mutual radio button exclusions
1081  // 1D-Tab buttons
1082  //
1083 
1084  if (id == -1) {
1085  TGButton *btn = (TGButton *) gTQSender;
1086  id = btn->WidgetId();
1087  }
1088  switch (id) {
1089  case 110: // 1D draw normal
1090  fRadioNorm->SetState(kButtonDown);
1091  fRadioSigma->SetState(kButtonUp);
1092  fRadioCumulative->SetState(kButtonUp);
1093  fRadioIntegrate->SetState(kButtonUp);
1094  break;
1095  case 111: // 1D draw sigma
1096  fRadioNorm->SetState(kButtonUp);
1097  fRadioSigma->SetState(kButtonDown);
1098  fRadioCumulative->SetState(kButtonUp);
1099  fRadioIntegrate->SetState(kButtonUp);
1100  break;
1101  case 112: // 1D draw cumulative
1102  fRadioNorm->SetState(kButtonUp);
1103  fRadioSigma->SetState(kButtonUp);
1104  fRadioCumulative->SetState(kButtonDown);
1105  fRadioIntegrate->SetState(kButtonUp);
1106  break;
1107  case 113: // 1D draw integral
1108  fRadioNorm->SetState(kButtonUp);
1109  fRadioSigma->SetState(kButtonUp);
1110  fRadioCumulative->SetState(kButtonUp);
1111  fRadioIntegrate->SetState(kButtonDown);
1112  break;
1113  }
1114  DoNewSelection();
1115 }
1116 
1117 //________________________________________________________________________________________
1119  //
1120  // handles statistic check boxes
1121  // checks each checkbox if checked
1122  // if the checkbox is checked, appends 'n' for name, 'e' for entries, ...
1123  // to a TString, passes this TString to gStyle->SetOptStat(...)
1124  //
1125  if (id == -1) {
1126  TGButton *btn = (TGButton *) gTQSender;
1127  id = btn->WidgetId();
1128  }
1129  TString statOpt("");
1130  if (fChkStatName->GetState() == kButtonDown) statOpt.Append("n");
1131  if (fChkStatEntries->GetState() == kButtonDown) statOpt.Append("e");
1132  if (fChkStatMean->GetState() == kButtonDown && fChkStatMeanPM->GetState() == kButtonUp) statOpt.Append("m");
1133  if (fChkStatMeanPM->GetState() == kButtonDown) statOpt.Append("M");
1134  if (fChkStatRMS->GetState() == kButtonDown && fChkStatRMSPM->GetState() == kButtonUp) statOpt.Append("r");
1135  if (fChkStatRMSPM->GetState() == kButtonDown) statOpt.Append("R");
1136  if (fChkStatUnderflow->GetState() == kButtonDown) statOpt.Append("u");
1137  if (fChkStatOverflow->GetState() == kButtonDown) statOpt.Append("o");
1138  if (fChkStatIntegral->GetState() == kButtonDown) statOpt.Append("i");
1139  if (fChkStatSkewness->GetState() == kButtonDown && fChkStatSkewnessPM->GetState() == kButtonUp) statOpt.Append("s");
1140  if (fChkStatSkewnessPM->GetState() == kButtonDown) statOpt.Append("S");
1141  if (fChkStatKurtosis->GetState() == kButtonDown && fChkStatKurtosisPM->GetState() == kButtonUp) statOpt.Append("k");
1142  if (fChkStatKurtosisPM->GetState() == kButtonDown) statOpt.Append("K");
1143 
1144  gStyle->SetOptStat(statOpt);
1145  DoNewSelection();
1146 }
1147 
1148 //________________________________________________________________________________________
1150  //
1151  // handles label & scaling checkboxes
1152  // without redrawing (not necessary, faster like this)
1153  //
1154  if (id == -1) {
1155  TGButton *btn = (TGButton *) gTQSender;
1156  id = btn->WidgetId();
1157  }
1158 
1159  switch (id) {
1160  case 40: // fTxtSetMin
1161  fChkSetMin->SetState(kButtonDown);
1162  break;
1163  case 41: // fTxtSetMax
1164  fChkSetMax->SetState(kButtonDown);
1165  break;
1166  case 50: // fTxtLabelTitle
1167  fChkLabelTitle->SetState(kButtonDown);
1168  break;
1169  case 51: // fTxtLabelXaxis
1170  fChkLabelXaxis->SetState(kButtonDown);
1171  break;
1172  case 52: // fTxtLabelXaxis
1173  fChkLabelYaxis->SetState(kButtonDown);
1174  break;
1175  }
1176  SetMinMaxLabel();
1177 }
1178 
1179 //________________________________________________________________________________________
1181 {
1182  //
1183  // replace the defined placeholders in the custom draw string and cut string
1184  //
1185  TString drawPlaceHolder("#draw#");
1186  TString normPlaceHolder("#norm#");
1187 
1188  //current draw variable
1189  TString desiredData("");
1190  if (fListVariables->GetSelectedEntry()){
1191  desiredData += ((TGTextLBEntry*)(fListVariables->GetSelectedEntry()))->GetTitle();
1192  str.ReplaceAll(drawPlaceHolder,desiredData);
1193  }
1194 
1195  //current normalisation
1196  TString normalizationData("");
1197  if (fListNormalization->GetSelectedEntry()){
1198  normalizationData += ((TGTextLBEntry*)(fListNormalization->GetSelectedEntry()))->GetTitle();
1199  if (! (TString(((TGTextLBEntry*)(fListNormalization->GetSelectedEntry()))->GetTitle())).BeginsWith("Fit"))
1200  if ( normalizationData.BeginsWith("_") ) normalizationData = desiredData+normalizationData;
1201  if ( fListVariables->FindEntry(normalizationData.Data()) )
1202  normalizationData+="~";
1203  str.ReplaceAll(normPlaceHolder,normalizationData);
1204  }
1205 }
1206 
1207 //________________________________________________________________________________________
1209  //
1210  // decides whether to redraw if user makes another selection
1211  //
1212  if (fChkAuto->GetState() == kButtonDown) DoDraw();
1213 }
1214 
1215 //________________________________________________________________________________________
1217  //
1218  // saves the current picture
1219  //
1220  // use the following combination of file type and save options:
1221  // (see also TCanvas::Print)
1222  //
1223  // "ps" - Postscript file is produced (see special cases below)
1224  // "Portrait" - Postscript file is produced (Portrait)
1225  // "Landscape" - Postscript file is produced (Landscape)
1226  // "eps" - an Encapsulated Postscript file is produced
1227  // "Preview" - an Encapsulated Postscript file with preview is produced.
1228  // "pdf" - a PDF file is produced
1229  // "svg" - a SVG file is produced
1230  // "gif" - a GIF file is produced
1231  // "gif+NN" - an animated GIF file is produced, where NN is delay in 10ms units
1232  // "xpm" - a XPM file is produced
1233  // "png" - a PNG file is produced
1234  // "jpg" - a JPEG file is produced
1235  // "tiff" - a TIFF file is produced
1236  // "cxx" - a C++ macro file is produced
1237  // "xml" - a XML file
1238  // "root" - a ROOT binary file
1239 
1240  const char *kSaveAsTypes[] = {
1241  "Postscript", "*.ps",
1242  "Encapsulated Postscript", "*.eps",
1243  "PDF", "*.pdf",
1244  "JPEG", "*.jpg",
1245  "PNG", "*.png",
1246  "TIFF", "*.tiff",
1247  "GIF", "*.gif",
1248  "XPM", "*.xpm",
1249  "SVG", "*.svg",
1250  "XML", "*.xml",
1251  "C++ macro", "*.cxx",
1252  "Macro file", "*.C",
1253  "ROOT file", "*.root",
1254  "All file", "*",
1255  0, 0
1256  };
1257  TString addSaveOpt("");
1258  if (fChkAddSaveOpt->GetState() == kButtonDown)
1259  addSaveOpt += fComboAddSaveOpt->GetTextEntry()->GetText();
1260  TString dir(".");
1261  TGFileInfo fi;
1262  fi.fFileTypes = kSaveAsTypes;
1263  fi.fOverwrite = kFALSE;
1264  new TGFileDialog(gClient->GetRoot(), gClient->GetRoot(), kFDSave, &fi);
1265  if (fi.fFilename && strlen(fi.fFilename)) {
1266  if (addSaveOpt != "")
1267  fCanvMain->GetCanvas()->Print(fi.fFilename, addSaveOpt.Data());
1268  else
1269  fCanvMain->GetCanvas()->Print(fi.fFilename);
1270  }
1271 }
1272 
1273 //________________________________________________________________________________________
1275  //
1276  // Read current Min & Max from the plot and set it to fTxtSetMin & fTxtSetMax
1277  //
1278  if (fChkGetMinMaxAuto->GetState() == kButtonUp) return;
1279  TList* listOfPrimitives = fCanvMain->GetCanvas()->GetListOfPrimitives();
1280  TObject* ptr = 0;
1281  for (Int_t i = 0; i < listOfPrimitives->GetEntries(); i++) {
1282  ptr = listOfPrimitives->At(i);
1283  if ( ptr->InheritsFrom("TH1") ) break;
1284  }
1285  if ( !ptr || !ptr->InheritsFrom("TH1") ) return; // if the loop did not find a TH1
1286  TH1 *hist = (TH1*)ptr;
1287 
1288  if (fRadio2D->GetState() == kButtonDown) {
1289  if (fChkSetMax->GetState() == kButtonUp)
1290  fTxtSetMax->SetText(Form("%f", hist->GetMaximum()));
1291  if (fChkSetMin->GetState() == kButtonUp)
1292  fTxtSetMin->SetText(Form("%f", hist->GetMinimum()));
1293  }
1294  else if (fRadio1D->GetState() == kButtonDown) {
1295  if (fChkSetMax->GetState() == kButtonUp)
1296  fTxtSetMax->SetText( Form("%f", hist->GetXaxis()->GetXmax()) );
1297  if (fChkSetMin->GetState() == kButtonUp)
1298  fTxtSetMin->SetText( Form("%f", hist->GetXaxis()->GetXmin()) );
1299  }
1300 }
1301 
1302 //________________________________________________________________________________________
1304  //
1305  // Set Minimum, Maximum and labels without redrawing the plot
1306  // (faster)
1307  //
1308 
1309  // search for histogram
1310  TList* listOfPrimitives = fCanvMain->GetCanvas()->GetListOfPrimitives();
1311  TObject* ptr = 0;
1312  for (Int_t i = 0; i < listOfPrimitives->GetEntries(); i++) {
1313  ptr = listOfPrimitives->At(i);
1314  if ( ptr->InheritsFrom("TH1") ) break;
1315  }
1316  if ( ptr == 0 || !ptr->InheritsFrom("TH1") ) { // if the loop did not find a TH1
1317  fCanvMain->GetCanvas()->Update();
1318  Warning("SetMinMaxLabel","No Histogram found!");
1319  return;
1320  // unable to find histogram, no min and max wil be read out
1321  }
1322 
1323  TH1 *hist = (TH1*)ptr;
1324  TString minTxt(fTxtSetMin->GetText());
1325  TString maxTxt(fTxtSetMax->GetText());
1326 
1327  // set min and max according to specified values, if checkbox is checked
1328  if (fRadio2D->GetState() == kButtonDown) {
1329  if (fChkSetMax->GetState() == kButtonDown && fChkSetMax->GetState() == kButtonDown &&(maxTxt.IsDigit() || maxTxt.IsFloat()) )
1330  hist->SetMaximum(maxTxt.Atof());
1331  if (fChkSetMax->GetState() == kButtonUp)
1332  hist->SetMaximum(-1111); // default value, to unzoom
1333  if (fChkSetMin->GetState() == kButtonDown && (minTxt.IsDigit() || minTxt.IsFloat()) )
1334  hist->SetMinimum(minTxt.Atof());
1335  if (fChkSetMin->GetState() == kButtonUp)
1336  hist->SetMinimum(-1111); // default value, to unzoom
1337  }
1338  else if (fRadio2D->GetState() == kButtonDown) {
1339  if (fChkSetMin->GetState() == kButtonDown &&
1340  fChkSetMax->GetState() == kButtonDown && hist->GetXaxis())
1341  hist->GetXaxis()->SetRangeUser(hist->GetXaxis()->GetXmin(), hist->GetXaxis()->GetXmax());
1342  else if (fChkSetMax->GetState() == kButtonDown && hist->GetXaxis())
1343  hist->GetXaxis()->SetRangeUser(hist->GetXaxis()->GetXmin(), maxTxt.Atof());
1344  else if (fChkSetMin->GetState() == kButtonDown && hist->GetXaxis())
1345  hist->GetXaxis()->SetRangeUser(minTxt.Atof(), hist->GetXaxis()->GetXmax());
1346  hist->SetTitle(hist->GetTitle()); // trick to update the histogram
1347  }
1348 
1349  // get min and max from plot
1350  GetMinMax();
1351 
1352  // set labels according to specification, if cehckboxes are checked
1353  if (fChkLabelTitle->GetState() == kButtonDown)
1354  hist->SetTitle(fTxtLabelTitle->GetText());
1355  if (fChkLabelXaxis->GetState() == kButtonDown)
1356  hist->GetXaxis()->SetTitle(fTxtLabelXaxis->GetText());
1357  if (fChkLabelYaxis->GetState() == kButtonDown)
1358  hist->GetYaxis()->SetTitle(fTxtLabelYaxis->GetText());
1359  // get and/or set labels and title
1360  if (fChkLabelGetAuto->GetState() == kButtonDown) {
1361  fTxtLabelTitle->SetText(hist->GetTitle());
1362  fTxtLabelXaxis->SetTitle(hist->GetXaxis()->GetTitle());
1363  fTxtLabelYaxis->SetTitle(hist->GetYaxis()->GetTitle());
1364  }
1365  hist->SetTitle(hist->GetTitle()); // trick to update the histogram
1366  fCanvMain->GetCanvas()->Update();
1367 }
1368 
1369 //________________________________________________________________________________________
1371  //
1372  // Disable all statistical legend entries, no statistical legend.
1373  //
1374  fChkStatName->SetState(kButtonUp);
1375  fChkStatEntries->SetState(kButtonUp);
1376  fChkStatMean->SetState(kButtonUp);
1377  fChkStatMeanPM->SetState(kButtonUp);
1378  fChkStatRMS->SetState(kButtonUp);
1379  fChkStatRMSPM->SetState(kButtonUp);
1380  fChkStatUnderflow->SetState(kButtonUp);
1381  fChkStatOverflow->SetState(kButtonUp);
1382  fChkStatIntegral->SetState(kButtonUp);
1383  fChkStatSkewness->SetState(kButtonUp);
1384  fChkStatSkewnessPM->SetState(kButtonUp);
1385  fChkStatKurtosis->SetState(kButtonUp);
1386  fChkStatKurtosisPM->SetState(kButtonUp);
1387 
1388  HandleButtonsStat(0);
1389 }
TGCompositeFrame * ftabLeft1
TGCompositeFrame * fContDrawOptSub1D2D
TGCompositeFrame * fContNormalized
void HandleButtonsNoRedraw(Int_t id=-1)
TGCheckButton * fChkGetMinMaxAuto
TStyle * gStyle
TGCompositeFrame * fContRight
TGCompositeFrame * fContFit
TGCompositeFrame * fContPlotOpt
TGCheckButton * fChkStatSkewnessPM
TGCompositeFrame * ftabLeft0
void HandleButtonsGeneral(Int_t id=-1)
TGCompositeFrame * fContStatKurt
TGCompositeFrame * fcontDrawOpt1DSubLR
Float_t p[]
Definition: kNNTest.C:133
TGCompositeFrame * fContStatRMS
TGCompositeFrame * fContCustom
AliBaseCalibViewerGUI & operator=(const AliBaseCalibViewerGUI &param)
TGCompositeFrame * fContCumLeft
TGCompositeFrame * fContLCR
TRootEmbeddedCanvas * fCanvMain
TGCompositeFrame * fContCumRight
TGCompositeFrame * fContTopBottom
TGCompositeFrame * fContCumuLR
virtual void DoDraw()=0
TGCompositeFrame * fContCuts
void DrawGUI(const TGWindow *p, UInt_t w, UInt_t h)
TGCheckButton * fChkStatKurtosis
TGCompositeFrame * fContLeft
TGCheckButton * fChkStatIntegral
TGCompositeFrame * fContTree
TGCompositeFrame * fContSetMax
void ReplacePlaceHolders(TString &str)
TGCompositeFrame * fContScaling
TGCheckButton * fChkStatUnderflow
TGCompositeFrame * fContStatSkew
TGCheckButton * fChkStatSkewness
TGRadioButton * fRadioCumulative
void HandleButtonsStat(Int_t id=-1)
TGCompositeFrame * fContStatMean
TGCheckButton * fChkStatOverflow
TGCompositeFrame * fContAddExport
TGCompositeFrame * fContAddDrawOpt
TGCompositeFrame * fContCenter
TGCompositeFrame * fContDrawOpt1DSubMML
TGCompositeFrame * fContAddFit
TGCompositeFrame * fContAddSaveOpt
AliBaseCalibViewerGUI(const TGWindow *p, UInt_t w, UInt_t h)
TGRadioButton * fRadioNormalized
TGCompositeFrame * fTabRight1
TGCheckButton * fCheckCumulativePM
TGCheckButton * fChkAddAsReference
TGCompositeFrame * fContSetMin
TGRadioButton * fRadioPredefined
TGCompositeFrame * fContDrawOpt1DSubNSC
TGCheckButton * fChkStatKurtosisPM
AliBaseCalibViewer * fViewer
TGCompositeFrame * fContAddCuts
TGCompositeFrame * fTabRight0
TGCheckButton * fChkLabelGetAuto
TGCompositeFrame * fContDrawOpt