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