1 ///////////////////////////////////////////////////////////////////////////////
3 // Base class for the AliTPCCalibViewer and AliTRDCalibViewer //
4 // used for the calibration monitor //
6 // Authors: Marian Ivanov (Marian.Ivanov@cern.ch) //
7 // Jens Wiechula (Jens.Wiechula@cern.ch) //
8 // Ionut Arsene (iarsene@cern.ch) //
10 ///////////////////////////////////////////////////////////////////////////////
14 #include <TVirtualPad.h>
16 #include <TObjArray.h>
17 #include <TObjString.h>
22 #include <TGFileDialog.h>
23 #include <TGInputDialog.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>
37 #include "AliBaseCalibViewerGUI.h"
39 ClassImp(AliBaseCalibViewerGUI)
41 //________________________________________________________________________________________
42 AliBaseCalibViewerGUI::AliBaseCalibViewerGUI(const TGWindow *p, UInt_t w, UInt_t h)
43 : TGCompositeFrame(p, w, h),
58 fContDrawOptSub1D2D(0),
72 fBtnAddFitFunction(0),
85 fListNormalization(0),
98 fcontDrawOpt1DSubLR(0),
99 fContDrawOpt1DSubNSC(0),
109 fCheckCumulativePM(0),
111 fContDrawOpt1DSubMML(0),
124 fChkStatUnderflow(0),
129 fChkStatSkewnessPM(0),
132 fChkStatKurtosisPM(0),
155 fChkAddAsReference(0),
160 // AliBaseCalibViewerGUI constructor; fileName specifies the ROOT tree used for drawing
164 //________________________________________________________________________________________
165 void AliBaseCalibViewerGUI::DrawGUI(const TGWindow *p, UInt_t w, UInt_t h) {
169 // ======================================================================
170 // ************************* Display everything *************************
171 // ======================================================================
173 SetCleanup(kDeepCleanup);
174 p = p; // to avoid compiler warnings
176 // *****************************************************************************
177 // ************************* content of this MainFrame *************************
178 // *****************************************************************************
179 // top level container with horizontal layout
180 fContTopBottom = new TGCompositeFrame(this, w, h, kVerticalFrame | kFixedWidth | kFixedHeight);
181 AddFrame(fContTopBottom, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
183 fContLCR = new TGCompositeFrame(fContTopBottom, w, h, kHorizontalFrame | kFixedWidth | kFixedHeight);
184 fContTopBottom->AddFrame(fContLCR, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
186 // ***********************************************************************
187 // ************************* content of fContLCR *************************
188 // ***********************************************************************
190 fContLeft = new TGCompositeFrame(fContLCR, 200, 200, kVerticalFrame | kFixedWidth | kFitHeight);
191 fContLCR->AddFrame(fContLeft, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandY, 5, 3, 3, 3));
193 // left vertical splitter
194 TGVSplitter *splitLeft = new TGVSplitter(fContLCR);
195 splitLeft->SetFrame(fContLeft, kTRUE);
196 fContLCR->AddFrame(splitLeft, new TGLayoutHints(kLHintsLeft | kLHintsExpandY, 0, 0, 0, 0));
199 fContRight = new TGCompositeFrame(fContLCR, 200, 200, kVerticalFrame | kFixedWidth | kFitHeight);
200 fContLCR->AddFrame(fContRight, new TGLayoutHints(kLHintsTop | kLHintsRight | kLHintsExpandY, 3, 5, 3, 3));
203 fContCenter = new TGCompositeFrame(fContLCR, 200, 200, kVerticalFrame | kFixedWidth | kFitHeight);
204 fContLCR->AddFrame(fContCenter, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
206 // right vertical splitter
207 TGVSplitter *splitRight = new TGVSplitter(fContLCR);
208 splitRight->SetFrame(fContRight, kFALSE);
209 fContLCR->AddFrame(splitRight, new TGLayoutHints(kLHintsLeft | kLHintsExpandY, 0, 0, 0, 0));
212 // ========================================================================
213 // ************************* content of fContLeft *************************
214 // ========================================================================
215 // --- draw button and tabLeft ---
217 fBtnDraw = new TGTextButton(fContLeft, "&Draw");
218 fContLeft->AddFrame(fBtnDraw, new TGLayoutHints(kLHintsExpandX, 10, 10, 0, 0));
219 //fBtnDraw->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoTest(=\"fBtnDraw clicked\")");
220 fBtnDraw->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "DoDraw()");
221 fBtnDraw->SetToolTipText("Press here to draw according to selections.");
223 // tabs on the left side:
224 ftabLeft = new TGTab(fContLeft);
225 fContLeft->AddFrame(ftabLeft, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 8, 0));
226 ftabLeft0 = ftabLeft->AddTab("General");
227 ftabLeft1 = ftabLeft->AddTab("More plot options");
230 // **************************** content of tabLeft0 *******************************
232 // draw options container *** fcontDrawOpt *** " Plot options "
233 fContDrawOpt = new TGGroupFrame(ftabLeft0, "Plot options", kVerticalFrame | kFitWidth | kFitHeight);
234 ftabLeft0->AddFrame(fContDrawOpt, new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0));
235 fContDrawOptSub1D2D = new TGCompositeFrame(fContDrawOpt, 200, 23, kHorizontalFrame | kFitWidth | kFixedHeight);
236 fContDrawOpt->AddFrame(fContDrawOptSub1D2D, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
238 // ------------------------- content of fContDrawOpt -------------------------
239 // -- radio1D, radio2D, chkAuto
241 fRadio1D = new TGRadioButton(fContDrawOptSub1D2D, "1D", 30);
242 fContDrawOptSub1D2D->AddFrame(fRadio1D, new TGLayoutHints(kLHintsNormal, 0, 2, 0, 0));
243 fRadio1D->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsGeneral()");
244 fRadio1D->SetToolTipText("1D drawing \nSelect this if you want to have the full control for the custom draw.");
247 fRadio2D = new TGRadioButton(fContDrawOptSub1D2D, "2D", 31);
248 fContDrawOptSub1D2D->AddFrame(fRadio2D, new TGLayoutHints(kLHintsNormal, 2, 2, 0, 0));
249 fRadio2D->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsGeneral()");
250 fRadio2D->SetToolTipText("2D drawing");
252 // additional draw options container
253 fContAddDrawOpt = new TGCompositeFrame(fContDrawOpt, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
254 fContDrawOpt->AddFrame(fContAddDrawOpt, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
256 // content of --- fContAddDrawOpt ---
257 // addition draw options label
258 fChkAddDrawOpt = new TGCheckButton(fContAddDrawOpt, "Draw options:");
259 //fChkAddDrawOpt->SetTextJustify(kTextLeft);
260 fContAddDrawOpt->AddFrame(fChkAddDrawOpt, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
261 fChkAddDrawOpt->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "DoNewSelection()");
262 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).");
264 // additional draw options combo box
265 fComboAddDrawOpt = new TGComboBox(fContAddDrawOpt);
266 fComboAddDrawOpt->Resize(0, fBtnDraw->GetDefaultHeight());
267 fComboAddDrawOpt->EnableTextInput(kTRUE);
268 fContAddDrawOpt->AddFrame(fComboAddDrawOpt, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
269 fComboAddDrawOpt->Connect("ReturnPressed()", "AliBaseCalibViewerGUI", this, "HandleButtonsGeneral(=14)");
270 fComboAddDrawOpt->Connect("Selected(Int_t)", "AliBaseCalibViewerGUI", this, "DoNewSelection()");
272 // automatic redraw check button
273 fChkAuto = new TGCheckButton(fContDrawOpt, "Auto redraw");
274 fContDrawOpt->AddFrame(fChkAuto, new TGLayoutHints(kLHintsNormal, 0, 2, 0, 0));
275 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'.");
277 // automatic append ending check button
278 fChkAutoAppend = new TGCheckButton(fContDrawOpt, "Auto add appending");
279 fContDrawOpt->AddFrame(fChkAutoAppend, new TGLayoutHints(kLHintsNormal, 0, 2, 0, 0));
280 fChkAutoAppend->SetToolTipText("Tries to repair your custom draw string or custom cut string, if you forgot '~' or '.fElements' \nThis function may be buggy!");
283 // *** predefined radio button *** " Predefined "
284 fRadioPredefined = new TGRadioButton(ftabLeft0, "Predefined: ", 13);
285 ftabLeft0->AddFrame(fRadioPredefined, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
286 fRadioPredefined->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsGeneral()");
287 fRadioPredefined->SetToolTipText("Draw predefined variables according to selection.");
290 fListVariables = new TGListBox(ftabLeft0);
291 ftabLeft0->AddFrame(fListVariables, new TGLayoutHints(kLHintsNormal | kLHintsExpandX | kLHintsExpandY, 10, 0, 0, 0));
292 fListVariables->Connect("Selected(Int_t)", "AliBaseCalibViewerGUI", this, "DoNewSelection()");
295 // normalization options container *** fContPlotOpt ***
296 //fContPlotOpt = new TGCompositeFrame(fContLeft, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
297 fContPlotOpt = new TGGroupFrame(ftabLeft0, "Normalization options", kVerticalFrame | kFitWidth | kFitHeight);
298 ftabLeft0->AddFrame(fContPlotOpt, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10, 0, 0, 0));
300 // ------------------------- content of fContPlotOpt -------------------------
302 fRadioRaw = new TGRadioButton(fContPlotOpt, "Raw", 10);
303 fContPlotOpt->AddFrame(fRadioRaw, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
304 fRadioRaw->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsGeneral()");
305 fRadioRaw->SetToolTipText("Plot without normalization");
307 // normalized radio button
308 fRadioNormalized = new TGRadioButton(fContPlotOpt, "Normalized", 11);
309 fContPlotOpt->AddFrame(fRadioNormalized, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
310 fRadioNormalized->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsGeneral()");
311 fRadioNormalized->SetToolTipText("Normalize data");
313 // normalized options container *** fContNormalized ***
314 fContNormalized = new TGCompositeFrame(fContPlotOpt, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
315 fContPlotOpt->AddFrame(fContNormalized, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 15, 0, 0, 0));
317 // --- content of fContNormalized ---
318 // --- combo box to select 'subtract' or 'divide', list of normalization variables
319 // method drop down combo box
320 fComboMethod = new TGComboBox(fContNormalized);
321 fComboMethod->Resize(0, fBtnDraw->GetDefaultHeight());
322 fContNormalized->AddFrame(fComboMethod, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
323 fComboMethod->Connect("Selected(Int_t)", "AliBaseCalibViewerGUI", this, "DoNewSelection()");
325 // list of normalization variables
326 fListNormalization = new TGListBox(fContNormalized);
327 fContNormalized->AddFrame(fListNormalization, new TGLayoutHints(kLHintsNormal | kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
328 fListNormalization->Connect("Selected(Int_t)", "AliBaseCalibViewerGUI", this, "DoNewSelection()");
330 // custom radio button
331 fRadioCustom = new TGRadioButton(ftabLeft0, "Custom: ", 12);
332 ftabLeft0->AddFrame(fRadioCustom, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
333 fRadioCustom->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsGeneral()");
334 fRadioCustom->SetToolTipText("Draw data according to user specific text entry in the 'Custom Draw' line. Remember '~' (= '.fElements')!");
335 // custom options container is located further down
337 // **************************** content of tabLeft1 *******************************
339 // draw options container *** fcontDrawOpt1D *** " Plot options "
340 fContDrawOpt1D = new TGGroupFrame(ftabLeft1, "1D Plot options", kVerticalFrame | kFitWidth | kFitHeight);
341 ftabLeft1->AddFrame(fContDrawOpt1D, new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0));
343 fcontDrawOpt1DSubLR = new TGCompositeFrame(fContDrawOpt1D, 1, 1, kVerticalFrame | kFitWidth | kFitHeight);
344 fContDrawOpt1D->AddFrame(fcontDrawOpt1DSubLR, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
346 // ***** content of fContDrawOpt1DSubLR *****
347 fContDrawOpt1DSubNSC = new TGCompositeFrame(fcontDrawOpt1DSubLR, 200, 23, kVerticalFrame | kFitWidth | kFitHeight);
348 fcontDrawOpt1DSubLR->AddFrame(fContDrawOpt1DSubNSC, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
350 // --------------------------- content of fContDrawOpt1DSubNSC -----------------
351 fRadioNorm = new TGRadioButton(fContDrawOpt1DSubNSC, "Normal", 110);
352 fContDrawOpt1DSubNSC->AddFrame(fRadioNorm, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
353 fRadioNorm->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtons1D()");
354 fRadioNorm->SetToolTipText("Produce a normal 1D plot, a histogram of the selected data.");
356 fRadioSigma = new TGRadioButton(fContDrawOpt1DSubNSC, "Sigma", 111);
357 fContDrawOpt1DSubNSC->AddFrame(fRadioSigma, new TGLayoutHints(kLHintsNormal, 0, 0, 5, 0));
358 fRadioSigma->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtons1D()");
359 fRadioSigma->SetToolTipText("Draw a normal histogram, but also lines that indicate the mean/median/LTM \nand sigmas of the selected data.");
361 fTxtSigmas = new TGTextEntry(fContDrawOpt1DSubNSC, "2; 4; 6", 111);
362 fContDrawOpt1DSubNSC->AddFrame(fTxtSigmas, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 10, 15, 0, 0));
363 fTxtSigmas->Connect("ReturnPressed()", "AliBaseCalibViewerGUI", this, "HandleButtons1D(=111)");
364 fTxtSigmas->SetToolTipText("Enter sigma intervals you would like to be indicated by lines. \nExample: '2; 4; 6'");
366 fContCumuLR = new TGCompositeFrame(fContDrawOpt1DSubNSC, 200, 23, kHorizontalFrame | kFitWidth | kFitHeight);
367 fContDrawOpt1DSubNSC->AddFrame(fContCumuLR, new TGLayoutHints(kLHintsExpandX, 0, 0, 5, 0));
369 fContCumLeft = new TGCompositeFrame(fContCumuLR, 200, 23, kVerticalFrame | kFitWidth | kFitHeight);
370 fContCumuLR->AddFrame(fContCumLeft, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
372 fRadioCumulative = new TGRadioButton(fContCumLeft, "Cumulative", 112);
373 fContCumLeft->AddFrame(fRadioCumulative, new TGLayoutHints(kLHintsNormal, 0, 10, 0, 0));
374 fRadioCumulative->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtons1D()");
375 fRadioCumulative->SetToolTipText("Draw the cumulative (SigmaCut) of the given selection. \nThe data distribution is integrated, starting from the mean/median/LTM.");
377 fCheckCumulativePM = new TGCheckButton(fContCumLeft, "Plus/Minus");
378 fContCumLeft->AddFrame(fCheckCumulativePM, new TGLayoutHints(kLHintsNormal, 10, 15, 0, 0));
379 fCheckCumulativePM->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtons1D()");
380 fCheckCumulativePM->SetToolTipText("Decide whether you want the cumulative integration for each direction (+/-) \nor only for the absolute distance to the mean/median/LTM value.");
382 fRadioIntegrate = new TGRadioButton(fContCumLeft, "Integrate", 113);
383 fContCumLeft->AddFrame(fRadioIntegrate, new TGLayoutHints(kLHintsNormal, 0, 0, 5, 0));
384 fRadioIntegrate->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtons1D()");
385 fRadioIntegrate->SetToolTipText("Draw the integral of the given selection.");
387 fContCumRight = new TGCompositeFrame(fContCumuLR, 200, 23, kVerticalFrame | kFitWidth | kFitHeight);
388 fContCumuLR->AddFrame(fContCumRight, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
390 fLblSigmaMax = new TGLabel(fContCumRight, "SigmaMax:");
391 fLblSigmaMax->SetTextJustify(kTextLeft);
392 fContCumRight->AddFrame(fLblSigmaMax, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 5, 0, 0, 0));
394 fTxtSigmaMax = new TGTextEntry(fContCumRight, "5", 112);
395 fContCumRight->AddFrame(fTxtSigmaMax, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 10, 15, 0, 0));
396 fTxtSigmaMax->Connect("ReturnPressed()", "AliBaseCalibViewerGUI", this, "HandleButtons1D(=112)");
397 fTxtSigmaMax->SetToolTipText("Enter up to which multiple of sigma you want to integrate.");
400 fContDrawOpt1DSubMML = new TGCompositeFrame(fcontDrawOpt1DSubLR, 200, 23, kHorizontalFrame | kFitWidth | kFitHeight);
401 fcontDrawOpt1DSubLR->AddFrame(fContDrawOpt1DSubMML, new TGLayoutHints(kLHintsExpandX, 0, 0, 5, 0));
403 // -------------- content of fcontDrawOpt1DSubLR
404 fChkMean = new TGCheckButton(fContDrawOpt1DSubMML, "Mean");
405 fContDrawOpt1DSubMML->AddFrame(fChkMean, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
406 fChkMean->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtons1D()");
407 fChkMean->SetToolTipText("Activate Mean for Sigma/Cumulative/Integrate");
409 fChkMedian = new TGCheckButton(fContDrawOpt1DSubMML, "Median");
410 fContDrawOpt1DSubMML->AddFrame(fChkMedian, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
411 fChkMedian->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtons1D()");
412 fChkMedian->SetToolTipText("Activate Median for Sigma/Cumulative/Integrate");
414 fChkLTM = new TGCheckButton(fContDrawOpt1DSubMML, "LTM");
415 fContDrawOpt1DSubMML->AddFrame(fChkLTM, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
416 fChkLTM->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtons1D()");
417 fChkLTM->SetToolTipText("Activate LTM for Sigma/Cumulative/Integrate");
420 // statistic options container *** fcontStatOpt1D *** " Statistic options "
421 fContStatOpt = new TGGroupFrame(ftabLeft1, "Statistic options", kVerticalFrame | kFitWidth | kFitHeight);
422 ftabLeft1->AddFrame(fContStatOpt, new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0));
424 fChkStatName = new TGCheckButton(fContStatOpt, "Name");
425 fContStatOpt->AddFrame(fChkStatName, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
426 fChkStatName->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsStat()");
427 fChkStatName->SetToolTipText("Display the name in the statistics legend.");
429 fChkStatEntries = new TGCheckButton(fContStatOpt, "Entries");
430 fContStatOpt->AddFrame(fChkStatEntries, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
431 fChkStatEntries->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsStat()");
432 fChkStatEntries->SetToolTipText("Display the number of entries in the statistics legend.");
434 fContStatMean = new TGCompositeFrame(fContStatOpt, 1, 1, kHorizontalFrame | kFitWidth | kFitHeight);
435 fContStatOpt->AddFrame(fContStatMean, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
437 fChkStatMean = new TGCheckButton(fContStatMean, "Mean");
438 fContStatMean->AddFrame(fChkStatMean, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
439 fChkStatMean->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsStat()");
440 fChkStatMean->SetToolTipText("Display the mean value of the data in the statistics legend.");
442 fChkStatMeanPM = new TGCheckButton(fContStatMean, "+- Error");
443 fContStatMean->AddFrame(fChkStatMeanPM, new TGLayoutHints(kLHintsNormal, 10, 0, 0, 0));
444 fChkStatMeanPM->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsStat()");
445 fChkStatMeanPM->SetToolTipText("Display the mean value's error in the statistics legend.");
447 fContStatRMS = new TGCompositeFrame(fContStatOpt, 1, 1, kHorizontalFrame | kFitWidth | kFitHeight);
448 fContStatOpt->AddFrame(fContStatRMS, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
450 fChkStatRMS = new TGCheckButton(fContStatRMS, "RMS");
451 fContStatRMS->AddFrame(fChkStatRMS, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
452 fChkStatRMS->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsStat()");
453 fChkStatRMS->SetToolTipText("Display the RMS value of the data in the statistics legend.");
455 fChkStatRMSPM = new TGCheckButton(fContStatRMS, "+- Error");
456 fContStatRMS->AddFrame(fChkStatRMSPM, new TGLayoutHints(kLHintsNormal, 10, 0, 0, 0));
457 fChkStatRMSPM->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsStat()");
458 fChkStatRMSPM->SetToolTipText("Display the RMS value's error in the statistics legend.");
460 fChkStatUnderflow = new TGCheckButton(fContStatOpt, "Underflow");
461 fContStatOpt->AddFrame(fChkStatUnderflow, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
462 fChkStatUnderflow->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsStat()");
463 fChkStatUnderflow->SetToolTipText("Display the number of entries in the underflow bin.");
465 fChkStatOverflow = new TGCheckButton(fContStatOpt, "Overflow");
466 fContStatOpt->AddFrame(fChkStatOverflow, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
467 fChkStatOverflow->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsStat()");
468 fChkStatOverflow->SetToolTipText("Display the number of entries in the overflow bin.");
470 fChkStatIntegral = new TGCheckButton(fContStatOpt, "Integral");
471 fContStatOpt->AddFrame(fChkStatIntegral, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
472 fChkStatIntegral->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsStat()");
473 fChkStatIntegral->SetToolTipText("Display the integral of the data in the statistics legend.");
475 fContStatSkew = new TGCompositeFrame(fContStatOpt, 1, 1, kHorizontalFrame | kFitWidth | kFitHeight);
476 fContStatOpt->AddFrame(fContStatSkew, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
478 fChkStatSkewness = new TGCheckButton(fContStatSkew, "Skewness");
479 fContStatSkew->AddFrame(fChkStatSkewness, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
480 fChkStatSkewness->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsStat()");
481 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!");
483 fChkStatSkewnessPM = new TGCheckButton(fContStatSkew, "+- Error");
484 fContStatSkew->AddFrame(fChkStatSkewnessPM, new TGLayoutHints(kLHintsNormal, 10, 0, 0, 0));
485 fChkStatSkewnessPM->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsStat()");
486 fChkStatSkewnessPM->SetToolTipText("Display the skewness' error in the statistics legend.");
488 fContStatKurt = new TGCompositeFrame(fContStatOpt, 1, 1, kHorizontalFrame | kFitWidth | kFitHeight);
489 fContStatOpt->AddFrame(fContStatKurt, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
491 fChkStatKurtosis = new TGCheckButton(fContStatKurt, "Kurtosis");
492 fContStatKurt->AddFrame(fChkStatKurtosis, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
493 fChkStatKurtosis->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsStat()");
494 fChkStatKurtosis->SetToolTipText("Display the kurtosis of the data in the statistics legend.");
496 fChkStatKurtosisPM = new TGCheckButton(fContStatKurt, "+- Error");
497 fContStatKurt->AddFrame(fChkStatKurtosisPM, new TGLayoutHints(kLHintsNormal, 10, 0, 0, 0));
498 fChkStatKurtosisPM->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsStat()");
499 fChkStatKurtosisPM->SetToolTipText("Display the kurtosis' error in the statistics legend.");
501 fBtnUnchekAll = new TGTextButton(fContStatOpt, "&Uncheck all");
502 fContStatOpt->AddFrame(fBtnUnchekAll, new TGLayoutHints(kLHintsExpandX, 10, 10, 0, 0));
503 fBtnUnchekAll->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "UnchekAllStat()");
504 fBtnUnchekAll->SetToolTipText("Disable all statistics legend entries, \nno statistics legend.");
507 // custom options container
508 // --- fComboCustom --- the custom draw line on the very low
509 fContCustom = new TGCompositeFrame(fContTopBottom, 200, 200, kHorizontalFrame | kFitWidth | kFitHeight);
510 fContTopBottom->AddFrame(fContCustom, new TGLayoutHints(kLHintsExpandX, 10, 0, 0, 0));
512 // ------------------------- content of fContCustom -------------------------
513 fLblCustomDraw = new TGLabel(fContCustom, "Custom draw: ");
514 fLblCustomDraw->SetTextJustify(kTextLeft);
515 fContCustom->AddFrame(fLblCustomDraw, new TGLayoutHints(kLHintsNormal, 5, 0, 0, 0));
516 // text field for custom draw command
517 fComboCustom = new TGComboBox(fContCustom);
518 fComboCustom->Resize(0, fBtnDraw->GetDefaultHeight());
519 fComboCustom->EnableTextInput(kTRUE);
520 fContCustom->AddFrame(fComboCustom, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
521 fComboCustom->Connect("ReturnPressed()", "AliBaseCalibViewerGUI", this, "HandleButtonsGeneral(=42)");
522 fComboCustom->Connect("Selected(Int_t)", "AliBaseCalibViewerGUI", this, "DoNewSelection()");
525 // additional cuts container
526 fContAddCuts = new TGCompositeFrame(fContTopBottom, 200, 200, kHorizontalFrame | kFitWidth | kFitHeight);
527 fContTopBottom->AddFrame(fContAddCuts, new TGLayoutHints(kLHintsExpandX, 10, 0, 0, 0));
529 // ------------------------- content of fContAddCuts -------------------------
530 fLblAddCuts = new TGLabel(fContAddCuts, "Custom cuts: ");
531 fLblAddCuts->SetTextJustify(kTextLeft);
532 fContAddCuts->AddFrame(fLblAddCuts, new TGLayoutHints(kLHintsNormal, 5, 0, 0, 0));
533 // combo text field for additional cuts
534 fComboAddCuts = new TGComboBox(fContAddCuts);
535 fComboAddCuts->Resize(0, fBtnDraw->GetDefaultHeight());
536 fComboAddCuts->EnableTextInput(kTRUE);
537 fContAddCuts->AddFrame(fComboAddCuts, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
538 fComboAddCuts->Connect("Selected(Int_t)", "AliBaseCalibViewerGUI", this, "DoNewSelection()");
540 // ==========================================================================
541 // ************************* content of fContCenter *************************
542 // ========================================================================
543 // main drawing canvas
544 fCanvMain = new TRootEmbeddedCanvas("Main_Canvas", fContCenter, 200, 200, kFitWidth | kFitHeight);
545 fContCenter->AddFrame(fCanvMain, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
547 fCanvMain->GetCanvas()->Connect("ProcessedEvent(Int_t, Int_t, Int_t, TObject*)", "AliBaseCalibViewerGUI", this, "MouseMove(Int_t, Int_t, Int_t, TObject*)");
549 fCanvMain->GetCanvas()->Connect("RangeAxisChanged()", "AliTPCCalibViewerGUI", this, "GetMinMax()");
550 fCanvMain->GetCanvas()->SetToolTipText("The Main_Canvas, here your plots are displayed.");
553 // =========================================================================
554 // ************************* content of fContRight *************************
555 // ========================================================================
557 // tabs on the right side:
558 ftabRight = new TGTab(fContRight);
559 fContRight->AddFrame(ftabRight, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 8, 0));
560 fTabRight0 = ftabRight->AddTab("Basic");
561 fTabRight1 = ftabRight->AddTab("Advanced");
564 // **************************** content of tabLeft0 *******************************
565 // cut options container
567 fContCuts = new TGGroupFrame(fTabRight0, "Cuts", kVerticalFrame | kFitWidth | kFitHeight);
568 fTabRight0->AddFrame(fContCuts, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
570 // Scaling options container
571 fContScaling = new TGGroupFrame(fTabRight0, "Scaling", kVerticalFrame | kFitWidth | kFitHeight);
572 fTabRight0->AddFrame(fContScaling, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
574 // ************************* content of fContScaling *************************
575 // SetMaximum container
576 fContSetMax = new TGCompositeFrame(fContScaling, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
577 fContScaling->AddFrame(fContSetMax, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
579 // ------------------------- content of fContSetMax -------------------------
580 // SetMaximum - checkbox
581 fChkSetMax = new TGCheckButton(fContSetMax, "Set fixed max.");
582 fContSetMax->AddFrame(fChkSetMax, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
583 fChkSetMax->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsNoRedraw()");
584 fChkSetMax->SetToolTipText("Set the maximum fixed to the value specified here.");
586 // text field for maximum value
587 fTxtSetMax = new TGTextEntry(fContSetMax, "", 41);
588 fContSetMax->AddFrame(fTxtSetMax, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
589 fTxtSetMax->Connect("ReturnPressed()", "AliBaseCalibViewerGUI", this, "HandleButtonsNoRedraw()");
590 fTxtSetMax->SetToolTipText("maximum value for the drawing");
592 // SetMinimum container
593 fContSetMin = new TGCompositeFrame(fContScaling, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
594 fContScaling->AddFrame(fContSetMin, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
596 // ------------------------- content of fContSetMin -------------------------
597 // SetMinimum - checkbox
598 fChkSetMin = new TGCheckButton(fContSetMin, "Set fixed min.");
599 fContSetMin->AddFrame(fChkSetMin, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
600 fChkSetMin->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsNoRedraw()");
601 fChkSetMin->SetToolTipText("Set the minimum fixed to the value specified here.");
603 // text field for minimum value
604 fTxtSetMin = new TGTextEntry(fContSetMin, "", 40);
605 fContSetMin->AddFrame(fTxtSetMin, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
606 fTxtSetMin->Connect("ReturnPressed()", "AliBaseCalibViewerGUI", this, "HandleButtonsNoRedraw()");
607 fTxtSetMin->SetToolTipText("minimum value for the drawing");
609 // get Min & Max from Plot - button
610 fBtnGetMinMax = new TGTextButton(fContScaling, "&Get scale from plot");
611 fContScaling->AddFrame(fBtnGetMinMax, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
612 fBtnGetMinMax->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "GetMinMax()");
613 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'.");
615 // GetMinMaxAuto - checkbox
616 fChkGetMinMaxAuto = new TGCheckButton(fContScaling, "Get Min + Max auto.");
617 fContScaling->AddFrame(fChkGetMinMaxAuto, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
618 fChkGetMinMaxAuto->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsNoRedraw()");
619 fChkGetMinMaxAuto->SetToolTipText("Get minimum and maximum automatically from each new plot. \nDeactivate this, if you want to 'save' your specified minimum and maximum.");
621 // labeling container *** fContLabeling *** " Labeling "
622 fContLabeling = new TGGroupFrame(fTabRight0, "Labeling", kVerticalFrame | kFitWidth | kFitHeight);
623 fTabRight0->AddFrame(fContLabeling, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
625 fChkLabelTitle = new TGCheckButton(fContLabeling, "Set title:");
626 fContLabeling->AddFrame(fChkLabelTitle, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
627 fChkLabelTitle->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsNoRedraw()");
628 fChkLabelTitle->SetToolTipText("Set the plot title.");
630 fTxtLabelTitle = new TGTextEntry(fContLabeling, "Title", 500);
631 fContLabeling->AddFrame(fTxtLabelTitle, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
632 fTxtLabelTitle->Connect("ReturnPressed()", "AliBaseCalibViewerGUI", this, "HandleButtonsNoRedraw(=50)");
633 fTxtLabelTitle->SetToolTipText("plot title");
635 fChkLabelXaxis = new TGCheckButton(fContLabeling, "Set X-axis label:");
636 fContLabeling->AddFrame(fChkLabelXaxis, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
637 fChkLabelXaxis->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsNoRedraw()");
638 fChkLabelXaxis->SetToolTipText("Set the X-axis label.");
640 fTxtLabelXaxis = new TGTextEntry(fContLabeling, "XaxisLabel", 500);
641 fContLabeling->AddFrame(fTxtLabelXaxis, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
642 fTxtLabelXaxis->Connect("ReturnPressed()", "AliBaseCalibViewerGUI", this, "HandleButtonsNoRedraw(=51)");
643 fTxtLabelXaxis->SetToolTipText("X-axis label");
645 fChkLabelYaxis = new TGCheckButton(fContLabeling, "Set Y-axis label:");
646 fContLabeling->AddFrame(fChkLabelYaxis, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
647 fChkLabelYaxis->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsNoRedraw()");
648 fChkLabelYaxis->SetToolTipText("Set the Y-axis label.");
650 fTxtLabelYaxis = new TGTextEntry(fContLabeling, "YaxisLabel", 500);
651 fContLabeling->AddFrame(fTxtLabelYaxis, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
652 fTxtLabelYaxis->Connect("ReturnPressed()", "AliBaseCalibViewerGUI", this, "HandleButtonsNoRedraw(=52)");
653 fTxtLabelYaxis->SetToolTipText("Y-axis label");
655 fChkLabelGetAuto = new TGCheckButton(fContLabeling, "Get labels auto.");
656 fContLabeling->AddFrame(fChkLabelGetAuto, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
657 fChkLabelGetAuto->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsNoRedraw()");
658 fChkLabelGetAuto->SetToolTipText("Get labels automatically from each new plot \nDeactivate this, if you want to 'save' your specified labels.");
661 // **************************** content of ftabRight1 *******************************
663 fContSave = new TGGroupFrame(fTabRight1, "Save", kVerticalFrame | kFitWidth | kFitHeight);
664 fTabRight1->AddFrame(fContSave, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
666 fBtnSave = new TGTextButton(fContSave, "&Save picture");
667 fContSave->AddFrame(fBtnSave, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
668 fBtnSave->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "SavePicture()");
669 fBtnSave->SetToolTipText("Open a 'Save as...' dialog to save the current plot as picture or macro.");
671 // additional save options container
672 fContAddSaveOpt = new TGCompositeFrame(fContSave, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
673 fContSave->AddFrame(fContAddSaveOpt, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
675 // content of --- fContAddSaveOpt ---
676 // addition save options label
677 fChkAddSaveOpt = new TGCheckButton(fContAddSaveOpt, "Save options:");
678 fContAddSaveOpt->AddFrame(fChkAddSaveOpt, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
679 fChkAddSaveOpt->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "DoNewSelection()");
680 fChkAddSaveOpt->SetToolTipText("Additional save options (see documentation for TPad::Print()).");
682 // additional save options combo box
683 fComboAddSaveOpt = new TGComboBox(fContAddSaveOpt);
684 fContAddSaveOpt->AddFrame(fComboAddSaveOpt, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
685 fComboAddSaveOpt->Resize(0, fBtnDraw->GetDefaultHeight());
686 fComboAddSaveOpt->EnableTextInput(kTRUE);
687 fComboAddSaveOpt->Connect("ReturnPressed()", "AliBaseCalibViewerGUI", this, "SavePicture()");
689 // calPad export container
690 fContExport = new TGGroupFrame(fTabRight1, "Export AliTPCCalPad", kVerticalFrame | kFitWidth | kFitHeight);
691 fTabRight1->AddFrame(fContExport, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
692 // ------------------------- content of fContExport -------------------------
693 // container for export name
695 fContAddExport = new TGCompositeFrame(fContExport, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
696 fContExport->AddFrame(fContAddExport, new TGLayoutHints(kLHintsExpandX, -5, -5, 0, 0));
698 fComboExportName = new TGComboBox(fContAddExport);
699 fComboExportName->Resize(0, fBtnDraw->GetDefaultHeight());
700 fContAddExport->AddFrame(fComboExportName, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
701 fComboExportName->AddEntry("calPad", 0); // first default value
702 fComboExportName->Select(0); // select default value before connecting
703 fComboExportName->EnableTextInput(kTRUE);
706 fBtnExport = new TGTextButton(fContExport, "&Export to CINT");
707 fContExport->AddFrame(fBtnExport, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
708 fBtnExport->SetToolTipText("Lifeless button :(");
710 // add to normalisation button
711 fBtnAddNorm = new TGTextButton(fContExport, "&Add to normalization");
712 fContExport->AddFrame(fBtnAddNorm, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
713 fBtnAddNorm->SetToolTipText("Lifeless button :(");
716 fContTree = new TGGroupFrame(fTabRight1, "Tree", kVerticalFrame | kFitWidth | kFitHeight);
717 fTabRight1->AddFrame(fContTree, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
719 // dump tree to file button
720 fBtnDumpToFile = new TGTextButton(fContTree, "&Dump to File");
721 fContTree->AddFrame(fBtnDumpToFile, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
722 fBtnDumpToFile->SetToolTipText("Lifeless button :(");
724 // dump tree to file button
725 fBtnLoadTree = new TGTextButton(fContTree, "&Load Tree");
726 fContTree->AddFrame(fBtnLoadTree, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
727 fBtnLoadTree->SetToolTipText("Lifeless button :(");
729 fChkAddAsReference = new TGCheckButton(fContTree, "as reference:");
730 fContTree->AddFrame(fChkAddAsReference, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
731 fChkAddAsReference->SetToolTipText("Lifeless button :(");
733 fTxtRefName = new TGTextEntry(fContTree, "R", 500);
734 fContTree->AddFrame(fTxtRefName, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 15, 0, 0, 0));
735 fTxtRefName->SetToolTipText("Reference Name");
737 // Fit options container
738 fContFit = new TGGroupFrame(fTabRight1, "Custom fit", kVerticalFrame | kFitWidth | kFitHeight);
739 fTabRight1->AddFrame(fContFit, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
741 // ------------------------- content of fContFit -------------------------
742 // container for additional fits
743 fContAddFit = new TGCompositeFrame(fContFit, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
744 fContFit->AddFrame(fContAddFit, new TGLayoutHints(kLHintsExpandX, -5, -5, 0, 0));
746 // --- content of fContAddFit ---
747 // text field for custom fit
748 fComboCustomFit = new TGComboBox(fContAddFit);
749 fComboCustomFit->Resize(0, fBtnDraw->GetDefaultHeight());
750 fComboCustomFit->EnableTextInput(kTRUE);
751 fContAddFit->AddFrame(fComboCustomFit, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
754 fBtnFit = new TGTextButton(fContAddFit, "&Fit");
755 fContAddFit->AddFrame(fBtnFit, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
756 fBtnFit->SetToolTipText("Lifeless button :(");
759 //________________________________________________________________________________________
760 AliBaseCalibViewerGUI::AliBaseCalibViewerGUI(const AliBaseCalibViewerGUI &c)
761 : TGCompositeFrame(c.fParent, c.fWidth, c.fHeight),
776 fContDrawOptSub1D2D(0),
790 fBtnAddFitFunction(0),
803 fListNormalization(0),
812 fChkGetMinMaxAuto(0),
816 fcontDrawOpt1DSubLR(0),
817 fContDrawOpt1DSubNSC(0),
827 fCheckCumulativePM(0),
829 fContDrawOpt1DSubMML(0),
842 fChkStatUnderflow(0),
847 fChkStatSkewnessPM(0),
850 fChkStatKurtosisPM(0),
873 fChkAddAsReference(0),
878 // dummy AliBaseCalibViewerGUI copy constructor
882 //________________________________________________________________________________________
883 AliBaseCalibViewerGUI & AliBaseCalibViewerGUI::operator =(const AliBaseCalibViewerGUI & /*param*/) {
885 // dummy assignment operator
890 //________________________________________________________________________________________
891 AliBaseCalibViewerGUI::~AliBaseCalibViewerGUI() {
896 if (fCanvMain && fCanvMain->GetCanvas()) {
897 for (Int_t i = 0; i < fCanvMain->GetCanvas()->GetListOfPrimitives()->GetEntries(); i++) {
898 if (strcmp(fCanvMain->GetCanvas()->GetListOfPrimitives()->At(i)->ClassName(), "TFrame") != 0)
899 fCanvMain->GetCanvas()->GetListOfPrimitives()->At(i)->Delete();
906 //________________________________________________________________________________________
907 void AliBaseCalibViewerGUI::SetInitialValues() {
909 // Set the default button states
911 fChkAuto->SetState(kButtonUp);
912 fRadioPredefined->SetState(kButtonDown);
913 fRadioRaw->SetState(kButtonDown);
914 fRadio1D->SetState(kButtonDown);
915 fChkGetMinMaxAuto->SetState(kButtonDown);
916 fChkSetMin->SetState(kButtonUp);
917 fChkSetMax->SetState(kButtonUp);
918 fRadioNorm->SetState(kButtonDown);
919 fRadioSigma->SetState(kButtonUp);
920 fRadioCumulative->SetState(kButtonUp);
921 fChkMean->SetState(kButtonDown);
922 fCheckCumulativePM->SetState(kButtonUp);
924 fChkLabelGetAuto->SetState(kButtonDown);
926 Int_t statOpt = gStyle->GetOptStat();
927 if (statOpt == 1) statOpt = 1111;
928 if (statOpt / 200000000 >= 1) {
929 fChkStatKurtosis->SetState(kButtonDown);
930 fChkStatKurtosisPM->SetState(kButtonDown);
931 statOpt -= 200000000;
933 if (statOpt / 100000000 >= 1) {
934 fChkStatKurtosis->SetState(kButtonDown);
935 statOpt -= 100000000;
937 if (statOpt / 20000000 >= 1) {
938 fChkStatSkewness->SetState(kButtonDown);
939 fChkStatSkewnessPM->SetState(kButtonDown);
942 if (statOpt / 10000000 >= 1) {
943 fChkStatSkewness->SetState(kButtonDown);
946 if (statOpt / 1000000 >= 1) {
947 fChkStatIntegral->SetState(kButtonDown);
950 if (statOpt / 100000 >= 1) {
951 fChkStatOverflow->SetState(kButtonDown);
954 if (statOpt / 10000 >= 1) {
955 fChkStatUnderflow->SetState(kButtonDown);
958 if (statOpt / 2000 >= 1) {
959 fChkStatRMS->SetState(kButtonDown);
960 fChkStatRMSPM->SetState(kButtonDown);
963 if (statOpt / 1000 >= 1) {
964 fChkStatRMS->SetState(kButtonDown);
967 if (statOpt / 200 >= 1) {
968 fChkStatMean->SetState(kButtonDown);
969 fChkStatMeanPM->SetState(kButtonDown);
972 if (statOpt / 100 >= 1) {
973 fChkStatMean->SetState(kButtonDown);
976 if (statOpt / 10 >= 1) {
977 fChkStatEntries->SetState(kButtonDown);
980 if (statOpt / 1 >= 1) {
981 fChkStatName->SetState(kButtonDown);
985 // fill fComboAddDrawOpt with some additional drawing options
986 fComboAddDrawOpt->AddEntry("same", 0);
987 fComboAddDrawOpt->AddEntry("profbox", 1);
988 fComboAddDrawOpt->AddEntry("profcolz", 2);
989 fComboAddDrawOpt->AddEntry("profcont0", 3);
990 fComboAddDrawOpt->AddEntry("proflego", 4);
991 fComboAddDrawOpt->AddEntry("proflego2", 5);
992 fComboAddDrawOpt->AddEntry("profsurf", 6);
993 fComboAddDrawOpt->AddEntry("profsurf1", 7);
994 fComboAddDrawOpt->AddEntry("profsurf2", 8);
995 fComboAddDrawOpt->AddEntry("box", 9);
996 fComboAddDrawOpt->AddEntry("colz", 10);
997 fComboAddDrawOpt->AddEntry("cont0", 11);
998 fComboAddDrawOpt->AddEntry("lego", 12);
999 fComboAddDrawOpt->AddEntry("lego2", 13);
1000 fComboAddDrawOpt->AddEntry("surf", 14);
1001 fComboAddDrawOpt->AddEntry("surf1", 15);
1002 fComboAddDrawOpt->AddEntry("surf2", 16);
1004 // fill fComboAddSaveOpt with some additional drawing options
1005 fComboAddSaveOpt->AddEntry("Portrait", 0);
1006 fComboAddSaveOpt->AddEntry("Landscape", 1);
1007 fComboAddSaveOpt->AddEntry("Preview", 2);
1008 fComboAddSaveOpt->AddEntry("+50", 3);
1010 // fill fComboMethod
1011 fComboMethod->AddEntry("subtract", 0);
1012 fComboMethod->AddEntry("divide by", 1);
1014 // fill fComboExportName
1015 fBtnExport->SetEnabled(kFALSE);
1016 fBtnAddNorm->SetEnabled(kFALSE);
1018 // select initial variables
1019 fListVariables->Select(0);
1020 fListNormalization->Select(0);
1021 fComboMethod->Select(0);
1023 fListVariables->IntegralHeight(kFALSE); // naja
1024 fListNormalization->IntegralHeight(kFALSE); // naja
1025 fChkAuto->SetState(kButtonDown);
1028 //________________________________________________________________________________________
1029 void AliBaseCalibViewerGUI::HandleButtonsGeneral(Int_t id) {
1031 // handles mutual radio button exclusions
1035 TGButton *btn = (TGButton *) gTQSender;
1036 id = btn->WidgetId();
1040 case 10: // fRadioRaw
1041 fRadioNormalized->SetState(kButtonUp);
1042 fRadioPredefined->SetState(kButtonDown);
1043 fRadioCustom->SetState(kButtonUp);
1045 case 11: // fRadioNormalized
1046 fRadioRaw->SetState(kButtonUp);
1047 fRadioPredefined->SetState(kButtonDown);
1048 fRadioCustom->SetState(kButtonUp);
1050 case 12: // fRadioCustom
1051 fRadioPredefined->SetState(kButtonUp);
1053 case 14: // select Draw options fComboAddDrawOpt
1054 fChkAddDrawOpt->SetState(kButtonDown);
1056 case 13: // fRadioPredefined
1057 fRadioCustom->SetState(kButtonUp);
1060 case 30: // fRadio1D
1061 fRadio2D->SetState(kButtonUp);
1062 fBtnExport->SetEnabled(kFALSE);
1063 fBtnAddNorm->SetEnabled(kFALSE);
1065 case 31: // fRadio2D
1066 fRadio1D->SetState(kButtonUp);
1067 fBtnExport->SetEnabled(kTRUE);
1068 fBtnAddNorm->SetEnabled(kTRUE);
1070 case 42: // fComboCustom
1071 fRadioCustom->SetState(kButtonDown);
1072 fRadioPredefined->SetState(kButtonUp);
1078 //________________________________________________________________________________________
1079 void AliBaseCalibViewerGUI::HandleButtons1D(Int_t id) {
1081 // handles mutual radio button exclusions
1086 TGButton *btn = (TGButton *) gTQSender;
1087 id = btn->WidgetId();
1090 case 110: // 1D draw normal
1091 fRadioNorm->SetState(kButtonDown);
1092 fRadioSigma->SetState(kButtonUp);
1093 fRadioCumulative->SetState(kButtonUp);
1094 fRadioIntegrate->SetState(kButtonUp);
1096 case 111: // 1D draw sigma
1097 fRadioNorm->SetState(kButtonUp);
1098 fRadioSigma->SetState(kButtonDown);
1099 fRadioCumulative->SetState(kButtonUp);
1100 fRadioIntegrate->SetState(kButtonUp);
1102 case 112: // 1D draw cumulative
1103 fRadioNorm->SetState(kButtonUp);
1104 fRadioSigma->SetState(kButtonUp);
1105 fRadioCumulative->SetState(kButtonDown);
1106 fRadioIntegrate->SetState(kButtonUp);
1108 case 113: // 1D draw integral
1109 fRadioNorm->SetState(kButtonUp);
1110 fRadioSigma->SetState(kButtonUp);
1111 fRadioCumulative->SetState(kButtonUp);
1112 fRadioIntegrate->SetState(kButtonDown);
1118 //________________________________________________________________________________________
1119 void AliBaseCalibViewerGUI::HandleButtonsStat(Int_t id) {
1121 // handles statistic check boxes
1122 // checks each checkbox if checked
1123 // if the checkbox is checked, appends 'n' for name, 'e' for entries, ...
1124 // to a TString, passes this TString to gStyle->SetOptStat(...)
1127 TGButton *btn = (TGButton *) gTQSender;
1128 id = btn->WidgetId();
1130 TString statOpt("");
1131 if (fChkStatName->GetState() == kButtonDown) statOpt.Append("n");
1132 if (fChkStatEntries->GetState() == kButtonDown) statOpt.Append("e");
1133 if (fChkStatMean->GetState() == kButtonDown && fChkStatMeanPM->GetState() == kButtonUp) statOpt.Append("m");
1134 if (fChkStatMeanPM->GetState() == kButtonDown) statOpt.Append("M");
1135 if (fChkStatRMS->GetState() == kButtonDown && fChkStatRMSPM->GetState() == kButtonUp) statOpt.Append("r");
1136 if (fChkStatRMSPM->GetState() == kButtonDown) statOpt.Append("R");
1137 if (fChkStatUnderflow->GetState() == kButtonDown) statOpt.Append("u");
1138 if (fChkStatOverflow->GetState() == kButtonDown) statOpt.Append("o");
1139 if (fChkStatIntegral->GetState() == kButtonDown) statOpt.Append("i");
1140 if (fChkStatSkewness->GetState() == kButtonDown && fChkStatSkewnessPM->GetState() == kButtonUp) statOpt.Append("s");
1141 if (fChkStatSkewnessPM->GetState() == kButtonDown) statOpt.Append("S");
1142 if (fChkStatKurtosis->GetState() == kButtonDown && fChkStatKurtosisPM->GetState() == kButtonUp) statOpt.Append("k");
1143 if (fChkStatKurtosisPM->GetState() == kButtonDown) statOpt.Append("K");
1145 gStyle->SetOptStat(statOpt);
1149 //________________________________________________________________________________________
1150 void AliBaseCalibViewerGUI::HandleButtonsNoRedraw(Int_t id) {
1152 // handles label & scaling checkboxes
1153 // without redrawing (not necessary, faster like this)
1156 TGButton *btn = (TGButton *) gTQSender;
1157 id = btn->WidgetId();
1161 case 40: // fTxtSetMin
1162 fChkSetMin->SetState(kButtonDown);
1164 case 41: // fTxtSetMax
1165 fChkSetMax->SetState(kButtonDown);
1167 case 50: // fTxtLabelTitle
1168 fChkLabelTitle->SetState(kButtonDown);
1170 case 51: // fTxtLabelXaxis
1171 fChkLabelXaxis->SetState(kButtonDown);
1173 case 52: // fTxtLabelXaxis
1174 fChkLabelYaxis->SetState(kButtonDown);
1180 //________________________________________________________________________________________
1181 void AliBaseCalibViewerGUI::ReplacePlaceHolders(TString &str)
1184 // replace the defined placeholders in the custom draw string and cut string
1186 TString drawPlaceHolder("#draw#");
1187 TString normPlaceHolder("#norm#");
1189 //current draw variable
1190 TString desiredData("");
1191 if (fListVariables->GetSelectedEntry()){
1192 desiredData += ((TGTextLBEntry*)(fListVariables->GetSelectedEntry()))->GetTitle();
1193 str.ReplaceAll(drawPlaceHolder,desiredData);
1196 //current normalisation
1197 TString normalizationData("");
1198 if (fListNormalization->GetSelectedEntry()){
1199 normalizationData += ((TGTextLBEntry*)(fListNormalization->GetSelectedEntry()))->GetTitle();
1200 if (! (TString(((TGTextLBEntry*)(fListNormalization->GetSelectedEntry()))->GetTitle())).BeginsWith("Fit"))
1201 if ( normalizationData.BeginsWith("_") ) normalizationData = desiredData+normalizationData;
1202 if ( fListVariables->FindEntry(normalizationData.Data()) )
1203 normalizationData+="~";
1204 str.ReplaceAll(normPlaceHolder,normalizationData);
1208 //________________________________________________________________________________________
1209 void AliBaseCalibViewerGUI::DoNewSelection() {
1211 // decides whether to redraw if user makes another selection
1213 if (fChkAuto->GetState() == kButtonDown) DoDraw();
1216 //________________________________________________________________________________________
1217 void AliBaseCalibViewerGUI::SavePicture() {
1219 // saves the current picture
1221 // use the following combination of file type and save options:
1222 // (see also TCanvas::Print)
1224 // "ps" - Postscript file is produced (see special cases below)
1225 // "Portrait" - Postscript file is produced (Portrait)
1226 // "Landscape" - Postscript file is produced (Landscape)
1227 // "eps" - an Encapsulated Postscript file is produced
1228 // "Preview" - an Encapsulated Postscript file with preview is produced.
1229 // "pdf" - a PDF file is produced
1230 // "svg" - a SVG file is produced
1231 // "gif" - a GIF file is produced
1232 // "gif+NN" - an animated GIF file is produced, where NN is delay in 10ms units
1233 // "xpm" - a XPM file is produced
1234 // "png" - a PNG file is produced
1235 // "jpg" - a JPEG file is produced
1236 // "tiff" - a TIFF file is produced
1237 // "cxx" - a C++ macro file is produced
1238 // "xml" - a XML file
1239 // "root" - a ROOT binary file
1241 const char *kSaveAsTypes[] = {
1242 "Postscript", "*.ps",
1243 "Encapsulated Postscript", "*.eps",
1252 "C++ macro", "*.cxx",
1253 "Macro file", "*.C",
1254 "ROOT file", "*.root",
1258 TString addSaveOpt("");
1259 if (fChkAddSaveOpt->GetState() == kButtonDown)
1260 addSaveOpt += fComboAddSaveOpt->GetTextEntry()->GetText();
1263 fi.fFileTypes = kSaveAsTypes;
1264 fi.fOverwrite = kFALSE;
1265 new TGFileDialog(gClient->GetRoot(), gClient->GetRoot(), kFDSave, &fi);
1266 if (fi.fFilename && strlen(fi.fFilename)) {
1267 if (addSaveOpt != "")
1268 fCanvMain->GetCanvas()->Print(fi.fFilename, addSaveOpt.Data());
1270 fCanvMain->GetCanvas()->Print(fi.fFilename);
1274 //________________________________________________________________________________________
1275 void AliBaseCalibViewerGUI::GetMinMax() {
1277 // Read current Min & Max from the plot and set it to fTxtSetMin & fTxtSetMax
1279 if (fChkGetMinMaxAuto->GetState() == kButtonUp) return;
1280 TList* listOfPrimitives = fCanvMain->GetCanvas()->GetListOfPrimitives();
1282 for (Int_t i = 0; i < listOfPrimitives->GetEntries(); i++) {
1283 ptr = listOfPrimitives->At(i);
1284 if ( ptr->InheritsFrom("TH1") ) break;
1286 if ( !ptr || !ptr->InheritsFrom("TH1") ) return; // if the loop did not find a TH1
1287 TH1 *hist = (TH1*)ptr;
1289 if (fRadio2D->GetState() == kButtonDown) {
1290 if (fChkSetMax->GetState() == kButtonUp)
1291 fTxtSetMax->SetText(Form("%f", hist->GetMaximum()));
1292 if (fChkSetMin->GetState() == kButtonUp)
1293 fTxtSetMin->SetText(Form("%f", hist->GetMinimum()));
1295 else if (fRadio1D->GetState() == kButtonDown) {
1296 if (fChkSetMax->GetState() == kButtonUp)
1297 fTxtSetMax->SetText( Form("%f", hist->GetXaxis()->GetXmax()) );
1298 if (fChkSetMin->GetState() == kButtonUp)
1299 fTxtSetMin->SetText( Form("%f", hist->GetXaxis()->GetXmin()) );
1303 //________________________________________________________________________________________
1304 void AliBaseCalibViewerGUI::SetMinMaxLabel() {
1306 // Set Minimum, Maximum and labels without redrawing the plot
1310 // search for histogram
1311 TList* listOfPrimitives = fCanvMain->GetCanvas()->GetListOfPrimitives();
1313 for (Int_t i = 0; i < listOfPrimitives->GetEntries(); i++) {
1314 ptr = listOfPrimitives->At(i);
1315 if ( ptr->InheritsFrom("TH1") ) break;
1317 if ( ptr == 0 || !ptr->InheritsFrom("TH1") ) { // if the loop did not find a TH1
1318 fCanvMain->GetCanvas()->Update();
1319 Warning("SetMinMaxLabel","No Histogram found!");
1321 // unable to find histogram, no min and max wil be read out
1324 TH1 *hist = (TH1*)ptr;
1325 TString minTxt(fTxtSetMin->GetText());
1326 TString maxTxt(fTxtSetMax->GetText());
1328 // set min and max according to specified values, if checkbox is checked
1329 if (fRadio2D->GetState() == kButtonDown) {
1330 if (fChkSetMax->GetState() == kButtonDown && fChkSetMax->GetState() == kButtonDown &&(maxTxt.IsDigit() || maxTxt.IsFloat()) )
1331 hist->SetMaximum(maxTxt.Atof());
1332 if (fChkSetMax->GetState() == kButtonUp)
1333 hist->SetMaximum(-1111); // default value, to unzoom
1334 if (fChkSetMin->GetState() == kButtonDown && (minTxt.IsDigit() || minTxt.IsFloat()) )
1335 hist->SetMinimum(minTxt.Atof());
1336 if (fChkSetMin->GetState() == kButtonUp)
1337 hist->SetMinimum(-1111); // default value, to unzoom
1339 else if (fRadio2D->GetState() == kButtonDown) {
1340 if (fChkSetMin->GetState() == kButtonDown &&
1341 fChkSetMax->GetState() == kButtonDown && hist->GetXaxis())
1342 hist->GetXaxis()->SetRangeUser(hist->GetXaxis()->GetXmin(), hist->GetXaxis()->GetXmax());
1343 else if (fChkSetMax->GetState() == kButtonDown && hist->GetXaxis())
1344 hist->GetXaxis()->SetRangeUser(hist->GetXaxis()->GetXmin(), maxTxt.Atof());
1345 else if (fChkSetMin->GetState() == kButtonDown && hist->GetXaxis())
1346 hist->GetXaxis()->SetRangeUser(minTxt.Atof(), hist->GetXaxis()->GetXmax());
1347 hist->SetTitle(hist->GetTitle()); // trick to update the histogram
1350 // get min and max from plot
1353 // set labels according to specification, if cehckboxes are checked
1354 if (fChkLabelTitle->GetState() == kButtonDown)
1355 hist->SetTitle(fTxtLabelTitle->GetText());
1356 if (fChkLabelXaxis->GetState() == kButtonDown)
1357 hist->GetXaxis()->SetTitle(fTxtLabelXaxis->GetText());
1358 if (fChkLabelYaxis->GetState() == kButtonDown)
1359 hist->GetYaxis()->SetTitle(fTxtLabelYaxis->GetText());
1360 // get and/or set labels and title
1361 if (fChkLabelGetAuto->GetState() == kButtonDown) {
1362 fTxtLabelTitle->SetText(hist->GetTitle());
1363 fTxtLabelXaxis->SetTitle(hist->GetXaxis()->GetTitle());
1364 fTxtLabelYaxis->SetTitle(hist->GetYaxis()->GetTitle());
1366 hist->SetTitle(hist->GetTitle()); // trick to update the histogram
1367 fCanvMain->GetCanvas()->Update();
1370 //________________________________________________________________________________________
1371 void AliBaseCalibViewerGUI::UnchekAllStat() {
1373 // Disable all statistical legend entries, no statistical legend.
1375 fChkStatName->SetState(kButtonUp);
1376 fChkStatEntries->SetState(kButtonUp);
1377 fChkStatMean->SetState(kButtonUp);
1378 fChkStatMeanPM->SetState(kButtonUp);
1379 fChkStatRMS->SetState(kButtonUp);
1380 fChkStatRMSPM->SetState(kButtonUp);
1381 fChkStatUnderflow->SetState(kButtonUp);
1382 fChkStatOverflow->SetState(kButtonUp);
1383 fChkStatIntegral->SetState(kButtonUp);
1384 fChkStatSkewness->SetState(kButtonUp);
1385 fChkStatSkewnessPM->SetState(kButtonUp);
1386 fChkStatKurtosis->SetState(kButtonUp);
1387 fChkStatKurtosisPM->SetState(kButtonUp);
1389 HandleButtonsStat(0);