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);
175 // *****************************************************************************
176 // ************************* content of this MainFrame *************************
177 // *****************************************************************************
178 // top level container with horizontal layout
179 fContTopBottom = new TGCompositeFrame(this, w, h, kVerticalFrame | kFixedWidth | kFixedHeight);
180 AddFrame(fContTopBottom, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
182 fContLCR = new TGCompositeFrame(fContTopBottom, w, h, kHorizontalFrame | kFixedWidth | kFixedHeight);
183 fContTopBottom->AddFrame(fContLCR, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
185 // ***********************************************************************
186 // ************************* content of fContLCR *************************
187 // ***********************************************************************
189 fContLeft = new TGCompositeFrame(fContLCR, 200, 200, kVerticalFrame | kFixedWidth | kFitHeight);
190 fContLCR->AddFrame(fContLeft, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandY, 5, 3, 3, 3));
192 // left vertical splitter
193 TGVSplitter *splitLeft = new TGVSplitter(fContLCR);
194 splitLeft->SetFrame(fContLeft, kTRUE);
195 fContLCR->AddFrame(splitLeft, new TGLayoutHints(kLHintsLeft | kLHintsExpandY, 0, 0, 0, 0));
198 fContRight = new TGCompositeFrame(fContLCR, 200, 200, kVerticalFrame | kFixedWidth | kFitHeight);
199 fContLCR->AddFrame(fContRight, new TGLayoutHints(kLHintsTop | kLHintsRight | kLHintsExpandY, 3, 5, 3, 3));
202 fContCenter = new TGCompositeFrame(fContLCR, 200, 200, kVerticalFrame | kFixedWidth | kFitHeight);
203 fContLCR->AddFrame(fContCenter, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
205 // right vertical splitter
206 TGVSplitter *splitRight = new TGVSplitter(fContLCR);
207 splitRight->SetFrame(fContRight, kFALSE);
208 fContLCR->AddFrame(splitRight, new TGLayoutHints(kLHintsLeft | kLHintsExpandY, 0, 0, 0, 0));
211 // ========================================================================
212 // ************************* content of fContLeft *************************
213 // ========================================================================
214 // --- draw button and tabLeft ---
216 fBtnDraw = new TGTextButton(fContLeft, "&Draw");
217 fContLeft->AddFrame(fBtnDraw, new TGLayoutHints(kLHintsExpandX, 10, 10, 0, 0));
218 //fBtnDraw->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoTest(=\"fBtnDraw clicked\")");
219 fBtnDraw->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "DoDraw()");
220 fBtnDraw->SetToolTipText("Press here to draw according to selections.");
222 // tabs on the left side:
223 ftabLeft = new TGTab(fContLeft);
224 fContLeft->AddFrame(ftabLeft, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 8, 0));
225 ftabLeft0 = ftabLeft->AddTab("General");
226 ftabLeft1 = ftabLeft->AddTab("More plot options");
229 // **************************** content of tabLeft0 *******************************
231 // draw options container *** fcontDrawOpt *** " Plot options "
232 fContDrawOpt = new TGGroupFrame(ftabLeft0, "Plot options", kVerticalFrame | kFitWidth | kFitHeight);
233 ftabLeft0->AddFrame(fContDrawOpt, new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0));
234 fContDrawOptSub1D2D = new TGCompositeFrame(fContDrawOpt, 200, 23, kHorizontalFrame | kFitWidth | kFixedHeight);
235 fContDrawOpt->AddFrame(fContDrawOptSub1D2D, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
237 // ------------------------- content of fContDrawOpt -------------------------
238 // -- radio1D, radio2D, chkAuto
240 fRadio1D = new TGRadioButton(fContDrawOptSub1D2D, "1D", 30);
241 fContDrawOptSub1D2D->AddFrame(fRadio1D, new TGLayoutHints(kLHintsNormal, 0, 2, 0, 0));
242 fRadio1D->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsGeneral()");
243 fRadio1D->SetToolTipText("1D drawing \nSelect this if you want to have the full control for the custom draw.");
246 fRadio2D = new TGRadioButton(fContDrawOptSub1D2D, "2D", 31);
247 fContDrawOptSub1D2D->AddFrame(fRadio2D, new TGLayoutHints(kLHintsNormal, 2, 2, 0, 0));
248 fRadio2D->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsGeneral()");
249 fRadio2D->SetToolTipText("2D drawing");
251 // additional draw options container
252 fContAddDrawOpt = new TGCompositeFrame(fContDrawOpt, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
253 fContDrawOpt->AddFrame(fContAddDrawOpt, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
255 // content of --- fContAddDrawOpt ---
256 // addition draw options label
257 fChkAddDrawOpt = new TGCheckButton(fContAddDrawOpt, "Draw options:");
258 //fChkAddDrawOpt->SetTextJustify(kTextLeft);
259 fContAddDrawOpt->AddFrame(fChkAddDrawOpt, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
260 fChkAddDrawOpt->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "DoNewSelection()");
261 fChkAddDrawOpt->SetToolTipText("Enter additional draw options like 'prof' or 'colz' here.\nBe careful with the option 'same' for 2D drawings as it will crash (ROOT feature).");
263 // additional draw options combo box
264 fComboAddDrawOpt = new TGComboBox(fContAddDrawOpt);
265 fComboAddDrawOpt->Resize(0, fBtnDraw->GetDefaultHeight());
266 fComboAddDrawOpt->EnableTextInput(kTRUE);
267 fContAddDrawOpt->AddFrame(fComboAddDrawOpt, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
268 fComboAddDrawOpt->Connect("ReturnPressed()", "AliBaseCalibViewerGUI", this, "HandleButtonsGeneral(=14)");
269 fComboAddDrawOpt->Connect("Selected(Int_t)", "AliBaseCalibViewerGUI", this, "DoNewSelection()");
271 // automatic redraw check button
272 fChkAuto = new TGCheckButton(fContDrawOpt, "Auto redraw");
273 fContDrawOpt->AddFrame(fChkAuto, new TGLayoutHints(kLHintsNormal, 0, 2, 0, 0));
274 fChkAuto->SetToolTipText("Decide if you want an automatic redraw on each new selection.\nNot recommended on a slow machine, during remote connection or if your draw option is 'same'.");
276 // automatic append ending check button
277 fChkAutoAppend = new TGCheckButton(fContDrawOpt, "Auto add appending");
278 fContDrawOpt->AddFrame(fChkAutoAppend, new TGLayoutHints(kLHintsNormal, 0, 2, 0, 0));
279 fChkAutoAppend->SetToolTipText("Tries to repair your custom draw string or custom cut string, if you forgot '~' or '.fElements' \nThis function may be buggy!");
282 // *** predefined radio button *** " Predefined "
283 fRadioPredefined = new TGRadioButton(ftabLeft0, "Predefined: ", 13);
284 ftabLeft0->AddFrame(fRadioPredefined, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
285 fRadioPredefined->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsGeneral()");
286 fRadioPredefined->SetToolTipText("Draw predefined variables according to selection.");
289 fListVariables = new TGListBox(ftabLeft0);
290 ftabLeft0->AddFrame(fListVariables, new TGLayoutHints(kLHintsNormal | kLHintsExpandX | kLHintsExpandY, 10, 0, 0, 0));
291 fListVariables->Connect("Selected(Int_t)", "AliBaseCalibViewerGUI", this, "DoNewSelection()");
294 // normalization options container *** fContPlotOpt ***
295 //fContPlotOpt = new TGCompositeFrame(fContLeft, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
296 fContPlotOpt = new TGGroupFrame(ftabLeft0, "Normalization options", kVerticalFrame | kFitWidth | kFitHeight);
297 ftabLeft0->AddFrame(fContPlotOpt, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10, 0, 0, 0));
299 // ------------------------- content of fContPlotOpt -------------------------
301 fRadioRaw = new TGRadioButton(fContPlotOpt, "Raw", 10);
302 fContPlotOpt->AddFrame(fRadioRaw, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
303 fRadioRaw->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsGeneral()");
304 fRadioRaw->SetToolTipText("Plot without normalization");
306 // normalized radio button
307 fRadioNormalized = new TGRadioButton(fContPlotOpt, "Normalized", 11);
308 fContPlotOpt->AddFrame(fRadioNormalized, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
309 fRadioNormalized->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsGeneral()");
310 fRadioNormalized->SetToolTipText("Normalize data");
312 // normalized options container *** fContNormalized ***
313 fContNormalized = new TGCompositeFrame(fContPlotOpt, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
314 fContPlotOpt->AddFrame(fContNormalized, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 15, 0, 0, 0));
316 // --- content of fContNormalized ---
317 // --- combo box to select 'subtract' or 'divide', list of normalization variables
318 // method drop down combo box
319 fComboMethod = new TGComboBox(fContNormalized);
320 fComboMethod->Resize(0, fBtnDraw->GetDefaultHeight());
321 fContNormalized->AddFrame(fComboMethod, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
322 fComboMethod->Connect("Selected(Int_t)", "AliBaseCalibViewerGUI", this, "DoNewSelection()");
324 // list of normalization variables
325 fListNormalization = new TGListBox(fContNormalized);
326 fContNormalized->AddFrame(fListNormalization, new TGLayoutHints(kLHintsNormal | kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
327 fListNormalization->Connect("Selected(Int_t)", "AliBaseCalibViewerGUI", this, "DoNewSelection()");
329 // custom radio button
330 fRadioCustom = new TGRadioButton(ftabLeft0, "Custom: ", 12);
331 ftabLeft0->AddFrame(fRadioCustom, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
332 fRadioCustom->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsGeneral()");
333 fRadioCustom->SetToolTipText("Draw data according to user specific text entry in the 'Custom Draw' line. Remember '~' (= '.fElements')!");
334 // custom options container is located further down
336 // **************************** content of tabLeft1 *******************************
338 // draw options container *** fcontDrawOpt1D *** " Plot options "
339 fContDrawOpt1D = new TGGroupFrame(ftabLeft1, "1D Plot options", kVerticalFrame | kFitWidth | kFitHeight);
340 ftabLeft1->AddFrame(fContDrawOpt1D, new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0));
342 fcontDrawOpt1DSubLR = new TGCompositeFrame(fContDrawOpt1D, 1, 1, kVerticalFrame | kFitWidth | kFitHeight);
343 fContDrawOpt1D->AddFrame(fcontDrawOpt1DSubLR, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
345 // ***** content of fContDrawOpt1DSubLR *****
346 fContDrawOpt1DSubNSC = new TGCompositeFrame(fcontDrawOpt1DSubLR, 200, 23, kVerticalFrame | kFitWidth | kFitHeight);
347 fcontDrawOpt1DSubLR->AddFrame(fContDrawOpt1DSubNSC, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
349 // --------------------------- content of fContDrawOpt1DSubNSC -----------------
350 fRadioNorm = new TGRadioButton(fContDrawOpt1DSubNSC, "Normal", 110);
351 fContDrawOpt1DSubNSC->AddFrame(fRadioNorm, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
352 fRadioNorm->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtons1D()");
353 fRadioNorm->SetToolTipText("Produce a normal 1D plot, a histogram of the selected data.");
355 fRadioSigma = new TGRadioButton(fContDrawOpt1DSubNSC, "Sigma", 111);
356 fContDrawOpt1DSubNSC->AddFrame(fRadioSigma, new TGLayoutHints(kLHintsNormal, 0, 0, 5, 0));
357 fRadioSigma->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtons1D()");
358 fRadioSigma->SetToolTipText("Draw a normal histogram, but also lines that indicate the mean/median/LTM \nand sigmas of the selected data.");
360 fTxtSigmas = new TGTextEntry(fContDrawOpt1DSubNSC, "2; 4; 6", 111);
361 fContDrawOpt1DSubNSC->AddFrame(fTxtSigmas, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 10, 15, 0, 0));
362 fTxtSigmas->Connect("ReturnPressed()", "AliBaseCalibViewerGUI", this, "HandleButtons1D(=111)");
363 fTxtSigmas->SetToolTipText("Enter sigma intervals you would like to be indicated by lines. \nExample: '2; 4; 6'");
365 fContCumuLR = new TGCompositeFrame(fContDrawOpt1DSubNSC, 200, 23, kHorizontalFrame | kFitWidth | kFitHeight);
366 fContDrawOpt1DSubNSC->AddFrame(fContCumuLR, new TGLayoutHints(kLHintsExpandX, 0, 0, 5, 0));
368 fContCumLeft = new TGCompositeFrame(fContCumuLR, 200, 23, kVerticalFrame | kFitWidth | kFitHeight);
369 fContCumuLR->AddFrame(fContCumLeft, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
371 fRadioCumulative = new TGRadioButton(fContCumLeft, "Cumulative", 112);
372 fContCumLeft->AddFrame(fRadioCumulative, new TGLayoutHints(kLHintsNormal, 0, 10, 0, 0));
373 fRadioCumulative->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtons1D()");
374 fRadioCumulative->SetToolTipText("Draw the cumulative (SigmaCut) of the given selection. \nThe data distribution is integrated, starting from the mean/median/LTM.");
376 fCheckCumulativePM = new TGCheckButton(fContCumLeft, "Plus/Minus");
377 fContCumLeft->AddFrame(fCheckCumulativePM, new TGLayoutHints(kLHintsNormal, 10, 15, 0, 0));
378 fCheckCumulativePM->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtons1D()");
379 fCheckCumulativePM->SetToolTipText("Decide whether you want the cumulative integration for each direction (+/-) \nor only for the absolute distance to the mean/median/LTM value.");
381 fRadioIntegrate = new TGRadioButton(fContCumLeft, "Integrate", 113);
382 fContCumLeft->AddFrame(fRadioIntegrate, new TGLayoutHints(kLHintsNormal, 0, 0, 5, 0));
383 fRadioIntegrate->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtons1D()");
384 fRadioIntegrate->SetToolTipText("Draw the integral of the given selection.");
386 fContCumRight = new TGCompositeFrame(fContCumuLR, 200, 23, kVerticalFrame | kFitWidth | kFitHeight);
387 fContCumuLR->AddFrame(fContCumRight, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
389 fLblSigmaMax = new TGLabel(fContCumRight, "SigmaMax:");
390 fLblSigmaMax->SetTextJustify(kTextLeft);
391 fContCumRight->AddFrame(fLblSigmaMax, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 5, 0, 0, 0));
393 fTxtSigmaMax = new TGTextEntry(fContCumRight, "5", 112);
394 fContCumRight->AddFrame(fTxtSigmaMax, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 10, 15, 0, 0));
395 fTxtSigmaMax->Connect("ReturnPressed()", "AliBaseCalibViewerGUI", this, "HandleButtons1D(=112)");
396 fTxtSigmaMax->SetToolTipText("Enter up to which multiple of sigma you want to integrate.");
399 fContDrawOpt1DSubMML = new TGCompositeFrame(fcontDrawOpt1DSubLR, 200, 23, kHorizontalFrame | kFitWidth | kFitHeight);
400 fcontDrawOpt1DSubLR->AddFrame(fContDrawOpt1DSubMML, new TGLayoutHints(kLHintsExpandX, 0, 0, 5, 0));
402 // -------------- content of fcontDrawOpt1DSubLR
403 fChkMean = new TGCheckButton(fContDrawOpt1DSubMML, "Mean");
404 fContDrawOpt1DSubMML->AddFrame(fChkMean, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
405 fChkMean->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtons1D()");
406 fChkMean->SetToolTipText("Activate Mean for Sigma/Cumulative/Integrate");
408 fChkMedian = new TGCheckButton(fContDrawOpt1DSubMML, "Median");
409 fContDrawOpt1DSubMML->AddFrame(fChkMedian, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
410 fChkMedian->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtons1D()");
411 fChkMedian->SetToolTipText("Activate Median for Sigma/Cumulative/Integrate");
413 fChkLTM = new TGCheckButton(fContDrawOpt1DSubMML, "LTM");
414 fContDrawOpt1DSubMML->AddFrame(fChkLTM, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
415 fChkLTM->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtons1D()");
416 fChkLTM->SetToolTipText("Activate LTM for Sigma/Cumulative/Integrate");
419 // statistic options container *** fcontStatOpt1D *** " Statistic options "
420 fContStatOpt = new TGGroupFrame(ftabLeft1, "Statistic options", kVerticalFrame | kFitWidth | kFitHeight);
421 ftabLeft1->AddFrame(fContStatOpt, new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0));
423 fChkStatName = new TGCheckButton(fContStatOpt, "Name");
424 fContStatOpt->AddFrame(fChkStatName, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
425 fChkStatName->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsStat()");
426 fChkStatName->SetToolTipText("Display the name in the statistics legend.");
428 fChkStatEntries = new TGCheckButton(fContStatOpt, "Entries");
429 fContStatOpt->AddFrame(fChkStatEntries, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
430 fChkStatEntries->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsStat()");
431 fChkStatEntries->SetToolTipText("Display the number of entries in the statistics legend.");
433 fContStatMean = new TGCompositeFrame(fContStatOpt, 1, 1, kHorizontalFrame | kFitWidth | kFitHeight);
434 fContStatOpt->AddFrame(fContStatMean, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
436 fChkStatMean = new TGCheckButton(fContStatMean, "Mean");
437 fContStatMean->AddFrame(fChkStatMean, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
438 fChkStatMean->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsStat()");
439 fChkStatMean->SetToolTipText("Display the mean value of the data in the statistics legend.");
441 fChkStatMeanPM = new TGCheckButton(fContStatMean, "+- Error");
442 fContStatMean->AddFrame(fChkStatMeanPM, new TGLayoutHints(kLHintsNormal, 10, 0, 0, 0));
443 fChkStatMeanPM->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsStat()");
444 fChkStatMeanPM->SetToolTipText("Display the mean value's error in the statistics legend.");
446 fContStatRMS = new TGCompositeFrame(fContStatOpt, 1, 1, kHorizontalFrame | kFitWidth | kFitHeight);
447 fContStatOpt->AddFrame(fContStatRMS, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
449 fChkStatRMS = new TGCheckButton(fContStatRMS, "RMS");
450 fContStatRMS->AddFrame(fChkStatRMS, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
451 fChkStatRMS->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsStat()");
452 fChkStatRMS->SetToolTipText("Display the RMS value of the data in the statistics legend.");
454 fChkStatRMSPM = new TGCheckButton(fContStatRMS, "+- Error");
455 fContStatRMS->AddFrame(fChkStatRMSPM, new TGLayoutHints(kLHintsNormal, 10, 0, 0, 0));
456 fChkStatRMSPM->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsStat()");
457 fChkStatRMSPM->SetToolTipText("Display the RMS value's error in the statistics legend.");
459 fChkStatUnderflow = new TGCheckButton(fContStatOpt, "Underflow");
460 fContStatOpt->AddFrame(fChkStatUnderflow, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
461 fChkStatUnderflow->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsStat()");
462 fChkStatUnderflow->SetToolTipText("Display the number of entries in the underflow bin.");
464 fChkStatOverflow = new TGCheckButton(fContStatOpt, "Overflow");
465 fContStatOpt->AddFrame(fChkStatOverflow, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
466 fChkStatOverflow->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsStat()");
467 fChkStatOverflow->SetToolTipText("Display the number of entries in the overflow bin.");
469 fChkStatIntegral = new TGCheckButton(fContStatOpt, "Integral");
470 fContStatOpt->AddFrame(fChkStatIntegral, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
471 fChkStatIntegral->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsStat()");
472 fChkStatIntegral->SetToolTipText("Display the integral of the data in the statistics legend.");
474 fContStatSkew = new TGCompositeFrame(fContStatOpt, 1, 1, kHorizontalFrame | kFitWidth | kFitHeight);
475 fContStatOpt->AddFrame(fContStatSkew, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
477 fChkStatSkewness = new TGCheckButton(fContStatSkew, "Skewness");
478 fContStatSkew->AddFrame(fChkStatSkewness, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
479 fChkStatSkewness->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsStat()");
480 fChkStatSkewness->SetToolTipText("Display the skewness of the data in the statistics legend. \nBe careful! Sometimes the skewness causes a floating point exception that hangs the GUI!");
482 fChkStatSkewnessPM = new TGCheckButton(fContStatSkew, "+- Error");
483 fContStatSkew->AddFrame(fChkStatSkewnessPM, new TGLayoutHints(kLHintsNormal, 10, 0, 0, 0));
484 fChkStatSkewnessPM->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsStat()");
485 fChkStatSkewnessPM->SetToolTipText("Display the skewness' error in the statistics legend.");
487 fContStatKurt = new TGCompositeFrame(fContStatOpt, 1, 1, kHorizontalFrame | kFitWidth | kFitHeight);
488 fContStatOpt->AddFrame(fContStatKurt, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
490 fChkStatKurtosis = new TGCheckButton(fContStatKurt, "Kurtosis");
491 fContStatKurt->AddFrame(fChkStatKurtosis, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
492 fChkStatKurtosis->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsStat()");
493 fChkStatKurtosis->SetToolTipText("Display the kurtosis of the data in the statistics legend.");
495 fChkStatKurtosisPM = new TGCheckButton(fContStatKurt, "+- Error");
496 fContStatKurt->AddFrame(fChkStatKurtosisPM, new TGLayoutHints(kLHintsNormal, 10, 0, 0, 0));
497 fChkStatKurtosisPM->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsStat()");
498 fChkStatKurtosisPM->SetToolTipText("Display the kurtosis' error in the statistics legend.");
500 fBtnUnchekAll = new TGTextButton(fContStatOpt, "&Uncheck all");
501 fContStatOpt->AddFrame(fBtnUnchekAll, new TGLayoutHints(kLHintsExpandX, 10, 10, 0, 0));
502 fBtnUnchekAll->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "UnchekAllStat()");
503 fBtnUnchekAll->SetToolTipText("Disable all statistics legend entries, \nno statistics legend.");
506 // custom options container
507 // --- fComboCustom --- the custom draw line on the very low
508 fContCustom = new TGCompositeFrame(fContTopBottom, 200, 200, kHorizontalFrame | kFitWidth | kFitHeight);
509 fContTopBottom->AddFrame(fContCustom, new TGLayoutHints(kLHintsExpandX, 10, 0, 0, 0));
511 // ------------------------- content of fContCustom -------------------------
512 fLblCustomDraw = new TGLabel(fContCustom, "Custom draw: ");
513 fLblCustomDraw->SetTextJustify(kTextLeft);
514 fContCustom->AddFrame(fLblCustomDraw, new TGLayoutHints(kLHintsNormal, 5, 0, 0, 0));
515 // text field for custom draw command
516 fComboCustom = new TGComboBox(fContCustom);
517 fComboCustom->Resize(0, fBtnDraw->GetDefaultHeight());
518 fComboCustom->EnableTextInput(kTRUE);
519 fContCustom->AddFrame(fComboCustom, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
520 fComboCustom->Connect("ReturnPressed()", "AliBaseCalibViewerGUI", this, "HandleButtonsGeneral(=42)");
521 fComboCustom->Connect("Selected(Int_t)", "AliBaseCalibViewerGUI", this, "DoNewSelection()");
524 // additional cuts container
525 fContAddCuts = new TGCompositeFrame(fContTopBottom, 200, 200, kHorizontalFrame | kFitWidth | kFitHeight);
526 fContTopBottom->AddFrame(fContAddCuts, new TGLayoutHints(kLHintsExpandX, 10, 0, 0, 0));
528 // ------------------------- content of fContAddCuts -------------------------
529 fLblAddCuts = new TGLabel(fContAddCuts, "Custom cuts: ");
530 fLblAddCuts->SetTextJustify(kTextLeft);
531 fContAddCuts->AddFrame(fLblAddCuts, new TGLayoutHints(kLHintsNormal, 5, 0, 0, 0));
532 // combo text field for additional cuts
533 fComboAddCuts = new TGComboBox(fContAddCuts);
534 fComboAddCuts->Resize(0, fBtnDraw->GetDefaultHeight());
535 fComboAddCuts->EnableTextInput(kTRUE);
536 fContAddCuts->AddFrame(fComboAddCuts, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
537 fComboAddCuts->Connect("Selected(Int_t)", "AliBaseCalibViewerGUI", this, "DoNewSelection()");
539 // ==========================================================================
540 // ************************* content of fContCenter *************************
541 // ========================================================================
542 // main drawing canvas
543 fCanvMain = new TRootEmbeddedCanvas("Main_Canvas", fContCenter, 200, 200, kFitWidth | kFitHeight);
544 fContCenter->AddFrame(fCanvMain, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
546 fCanvMain->GetCanvas()->Connect("ProcessedEvent(Int_t, Int_t, Int_t, TObject*)", "AliBaseCalibViewerGUI", this, "MouseMove(Int_t, Int_t, Int_t, TObject*)");
548 fCanvMain->GetCanvas()->Connect("RangeAxisChanged()", "AliTPCCalibViewerGUI", this, "GetMinMax()");
549 fCanvMain->GetCanvas()->SetToolTipText("The Main_Canvas, here your plots are displayed.");
552 // =========================================================================
553 // ************************* content of fContRight *************************
554 // ========================================================================
556 // tabs on the right side:
557 ftabRight = new TGTab(fContRight);
558 fContRight->AddFrame(ftabRight, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 8, 0));
559 fTabRight0 = ftabRight->AddTab("Basic");
560 fTabRight1 = ftabRight->AddTab("Advanced");
563 // **************************** content of tabLeft0 *******************************
564 // cut options container
566 fContCuts = new TGGroupFrame(fTabRight0, "Cuts", kVerticalFrame | kFitWidth | kFitHeight);
567 fTabRight0->AddFrame(fContCuts, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
569 // Scaling options container
570 fContScaling = new TGGroupFrame(fTabRight0, "Scaling", kVerticalFrame | kFitWidth | kFitHeight);
571 fTabRight0->AddFrame(fContScaling, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
573 // ************************* content of fContScaling *************************
574 // SetMaximum container
575 fContSetMax = new TGCompositeFrame(fContScaling, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
576 fContScaling->AddFrame(fContSetMax, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
578 // ------------------------- content of fContSetMax -------------------------
579 // SetMaximum - checkbox
580 fChkSetMax = new TGCheckButton(fContSetMax, "Set fixed max.");
581 fContSetMax->AddFrame(fChkSetMax, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
582 fChkSetMax->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsNoRedraw()");
583 fChkSetMax->SetToolTipText("Set the maximum fixed to the value specified here.");
585 // text field for maximum value
586 fTxtSetMax = new TGTextEntry(fContSetMax, "", 41);
587 fContSetMax->AddFrame(fTxtSetMax, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
588 fTxtSetMax->Connect("ReturnPressed()", "AliBaseCalibViewerGUI", this, "HandleButtonsNoRedraw()");
589 fTxtSetMax->SetToolTipText("maximum value for the drawing");
591 // SetMinimum container
592 fContSetMin = new TGCompositeFrame(fContScaling, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
593 fContScaling->AddFrame(fContSetMin, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
595 // ------------------------- content of fContSetMin -------------------------
596 // SetMinimum - checkbox
597 fChkSetMin = new TGCheckButton(fContSetMin, "Set fixed min.");
598 fContSetMin->AddFrame(fChkSetMin, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
599 fChkSetMin->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsNoRedraw()");
600 fChkSetMin->SetToolTipText("Set the minimum fixed to the value specified here.");
602 // text field for minimum value
603 fTxtSetMin = new TGTextEntry(fContSetMin, "", 40);
604 fContSetMin->AddFrame(fTxtSetMin, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
605 fTxtSetMin->Connect("ReturnPressed()", "AliBaseCalibViewerGUI", this, "HandleButtonsNoRedraw()");
606 fTxtSetMin->SetToolTipText("minimum value for the drawing");
608 // get Min & Max from Plot - button
609 fBtnGetMinMax = new TGTextButton(fContScaling, "&Get scale from plot");
610 fContScaling->AddFrame(fBtnGetMinMax, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
611 fBtnGetMinMax->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "GetMinMax()");
612 fBtnGetMinMax->SetToolTipText("Get min and max from plot, e.g. after rescaling by dragging the palette. \nObsolete! The button's function will change to 'Unzoom all'.");
614 // GetMinMaxAuto - checkbox
615 fChkGetMinMaxAuto = new TGCheckButton(fContScaling, "Get Min + Max auto.");
616 fContScaling->AddFrame(fChkGetMinMaxAuto, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
617 fChkGetMinMaxAuto->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsNoRedraw()");
618 fChkGetMinMaxAuto->SetToolTipText("Get minimum and maximum automatically from each new plot. \nDeactivate this, if you want to 'save' your specified minimum and maximum.");
620 // labeling container *** fContLabeling *** " Labeling "
621 fContLabeling = new TGGroupFrame(fTabRight0, "Labeling", kVerticalFrame | kFitWidth | kFitHeight);
622 fTabRight0->AddFrame(fContLabeling, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
624 fChkLabelTitle = new TGCheckButton(fContLabeling, "Set title:");
625 fContLabeling->AddFrame(fChkLabelTitle, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
626 fChkLabelTitle->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsNoRedraw()");
627 fChkLabelTitle->SetToolTipText("Set the plot title.");
629 fTxtLabelTitle = new TGTextEntry(fContLabeling, "Title", 500);
630 fContLabeling->AddFrame(fTxtLabelTitle, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
631 fTxtLabelTitle->Connect("ReturnPressed()", "AliBaseCalibViewerGUI", this, "HandleButtonsNoRedraw(=50)");
632 fTxtLabelTitle->SetToolTipText("plot title");
634 fChkLabelXaxis = new TGCheckButton(fContLabeling, "Set X-axis label:");
635 fContLabeling->AddFrame(fChkLabelXaxis, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
636 fChkLabelXaxis->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsNoRedraw()");
637 fChkLabelXaxis->SetToolTipText("Set the X-axis label.");
639 fTxtLabelXaxis = new TGTextEntry(fContLabeling, "XaxisLabel", 500);
640 fContLabeling->AddFrame(fTxtLabelXaxis, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
641 fTxtLabelXaxis->Connect("ReturnPressed()", "AliBaseCalibViewerGUI", this, "HandleButtonsNoRedraw(=51)");
642 fTxtLabelXaxis->SetToolTipText("X-axis label");
644 fChkLabelYaxis = new TGCheckButton(fContLabeling, "Set Y-axis label:");
645 fContLabeling->AddFrame(fChkLabelYaxis, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
646 fChkLabelYaxis->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsNoRedraw()");
647 fChkLabelYaxis->SetToolTipText("Set the Y-axis label.");
649 fTxtLabelYaxis = new TGTextEntry(fContLabeling, "YaxisLabel", 500);
650 fContLabeling->AddFrame(fTxtLabelYaxis, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
651 fTxtLabelYaxis->Connect("ReturnPressed()", "AliBaseCalibViewerGUI", this, "HandleButtonsNoRedraw(=52)");
652 fTxtLabelYaxis->SetToolTipText("Y-axis label");
654 fChkLabelGetAuto = new TGCheckButton(fContLabeling, "Get labels auto.");
655 fContLabeling->AddFrame(fChkLabelGetAuto, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
656 fChkLabelGetAuto->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "HandleButtonsNoRedraw()");
657 fChkLabelGetAuto->SetToolTipText("Get labels automatically from each new plot \nDeactivate this, if you want to 'save' your specified labels.");
660 // **************************** content of ftabRight1 *******************************
662 fContSave = new TGGroupFrame(fTabRight1, "Save", kVerticalFrame | kFitWidth | kFitHeight);
663 fTabRight1->AddFrame(fContSave, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
665 fBtnSave = new TGTextButton(fContSave, "&Save picture");
666 fContSave->AddFrame(fBtnSave, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
667 fBtnSave->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "SavePicture()");
668 fBtnSave->SetToolTipText("Open a 'Save as...' dialog to save the current plot as picture or macro.");
670 // additional save options container
671 fContAddSaveOpt = new TGCompositeFrame(fContSave, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
672 fContSave->AddFrame(fContAddSaveOpt, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
674 // content of --- fContAddSaveOpt ---
675 // addition save options label
676 fChkAddSaveOpt = new TGCheckButton(fContAddSaveOpt, "Save options:");
677 fContAddSaveOpt->AddFrame(fChkAddSaveOpt, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
678 fChkAddSaveOpt->Connect("Clicked()", "AliBaseCalibViewerGUI", this, "DoNewSelection()");
679 fChkAddSaveOpt->SetToolTipText("Additional save options (see documentation for TPad::Print()).");
681 // additional save options combo box
682 fComboAddSaveOpt = new TGComboBox(fContAddSaveOpt);
683 fContAddSaveOpt->AddFrame(fComboAddSaveOpt, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
684 fComboAddSaveOpt->Resize(0, fBtnDraw->GetDefaultHeight());
685 fComboAddSaveOpt->EnableTextInput(kTRUE);
686 fComboAddSaveOpt->Connect("ReturnPressed()", "AliBaseCalibViewerGUI", this, "SavePicture()");
688 // calPad export container
689 fContExport = new TGGroupFrame(fTabRight1, "Export AliTPCCalPad", kVerticalFrame | kFitWidth | kFitHeight);
690 fTabRight1->AddFrame(fContExport, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
691 // ------------------------- content of fContExport -------------------------
692 // container for export name
694 fContAddExport = new TGCompositeFrame(fContExport, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
695 fContExport->AddFrame(fContAddExport, new TGLayoutHints(kLHintsExpandX, -5, -5, 0, 0));
697 fComboExportName = new TGComboBox(fContAddExport);
698 fComboExportName->Resize(0, fBtnDraw->GetDefaultHeight());
699 fContAddExport->AddFrame(fComboExportName, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
700 fComboExportName->AddEntry("calPad", 0); // first default value
701 fComboExportName->Select(0); // select default value before connecting
702 fComboExportName->EnableTextInput(kTRUE);
705 fBtnExport = new TGTextButton(fContExport, "&Export to CINT");
706 fContExport->AddFrame(fBtnExport, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
707 fBtnExport->SetToolTipText("Lifeless button :(");
709 // add to normalisation button
710 fBtnAddNorm = new TGTextButton(fContExport, "&Add to normalization");
711 fContExport->AddFrame(fBtnAddNorm, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
712 fBtnAddNorm->SetToolTipText("Lifeless button :(");
715 fContTree = new TGGroupFrame(fTabRight1, "Tree", kVerticalFrame | kFitWidth | kFitHeight);
716 fTabRight1->AddFrame(fContTree, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
718 // dump tree to file button
719 fBtnDumpToFile = new TGTextButton(fContTree, "&Dump to File");
720 fContTree->AddFrame(fBtnDumpToFile, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
721 fBtnDumpToFile->SetToolTipText("Lifeless button :(");
723 // dump tree to file button
724 fBtnLoadTree = new TGTextButton(fContTree, "&Load Tree");
725 fContTree->AddFrame(fBtnLoadTree, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
726 fBtnLoadTree->SetToolTipText("Lifeless button :(");
728 fChkAddAsReference = new TGCheckButton(fContTree, "as reference:");
729 fContTree->AddFrame(fChkAddAsReference, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
730 fChkAddAsReference->SetToolTipText("Lifeless button :(");
732 fTxtRefName = new TGTextEntry(fContTree, "R", 500);
733 fContTree->AddFrame(fTxtRefName, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 15, 0, 0, 0));
734 fTxtRefName->SetToolTipText("Reference Name");
736 // Fit options container
737 fContFit = new TGGroupFrame(fTabRight1, "Custom fit", kVerticalFrame | kFitWidth | kFitHeight);
738 fTabRight1->AddFrame(fContFit, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
740 // ------------------------- content of fContFit -------------------------
741 // container for additional fits
742 fContAddFit = new TGCompositeFrame(fContFit, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
743 fContFit->AddFrame(fContAddFit, new TGLayoutHints(kLHintsExpandX, -5, -5, 0, 0));
745 // --- content of fContAddFit ---
746 // text field for custom fit
747 fComboCustomFit = new TGComboBox(fContAddFit);
748 fComboCustomFit->Resize(0, fBtnDraw->GetDefaultHeight());
749 fComboCustomFit->EnableTextInput(kTRUE);
750 fContAddFit->AddFrame(fComboCustomFit, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
753 fBtnFit = new TGTextButton(fContAddFit, "&Fit");
754 fContAddFit->AddFrame(fBtnFit, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
755 fBtnFit->SetToolTipText("Lifeless button :(");
758 //________________________________________________________________________________________
759 AliBaseCalibViewerGUI::AliBaseCalibViewerGUI(const AliBaseCalibViewerGUI &c)
760 : TGCompositeFrame(c.fParent, c.fWidth, c.fHeight),
775 fContDrawOptSub1D2D(0),
789 fBtnAddFitFunction(0),
802 fListNormalization(0),
811 fChkGetMinMaxAuto(0),
815 fcontDrawOpt1DSubLR(0),
816 fContDrawOpt1DSubNSC(0),
826 fCheckCumulativePM(0),
828 fContDrawOpt1DSubMML(0),
841 fChkStatUnderflow(0),
846 fChkStatSkewnessPM(0),
849 fChkStatKurtosisPM(0),
872 fChkAddAsReference(0),
877 // dummy AliBaseCalibViewerGUI copy constructor
881 //________________________________________________________________________________________
882 AliBaseCalibViewerGUI & AliBaseCalibViewerGUI::operator =(const AliBaseCalibViewerGUI & /*param*/) {
884 // dummy assignment operator
889 //________________________________________________________________________________________
890 AliBaseCalibViewerGUI::~AliBaseCalibViewerGUI() {
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();
905 //________________________________________________________________________________________
906 void AliBaseCalibViewerGUI::SetInitialValues() {
908 // Set the default button states
910 fChkAuto->SetState(kButtonUp);
911 fRadioPredefined->SetState(kButtonDown);
912 fRadioRaw->SetState(kButtonDown);
913 fRadio1D->SetState(kButtonDown);
914 fChkGetMinMaxAuto->SetState(kButtonDown);
915 fChkSetMin->SetState(kButtonUp);
916 fChkSetMax->SetState(kButtonUp);
917 fRadioNorm->SetState(kButtonDown);
918 fRadioSigma->SetState(kButtonUp);
919 fRadioCumulative->SetState(kButtonUp);
920 fChkMean->SetState(kButtonDown);
921 fCheckCumulativePM->SetState(kButtonUp);
923 fChkLabelGetAuto->SetState(kButtonDown);
925 Int_t statOpt = gStyle->GetOptStat();
926 if (statOpt == 1) statOpt = 1111;
927 if (statOpt / 200000000 >= 1) {
928 fChkStatKurtosis->SetState(kButtonDown);
929 fChkStatKurtosisPM->SetState(kButtonDown);
930 statOpt -= 200000000;
932 if (statOpt / 100000000 >= 1) {
933 fChkStatKurtosis->SetState(kButtonDown);
934 statOpt -= 100000000;
936 if (statOpt / 20000000 >= 1) {
937 fChkStatSkewness->SetState(kButtonDown);
938 fChkStatSkewnessPM->SetState(kButtonDown);
941 if (statOpt / 10000000 >= 1) {
942 fChkStatSkewness->SetState(kButtonDown);
945 if (statOpt / 1000000 >= 1) {
946 fChkStatIntegral->SetState(kButtonDown);
949 if (statOpt / 100000 >= 1) {
950 fChkStatOverflow->SetState(kButtonDown);
953 if (statOpt / 10000 >= 1) {
954 fChkStatUnderflow->SetState(kButtonDown);
957 if (statOpt / 2000 >= 1) {
958 fChkStatRMS->SetState(kButtonDown);
959 fChkStatRMSPM->SetState(kButtonDown);
962 if (statOpt / 1000 >= 1) {
963 fChkStatRMS->SetState(kButtonDown);
966 if (statOpt / 200 >= 1) {
967 fChkStatMean->SetState(kButtonDown);
968 fChkStatMeanPM->SetState(kButtonDown);
971 if (statOpt / 100 >= 1) {
972 fChkStatMean->SetState(kButtonDown);
975 if (statOpt / 10 >= 1) {
976 fChkStatEntries->SetState(kButtonDown);
979 if (statOpt / 1 >= 1) {
980 fChkStatName->SetState(kButtonDown);
984 // fill fComboAddDrawOpt with some additional drawing options
985 fComboAddDrawOpt->AddEntry("same", 0);
986 fComboAddDrawOpt->AddEntry("profbox", 1);
987 fComboAddDrawOpt->AddEntry("profcolz", 2);
988 fComboAddDrawOpt->AddEntry("profcont0", 3);
989 fComboAddDrawOpt->AddEntry("proflego", 4);
990 fComboAddDrawOpt->AddEntry("proflego2", 5);
991 fComboAddDrawOpt->AddEntry("profsurf", 6);
992 fComboAddDrawOpt->AddEntry("profsurf1", 7);
993 fComboAddDrawOpt->AddEntry("profsurf2", 8);
994 fComboAddDrawOpt->AddEntry("box", 9);
995 fComboAddDrawOpt->AddEntry("colz", 10);
996 fComboAddDrawOpt->AddEntry("cont0", 11);
997 fComboAddDrawOpt->AddEntry("lego", 12);
998 fComboAddDrawOpt->AddEntry("lego2", 13);
999 fComboAddDrawOpt->AddEntry("surf", 14);
1000 fComboAddDrawOpt->AddEntry("surf1", 15);
1001 fComboAddDrawOpt->AddEntry("surf2", 16);
1003 // fill fComboAddSaveOpt with some additional drawing options
1004 fComboAddSaveOpt->AddEntry("Portrait", 0);
1005 fComboAddSaveOpt->AddEntry("Landscape", 1);
1006 fComboAddSaveOpt->AddEntry("Preview", 2);
1007 fComboAddSaveOpt->AddEntry("+50", 3);
1009 // fill fComboMethod
1010 fComboMethod->AddEntry("subtract", 0);
1011 fComboMethod->AddEntry("divide by", 1);
1013 // fill fComboExportName
1014 fBtnExport->SetEnabled(kFALSE);
1015 fBtnAddNorm->SetEnabled(kFALSE);
1017 // select initial variables
1018 fListVariables->Select(0);
1019 fListNormalization->Select(0);
1020 fComboMethod->Select(0);
1022 fListVariables->IntegralHeight(kFALSE); // naja
1023 fListNormalization->IntegralHeight(kFALSE); // naja
1024 fChkAuto->SetState(kButtonDown);
1027 //________________________________________________________________________________________
1028 void AliBaseCalibViewerGUI::HandleButtonsGeneral(Int_t id) {
1030 // handles mutual radio button exclusions
1034 TGButton *btn = (TGButton *) gTQSender;
1035 id = btn->WidgetId();
1039 case 10: // fRadioRaw
1040 fRadioNormalized->SetState(kButtonUp);
1041 fRadioPredefined->SetState(kButtonDown);
1042 fRadioCustom->SetState(kButtonUp);
1044 case 11: // fRadioNormalized
1045 fRadioRaw->SetState(kButtonUp);
1046 fRadioPredefined->SetState(kButtonDown);
1047 fRadioCustom->SetState(kButtonUp);
1049 case 12: // fRadioCustom
1050 fRadioPredefined->SetState(kButtonUp);
1052 case 14: // select Draw options fComboAddDrawOpt
1053 fChkAddDrawOpt->SetState(kButtonDown);
1055 case 13: // fRadioPredefined
1056 fRadioCustom->SetState(kButtonUp);
1059 case 30: // fRadio1D
1060 fRadio2D->SetState(kButtonUp);
1061 fBtnExport->SetEnabled(kFALSE);
1062 fBtnAddNorm->SetEnabled(kFALSE);
1064 case 31: // fRadio2D
1065 fRadio1D->SetState(kButtonUp);
1066 fBtnExport->SetEnabled(kTRUE);
1067 fBtnAddNorm->SetEnabled(kTRUE);
1069 case 42: // fComboCustom
1070 fRadioCustom->SetState(kButtonDown);
1071 fRadioPredefined->SetState(kButtonUp);
1077 //________________________________________________________________________________________
1078 void AliBaseCalibViewerGUI::HandleButtons1D(Int_t id) {
1080 // handles mutual radio button exclusions
1085 TGButton *btn = (TGButton *) gTQSender;
1086 id = btn->WidgetId();
1089 case 110: // 1D draw normal
1090 fRadioNorm->SetState(kButtonDown);
1091 fRadioSigma->SetState(kButtonUp);
1092 fRadioCumulative->SetState(kButtonUp);
1093 fRadioIntegrate->SetState(kButtonUp);
1095 case 111: // 1D draw sigma
1096 fRadioNorm->SetState(kButtonUp);
1097 fRadioSigma->SetState(kButtonDown);
1098 fRadioCumulative->SetState(kButtonUp);
1099 fRadioIntegrate->SetState(kButtonUp);
1101 case 112: // 1D draw cumulative
1102 fRadioNorm->SetState(kButtonUp);
1103 fRadioSigma->SetState(kButtonUp);
1104 fRadioCumulative->SetState(kButtonDown);
1105 fRadioIntegrate->SetState(kButtonUp);
1107 case 113: // 1D draw integral
1108 fRadioNorm->SetState(kButtonUp);
1109 fRadioSigma->SetState(kButtonUp);
1110 fRadioCumulative->SetState(kButtonUp);
1111 fRadioIntegrate->SetState(kButtonDown);
1117 //________________________________________________________________________________________
1118 void AliBaseCalibViewerGUI::HandleButtonsStat(Int_t id) {
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(...)
1126 TGButton *btn = (TGButton *) gTQSender;
1127 id = btn->WidgetId();
1129 TString statOpt("");
1130 if (fChkStatName->GetState() == kButtonDown) statOpt.Append("n");
1131 if (fChkStatEntries->GetState() == kButtonDown) statOpt.Append("e");
1132 if (fChkStatMean->GetState() == kButtonDown && fChkStatMeanPM->GetState() == kButtonUp) statOpt.Append("m");
1133 if (fChkStatMeanPM->GetState() == kButtonDown) statOpt.Append("M");
1134 if (fChkStatRMS->GetState() == kButtonDown && fChkStatRMSPM->GetState() == kButtonUp) statOpt.Append("r");
1135 if (fChkStatRMSPM->GetState() == kButtonDown) statOpt.Append("R");
1136 if (fChkStatUnderflow->GetState() == kButtonDown) statOpt.Append("u");
1137 if (fChkStatOverflow->GetState() == kButtonDown) statOpt.Append("o");
1138 if (fChkStatIntegral->GetState() == kButtonDown) statOpt.Append("i");
1139 if (fChkStatSkewness->GetState() == kButtonDown && fChkStatSkewnessPM->GetState() == kButtonUp) statOpt.Append("s");
1140 if (fChkStatSkewnessPM->GetState() == kButtonDown) statOpt.Append("S");
1141 if (fChkStatKurtosis->GetState() == kButtonDown && fChkStatKurtosisPM->GetState() == kButtonUp) statOpt.Append("k");
1142 if (fChkStatKurtosisPM->GetState() == kButtonDown) statOpt.Append("K");
1144 gStyle->SetOptStat(statOpt);
1148 //________________________________________________________________________________________
1149 void AliBaseCalibViewerGUI::HandleButtonsNoRedraw(Int_t id) {
1151 // handles label & scaling checkboxes
1152 // without redrawing (not necessary, faster like this)
1155 TGButton *btn = (TGButton *) gTQSender;
1156 id = btn->WidgetId();
1160 case 40: // fTxtSetMin
1161 fChkSetMin->SetState(kButtonDown);
1163 case 41: // fTxtSetMax
1164 fChkSetMax->SetState(kButtonDown);
1166 case 50: // fTxtLabelTitle
1167 fChkLabelTitle->SetState(kButtonDown);
1169 case 51: // fTxtLabelXaxis
1170 fChkLabelXaxis->SetState(kButtonDown);
1172 case 52: // fTxtLabelXaxis
1173 fChkLabelYaxis->SetState(kButtonDown);
1179 //________________________________________________________________________________________
1180 void AliBaseCalibViewerGUI::ReplacePlaceHolders(TString &str)
1183 // replace the defined placeholders in the custom draw string and cut string
1185 TString drawPlaceHolder("#draw#");
1186 TString normPlaceHolder("#norm#");
1188 //current draw variable
1189 TString desiredData("");
1190 if (fListVariables->GetSelectedEntry()){
1191 desiredData += ((TGTextLBEntry*)(fListVariables->GetSelectedEntry()))->GetTitle();
1192 str.ReplaceAll(drawPlaceHolder,desiredData);
1195 //current normalisation
1196 TString normalizationData("");
1197 if (fListNormalization->GetSelectedEntry()){
1198 normalizationData += ((TGTextLBEntry*)(fListNormalization->GetSelectedEntry()))->GetTitle();
1199 if (! (TString(((TGTextLBEntry*)(fListNormalization->GetSelectedEntry()))->GetTitle())).BeginsWith("Fit"))
1200 if ( normalizationData.BeginsWith("_") ) normalizationData = desiredData+normalizationData;
1201 if ( fListVariables->FindEntry(normalizationData.Data()) )
1202 normalizationData+="~";
1203 str.ReplaceAll(normPlaceHolder,normalizationData);
1207 //________________________________________________________________________________________
1208 void AliBaseCalibViewerGUI::DoNewSelection() {
1210 // decides whether to redraw if user makes another selection
1212 if (fChkAuto->GetState() == kButtonDown) DoDraw();
1215 //________________________________________________________________________________________
1216 void AliBaseCalibViewerGUI::SavePicture() {
1218 // saves the current picture
1220 // use the following combination of file type and save options:
1221 // (see also TCanvas::Print)
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
1240 const char *kSaveAsTypes[] = {
1241 "Postscript", "*.ps",
1242 "Encapsulated Postscript", "*.eps",
1251 "C++ macro", "*.cxx",
1252 "Macro file", "*.C",
1253 "ROOT file", "*.root",
1257 TString addSaveOpt("");
1258 if (fChkAddSaveOpt->GetState() == kButtonDown)
1259 addSaveOpt += fComboAddSaveOpt->GetTextEntry()->GetText();
1262 fi.fFileTypes = kSaveAsTypes;
1263 fi.fOverwrite = kFALSE;
1264 new TGFileDialog(gClient->GetRoot(), gClient->GetRoot(), kFDSave, &fi);
1265 if (fi.fFilename && strlen(fi.fFilename)) {
1266 if (addSaveOpt != "")
1267 fCanvMain->GetCanvas()->Print(fi.fFilename, addSaveOpt.Data());
1269 fCanvMain->GetCanvas()->Print(fi.fFilename);
1273 //________________________________________________________________________________________
1274 void AliBaseCalibViewerGUI::GetMinMax() {
1276 // Read current Min & Max from the plot and set it to fTxtSetMin & fTxtSetMax
1278 if (fChkGetMinMaxAuto->GetState() == kButtonUp) return;
1279 TList* listOfPrimitives = fCanvMain->GetCanvas()->GetListOfPrimitives();
1281 for (Int_t i = 0; i < listOfPrimitives->GetEntries(); i++) {
1282 ptr = listOfPrimitives->At(i);
1283 if ( ptr->InheritsFrom("TH1") ) break;
1285 if ( !ptr || !ptr->InheritsFrom("TH1") ) return; // if the loop did not find a TH1
1286 TH1 *hist = (TH1*)ptr;
1288 if (fRadio2D->GetState() == kButtonDown) {
1289 if (fChkSetMax->GetState() == kButtonUp)
1290 fTxtSetMax->SetText(Form("%f", hist->GetMaximum()));
1291 if (fChkSetMin->GetState() == kButtonUp)
1292 fTxtSetMin->SetText(Form("%f", hist->GetMinimum()));
1294 else if (fRadio1D->GetState() == kButtonDown) {
1295 if (fChkSetMax->GetState() == kButtonUp)
1296 fTxtSetMax->SetText( Form("%f", hist->GetXaxis()->GetXmax()) );
1297 if (fChkSetMin->GetState() == kButtonUp)
1298 fTxtSetMin->SetText( Form("%f", hist->GetXaxis()->GetXmin()) );
1302 //________________________________________________________________________________________
1303 void AliBaseCalibViewerGUI::SetMinMaxLabel() {
1305 // Set Minimum, Maximum and labels without redrawing the plot
1309 // search for histogram
1310 TList* listOfPrimitives = fCanvMain->GetCanvas()->GetListOfPrimitives();
1312 for (Int_t i = 0; i < listOfPrimitives->GetEntries(); i++) {
1313 ptr = listOfPrimitives->At(i);
1314 if ( ptr->InheritsFrom("TH1") ) break;
1316 if ( ptr == 0 || !ptr->InheritsFrom("TH1") ) { // if the loop did not find a TH1
1317 fCanvMain->GetCanvas()->Update();
1318 Warning("SetMinMaxLabel","No Histogram found!");
1320 // unable to find histogram, no min and max wil be read out
1323 TH1 *hist = (TH1*)ptr;
1324 TString minTxt(fTxtSetMin->GetText());
1325 TString maxTxt(fTxtSetMax->GetText());
1327 // set min and max according to specified values, if checkbox is checked
1328 if (fRadio2D->GetState() == kButtonDown) {
1329 if (fChkSetMax->GetState() == kButtonDown && fChkSetMax->GetState() == kButtonDown &&(maxTxt.IsDigit() || maxTxt.IsFloat()) )
1330 hist->SetMaximum(maxTxt.Atof());
1331 if (fChkSetMax->GetState() == kButtonUp)
1332 hist->SetMaximum(-1111); // default value, to unzoom
1333 if (fChkSetMin->GetState() == kButtonDown && (minTxt.IsDigit() || minTxt.IsFloat()) )
1334 hist->SetMinimum(minTxt.Atof());
1335 if (fChkSetMin->GetState() == kButtonUp)
1336 hist->SetMinimum(-1111); // default value, to unzoom
1338 else if (fRadio2D->GetState() == kButtonDown) {
1339 if (fChkSetMin->GetState() == kButtonDown &&
1340 fChkSetMax->GetState() == kButtonDown && hist->GetXaxis())
1341 hist->GetXaxis()->SetRangeUser(hist->GetXaxis()->GetXmin(), hist->GetXaxis()->GetXmax());
1342 else if (fChkSetMax->GetState() == kButtonDown && hist->GetXaxis())
1343 hist->GetXaxis()->SetRangeUser(hist->GetXaxis()->GetXmin(), maxTxt.Atof());
1344 else if (fChkSetMin->GetState() == kButtonDown && hist->GetXaxis())
1345 hist->GetXaxis()->SetRangeUser(minTxt.Atof(), hist->GetXaxis()->GetXmax());
1346 hist->SetTitle(hist->GetTitle()); // trick to update the histogram
1349 // get min and max from plot
1352 // set labels according to specification, if cehckboxes are checked
1353 if (fChkLabelTitle->GetState() == kButtonDown)
1354 hist->SetTitle(fTxtLabelTitle->GetText());
1355 if (fChkLabelXaxis->GetState() == kButtonDown)
1356 hist->GetXaxis()->SetTitle(fTxtLabelXaxis->GetText());
1357 if (fChkLabelYaxis->GetState() == kButtonDown)
1358 hist->GetYaxis()->SetTitle(fTxtLabelYaxis->GetText());
1359 // get and/or set labels and title
1360 if (fChkLabelGetAuto->GetState() == kButtonDown) {
1361 fTxtLabelTitle->SetText(hist->GetTitle());
1362 fTxtLabelXaxis->SetTitle(hist->GetXaxis()->GetTitle());
1363 fTxtLabelYaxis->SetTitle(hist->GetYaxis()->GetTitle());
1365 hist->SetTitle(hist->GetTitle()); // trick to update the histogram
1366 fCanvMain->GetCanvas()->Update();
1369 //________________________________________________________________________________________
1370 void AliBaseCalibViewerGUI::UnchekAllStat() {
1372 // Disable all statistical legend entries, no statistical legend.
1374 fChkStatName->SetState(kButtonUp);
1375 fChkStatEntries->SetState(kButtonUp);
1376 fChkStatMean->SetState(kButtonUp);
1377 fChkStatMeanPM->SetState(kButtonUp);
1378 fChkStatRMS->SetState(kButtonUp);
1379 fChkStatRMSPM->SetState(kButtonUp);
1380 fChkStatUnderflow->SetState(kButtonUp);
1381 fChkStatOverflow->SetState(kButtonUp);
1382 fChkStatIntegral->SetState(kButtonUp);
1383 fChkStatSkewness->SetState(kButtonUp);
1384 fChkStatSkewnessPM->SetState(kButtonUp);
1385 fChkStatKurtosis->SetState(kButtonUp);
1386 fChkStatKurtosisPM->SetState(kButtonUp);
1388 HandleButtonsStat(0);