1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
17 ///////////////////////////////////////////////////////////////////////////////
19 // GUI for the AliTPCCalibViewer //
20 // used for the calibration monitor //
21 // All functionalities of the AliTPCCalibViewer are here available
26 AliTPCCalibViewerGUI::ShowGUI("CalibTree.root")
31 ///////////////////////////////////////////////////////////////////////////////
34 #include "AliTPCCalibViewerGUI.h"
39 #include <TVirtualPad.h>
42 #include <TObjArray.h>
43 #include <TObjString.h>
48 #include "TGFileDialog.h"
49 #include "TGInputDialog.h"
50 #include "AliTPCCalibViewer.h"
51 #include "AliTPCPreprocessorOnline.h"
53 // #include "TGListBox.h"
54 // #include "TGNumberEntry"
55 // #include "TGSplitter"
58 // #include "TGButtonGroup"
59 // #include "TGComboBox"
60 // #include "TRootEmbeddedCanvas"
61 // #include "TGButton"
62 // #include "TGRadioButton"
63 // #include "GTCheckButton"
64 // #include "TGTextEntry"
69 ClassImp(AliTPCCalibViewerGUI)
71 AliTPCCalibViewerGUI::AliTPCCalibViewerGUI(const TGWindow *p, UInt_t w, UInt_t h, char* fileName)
72 : TGCompositeFrame(p, w, h),
88 fContDrawOptSub1D2D(0),
103 fBtnAddFitFunction(0),
120 fListNormalization(0),
133 fChkGetMinMaxAuto(0),
137 fcontDrawOpt1DSubLR(0),
138 fContDrawOpt1DSubNSC(0),
148 fCheckCumulativePM(0),
150 fContDrawOpt1DSubMML(0),
163 fChkStatUnderflow(0),
168 fChkStatSkewnessPM(0),
171 fChkStatKurtosisPM(0),
194 fChkAddAsReference(0),
199 // AliTPCCalibViewerGUI constructor; fileName specifies the ROOT tree used for drawing
203 fPreprocessor = new AliTPCPreprocessorOnline();
205 // initialize the AliTPCCalibViewer:
206 if (fileName) Initialize(fileName);
207 // set default button states:
210 if (fileName) DoDraw();
214 void AliTPCCalibViewerGUI::DrawGUI(const TGWindow *p, UInt_t w, UInt_t h) {
218 // ======================================================================
219 // ************************* Display everything *************************
220 // ======================================================================
222 SetCleanup(kDeepCleanup);
223 p = p; // to avoid compiler warnings
225 // *****************************************************************************
226 // ************************* content of this MainFrame *************************
227 // *****************************************************************************
228 // top level container with horizontal layout
229 fContTopBottom = new TGCompositeFrame(this, w, h, kVerticalFrame | kFixedWidth | kFixedHeight);
230 AddFrame(fContTopBottom, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
232 fContLCR = new TGCompositeFrame(fContTopBottom, w, h, kHorizontalFrame | kFixedWidth | kFixedHeight);
233 fContTopBottom->AddFrame(fContLCR, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
235 // ***********************************************************************
236 // ************************* content of fContLCR *************************
237 // ***********************************************************************
239 fContLeft = new TGCompositeFrame(fContLCR, 200, 200, kVerticalFrame | kFixedWidth | kFitHeight);
240 fContLCR->AddFrame(fContLeft, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandY, 5, 3, 3, 3));
242 // left vertical splitter
243 TGVSplitter *splitLeft = new TGVSplitter(fContLCR);
244 splitLeft->SetFrame(fContLeft, kTRUE);
245 fContLCR->AddFrame(splitLeft, new TGLayoutHints(kLHintsLeft | kLHintsExpandY, 0, 0, 0, 0));
248 fContRight = new TGCompositeFrame(fContLCR, 150, 200, kVerticalFrame | kFixedWidth | kFitHeight);
249 fContLCR->AddFrame(fContRight, new TGLayoutHints(kLHintsTop | kLHintsRight | kLHintsExpandY, 3, 5, 3, 3));
252 fContCenter = new TGCompositeFrame(fContLCR, 200, 200, kVerticalFrame | kFixedWidth | kFitHeight);
253 fContLCR->AddFrame(fContCenter, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
255 // right vertical splitter
256 TGVSplitter *splitRight = new TGVSplitter(fContLCR);
257 splitRight->SetFrame(fContRight, kFALSE);
258 fContLCR->AddFrame(splitRight, new TGLayoutHints(kLHintsLeft | kLHintsExpandY, 0, 0, 0, 0));
261 // ========================================================================
262 // ************************* content of fContLeft *************************
263 // ========================================================================
264 // --- draw button and tabLeft ---
266 fBtnDraw = new TGTextButton(fContLeft, "&Draw");
267 fContLeft->AddFrame(fBtnDraw, new TGLayoutHints(kLHintsExpandX, 10, 10, 0, 0));
268 //fBtnDraw->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoTest(=\"fBtnDraw clicked\")");
269 fBtnDraw->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoDraw()");
270 fBtnDraw->SetToolTipText("Press here to draw according to selections.");
272 // tabs on the left side:
273 ftabLeft = new TGTab(fContLeft);
274 fContLeft->AddFrame(ftabLeft, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 8, 0));
275 ftabLeft0 = ftabLeft->AddTab("General");
276 ftabLeft1 = ftabLeft->AddTab("More plot options");
279 // **************************** content of tabLeft0 *******************************
281 // draw options container *** fcontDrawOpt *** " Plot options "
282 fContDrawOpt = new TGGroupFrame(ftabLeft0, "Plot options", kVerticalFrame | kFitWidth | kFitHeight);
283 ftabLeft0->AddFrame(fContDrawOpt, new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0));
284 fContDrawOptSub1D2D = new TGCompositeFrame(fContDrawOpt, 200, 23, kHorizontalFrame | kFitWidth | kFixedHeight);
285 fContDrawOpt->AddFrame(fContDrawOptSub1D2D, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
287 // ------------------------- content of fContDrawOpt -------------------------
288 // -- radio1D, radio2D, chkAuto
290 fRadio1D = new TGRadioButton(fContDrawOptSub1D2D, "1D", 30);
291 fContDrawOptSub1D2D->AddFrame(fRadio1D, new TGLayoutHints(kLHintsNormal, 0, 2, 0, 0));
292 fRadio1D->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsGeneral()");
293 fRadio1D->SetToolTipText("1D drawing \nSelect this if you want to have the full control for the custom draw.");
296 fRadio2D = new TGRadioButton(fContDrawOptSub1D2D, "2D", 31);
297 fContDrawOptSub1D2D->AddFrame(fRadio2D, new TGLayoutHints(kLHintsNormal, 2, 2, 0, 0));
298 fRadio2D->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsGeneral()");
299 fRadio2D->SetToolTipText("2D drawing");
301 // additional draw options container
302 fContAddDrawOpt = new TGCompositeFrame(fContDrawOpt, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
303 fContDrawOpt->AddFrame(fContAddDrawOpt, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
305 // content of --- fContAddDrawOpt ---
306 // addition draw options label
307 fChkAddDrawOpt = new TGCheckButton(fContAddDrawOpt, "Draw options:");
308 //fChkAddDrawOpt->SetTextJustify(kTextLeft);
309 fContAddDrawOpt->AddFrame(fChkAddDrawOpt, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
310 fChkAddDrawOpt->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoNewSelection()");
311 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).");
313 // additional draw options combo box
314 fComboAddDrawOpt = new TGComboBox(fContAddDrawOpt);
315 fComboAddDrawOpt->Resize(0, fBtnDraw->GetDefaultHeight());
316 fComboAddDrawOpt->EnableTextInput(kTRUE);
317 fContAddDrawOpt->AddFrame(fComboAddDrawOpt, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
318 fComboAddDrawOpt->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsGeneral(=14)");
319 fComboAddDrawOpt->Connect("Selected(Int_t)", "AliTPCCalibViewerGUI", this, "DoNewSelection()");
321 // automatic redraw check button
322 fChkAuto = new TGCheckButton(fContDrawOpt, "Auto redraw");
323 fContDrawOpt->AddFrame(fChkAuto, new TGLayoutHints(kLHintsNormal, 0, 2, 0, 0));
324 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'.");
326 // automatic append ending check button
327 fChkAutoAppend = new TGCheckButton(fContDrawOpt, "Auto add appending");
328 fContDrawOpt->AddFrame(fChkAutoAppend, new TGLayoutHints(kLHintsNormal, 0, 2, 0, 0));
329 fChkAutoAppend->SetToolTipText("Tries to repair your custom draw string or custom cut string, if you forgot '~' or '.fElements' \nThis function may be buggy!");
332 // *** predefined radio button *** " Predefined "
333 fRadioPredefined = new TGRadioButton(ftabLeft0, "Predefined: ", 13);
334 ftabLeft0->AddFrame(fRadioPredefined, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
335 fRadioPredefined->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsGeneral()");
336 fRadioPredefined->SetToolTipText("Draw predefined variables according to selection.");
339 fListVariables = new TGListBox(ftabLeft0);
340 ftabLeft0->AddFrame(fListVariables, new TGLayoutHints(kLHintsNormal | kLHintsExpandX | kLHintsExpandY, 10, 0, 0, 0));
341 fListVariables->Connect("Selected(Int_t)", "AliTPCCalibViewerGUI", this, "DoNewSelection()");
344 // normalization options container *** fContPlotOpt ***
345 //fContPlotOpt = new TGCompositeFrame(fContLeft, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
346 fContPlotOpt = new TGGroupFrame(ftabLeft0, "Normalization options", kVerticalFrame | kFitWidth | kFitHeight);
347 ftabLeft0->AddFrame(fContPlotOpt, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10, 0, 0, 0));
349 // ------------------------- content of fContPlotOpt -------------------------
351 fRadioRaw = new TGRadioButton(fContPlotOpt, "Raw", 10);
352 fContPlotOpt->AddFrame(fRadioRaw, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
353 fRadioRaw->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsGeneral()");
354 fRadioRaw->SetToolTipText("Plot without normalization");
356 // normalized radio button
357 fRadioNormalized = new TGRadioButton(fContPlotOpt, "Normalized", 11);
358 fContPlotOpt->AddFrame(fRadioNormalized, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
359 fRadioNormalized->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsGeneral()");
360 fRadioNormalized->SetToolTipText("Normalize data");
362 // normalized options container *** fContNormalized ***
363 fContNormalized = new TGCompositeFrame(fContPlotOpt, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
364 fContPlotOpt->AddFrame(fContNormalized, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 15, 0, 0, 0));
366 // --- content of fContNormalized ---
367 // --- combo box to select 'subtract' or 'divide', list of normalization variables
368 // method drop down combo box
369 fComboMethod = new TGComboBox(fContNormalized);
370 fComboMethod->Resize(0, fBtnDraw->GetDefaultHeight());
371 fContNormalized->AddFrame(fComboMethod, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
372 fComboMethod->Connect("Selected(Int_t)", "AliTPCCalibViewerGUI", this, "DoNewSelection()");
374 // list of normalization variables
375 fListNormalization = new TGListBox(fContNormalized);
376 fContNormalized->AddFrame(fListNormalization, new TGLayoutHints(kLHintsNormal | kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
377 fListNormalization->Connect("Selected(Int_t)", "AliTPCCalibViewerGUI", this, "DoNewSelection()");
379 // custom radio button
380 fRadioCustom = new TGRadioButton(ftabLeft0, "Custom: ", 12);
381 ftabLeft0->AddFrame(fRadioCustom, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
382 fRadioCustom->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsGeneral()");
383 fRadioCustom->SetToolTipText("Draw data according to user specific text entry in the 'Custom Draw' line. Remember '~' (= '.fElements')!");
384 // custom options container is located further down
386 // **************************** content of tabLeft1 *******************************
388 // draw options container *** fcontDrawOpt1D *** " Plot options "
389 fContDrawOpt1D = new TGGroupFrame(ftabLeft1, "1D Plot options", kVerticalFrame | kFitWidth | kFitHeight);
390 ftabLeft1->AddFrame(fContDrawOpt1D, new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0));
392 fcontDrawOpt1DSubLR = new TGCompositeFrame(fContDrawOpt1D, 1, 1, kVerticalFrame | kFitWidth | kFitHeight);
393 fContDrawOpt1D->AddFrame(fcontDrawOpt1DSubLR, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
395 // ***** content of fContDrawOpt1DSubLR *****
396 fContDrawOpt1DSubNSC = new TGCompositeFrame(fcontDrawOpt1DSubLR, 200, 23, kVerticalFrame | kFitWidth | kFitHeight);
397 fcontDrawOpt1DSubLR->AddFrame(fContDrawOpt1DSubNSC, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
399 // --------------------------- content of fContDrawOpt1DSubNSC -----------------
400 fRadioNorm = new TGRadioButton(fContDrawOpt1DSubNSC, "Normal", 110);
401 fContDrawOpt1DSubNSC->AddFrame(fRadioNorm, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
402 fRadioNorm->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtons1D()");
403 fRadioNorm->SetToolTipText("Produce a normal 1D plot, a histogram of the selected data.");
405 fRadioSigma = new TGRadioButton(fContDrawOpt1DSubNSC, "Sigma", 111);
406 fContDrawOpt1DSubNSC->AddFrame(fRadioSigma, new TGLayoutHints(kLHintsNormal, 0, 0, 5, 0));
407 fRadioSigma->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtons1D()");
408 fRadioSigma->SetToolTipText("Draw a normal histogram, but also lines that indicate the mean/median/LTM \nand sigmas of the selected data.");
410 fTxtSigmas = new TGTextEntry(fContDrawOpt1DSubNSC, "2; 4; 6", 111);
411 fContDrawOpt1DSubNSC->AddFrame(fTxtSigmas, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 10, 15, 0, 0));
412 fTxtSigmas->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtons1D(=111)");
413 fTxtSigmas->SetToolTipText("Enter sigma intervals you would like to be indicated by lines. \nExample: '2; 4; 6'");
415 fContCumuLR = new TGCompositeFrame(fContDrawOpt1DSubNSC, 200, 23, kHorizontalFrame | kFitWidth | kFitHeight);
416 fContDrawOpt1DSubNSC->AddFrame(fContCumuLR, new TGLayoutHints(kLHintsExpandX, 0, 0, 5, 0));
418 fContCumLeft = new TGCompositeFrame(fContCumuLR, 200, 23, kVerticalFrame | kFitWidth | kFitHeight);
419 fContCumuLR->AddFrame(fContCumLeft, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
421 fRadioCumulative = new TGRadioButton(fContCumLeft, "Cumulative", 112);
422 fContCumLeft->AddFrame(fRadioCumulative, new TGLayoutHints(kLHintsNormal, 0, 10, 0, 0));
423 fRadioCumulative->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtons1D()");
424 fRadioCumulative->SetToolTipText("Draw the cumulative (SigmaCut) of the given selection. \nThe data distribution is integrated, starting from the mean/median/LTM.");
426 fCheckCumulativePM = new TGCheckButton(fContCumLeft, "Plus/Minus");
427 fContCumLeft->AddFrame(fCheckCumulativePM, new TGLayoutHints(kLHintsNormal, 10, 15, 0, 0));
428 fCheckCumulativePM->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtons1D()");
429 fCheckCumulativePM->SetToolTipText("Decide whether you want the cumulative integration for each direction (+/-) \nor only for the absolute distance to the mean/median/LTM value.");
431 fRadioIntegrate = new TGRadioButton(fContCumLeft, "Integrate", 113);
432 fContCumLeft->AddFrame(fRadioIntegrate, new TGLayoutHints(kLHintsNormal, 0, 0, 5, 0));
433 fRadioIntegrate->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtons1D()");
434 fRadioIntegrate->SetToolTipText("Draw the integral of the given selection.");
436 fContCumRight = new TGCompositeFrame(fContCumuLR, 200, 23, kVerticalFrame | kFitWidth | kFitHeight);
437 fContCumuLR->AddFrame(fContCumRight, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
439 fLblSigmaMax = new TGLabel(fContCumRight, "SigmaMax:");
440 fLblSigmaMax->SetTextJustify(kTextLeft);
441 fContCumRight->AddFrame(fLblSigmaMax, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 5, 0, 0, 0));
443 fTxtSigmaMax = new TGTextEntry(fContCumRight, "5", 112);
444 fContCumRight->AddFrame(fTxtSigmaMax, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 10, 15, 0, 0));
445 fTxtSigmaMax->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtons1D(=112)");
446 fTxtSigmaMax->SetToolTipText("Enter up to which multiple of sigma you want to integrate.");
449 fContDrawOpt1DSubMML = new TGCompositeFrame(fcontDrawOpt1DSubLR, 200, 23, kHorizontalFrame | kFitWidth | kFitHeight);
450 fcontDrawOpt1DSubLR->AddFrame(fContDrawOpt1DSubMML, new TGLayoutHints(kLHintsExpandX, 0, 0, 5, 0));
452 // -------------- content of fcontDrawOpt1DSubLR
453 fChkMean = new TGCheckButton(fContDrawOpt1DSubMML, "Mean");
454 fContDrawOpt1DSubMML->AddFrame(fChkMean, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
455 fChkMean->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtons1D()");
456 fChkMean->SetToolTipText("Activate Mean for Sigma/Cumulative/Integrate");
458 fChkMedian = new TGCheckButton(fContDrawOpt1DSubMML, "Median");
459 fContDrawOpt1DSubMML->AddFrame(fChkMedian, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
460 fChkMedian->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtons1D()");
461 fChkMedian->SetToolTipText("Activate Median for Sigma/Cumulative/Integrate");
463 fChkLTM = new TGCheckButton(fContDrawOpt1DSubMML, "LTM");
464 fContDrawOpt1DSubMML->AddFrame(fChkLTM, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
465 fChkLTM->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtons1D()");
466 fChkLTM->SetToolTipText("Activate LTM for Sigma/Cumulative/Integrate");
469 // statistic options container *** fcontStatOpt1D *** " Statistic options "
470 fContStatOpt = new TGGroupFrame(ftabLeft1, "Statistic options", kVerticalFrame | kFitWidth | kFitHeight);
471 ftabLeft1->AddFrame(fContStatOpt, new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0));
473 fChkStatName = new TGCheckButton(fContStatOpt, "Name");
474 fContStatOpt->AddFrame(fChkStatName, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
475 fChkStatName->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
476 fChkStatName->SetToolTipText("Display the name in the statistics legend.");
478 fChkStatEntries = new TGCheckButton(fContStatOpt, "Entries");
479 fContStatOpt->AddFrame(fChkStatEntries, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
480 fChkStatEntries->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
481 fChkStatEntries->SetToolTipText("Display the number of entries in the statistics legend.");
483 fContStatMean = new TGCompositeFrame(fContStatOpt, 1, 1, kHorizontalFrame | kFitWidth | kFitHeight);
484 fContStatOpt->AddFrame(fContStatMean, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
486 fChkStatMean = new TGCheckButton(fContStatMean, "Mean");
487 fContStatMean->AddFrame(fChkStatMean, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
488 fChkStatMean->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
489 fChkStatMean->SetToolTipText("Display the mean value of the data in the statistics legend.");
491 fChkStatMeanPM = new TGCheckButton(fContStatMean, "+- Error");
492 fContStatMean->AddFrame(fChkStatMeanPM, new TGLayoutHints(kLHintsNormal, 10, 0, 0, 0));
493 fChkStatMeanPM->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
494 fChkStatMeanPM->SetToolTipText("Display the mean value's error in the statistics legend.");
496 fContStatRMS = new TGCompositeFrame(fContStatOpt, 1, 1, kHorizontalFrame | kFitWidth | kFitHeight);
497 fContStatOpt->AddFrame(fContStatRMS, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
499 fChkStatRMS = new TGCheckButton(fContStatRMS, "RMS");
500 fContStatRMS->AddFrame(fChkStatRMS, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
501 fChkStatRMS->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
502 fChkStatRMS->SetToolTipText("Display the RMS value of the data in the statistics legend.");
504 fChkStatRMSPM = new TGCheckButton(fContStatRMS, "+- Error");
505 fContStatRMS->AddFrame(fChkStatRMSPM, new TGLayoutHints(kLHintsNormal, 10, 0, 0, 0));
506 fChkStatRMSPM->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
507 fChkStatRMSPM->SetToolTipText("Display the RMS value's error in the statistics legend.");
509 fChkStatUnderflow = new TGCheckButton(fContStatOpt, "Underflow");
510 fContStatOpt->AddFrame(fChkStatUnderflow, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
511 fChkStatUnderflow->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
512 fChkStatUnderflow->SetToolTipText("Display the number of entries in the underflow bin.");
514 fChkStatOverflow = new TGCheckButton(fContStatOpt, "Overflow");
515 fContStatOpt->AddFrame(fChkStatOverflow, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
516 fChkStatOverflow->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
517 fChkStatOverflow->SetToolTipText("Display the number of entries in the overflow bin.");
519 fChkStatIntegral = new TGCheckButton(fContStatOpt, "Integral");
520 fContStatOpt->AddFrame(fChkStatIntegral, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
521 fChkStatIntegral->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
522 fChkStatIntegral->SetToolTipText("Display the integral of the data in the statistics legend.");
524 fContStatSkew = new TGCompositeFrame(fContStatOpt, 1, 1, kHorizontalFrame | kFitWidth | kFitHeight);
525 fContStatOpt->AddFrame(fContStatSkew, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
527 fChkStatSkewness = new TGCheckButton(fContStatSkew, "Skewness");
528 fContStatSkew->AddFrame(fChkStatSkewness, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
529 fChkStatSkewness->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
530 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!");
532 fChkStatSkewnessPM = new TGCheckButton(fContStatSkew, "+- Error");
533 fContStatSkew->AddFrame(fChkStatSkewnessPM, new TGLayoutHints(kLHintsNormal, 10, 0, 0, 0));
534 fChkStatSkewnessPM->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
535 fChkStatSkewnessPM->SetToolTipText("Display the skewness' error in the statistics legend.");
537 fContStatKurt = new TGCompositeFrame(fContStatOpt, 1, 1, kHorizontalFrame | kFitWidth | kFitHeight);
538 fContStatOpt->AddFrame(fContStatKurt, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
540 fChkStatKurtosis = new TGCheckButton(fContStatKurt, "Kurtosis");
541 fContStatKurt->AddFrame(fChkStatKurtosis, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
542 fChkStatKurtosis->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
543 fChkStatKurtosis->SetToolTipText("Display the kurtosis of the data in the statistics legend.");
545 fChkStatKurtosisPM = new TGCheckButton(fContStatKurt, "+- Error");
546 fContStatKurt->AddFrame(fChkStatKurtosisPM, new TGLayoutHints(kLHintsNormal, 10, 0, 0, 0));
547 fChkStatKurtosisPM->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
548 fChkStatKurtosisPM->SetToolTipText("Display the kurtosis' error in the statistics legend.");
550 fBtnUnchekAll = new TGTextButton(fContStatOpt, "&Uncheck all");
551 fContStatOpt->AddFrame(fBtnUnchekAll, new TGLayoutHints(kLHintsExpandX, 10, 10, 0, 0));
552 //fBtnDraw->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoTest(=\"fBtnDraw clicked\")");
553 fBtnUnchekAll->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "UnchekAllStat()");
554 fBtnUnchekAll->SetToolTipText("Disable all statistics legend entries, \nno statistics legend.");
557 // custom options container
558 // --- fComboCustom --- the custom draw line on the very low
559 fContCustom = new TGCompositeFrame(fContTopBottom, 200, 200, kHorizontalFrame | kFitWidth | kFitHeight);
560 fContTopBottom->AddFrame(fContCustom, new TGLayoutHints(kLHintsExpandX, 10, 0, 0, 0));
562 // ------------------------- content of fContCustom -------------------------
563 fLblCustomDraw = new TGLabel(fContCustom, "Custom draw: ");
564 fLblCustomDraw->SetTextJustify(kTextLeft);
565 fContCustom->AddFrame(fLblCustomDraw, new TGLayoutHints(kLHintsNormal, 5, 0, 0, 0));
566 // text field for custom draw command
567 fComboCustom = new TGComboBox(fContCustom);
568 fComboCustom->Resize(0, fBtnDraw->GetDefaultHeight());
569 fComboCustom->EnableTextInput(kTRUE);
570 fContCustom->AddFrame(fComboCustom, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
571 fComboCustom->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsGeneral(=42)");
572 fComboCustom->Connect("Selected(Int_t)", "AliTPCCalibViewerGUI", this, "DoNewSelection()");
575 // additional cuts container
576 fContAddCuts = new TGCompositeFrame(fContTopBottom, 200, 200, kHorizontalFrame | kFitWidth | kFitHeight);
577 fContTopBottom->AddFrame(fContAddCuts, new TGLayoutHints(kLHintsExpandX, 10, 0, 0, 0));
579 // ------------------------- content of fContAddCuts -------------------------
580 fLblAddCuts = new TGLabel(fContAddCuts, "Custom cuts: ");
581 fLblAddCuts->SetTextJustify(kTextLeft);
582 fContAddCuts->AddFrame(fLblAddCuts, new TGLayoutHints(kLHintsNormal, 5, 0, 0, 0));
583 // combo text field for additional cuts
584 fComboAddCuts = new TGComboBox(fContAddCuts);
585 fComboAddCuts->Resize(0, fBtnDraw->GetDefaultHeight());
586 fComboAddCuts->EnableTextInput(kTRUE);
587 fContAddCuts->AddFrame(fComboAddCuts, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
588 fComboAddCuts->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsCuts(=31)");
589 fComboAddCuts->Connect("Selected(Int_t)", "AliTPCCalibViewerGUI", this, "DoNewSelection()");
591 // ==========================================================================
592 // ************************* content of fContCenter *************************
593 // ========================================================================
594 // main drawing canvas
595 fCanvMain = new TRootEmbeddedCanvas("Main_Canvas", fContCenter, 200, 200, kFitWidth | kFitHeight);
596 fContCenter->AddFrame(fCanvMain, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
597 fCanvMain->GetCanvas()->Connect("ProcessedEvent(Int_t, Int_t, Int_t, TObject*)", "AliTPCCalibViewerGUI", this, "MouseMove(Int_t, Int_t, Int_t, TObject*)");
598 fCanvMain->GetCanvas()->Connect("RangeAxisChanged()", "AliTPCCalibViewerGUI", this, "GetMinMax()");
599 fCanvMain->GetCanvas()->SetToolTipText("The Main_Canvas, here your plots are displayed.");
602 // =========================================================================
603 // ************************* content of fContRight *************************
604 // ========================================================================
606 // tabs on the right side:
607 ftabRight = new TGTab(fContRight);
608 fContRight->AddFrame(ftabRight, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 8, 0));
609 fTabRight0 = ftabRight->AddTab("Basic");
610 fTabRight1 = ftabRight->AddTab("Advanced");
613 // **************************** content of tabLeft0 *******************************
614 // cut options container
615 fContCuts = new TGGroupFrame(fTabRight0, "Cuts", kVerticalFrame | kFitWidth | kFitHeight);
616 fTabRight0->AddFrame(fContCuts, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
619 // ************************* content of fContCuts *************************
621 fRadioTPC = new TGRadioButton(fContCuts, "Whole TPC", 20);
622 fContCuts->AddFrame(fRadioTPC, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
623 fRadioTPC->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsCuts()");
624 fRadioTPC->SetToolTipText("No cuts, use the whole TPC. \nIn 2D mode, A side and C side are superimposed!");
626 // side A radio button
627 fRadioSideA = new TGRadioButton(fContCuts, "Side A", 21);
628 fContCuts->AddFrame(fRadioSideA, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
629 fRadioSideA->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsCuts()");
630 fRadioSideA->SetToolTipText("Use only side A.");
632 // side C radio button
633 fRadioSideC = new TGRadioButton(fContCuts, "Side C", 22);
634 fContCuts->AddFrame(fRadioSideC, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
635 fRadioSideC->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsCuts()");
636 fRadioSideC->SetToolTipText("Use only side C.");
638 // sector radio button
639 fRadioSector = new TGRadioButton(fContCuts, "ROC", 23);
640 fContCuts->AddFrame(fRadioSector, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
641 fRadioSector->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsCuts()");
642 fRadioSector->SetToolTipText("Use only one ROC (readout chamber).");
644 // sector options container
645 fContSector = new TGCompositeFrame(fContCuts, 200, 200, kHorizontalFrame | kFitWidth | kFitHeight);
646 fContCuts->AddFrame(fContSector, new TGLayoutHints(kLHintsExpandX, 5, 0, 0, 0));
648 // ------------------------- content of fContSector -------------------------
649 // sector number entry
650 fNmbSector = new TGNumberEntry(fContSector, 0, 1, -1, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, 71);
651 fContSector->AddFrame(fNmbSector, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
652 fNmbSector->Connect("ValueSet(Long_t)", "AliTPCCalibViewerGUI", this, "ChangeSector()");
654 // sector number label
655 fLblSector = new TGLabel(fContSector, "IROC, A");
656 fLblSector->SetTextJustify(kTextLeft);
657 fContSector->AddFrame(fLblSector, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 5, 0, 0, 0));
659 // cut zeros check button
660 fChkCutZero = new TGCheckButton(fContCuts, "Cut zeros");
661 fContCuts->AddFrame(fChkCutZero, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
662 fChkCutZero->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoNewSelection()");
663 fChkCutZero->SetToolTipText("Use only values that are not zero. \nWhen doing a custom draw this cut is composed of the draw string\nup to the first ':' or '>>' and the condition that this should not be zero.");
665 // additional cuts check button
666 fChkAddCuts = new TGCheckButton(fContCuts, "Custom cuts");
667 fContCuts->AddFrame(fChkAddCuts, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
668 fChkAddCuts->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoNewSelection()");
669 fChkAddCuts->SetToolTipText("Activate the custom cuts on the bottom. Remember '~' (= '.fElements')!");
670 // fContAddCuts' content is locaed further op
673 // Scaling options container
674 fContScaling = new TGGroupFrame(fTabRight0, "Scaling", kVerticalFrame | kFitWidth | kFitHeight);
675 fTabRight0->AddFrame(fContScaling, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
677 // ************************* content of fContScaling *************************
678 // SetMaximum container
679 fContSetMax = new TGCompositeFrame(fContScaling, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
680 fContScaling->AddFrame(fContSetMax, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
682 // ------------------------- content of fContSetMax -------------------------
683 // SetMaximum - checkbox
684 fChkSetMax = new TGCheckButton(fContSetMax, "Set fixed max.");
685 fContSetMax->AddFrame(fChkSetMax, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
686 fChkSetMax->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw()");
687 fChkSetMax->SetToolTipText("Set the maximum fixed to the value specified here.");
689 // text field for maximum value
690 fTxtSetMax = new TGTextEntry(fContSetMax, "", 41);
691 fContSetMax->AddFrame(fTxtSetMax, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
692 fTxtSetMax->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw()");
693 fTxtSetMax->SetToolTipText("maximum value for the drawing");
695 // SetMinimum container
696 fContSetMin = new TGCompositeFrame(fContScaling, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
697 fContScaling->AddFrame(fContSetMin, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
699 // ------------------------- content of fContSetMin -------------------------
700 // SetMinimum - checkbox
701 fChkSetMin = new TGCheckButton(fContSetMin, "Set fixed min.");
702 fContSetMin->AddFrame(fChkSetMin, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
703 fChkSetMin->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw()");
704 fChkSetMin->SetToolTipText("Set the minimum fixed to the value specified here.");
706 // text field for minimum value
707 fTxtSetMin = new TGTextEntry(fContSetMin, "", 40);
708 fContSetMin->AddFrame(fTxtSetMin, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
709 fTxtSetMin->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw()");
710 fTxtSetMin->SetToolTipText("minimum value for the drawing");
712 // get Min & Max from Plot - button
713 fBtnGetMinMax = new TGTextButton(fContScaling, "&Get scale from plot");
714 fContScaling->AddFrame(fBtnGetMinMax, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
715 fBtnGetMinMax->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "GetMinMax()");
716 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'.");
718 // GetMinMaxAuto - checkbox
719 fChkGetMinMaxAuto = new TGCheckButton(fContScaling, "Get Min + Max auto.");
720 fContScaling->AddFrame(fChkGetMinMaxAuto, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
721 fChkGetMinMaxAuto->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw()");
722 fChkGetMinMaxAuto->SetToolTipText("Get minimum and maximum automatically from each new plot. \nDeactivate this, if you want to 'save' your specified minimum and maximum.");
724 // labeling container *** fContLabeling *** " Labeling "
725 fContLabeling = new TGGroupFrame(fTabRight0, "Labeling", kVerticalFrame | kFitWidth | kFitHeight);
726 fTabRight0->AddFrame(fContLabeling, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
728 fChkLabelTitle = new TGCheckButton(fContLabeling, "Set title:");
729 fContLabeling->AddFrame(fChkLabelTitle, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
730 fChkLabelTitle->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw()");
731 fChkLabelTitle->SetToolTipText("Set the plot title.");
733 fTxtLabelTitle = new TGTextEntry(fContLabeling, "Title", 500);
734 fContLabeling->AddFrame(fTxtLabelTitle, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
735 fTxtLabelTitle->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw(=50)");
736 fTxtLabelTitle->SetToolTipText("plot title");
738 fChkLabelXaxis = new TGCheckButton(fContLabeling, "Set X-axis label:");
739 fContLabeling->AddFrame(fChkLabelXaxis, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
740 fChkLabelXaxis->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw()");
741 fChkLabelXaxis->SetToolTipText("Set the X-axis label.");
743 fTxtLabelXaxis = new TGTextEntry(fContLabeling, "XaxisLabel", 500);
744 fContLabeling->AddFrame(fTxtLabelXaxis, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
745 fTxtLabelXaxis->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw(=51)");
746 fTxtLabelXaxis->SetToolTipText("X-axis label");
748 fChkLabelYaxis = new TGCheckButton(fContLabeling, "Set Y-axis label:");
749 fContLabeling->AddFrame(fChkLabelYaxis, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
750 fChkLabelYaxis->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw()");
751 fChkLabelYaxis->SetToolTipText("Set the Y-axis label.");
753 fTxtLabelYaxis = new TGTextEntry(fContLabeling, "YaxisLabel", 500);
754 fContLabeling->AddFrame(fTxtLabelYaxis, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
755 fTxtLabelYaxis->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw(=52)");
756 fTxtLabelYaxis->SetToolTipText("Y-axis label");
758 fChkLabelGetAuto = new TGCheckButton(fContLabeling, "Get labels auto.");
759 fContLabeling->AddFrame(fChkLabelGetAuto, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
760 fChkLabelGetAuto->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw()");
761 fChkLabelGetAuto->SetToolTipText("Get labels automatically from each new plot \nDeactivate this, if you want to 'save' your specified labels.");
764 // **************************** content of ftabRight1 *******************************
766 fContSave = new TGGroupFrame(fTabRight1, "Save", kVerticalFrame | kFitWidth | kFitHeight);
767 fTabRight1->AddFrame(fContSave, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
769 fBtnSave = new TGTextButton(fContSave, "&Save picture");
770 fContSave->AddFrame(fBtnSave, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
771 fBtnSave->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "SavePicture()");
772 fBtnSave->SetToolTipText("Open a 'Save as...' dialog to save the current plot as picture or macro.");
774 // additional save options container
775 fContAddSaveOpt = new TGCompositeFrame(fContSave, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
776 fContSave->AddFrame(fContAddSaveOpt, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
778 // content of --- fContAddSaveOpt ---
779 // addition save options label
780 fChkAddSaveOpt = new TGCheckButton(fContAddSaveOpt, "Save options:");
781 fContAddSaveOpt->AddFrame(fChkAddSaveOpt, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
782 fChkAddSaveOpt->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoNewSelection()");
783 fChkAddSaveOpt->SetToolTipText("Additional save options (see documentation for TPad::Print()).");
785 // additional save options combo box
786 fComboAddSaveOpt = new TGComboBox(fContAddSaveOpt);
787 fContAddSaveOpt->AddFrame(fComboAddSaveOpt, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
788 fComboAddSaveOpt->Resize(0, fBtnDraw->GetDefaultHeight());
789 fComboAddSaveOpt->EnableTextInput(kTRUE);
790 fComboAddSaveOpt->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "SavePicture()");
791 // fComboAddSaveOpt->Connect("Selected(Int_t)", "AliTPCCalibViewerGUI", this, "SavePicture()");
793 // calPad export container
794 fContExport = new TGGroupFrame(fTabRight1, "Export AliTPCCalPad", kVerticalFrame | kFitWidth | kFitHeight);
795 fTabRight1->AddFrame(fContExport, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
797 // ------------------------- content of fContExport -------------------------
798 // container for export name
799 fContAddExport = new TGCompositeFrame(fContExport, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
800 fContExport->AddFrame(fContAddExport, new TGLayoutHints(kLHintsExpandX, -5, -5, 0, 0));
802 fComboExportName = new TGComboBox(fContAddExport);
803 fComboExportName->Resize(0, fBtnDraw->GetDefaultHeight());
804 fContAddExport->AddFrame(fComboExportName, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
805 fComboExportName->AddEntry("calPad", 0); // first default value
806 fComboExportName->Select(0); // select default value before connecting
807 fComboExportName->EnableTextInput(kTRUE);
808 fComboExportName->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "DoExport()");
809 fComboExportName->Connect("Selected(Int_t)", "AliTPCCalibViewerGUI", this, "DoExport()");
812 fBtnExport = new TGTextButton(fContExport, "&Export to CINT");
813 fContExport->AddFrame(fBtnExport, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
814 fBtnExport->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoExport()");
815 fBtnExport->SetToolTipText("Export the current 2D view as AliTPCCalPad to the CINT command line interpreter, use the specified name. \nThis works only in 2D mode.");
817 // add to normalisation button
818 fBtnAddNorm = new TGTextButton(fContExport, "&Add to normalization");
819 fContExport->AddFrame(fBtnAddNorm, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
820 fBtnAddNorm->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoExportNorm()");
821 fBtnAddNorm->SetToolTipText("Use the current 2D view as normalization variable, use the specified name. \nNot yet working!");
824 fContTree = new TGGroupFrame(fTabRight1, "Tree", kVerticalFrame | kFitWidth | kFitHeight);
825 fTabRight1->AddFrame(fContTree, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
827 // dump tree to file button
828 fBtnDumpToFile = new TGTextButton(fContTree, "&Dump to File");
829 fContTree->AddFrame(fBtnDumpToFile, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
830 fBtnDumpToFile->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoDumpToFile()");
831 fBtnDumpToFile->SetToolTipText("Write the exported CalPads to a new CalibTree");
833 // dump tree to file button
834 fBtnLoadTree = new TGTextButton(fContTree, "&Load Tree");
835 fContTree->AddFrame(fBtnLoadTree, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
836 fBtnLoadTree->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoLoadTree()");
837 fBtnLoadTree->SetToolTipText("Load and initialize a new calibration tree. ");
839 fChkAddAsReference = new TGCheckButton(fContTree, "as reference:");
840 fContTree->AddFrame(fChkAddAsReference, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
841 fChkAddAsReference->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoLoadTree()");
842 fChkAddAsReference->SetToolTipText("To add a new tree as reference tree.");
844 fTxtRefName = new TGTextEntry(fContTree, "R", 500);
845 fContTree->AddFrame(fTxtRefName, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 15, 0, 0, 0));
846 // fTxtRefName->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw(=50)");
847 fTxtRefName->SetToolTipText("Reference Name");
850 // Fit options container
851 fContFit = new TGGroupFrame(fTabRight1, "Custom fit", kVerticalFrame | kFitWidth | kFitHeight);
852 fTabRight1->AddFrame(fContFit, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
854 // ------------------------- content of fContFit -------------------------
855 // container for additional fits
856 fContAddFit = new TGCompositeFrame(fContFit, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
857 fContFit->AddFrame(fContAddFit, new TGLayoutHints(kLHintsExpandX, -5, -5, 0, 0));
859 // --- content of fContAddFit ---
860 // text field for custom fit
861 fComboCustomFit = new TGComboBox(fContAddFit);
862 fComboCustomFit->Resize(0, fBtnDraw->GetDefaultHeight());
863 fComboCustomFit->EnableTextInput(kTRUE);
864 fContAddFit->AddFrame(fComboCustomFit, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
865 fComboCustomFit->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "DoFit()");
866 fComboCustomFit->Connect("Selected(Int_t)", "AliTPCCalibViewerGUI", this, "DoFit()");
869 fBtnFit = new TGTextButton(fContAddFit, "&Fit");
870 fContAddFit->AddFrame(fBtnFit, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
871 fBtnFit->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoFit()");
872 fBtnFit->SetToolTipText("Fit a whole TPC side, e.g. with gx~ ++ gy~, the result is printed to the console \nNot yet final status.");
874 // add fit function button
875 //fBtnAddFitFunction = new TGTextButton(fContAddFit, "&Add fit function to normalization");
876 //fContAddFit->AddFrame(fBtnAddFitFunction, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
877 //fBtnAddFitFunction->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "AddFitFunction()");
879 SetWindowName("AliTPCCalibViewer GUI");
881 Resize(GetDefaultSize());
886 void AliTPCCalibViewerGUI::SetInitialValues() {
888 // Set the default button states
890 fChkAuto->SetState(kButtonUp);
891 fRadioPredefined->SetState(kButtonDown);
892 fRadioRaw->SetState(kButtonDown);
893 fRadioTPC->SetState(kButtonDown);
894 fRadio1D->SetState(kButtonDown);
895 fChkAddCuts->SetState(kButtonUp);
896 fChkGetMinMaxAuto->SetState(kButtonDown);
897 fChkSetMin->SetState(kButtonUp);
898 fChkSetMax->SetState(kButtonUp);
899 fRadioNorm->SetState(kButtonDown);
900 fRadioSigma->SetState(kButtonUp);
901 fRadioCumulative->SetState(kButtonUp);
902 fChkMean->SetState(kButtonDown);
903 fCheckCumulativePM->SetState(kButtonUp);
905 fChkLabelGetAuto->SetState(kButtonDown);
907 // TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO
908 // TODO Set the checkboxes state as it is really TODO
909 // TODO in gStyle TODO
910 // TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO
911 // k = 1; kurtosis printed
912 // k = 2; kurtosis and kurtosis error printed
913 // s = 1; skewness printed
914 // s = 2; skewness and skewness error printed
915 // i = 1; integral of bins printed
916 // o = 1; number of overflows printed
917 // u = 1; number of underflows printed
918 // r = 1; rms printed
919 // r = 2; rms and rms error printed
920 // m = 1; mean value printed
921 // m = 2; mean and mean error values printed
922 // e = 1; number of entries printed
923 // n = 1; name of histogram is printed
924 // (default = 000001111)
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);
986 fChkStatName->SetState(kButtonDown);
987 fChkStatEntries->SetState(kButtonDown);
988 fChkStatMean->SetState(kButtonDown);
989 fChkStatRMS->SetState(kButtonDown);
991 // fChkStatMeanPM->SetState(kButtonUp);
992 // fChkStatRMSPM->SetState(kButtonUp);
993 // fChkStatUnderflow->SetState(kButtonUp);
994 // fChkStatOverflow->SetState(kButtonUp);
995 // fChkStatIntegral->SetState(kButtonUp);
996 // fChkStatSkewness->SetState(kButtonUp);
997 // fChkStatSkewnessPM->SetState(kButtonUp);
998 // fChkStatKurtosis->SetState(kButtonDown);
999 // fChkStatKurtosisPM->SetState(kButtonDown);
1001 // fill fComboAddDrawOpt with some additional drawing options
1002 fComboAddDrawOpt->AddEntry("same", 0);
1003 fComboAddDrawOpt->AddEntry("profbox", 1);
1004 fComboAddDrawOpt->AddEntry("profcolz", 2);
1005 fComboAddDrawOpt->AddEntry("profcont0", 3);
1006 fComboAddDrawOpt->AddEntry("proflego", 4);
1007 fComboAddDrawOpt->AddEntry("proflego2", 5);
1008 fComboAddDrawOpt->AddEntry("profsurf", 6);
1009 fComboAddDrawOpt->AddEntry("profsurf1", 7);
1010 fComboAddDrawOpt->AddEntry("profsurf2", 8);
1011 fComboAddDrawOpt->AddEntry("box", 9);
1012 fComboAddDrawOpt->AddEntry("colz", 10);
1013 fComboAddDrawOpt->AddEntry("cont0", 11);
1014 fComboAddDrawOpt->AddEntry("lego", 12);
1015 fComboAddDrawOpt->AddEntry("lego2", 13);
1016 fComboAddDrawOpt->AddEntry("surf", 14);
1017 fComboAddDrawOpt->AddEntry("surf1", 15);
1018 fComboAddDrawOpt->AddEntry("surf2", 16);
1020 // fill fComboAddSaveOpt with some additional drawing options
1021 fComboAddSaveOpt->AddEntry("Portrait", 0);
1022 fComboAddSaveOpt->AddEntry("Landscape", 1);
1023 fComboAddSaveOpt->AddEntry("Preview", 2);
1024 fComboAddSaveOpt->AddEntry("+50", 3);
1026 // fill fComboMethod
1027 fComboMethod->AddEntry("subtract", 0);
1028 fComboMethod->AddEntry("divide by", 1);
1030 // fill fComboExportName
1031 // fComboExportName->AddEntry("calPad", 0);
1032 // fComboExportName->AddEntry("calPad2", 1);
1033 fBtnExport->SetEnabled(kFALSE);
1034 fBtnAddNorm->SetEnabled(kFALSE);
1036 // select initial variables
1037 fListVariables->Select(0);
1038 fListNormalization->Select(0);
1039 fComboMethod->Select(0);
1040 // fComboExportName->Select(0);
1041 // fComboExportName->EnableTextInput(kTRUE);
1043 //fCanvMain->GetCanvas()->ToggleEventStatus(); // klappt nicht
1044 //fCanvMain->GetCanvas()->GetCanvasImp()->ShowStatusBar(kTRUE); // klappt auch nicht
1045 fListVariables->IntegralHeight(kFALSE); // naja
1046 fListNormalization->IntegralHeight(kFALSE); // naja
1047 fChkAuto->SetState(kButtonDown);
1049 // Make first drawing:
1054 AliTPCCalibViewerGUI::AliTPCCalibViewerGUI(const AliTPCCalibViewerGUI &c)
1055 : TGCompositeFrame(c.fParent, c.fWidth, c.fHeight),
1071 fContDrawOptSub1D2D(0),
1086 fBtnAddFitFunction(0),
1090 fRadioNormalized(0),
1091 fRadioPredefined(0),
1099 fComboAddDrawOpt(0),
1103 fListNormalization(0),
1116 fChkGetMinMaxAuto(0),
1120 fcontDrawOpt1DSubLR(0),
1121 fContDrawOpt1DSubNSC(0),
1130 fRadioCumulative(0),
1131 fCheckCumulativePM(0),
1133 fContDrawOpt1DSubMML(0),
1146 fChkStatUnderflow(0),
1147 fChkStatOverflow(0),
1148 fChkStatIntegral(0),
1150 fChkStatSkewness(0),
1151 fChkStatSkewnessPM(0),
1153 fChkStatKurtosis(0),
1154 fChkStatKurtosisPM(0),
1163 fChkLabelGetAuto(0),
1168 fComboAddSaveOpt(0),
1171 fComboExportName(0),
1177 fChkAddAsReference(0),
1182 // dummy AliTPCCalibViewerGUI copy constructor
1187 AliTPCCalibViewerGUI & AliTPCCalibViewerGUI::operator =(const AliTPCCalibViewerGUI & param) {
1189 // dummy assignment operator
1195 AliTPCCalibViewerGUI::~AliTPCCalibViewerGUI() {
1199 if (fCanvMain && fCanvMain->GetCanvas()) {
1200 for (Int_t i = 0; i < fCanvMain->GetCanvas()->GetListOfPrimitives()->GetEntries(); i++) {
1201 if (strcmp(fCanvMain->GetCanvas()->GetListOfPrimitives()->At(i)->ClassName(), "TFrame") != 0)
1202 fCanvMain->GetCanvas()->GetListOfPrimitives()->At(i)->Delete();
1206 if (fViewer) fViewer->Delete();
1207 delete fPreprocessor;
1212 void AliTPCCalibViewerGUI::CloseWindow() {
1218 void AliTPCCalibViewerGUI::Initialize(char* fileName, char* treeName) {
1220 // initialize the GUI with a calibrationTree from fileName
1223 // create AliTPCCalibViewer object, which will be used for generating all drawings
1224 if (fViewer) delete fViewer;
1225 fViewer = new AliTPCCalibViewer(fileName, treeName);
1226 Initialize(fViewer);
1230 void AliTPCCalibViewerGUI::Initialize(AliTPCCalibViewer *viewer) {
1232 // initializes the GUI with default settings and opens tree for drawing
1236 TString selectedVariable("");
1237 TString selectedNormalization("");
1238 Int_t variableId = -1;
1239 Int_t normalizationId = -1;
1241 // remember the selected entry
1242 if (fListVariables->GetSelectedEntry()) selectedVariable = fListVariables->GetSelectedEntry()->GetTitle();
1243 if (fListNormalization->GetSelectedEntry()) selectedNormalization = fListNormalization->GetSelectedEntry()->GetTitle();
1246 // fill fListVariables, list of drawable variables:
1247 TObjArray* arr = fViewer->GetListOfVariables();
1248 TIterator* iter = arr->MakeIterator();
1250 TObjString* currentStr = 0;
1252 fListVariables->RemoveAll();
1253 while ((currentStr = (TObjString*)(iter->Next()))) {
1254 fListVariables->AddEntry(currentStr->GetString().Data(), id);
1255 if (fInitialized && currentStr->GetString() == selectedVariable) variableId = id;
1262 // fill fListNorm, list of normalization variables:
1263 arr = fViewer->GetListOfNormalizationVariables();
1264 iter = arr->MakeIterator();
1268 fListNormalization->RemoveAll();
1269 while ((currentStr = (TObjString*)(iter->Next()))) {
1270 fListNormalization->AddEntry(currentStr->GetString().Data(), id);
1271 if (fInitialized && currentStr->GetString() == selectedNormalization) normalizationId = id;
1278 // trick do display the entries corectly after reinitialization
1279 // otherwise all the entries would appear as one kryptic entry
1280 // resizing the listbox somehow fixes the problem...
1281 if (fInitialized) fListVariables->Resize(fListVariables->GetWidth()-1, fListVariables->GetHeight());
1282 if (fInitialized) fListVariables->Resize(fListVariables->GetWidth()+1, fListVariables->GetHeight());
1283 if (fInitialized) fListNormalization->Resize(fListNormalization->GetWidth()-1, fListNormalization->GetHeight());
1284 if (fInitialized) fListNormalization->Resize(fListNormalization->GetWidth()+1, fListNormalization->GetHeight());
1286 // select the last selected variable and normalization
1287 if (fInitialized && variableId != -1) fListVariables->Select(variableId);
1288 if (fInitialized && normalizationId != -1)fListVariables->Select(normalizationId);
1290 if (fInitialized) Info("Initialize", "AliTPCCalibViewerGUI new initialized.");
1291 fInitialized = kTRUE;
1296 void AliTPCCalibViewerGUI::HandleButtonsGeneral(Int_t id) {
1298 // handles mutual radio button exclusions
1302 TGButton *btn = (TGButton *) gTQSender;
1303 id = btn->WidgetId();
1307 case 10: // fRadioRaw
1308 fRadioNormalized->SetState(kButtonUp);
1309 fRadioPredefined->SetState(kButtonDown);
1310 fRadioCustom->SetState(kButtonUp);
1311 // fComboMethod->UnmapWindow();
1312 // fListNormalization->UnmapWindow();
1314 case 11: // fRadioNormalized
1315 fRadioRaw->SetState(kButtonUp);
1316 fRadioPredefined->SetState(kButtonDown);
1317 fRadioCustom->SetState(kButtonUp);
1319 case 12: // fRadioCustom
1320 fRadioPredefined->SetState(kButtonUp);
1321 // fComboCustom->SetEnabled(kFALSE);
1322 // fRadioNormalized->SetState(kButtonUp);
1324 case 14: // select Draw options fComboAddDrawOpt
1325 fChkAddDrawOpt->SetState(kButtonDown);
1327 case 13: // fRadioPredefined
1328 fRadioCustom->SetState(kButtonUp);
1329 // fComboCustom->SetEnabled(kTRUE);
1330 //f RadioNormalized->SetState(kButtonUp);
1333 case 30: // fRadio1D
1334 fRadio2D->SetState(kButtonUp);
1335 fBtnExport->SetEnabled(kFALSE);
1336 fBtnAddNorm->SetEnabled(kFALSE);
1338 case 31: // fRadio2D
1339 fRadio1D->SetState(kButtonUp);
1340 fBtnExport->SetEnabled(kTRUE);
1341 fBtnAddNorm->SetEnabled(kTRUE);
1343 case 42: // fComboCustom
1344 fRadioCustom->SetState(kButtonDown);
1345 fRadioPredefined->SetState(kButtonUp);
1352 void AliTPCCalibViewerGUI::HandleButtons1D(Int_t id) {
1354 // handles mutual radio button exclusions
1359 TGButton *btn = (TGButton *) gTQSender;
1360 id = btn->WidgetId();
1363 case 110: // 1D draw normal
1364 fRadioNorm->SetState(kButtonDown);
1365 fRadioSigma->SetState(kButtonUp);
1366 fRadioCumulative->SetState(kButtonUp);
1367 fRadioIntegrate->SetState(kButtonUp);
1369 case 111: // 1D draw sigma
1370 fRadioNorm->SetState(kButtonUp);
1371 fRadioSigma->SetState(kButtonDown);
1372 fRadioCumulative->SetState(kButtonUp);
1373 fRadioIntegrate->SetState(kButtonUp);
1375 case 112: // 1D draw cumulative
1376 fRadioNorm->SetState(kButtonUp);
1377 fRadioSigma->SetState(kButtonUp);
1378 fRadioCumulative->SetState(kButtonDown);
1379 fRadioIntegrate->SetState(kButtonUp);
1381 case 113: // 1D draw integral
1382 fRadioNorm->SetState(kButtonUp);
1383 fRadioSigma->SetState(kButtonUp);
1384 fRadioCumulative->SetState(kButtonUp);
1385 fRadioIntegrate->SetState(kButtonDown);
1392 void AliTPCCalibViewerGUI::HandleButtonsStat(Int_t id) {
1394 // handles statistic check boxes
1395 // checks each checkbox if checked
1396 // if the checkbox is checked, appends 'n' for name, 'e' for entries, ...
1397 // to a TString, passes this TString to gStyle->SetOptStat(...)
1400 TGButton *btn = (TGButton *) gTQSender;
1401 id = btn->WidgetId();
1403 TString statOpt("");
1404 if (fChkStatName->GetState() == kButtonDown) statOpt.Append("n");
1405 if (fChkStatEntries->GetState() == kButtonDown) statOpt.Append("e");
1406 if (fChkStatMean->GetState() == kButtonDown && fChkStatMeanPM->GetState() == kButtonUp) statOpt.Append("m");
1407 if (fChkStatMeanPM->GetState() == kButtonDown) statOpt.Append("M");
1408 if (fChkStatRMS->GetState() == kButtonDown && fChkStatRMSPM->GetState() == kButtonUp) statOpt.Append("r");
1409 if (fChkStatRMSPM->GetState() == kButtonDown) statOpt.Append("R");
1410 if (fChkStatUnderflow->GetState() == kButtonDown) statOpt.Append("u");
1411 if (fChkStatOverflow->GetState() == kButtonDown) statOpt.Append("o");
1412 if (fChkStatIntegral->GetState() == kButtonDown) statOpt.Append("i");
1413 if (fChkStatSkewness->GetState() == kButtonDown && fChkStatSkewnessPM->GetState() == kButtonUp) statOpt.Append("s");
1414 if (fChkStatSkewnessPM->GetState() == kButtonDown) statOpt.Append("S");
1415 if (fChkStatKurtosis->GetState() == kButtonDown && fChkStatKurtosisPM->GetState() == kButtonUp) statOpt.Append("k");
1416 if (fChkStatKurtosisPM->GetState() == kButtonDown) statOpt.Append("K");
1418 gStyle->SetOptStat(statOpt);
1423 void AliTPCCalibViewerGUI::HandleButtonsCuts(Int_t id) {
1425 // handles mutual radio button exclusions
1426 // right side buttons
1429 TGButton *btn = (TGButton *) gTQSender;
1430 id = btn->WidgetId();
1434 case 20: // fRadioTPC
1435 fRadioSideA->SetState(kButtonUp);
1436 fRadioSideC->SetState(kButtonUp);
1437 fRadioSector->SetState(kButtonUp);
1439 case 21: // fRadioSideA
1440 fRadioTPC->SetState(kButtonUp);
1441 fRadioSideC->SetState(kButtonUp);
1442 fRadioSector->SetState(kButtonUp);
1444 case 22: // fRadioSideC
1445 fRadioTPC->SetState(kButtonUp);
1446 fRadioSideA->SetState(kButtonUp);
1447 fRadioSector->SetState(kButtonUp);
1449 case 23: // fRadioSector
1450 fRadioTPC->SetState(kButtonUp);
1451 fRadioSideA->SetState(kButtonUp);
1452 fRadioSideC->SetState(kButtonUp);
1454 case 31: // fComboAddCuts
1455 fChkAddCuts->SetState(kButtonDown);
1462 void AliTPCCalibViewerGUI::HandleButtonsNoRedraw(Int_t id) {
1464 // handles label & scaling checkboxes
1465 // without redrawing (not necessary, faster like this)
1468 TGButton *btn = (TGButton *) gTQSender;
1469 id = btn->WidgetId();
1473 case 40: // fTxtSetMin
1474 fChkSetMin->SetState(kButtonDown);
1476 case 41: // fTxtSetMax
1477 fChkSetMax->SetState(kButtonDown);
1479 case 50: // fTxtLabelTitle
1480 fChkLabelTitle->SetState(kButtonDown);
1482 case 51: // fTxtLabelXaxis
1483 fChkLabelXaxis->SetState(kButtonDown);
1485 case 52: // fTxtLabelXaxis
1486 fChkLabelYaxis->SetState(kButtonDown);
1493 void AliTPCCalibViewerGUI::DoNewSelection() {
1495 // decides whether to redraw if user makes another selection
1497 if (fChkAuto->GetState() == kButtonDown) DoDraw();
1501 TString* AliTPCCalibViewerGUI::GetDrawString() {
1503 // create the draw string out of selection
1506 // specify data to plot
1507 TString desiredData("");
1508 if (!fListVariables->GetSelectedEntry()) return 0;
1509 desiredData += ((TGTextLBEntry*)(fListVariables->GetSelectedEntry()))->GetTitle();
1510 desiredData += fViewer->GetAbbreviation();
1512 // specify normalization
1513 if (fRadioPredefined->GetState() == kButtonDown && fRadioNormalized->GetState() == kButtonDown) {
1515 switch (fComboMethod->GetSelected()) {
1516 case 0: // subtraction
1523 TString normalizationData("");
1524 if (!fListNormalization->GetSelectedEntry()) return 0;
1525 normalizationData += ((TGTextLBEntry*)(fListNormalization->GetSelectedEntry()))->GetTitle();
1527 if ( normalizationData.BeginsWith("Fit")) {
1528 // create fit formula, evaluate it an replace normalizationData-String
1529 // ********** create cut string **********
1531 if (fRadioTPC->GetState() == kButtonDown)
1532 cutStr += ""; // whole TPC is used for fitting
1533 if (fRadioSideA->GetState() == kButtonDown)
1534 cutStr += "(sector/18)%2==0"; // side A
1535 if (fRadioSideC->GetState() == kButtonDown)
1536 cutStr+= "(sector/18)%2==1"; // side C
1537 if (fRadioSector->GetState() == kButtonDown) {
1538 Int_t sector = (Int_t)(fNmbSector->GetNumber());
1539 cutStr += "sector==";
1542 if (fChkAddCuts->GetState() == kButtonDown && strcmp(fComboAddCuts->GetTextEntry()->GetText(), "") != 0){
1543 if (fRadioTPC->GetState() != kButtonDown) cutStr += " && ";
1544 cutStr += fComboAddCuts->GetTextEntry()->GetText();
1547 TVectorD fitParam(0);
1548 TMatrixD covMatrix(0,0);
1549 TString formulaStr("");
1550 if (normalizationData.CompareTo("FitLinLocal") == 0)
1551 formulaStr = "lx~ ++ ly~";
1552 if (normalizationData.CompareTo("FitLinGlobal") == 0)
1553 formulaStr = "gx~ ++ gy~";
1554 if (normalizationData.CompareTo("FitParLocal") == 0)
1555 formulaStr = "lx~ ++ ly~ ++ lx~^2 ++ ly~^2 ++ lx~*ly~";
1556 if (normalizationData.CompareTo("FitParGlobal") == 0)
1557 formulaStr = "gx~ ++ gy~ ++ gx~^2 ++ gy~^2 ++ gx~*gy~";
1558 formulaStr.ReplaceAll("~", fViewer->GetAbbreviation());
1559 normalizationData = *fViewer->Fit(desiredData.Data(), formulaStr.Data(), cutStr.Data(), chi2, fitParam, covMatrix);
1560 } // if ( normalizationData.BeginsWith("Fit")
1563 if (! (TString(((TGTextLBEntry*)(fListNormalization->GetSelectedEntry()))->GetTitle())).BeginsWith("Fit"))
1564 desiredData += ((TGTextLBEntry*)(fListVariables->GetSelectedEntry()))->GetTitle();
1565 desiredData += normalizationData;
1567 else if (fRadioCustom->GetState() == kButtonDown) {
1568 desiredData = fComboCustom->GetTextEntry()->GetText();
1569 if (desiredData == "") return 0;
1572 // try to add forgotten '~'
1573 if (fChkAutoAppend->GetState() == kButtonDown)
1574 desiredData = TString(fViewer->AddAbbreviations((char*)desiredData.Data()));
1575 return new TString(desiredData.Data());
1579 TString* AliTPCCalibViewerGUI::GetSectorString() {
1581 // create the sector string out of selection
1584 TString sectorStr("");
1585 if (fRadioTPC->GetState() == kButtonDown)
1587 if (fRadioSideA->GetState() == kButtonDown)
1588 sectorStr += "A"; //cuts += "(sector/18)%2==0";
1589 if (fRadioSideC->GetState() == kButtonDown)
1590 sectorStr+= "C"; //cuts += "(sector/18)%2==1";
1591 if (fRadioSector->GetState() == kButtonDown) {
1592 Int_t sector = (Int_t)(fNmbSector->GetNumber());
1593 sectorStr += sector; //cuts += "sector==";
1595 return new TString(sectorStr.Data());
1599 TString* AliTPCCalibViewerGUI::GetCutString() {
1601 // create the cut string out of selection
1604 TString cutsStr("");
1605 if (fChkCutZero->GetState() == kButtonDown) {
1606 TString cutZerosStr(GetDrawString()->Data());
1607 if (cutZerosStr.Contains(">>")) {
1608 cutZerosStr.Remove(cutZerosStr.First(">>"));
1610 if (cutZerosStr.Contains(":")) {
1611 cutZerosStr.Remove(cutZerosStr.First(":"));
1613 cutsStr += cutZerosStr.Data();
1615 if (fChkAddCuts->GetState() == kButtonDown) cutsStr += " && ";
1617 if (fChkAddCuts->GetState() == kButtonDown)
1618 cutsStr += fComboAddCuts->GetTextEntry()->GetText();
1620 // try to add forgotten '~'
1621 if (fChkAutoAppend->GetState() == kButtonDown)
1622 cutsStr = TString(fViewer->AddAbbreviations((char*)cutsStr.Data()));
1623 return new TString(cutsStr.Data());
1627 void AliTPCCalibViewerGUI::DoDraw() {
1629 // main method for drawing according to user selection
1632 // specify data to plot:
1633 TString desiredData(GetDrawString()->Data());
1635 TString sectorStr(GetSectorString()->Data());
1637 TString cutsStr(GetCutString()->Data());
1639 TString addDrawOpt("");
1640 if (fChkAddDrawOpt->GetState() == kButtonDown)
1641 addDrawOpt += fComboAddDrawOpt->GetTextEntry()->GetText();
1643 // remove last picture
1644 if (!addDrawOpt.Contains("same"))
1645 for (Int_t i = 0; i < fCanvMain->GetCanvas()->GetListOfPrimitives()->GetEntries(); i++) {
1646 if (strcmp(fCanvMain->GetCanvas()->GetListOfPrimitives()->At(i)->ClassName(), "TFrame") != 0)
1647 fCanvMain->GetCanvas()->GetListOfPrimitives()->At(i)->Delete();
1649 //fCanvMain->GetCanvas()->Clear();
1650 fCanvMain->GetCanvas()->cd();
1653 if (fRadio1D->GetState() == kButtonDown){
1655 TString strSigmaMax(fTxtSigmaMax->GetText()); // get sigmaMax from text enty
1656 Double_t sigmaMax = (strSigmaMax.IsFloat()) ? strSigmaMax.Atof() : 5; // convert to double, if not convertable, set to 5
1657 Bool_t plotMean = fChkMean->GetState() == kButtonDown;
1658 Bool_t plotMedian = fChkMedian->GetState() == kButtonDown;
1659 Bool_t plotLTM = fChkLTM->GetState() == kButtonDown;
1660 if (fRadioNorm->GetState() == kButtonDown) // normal 1D drawing
1661 entries = fViewer->EasyDraw1D(desiredData.Data(), sectorStr.Data(), cutsStr.Data(), addDrawOpt.Data());
1662 if (fRadioSigma->GetState() == kButtonDown) // sigma 1D drawing
1663 entries = fViewer->DrawHisto1D(desiredData.Data(), sectorStr.Data(), cutsStr.Data(), //
1664 fTxtSigmas->GetText(), plotMean, plotMedian, plotLTM);
1665 if (fRadioCumulative->GetState() == kButtonDown) // cumulative 1D drawing
1666 entries = fViewer->SigmaCut(desiredData.Data(), sectorStr.Data(), cutsStr.Data(), //
1667 sigmaMax, plotMean, plotMedian, plotLTM, //
1668 fCheckCumulativePM->GetState() == kButtonDown, fTxtSigmas->GetText(), /* Float_t sigmaStep =*/ -1);
1669 if (fRadioIntegrate->GetState() == kButtonDown) // integral 1D drawing
1670 entries = fViewer->Integrate(desiredData.Data(), sectorStr.Data(), cutsStr.Data(), //
1671 sigmaMax, plotMean, plotMedian, plotLTM, //
1672 fTxtSigmas->GetText(), /* Float_t sigmaStep =*/ -1);
1674 else if (fRadio2D->GetState() == kButtonDown) {
1676 entries = fViewer->EasyDraw(desiredData.Data(), sectorStr.Data(), cutsStr.Data(), addDrawOpt.Data());
1678 if (entries == -1) return; // nothing was drawn, there is no histogram to get min and max
1681 fCanvMain->GetCanvas()->Update();
1685 void AliTPCCalibViewerGUI::DoFit() {
1687 // main method for fitting
1691 TVectorD fitParam(0);
1692 TMatrixD covMatrix(0,0);
1694 TString formulaStr("");
1695 TString *returnStr = new TString("");
1697 // specify data to plot:
1698 TString drawStr(GetDrawString()->Data());
1700 // ********** create cut string **********
1701 if (fRadioTPC->GetState() == kButtonDown)
1702 cutStr += ""; // whole TPC is used for fitting
1703 if (fRadioSideA->GetState() == kButtonDown)
1704 cutStr += "(sector/18)%2==0"; // side A
1705 if (fRadioSideC->GetState() == kButtonDown)
1706 cutStr+= "(sector/18)%2==1"; // side C
1707 if (fRadioSector->GetState() == kButtonDown) {
1708 Int_t sector = (Int_t)(fNmbSector->GetNumber());
1709 cutStr += "sector==";
1712 if (fChkAddCuts->GetState() == kButtonDown && strcmp(fComboAddCuts->GetTextEntry()->GetText(), "") != 0){
1713 if (fRadioTPC->GetState() != kButtonDown) cutStr += " && ";
1714 cutStr += fComboAddCuts->GetTextEntry()->GetText();
1716 // try to add forgotten '~'
1717 if (fChkAutoAppend->GetState() == kButtonDown)
1718 cutStr = TString(fViewer->AddAbbreviations((char*)cutStr.Data()));
1720 // ********** get formula string **********
1721 formulaStr += fComboCustomFit->GetTextEntry()->GetText();
1722 if (fChkAutoAppend->GetState() == kButtonDown)
1723 formulaStr = TString(fViewer->AddAbbreviations((char*)formulaStr.Data()));
1725 // ********** call AliTPCCalibViewer's fit-function
1726 returnStr = fViewer->Fit(drawStr.Data(), formulaStr.Data(), cutStr.Data(), chi2, fitParam, covMatrix);
1728 std::cout << std::endl;
1729 std::cout << "Your fit formula reads as follows:" << std::endl;
1730 std::cout << returnStr->Data() << std::endl;
1731 std::cout << "chi2 = " << chi2 << std::endl;
1735 void AliTPCCalibViewerGUI::DoExport() {
1737 // function to export a CalPad to Cint
1739 if ( fRadio2D->GetState() != kButtonDown){
1740 Error("ExportCalPad", "Export of AliTPCCalPad to CINT works only in 2D mode.");
1743 // specify data to plot:
1744 TString desiredData(GetDrawString()->Data());
1746 TString cutsStr(GetCutString()->Data());
1747 // get name for the calPad
1748 const char* calPadName = fComboExportName->GetTextEntry()->GetText();
1749 // create calPad according to drawCommand and cuts
1750 AliTPCCalPad *calPad = fViewer->GetCalPad(desiredData.Data(), (char*)cutsStr.Data(), (char*)calPadName);
1751 // finally export calPad to Cint:
1752 gROOT->ProcessLine(Form("AliTPCCalPad* %s = (AliTPCCalPad*)0x%lx;", calPadName, calPad));
1753 fPreprocessor->AddComponent(calPad);
1754 Info("ExportCalPad", "Current 2D view has been exported to an AliTPCCalPad* with name '%s'", calPadName);
1758 void AliTPCCalibViewerGUI::DoExportNorm() {
1760 // function to export a CalPad to Cint
1763 if ( fRadio2D->GetState() != kButtonDown){
1764 Error("ExportCalPad", "Adding an AliTPCCalPad to the normalization works only in 2D mode.");
1768 Error("DoExportNorm", "Not yet implemented.");
1771 // specify data to plot:
1772 TString desiredData(GetDrawString()->Data());
1774 TString sectorStr(GetSectorString()->Data());
1776 TString cutsStr(GetCutString()->Data());
1778 // get name for the calPad
1779 const char* calPadName = fComboExportName->GetTextEntry()->GetText();
1780 // create calPad according to drawCommand and cuts
1781 AliTPCCalPad *calPad = fViewer->GetCalPad(desiredData.Data(), (char*)cutsStr.Data(), (char*)fComboExportName->GetTextEntry()->GetText());
1782 // finally export calPad to Cint:
1783 gROOT->ProcessLine(Form("AliTPCCalPad* %s = (AliTPCCalPad*)0x%lx;", calPadName, calPad));
1784 Info("ExportCalPad", "Current 2D view has been exported to an AliTPCCalPad* with name '%s'", calPadName);
1788 void AliTPCCalibViewerGUI::GetMinMax() {
1790 // Read current Min & Max from the plot and set it to fTxtSetMin & fTxtSetMax
1792 if (fChkGetMinMaxAuto->GetState() == kButtonUp) return;
1793 TList* listOfPrimitives = fCanvMain->GetCanvas()->GetListOfPrimitives();
1795 for (Int_t i = 0; i < listOfPrimitives->GetEntries(); i++) {
1796 ptr = listOfPrimitives->At(i);
1797 if ( ptr->InheritsFrom("TH1") ) break;
1799 if ( ptr != 0 && !ptr->InheritsFrom("TH1") ) return; // if the loop did not find a TH1
1800 TH1 *hist = (TH1*)ptr;
1802 // Double_t histMax = hist->GetMaximum();
1803 // Double_t histMin = hist->GetMinimum();
1804 // fTxtSetMax->SetText(Form("%f",histMax));
1805 // fTxtSetMin->SetText(Form("%f",histMin));
1807 if (fRadio2D->GetState() == kButtonDown) {
1808 if (fChkSetMax->GetState() == kButtonUp)
1809 fTxtSetMax->SetText(Form("%f", hist->GetMaximum()));
1810 if (fChkSetMin->GetState() == kButtonUp)
1811 fTxtSetMin->SetText(Form("%f", hist->GetMinimum()));
1813 else if (fRadio1D->GetState() == kButtonDown) {
1814 if (fChkSetMax->GetState() == kButtonUp)
1815 fTxtSetMax->SetText( Form("%f", hist->GetXaxis()->GetXmax()) );
1816 if (fChkSetMin->GetState() == kButtonUp)
1817 fTxtSetMin->SetText( Form("%f", hist->GetXaxis()->GetXmin()) );
1822 void AliTPCCalibViewerGUI::SetMinMaxLabel() {
1824 // Set Minimum, Maximum and labels without redrawing the plot
1828 // search for histogram
1829 TList* listOfPrimitives = fCanvMain->GetCanvas()->GetListOfPrimitives();
1831 for (Int_t i = 0; i < listOfPrimitives->GetEntries(); i++) {
1832 ptr = listOfPrimitives->At(i);
1833 if ( ptr->InheritsFrom("TH1") ) break;
1835 if ( ptr == 0 || !ptr->InheritsFrom("TH1") ) { // if the loop did not find a TH1
1836 fCanvMain->GetCanvas()->Update();
1837 Warning("SetMinMaxLabel","No Histogram found!");
1839 // unable to find histogram, no min and max wil be read out
1842 TH1 *hist = (TH1*)ptr;
1843 TString minTxt(fTxtSetMin->GetText());
1844 TString maxTxt(fTxtSetMax->GetText());
1846 // set min and max according to specified values, if checkbox is checked
1847 if (fRadio2D->GetState() == kButtonDown) {
1848 if (fChkSetMax->GetState() == kButtonDown && fChkSetMax->GetState() == kButtonDown &&(maxTxt.IsDigit() || maxTxt.IsFloat()) )
1849 hist->SetMaximum(maxTxt.Atof());
1850 if (fChkSetMax->GetState() == kButtonUp)
1851 hist->SetMaximum(-1111); // default value, to unzoom
1852 if (fChkSetMin->GetState() == kButtonDown && (minTxt.IsDigit() || minTxt.IsFloat()) )
1853 hist->SetMinimum(minTxt.Atof());
1854 if (fChkSetMin->GetState() == kButtonUp)
1855 hist->SetMinimum(-1111); // default value, to unzoom
1857 else if (fRadio2D->GetState() == kButtonDown) {
1858 if (fChkSetMin->GetState() == kButtonDown &&
1859 fChkSetMax->GetState() == kButtonDown && hist->GetXaxis())
1860 hist->GetXaxis()->SetRangeUser(hist->GetXaxis()->GetXmin(), hist->GetXaxis()->GetXmax());
1861 else if (fChkSetMax->GetState() == kButtonDown && hist->GetXaxis())
1862 hist->GetXaxis()->SetRangeUser(hist->GetXaxis()->GetXmin(), maxTxt.Atof());
1863 else if (fChkSetMin->GetState() == kButtonDown && hist->GetXaxis())
1864 hist->GetXaxis()->SetRangeUser(minTxt.Atof(), hist->GetXaxis()->GetXmax());
1865 hist->SetTitle(hist->GetTitle()); // trick to update the histogram
1868 // get min and max from plot
1871 // set labels according to specification, if cehckboxes are checked
1872 if (fChkLabelTitle->GetState() == kButtonDown)
1873 hist->SetTitle(fTxtLabelTitle->GetText());
1874 if (fChkLabelXaxis->GetState() == kButtonDown)
1875 hist->GetXaxis()->SetTitle(fTxtLabelXaxis->GetText());
1876 if (fChkLabelYaxis->GetState() == kButtonDown)
1877 hist->GetYaxis()->SetTitle(fTxtLabelYaxis->GetText());
1878 // get and/or set labels and title
1879 if (fChkLabelGetAuto->GetState() == kButtonDown) {
1880 fTxtLabelTitle->SetText(hist->GetTitle());
1881 fTxtLabelXaxis->SetTitle(hist->GetXaxis()->GetTitle());
1882 fTxtLabelYaxis->SetTitle(hist->GetYaxis()->GetTitle());
1884 hist->SetTitle(hist->GetTitle()); // trick to update the histogram
1885 fCanvMain->GetCanvas()->Update();
1889 void AliTPCCalibViewerGUI::ChangeSector(){
1891 // function that is called, when the number of the sector is changed
1892 // to change the sector label
1894 Int_t sector = (Int_t)(fNmbSector->GetNumber());
1895 char* secLabel = "";
1896 if (sector >= 0 && sector <= 17) // IROC, Side A
1897 secLabel = "IROC, A";
1898 if (sector >= 18 && sector <= 35) // IROC, Side C
1899 secLabel = "IROC, C";
1900 if (sector >= 36 && sector <= 53) // OROC, Side A
1901 secLabel = "OROC, A";
1902 if (sector >= 54 && sector <= 71) // OROC, Side C
1903 secLabel = "OROC, C";
1904 fLblSector->SetText(secLabel);
1909 void AliTPCCalibViewerGUI::AddFitFunction() const {
1911 // adds the last fit function to the normalization list
1913 std::cout << "Not yet implemented." << std::endl;
1917 void AliTPCCalibViewerGUI::UnchekAllStat() {
1919 // Disable all statistical legend entries, no statistical legend.
1921 fChkStatName->SetState(kButtonUp);
1922 fChkStatEntries->SetState(kButtonUp);
1923 fChkStatMean->SetState(kButtonUp);
1924 fChkStatMeanPM->SetState(kButtonUp);
1925 fChkStatRMS->SetState(kButtonUp);
1926 fChkStatRMSPM->SetState(kButtonUp);
1927 fChkStatUnderflow->SetState(kButtonUp);
1928 fChkStatOverflow->SetState(kButtonUp);
1929 fChkStatIntegral->SetState(kButtonUp);
1930 fChkStatSkewness->SetState(kButtonUp);
1931 fChkStatSkewnessPM->SetState(kButtonUp);
1932 fChkStatKurtosis->SetState(kButtonUp);
1933 fChkStatKurtosisPM->SetState(kButtonUp);
1935 HandleButtonsStat(0);
1939 void AliTPCCalibViewerGUI::MouseMove(Int_t event, Int_t x, Int_t y, TObject *selectedObject) {
1942 // zoom to sector works ONLY in 2D mode, if one side is specified
1944 Double_t pi = TMath::Pi();
1945 if (event != kButton1Double )
1947 if (!selectedObject->InheritsFrom("TH2")) return;
1948 // zoom to sector works ONLY in 2D mode, if one side is specified
1949 if (fRadio2D->GetState() == kButtonUp) return;
1950 if (fRadioSector->GetState() == kButtonDown) { // return to full side view
1951 // return to full side view
1952 Int_t sector = (Int_t)(fNmbSector->GetNumber());
1953 if ( (sector >= 0 && sector <= 17) || (sector >= 36 && sector <= 53) ) {
1955 fRadioSideA->Clicked();
1956 fRadioSideA->SetState(kButtonDown);
1959 if ( (sector >= 18 && sector <= 35) || (sector >= 54 && sector <= 71) ) {
1961 fRadioSideC->Clicked();
1962 fRadioSideC->SetState(kButtonDown);
1967 if (!(fRadioSideA->GetState() == kButtonDown || fRadioSideC->GetState() == kButtonDown)) return;
1969 // Int_t px = gPad->GetEventX();
1970 // Int_t py = gPad->GetEventY();
1971 Float_t upy = gPad->AbsPixeltoY(y);
1972 Float_t upx = gPad->AbsPixeltoX(x);
1973 Float_t gy = gPad->PadtoY(upy);
1974 Float_t gx = gPad->PadtoX(upx);
1975 Int_t quadrant = -1;
1976 if (gx >= 0 && gy >= 0) quadrant = 1;
1977 if (gx < 0 && gy >= 0) quadrant = 2;
1978 if (gx < 0 && gy < 0) quadrant = 3;
1979 if (gx >= 0 && gy < 0) quadrant = 4;
1980 gx = TMath::Abs(gx);
1981 gy = TMath::Abs(gy);
1982 Double_t phi = TMath::ATan(gy/gx); // angle phi is in Pi- units
1983 Double_t r = TMath::Sqrt(gx*gx + gy*gy);
1984 if (quadrant == 2) phi = pi - phi;
1985 if (quadrant == 3) phi = pi + phi;
1986 if (quadrant == 4) phi = 2 * pi - phi;
1987 Double_t phiGrad = phi / pi * 180;
1988 Int_t sector = (Int_t) phiGrad / 20; // one sector coresponds to 20°
1989 // IROC starts at 84.5 cm
1990 // IROC ends at 135.5 cm, OROC begins
1991 // OROC ends at 250 cm
1992 if (r < 84.5 || r > 250) return; // outside TPC
1993 if (r < 135.5) { // IROC
1994 if (fRadioSideC->GetState() == kButtonDown) sector += 18;
1998 if (fRadioSideC->GetState() == kButtonDown) sector += 18;
2000 // printf("r: %f, phi: %f, phiGrad: %f, gy/gx: %f, quadrant: %i, sector: %i \n", r, phi, phiGrad, gy/gx, quadrant, sector);
2001 fNmbSector->SetNumber(sector);
2002 fRadioSector->Clicked();
2003 fRadioSector->SetState(kButtonDown);
2008 void AliTPCCalibViewerGUI::SavePicture() {
2010 // saves the current picture
2012 // use the following combination of file type and save options:
2013 // (see also TCanvas::Print)
2015 // "ps" - Postscript file is produced (see special cases below)
2016 // "Portrait" - Postscript file is produced (Portrait)
2017 // "Landscape" - Postscript file is produced (Landscape)
2018 // "eps" - an Encapsulated Postscript file is produced
2019 // "Preview" - an Encapsulated Postscript file with preview is produced.
2020 // "pdf" - a PDF file is produced
2021 // "svg" - a SVG file is produced
2022 // "gif" - a GIF file is produced
2023 // "gif+NN" - an animated GIF file is produced, where NN is delay in 10ms units
2024 // "xpm" - a XPM file is produced
2025 // "png" - a PNG file is produced
2026 // "jpg" - a JPEG file is produced
2027 // "tiff" - a TIFF file is produced
2028 // "cxx" - a C++ macro file is produced
2029 // "xml" - a XML file
2030 // "root" - a ROOT binary file
2032 const char *kSaveAsTypes[] = {
2033 "Postscript", "*.ps",
2034 "Encapsulated Postscript", "*.eps",
2043 "C++ macro", "*.cxx",
2044 "Macro file", "*.C",
2045 "ROOT file", "*.root",
2049 TString addSaveOpt("");
2050 if (fChkAddSaveOpt->GetState() == kButtonDown)
2051 addSaveOpt += fComboAddSaveOpt->GetTextEntry()->GetText();
2054 fi.fFileTypes = kSaveAsTypes;
2055 // fi.fIniDir = StrDup(dir);
2056 fi.fOverwrite = kFALSE;
2057 new TGFileDialog(gClient->GetRoot(), gClient->GetRoot(), kFDSave, &fi);
2058 if (fi.fFilename && strlen(fi.fFilename)) {
2059 if (addSaveOpt != "")
2060 fCanvMain->GetCanvas()->Print(fi.fFilename, addSaveOpt.Data());
2062 fCanvMain->GetCanvas()->Print(fi.fFilename);
2065 // TList* fFileNamesList list of selected file names
2066 // Int_t fFileTypeIdx selected file type, index in fFileTypes
2067 // const char** fFileTypes file types used to filter selectable files
2068 // char* fFilename selected file name
2069 // char* fIniDir on input: initial directory, on output: new directory
2070 // Bool_t fMultipleSelection if true, allow multiple file selection
2071 // Bool_t fOverwrite if true overwrite the file with existing name on save
2076 void AliTPCCalibViewerGUI::DoDumpToFile() {
2078 // This function is called, when the "Dump to File" button is pressed.
2079 // All the exported CalPads will be written into an new CalibTree,
2080 // a Save File dialog will appear to specify the filename
2082 const char *kSaveAsTypes[] = {
2083 "ROOT file", "*.root",
2088 fi.fFileTypes = kSaveAsTypes;
2089 // fi.fIniDir = StrDup(dir);
2090 fi.fOverwrite = kFALSE;
2091 new TGFileDialog(gClient->GetRoot(), gClient->GetRoot(), kFDSave, &fi);
2092 if (fi.fFilename && strlen(fi.fFilename)) {
2093 fPreprocessor->DumpToFile(fi.fFilename);
2094 Info("DumpToFile", Form("New CalibTree has been writen to file '%s'", fi.fFilename));
2099 void AliTPCCalibViewerGUI::DoLoadTree() {
2100 // function to load a new calib tree
2103 const char *kFileTypes[] = {
2104 "ROOT file", "*.root",
2109 fi.fFileTypes = kFileTypes;
2110 // fi.fIniDir = StrDup(dir);
2111 fi.fOverwrite = kFALSE;
2112 new TGFileDialog(gClient->GetRoot(), gClient->GetRoot(), kFDOpen, &fi);
2113 if (fi.fFilename && strlen(fi.fFilename) && fChkAddAsReference->GetState() == kButtonUp) {
2114 Initialize(fi.fFilename);
2117 else if (fi.fFilename && strlen(fi.fFilename) && fChkAddAsReference->GetState() == kButtonDown) {
2118 fViewer->AddReferenceTree(fi.fFilename, "calPads", fTxtRefName->GetText());
2124 TObjArray* AliTPCCalibViewerGUI::ShowGUI(const char* fileName) {
2126 // Initialize and show GUI for presentation for demonstration purposes
2127 // or for fast standalone use
2129 TGMainFrame* frmMain = new TGMainFrame(gClient->GetRoot(), 1000, 600);
2130 frmMain->SetWindowName("AliTPCCalibViewer GUI");
2131 frmMain->SetCleanup(kDeepCleanup);
2133 TGTab* tabMain = new TGTab(frmMain, 1000, 600);
2134 frmMain->AddFrame(tabMain, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
2136 TGCompositeFrame* tabCont1 = tabMain->AddTab("Viewer 1");
2137 TGCompositeFrame* tabCont2 = tabMain->AddTab("Viewer 2");
2139 AliTPCCalibViewerGUI* calibViewer1 = new AliTPCCalibViewerGUI(tabCont1, 1000, 600, (char*)fileName);
2140 tabCont1->AddFrame(calibViewer1, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
2142 AliTPCCalibViewerGUI* calibViewer2 = new AliTPCCalibViewerGUI(tabCont2, 1000, 600, (char*)fileName);
2143 tabCont2->AddFrame(calibViewer2, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
2145 TObjArray *guiArray = new TObjArray();
2146 guiArray->Add(calibViewer1);
2147 guiArray->Add(calibViewer2);
2149 frmMain->MapSubwindows();
2151 frmMain->MapWindow();