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();
1249 TIterator* iter = arr->MakeIterator();
1251 TObjString* currentStr = 0;
1253 fListVariables->RemoveAll();
1254 while ((currentStr = (TObjString*)(iter->Next()))) {
1255 fListVariables->AddEntry(currentStr->GetString().Data(), id);
1256 if (fInitialized && currentStr->GetString() == selectedVariable) variableId = id;
1263 // fill fListNorm, list of normalization variables:
1264 arr = fViewer->GetListOfNormalizationVariables();
1265 iter = arr->MakeIterator();
1269 fListNormalization->RemoveAll();
1270 while ((currentStr = (TObjString*)(iter->Next()))) {
1271 fListNormalization->AddEntry(currentStr->GetString().Data(), id);
1272 if (fInitialized && currentStr->GetString() == selectedNormalization) normalizationId = id;
1279 // trick do display the entries corectly after reinitialization
1280 // otherwise all the entries would appear as one kryptic entry
1281 // resizing the listbox somehow fixes the problem...
1282 if (fInitialized) fListVariables->Resize(fListVariables->GetWidth()-1, fListVariables->GetHeight());
1283 if (fInitialized) fListVariables->Resize(fListVariables->GetWidth()+1, fListVariables->GetHeight());
1284 if (fInitialized) fListNormalization->Resize(fListNormalization->GetWidth()-1, fListNormalization->GetHeight());
1285 if (fInitialized) fListNormalization->Resize(fListNormalization->GetWidth()+1, fListNormalization->GetHeight());
1287 // select the last selected variable and normalization
1288 if (fInitialized && variableId != -1) fListVariables->Select(variableId);
1289 if (fInitialized && normalizationId != -1)fListVariables->Select(normalizationId);
1291 if (fInitialized) Info("Initialize", "AliTPCCalibViewerGUI new initialized.");
1292 fInitialized = kTRUE;
1297 void AliTPCCalibViewerGUI::HandleButtonsGeneral(Int_t id) {
1299 // handles mutual radio button exclusions
1303 TGButton *btn = (TGButton *) gTQSender;
1304 id = btn->WidgetId();
1308 case 10: // fRadioRaw
1309 fRadioNormalized->SetState(kButtonUp);
1310 fRadioPredefined->SetState(kButtonDown);
1311 fRadioCustom->SetState(kButtonUp);
1312 // fComboMethod->UnmapWindow();
1313 // fListNormalization->UnmapWindow();
1315 case 11: // fRadioNormalized
1316 fRadioRaw->SetState(kButtonUp);
1317 fRadioPredefined->SetState(kButtonDown);
1318 fRadioCustom->SetState(kButtonUp);
1320 case 12: // fRadioCustom
1321 fRadioPredefined->SetState(kButtonUp);
1322 // fComboCustom->SetEnabled(kFALSE);
1323 // fRadioNormalized->SetState(kButtonUp);
1325 case 14: // select Draw options fComboAddDrawOpt
1326 fChkAddDrawOpt->SetState(kButtonDown);
1328 case 13: // fRadioPredefined
1329 fRadioCustom->SetState(kButtonUp);
1330 // fComboCustom->SetEnabled(kTRUE);
1331 //f RadioNormalized->SetState(kButtonUp);
1334 case 30: // fRadio1D
1335 fRadio2D->SetState(kButtonUp);
1336 fBtnExport->SetEnabled(kFALSE);
1337 fBtnAddNorm->SetEnabled(kFALSE);
1339 case 31: // fRadio2D
1340 fRadio1D->SetState(kButtonUp);
1341 fBtnExport->SetEnabled(kTRUE);
1342 fBtnAddNorm->SetEnabled(kTRUE);
1344 case 42: // fComboCustom
1345 fRadioCustom->SetState(kButtonDown);
1346 fRadioPredefined->SetState(kButtonUp);
1353 void AliTPCCalibViewerGUI::HandleButtons1D(Int_t id) {
1355 // handles mutual radio button exclusions
1360 TGButton *btn = (TGButton *) gTQSender;
1361 id = btn->WidgetId();
1364 case 110: // 1D draw normal
1365 fRadioNorm->SetState(kButtonDown);
1366 fRadioSigma->SetState(kButtonUp);
1367 fRadioCumulative->SetState(kButtonUp);
1368 fRadioIntegrate->SetState(kButtonUp);
1370 case 111: // 1D draw sigma
1371 fRadioNorm->SetState(kButtonUp);
1372 fRadioSigma->SetState(kButtonDown);
1373 fRadioCumulative->SetState(kButtonUp);
1374 fRadioIntegrate->SetState(kButtonUp);
1376 case 112: // 1D draw cumulative
1377 fRadioNorm->SetState(kButtonUp);
1378 fRadioSigma->SetState(kButtonUp);
1379 fRadioCumulative->SetState(kButtonDown);
1380 fRadioIntegrate->SetState(kButtonUp);
1382 case 113: // 1D draw integral
1383 fRadioNorm->SetState(kButtonUp);
1384 fRadioSigma->SetState(kButtonUp);
1385 fRadioCumulative->SetState(kButtonUp);
1386 fRadioIntegrate->SetState(kButtonDown);
1393 void AliTPCCalibViewerGUI::HandleButtonsStat(Int_t id) {
1395 // handles statistic check boxes
1396 // checks each checkbox if checked
1397 // if the checkbox is checked, appends 'n' for name, 'e' for entries, ...
1398 // to a TString, passes this TString to gStyle->SetOptStat(...)
1401 TGButton *btn = (TGButton *) gTQSender;
1402 id = btn->WidgetId();
1404 TString statOpt("");
1405 if (fChkStatName->GetState() == kButtonDown) statOpt.Append("n");
1406 if (fChkStatEntries->GetState() == kButtonDown) statOpt.Append("e");
1407 if (fChkStatMean->GetState() == kButtonDown && fChkStatMeanPM->GetState() == kButtonUp) statOpt.Append("m");
1408 if (fChkStatMeanPM->GetState() == kButtonDown) statOpt.Append("M");
1409 if (fChkStatRMS->GetState() == kButtonDown && fChkStatRMSPM->GetState() == kButtonUp) statOpt.Append("r");
1410 if (fChkStatRMSPM->GetState() == kButtonDown) statOpt.Append("R");
1411 if (fChkStatUnderflow->GetState() == kButtonDown) statOpt.Append("u");
1412 if (fChkStatOverflow->GetState() == kButtonDown) statOpt.Append("o");
1413 if (fChkStatIntegral->GetState() == kButtonDown) statOpt.Append("i");
1414 if (fChkStatSkewness->GetState() == kButtonDown && fChkStatSkewnessPM->GetState() == kButtonUp) statOpt.Append("s");
1415 if (fChkStatSkewnessPM->GetState() == kButtonDown) statOpt.Append("S");
1416 if (fChkStatKurtosis->GetState() == kButtonDown && fChkStatKurtosisPM->GetState() == kButtonUp) statOpt.Append("k");
1417 if (fChkStatKurtosisPM->GetState() == kButtonDown) statOpt.Append("K");
1419 gStyle->SetOptStat(statOpt);
1424 void AliTPCCalibViewerGUI::HandleButtonsCuts(Int_t id) {
1426 // handles mutual radio button exclusions
1427 // right side buttons
1430 TGButton *btn = (TGButton *) gTQSender;
1431 id = btn->WidgetId();
1435 case 20: // fRadioTPC
1436 fRadioSideA->SetState(kButtonUp);
1437 fRadioSideC->SetState(kButtonUp);
1438 fRadioSector->SetState(kButtonUp);
1440 case 21: // fRadioSideA
1441 fRadioTPC->SetState(kButtonUp);
1442 fRadioSideC->SetState(kButtonUp);
1443 fRadioSector->SetState(kButtonUp);
1445 case 22: // fRadioSideC
1446 fRadioTPC->SetState(kButtonUp);
1447 fRadioSideA->SetState(kButtonUp);
1448 fRadioSector->SetState(kButtonUp);
1450 case 23: // fRadioSector
1451 fRadioTPC->SetState(kButtonUp);
1452 fRadioSideA->SetState(kButtonUp);
1453 fRadioSideC->SetState(kButtonUp);
1455 case 31: // fComboAddCuts
1456 fChkAddCuts->SetState(kButtonDown);
1463 void AliTPCCalibViewerGUI::HandleButtonsNoRedraw(Int_t id) {
1465 // handles label & scaling checkboxes
1466 // without redrawing (not necessary, faster like this)
1469 TGButton *btn = (TGButton *) gTQSender;
1470 id = btn->WidgetId();
1474 case 40: // fTxtSetMin
1475 fChkSetMin->SetState(kButtonDown);
1477 case 41: // fTxtSetMax
1478 fChkSetMax->SetState(kButtonDown);
1480 case 50: // fTxtLabelTitle
1481 fChkLabelTitle->SetState(kButtonDown);
1483 case 51: // fTxtLabelXaxis
1484 fChkLabelXaxis->SetState(kButtonDown);
1486 case 52: // fTxtLabelXaxis
1487 fChkLabelYaxis->SetState(kButtonDown);
1494 void AliTPCCalibViewerGUI::DoNewSelection() {
1496 // decides whether to redraw if user makes another selection
1498 if (fChkAuto->GetState() == kButtonDown) DoDraw();
1502 TString* AliTPCCalibViewerGUI::GetDrawString() {
1504 // create the draw string out of selection
1507 // specify data to plot
1508 TString desiredData("");
1509 if (!fListVariables->GetSelectedEntry()) return 0;
1510 desiredData += ((TGTextLBEntry*)(fListVariables->GetSelectedEntry()))->GetTitle();
1511 desiredData += fViewer->GetAbbreviation();
1513 // specify normalization
1514 if (fRadioPredefined->GetState() == kButtonDown && fRadioNormalized->GetState() == kButtonDown) {
1516 switch (fComboMethod->GetSelected()) {
1517 case 0: // subtraction
1524 TString normalizationData("");
1525 if (!fListNormalization->GetSelectedEntry()) return 0;
1526 normalizationData += ((TGTextLBEntry*)(fListNormalization->GetSelectedEntry()))->GetTitle();
1528 if ( normalizationData.BeginsWith("Fit")) {
1529 // create fit formula, evaluate it an replace normalizationData-String
1530 // ********** create cut string **********
1532 if (fRadioTPC->GetState() == kButtonDown)
1533 cutStr += ""; // whole TPC is used for fitting
1534 if (fRadioSideA->GetState() == kButtonDown)
1535 cutStr += "(sector/18)%2==0"; // side A
1536 if (fRadioSideC->GetState() == kButtonDown)
1537 cutStr+= "(sector/18)%2==1"; // side C
1538 if (fRadioSector->GetState() == kButtonDown) {
1539 Int_t sector = (Int_t)(fNmbSector->GetNumber());
1540 cutStr += "sector==";
1543 if (fChkAddCuts->GetState() == kButtonDown && strcmp(fComboAddCuts->GetTextEntry()->GetText(), "") != 0){
1544 if (fRadioTPC->GetState() != kButtonDown) cutStr += " && ";
1545 cutStr += fComboAddCuts->GetTextEntry()->GetText();
1548 TVectorD fitParam(0);
1549 TMatrixD covMatrix(0,0);
1550 TString formulaStr("");
1551 if (normalizationData.CompareTo("FitLinLocal") == 0)
1552 formulaStr = "lx~ ++ ly~";
1553 if (normalizationData.CompareTo("FitLinGlobal") == 0)
1554 formulaStr = "gx~ ++ gy~";
1555 if (normalizationData.CompareTo("FitParLocal") == 0)
1556 formulaStr = "lx~ ++ ly~ ++ lx~^2 ++ ly~^2 ++ lx~*ly~";
1557 if (normalizationData.CompareTo("FitParGlobal") == 0)
1558 formulaStr = "gx~ ++ gy~ ++ gx~^2 ++ gy~^2 ++ gx~*gy~";
1559 formulaStr.ReplaceAll("~", fViewer->GetAbbreviation());
1560 normalizationData = *fViewer->Fit(desiredData.Data(), formulaStr.Data(), cutStr.Data(), chi2, fitParam, covMatrix);
1561 } // if ( normalizationData.BeginsWith("Fit")
1564 if (! (TString(((TGTextLBEntry*)(fListNormalization->GetSelectedEntry()))->GetTitle())).BeginsWith("Fit"))
1565 desiredData += ((TGTextLBEntry*)(fListVariables->GetSelectedEntry()))->GetTitle();
1566 desiredData += normalizationData;
1568 else if (fRadioCustom->GetState() == kButtonDown) {
1569 desiredData = fComboCustom->GetTextEntry()->GetText();
1570 if (desiredData == "") return 0;
1573 // try to add forgotten '~'
1574 if (fChkAutoAppend->GetState() == kButtonDown)
1575 desiredData = TString(fViewer->AddAbbreviations((char*)desiredData.Data()));
1576 return new TString(desiredData.Data());
1580 TString* AliTPCCalibViewerGUI::GetSectorString() {
1582 // create the sector string out of selection
1585 TString sectorStr("");
1586 if (fRadioTPC->GetState() == kButtonDown)
1588 if (fRadioSideA->GetState() == kButtonDown)
1589 sectorStr += "A"; //cuts += "(sector/18)%2==0";
1590 if (fRadioSideC->GetState() == kButtonDown)
1591 sectorStr+= "C"; //cuts += "(sector/18)%2==1";
1592 if (fRadioSector->GetState() == kButtonDown) {
1593 Int_t sector = (Int_t)(fNmbSector->GetNumber());
1594 sectorStr += sector; //cuts += "sector==";
1596 return new TString(sectorStr.Data());
1600 TString* AliTPCCalibViewerGUI::GetCutString() {
1602 // create the cut string out of selection
1605 TString cutsStr("");
1606 if (fChkCutZero->GetState() == kButtonDown) {
1607 TString cutZerosStr(GetDrawString()->Data());
1608 if (cutZerosStr.Contains(">>")) {
1609 cutZerosStr.Remove(cutZerosStr.First(">>"));
1611 if (cutZerosStr.Contains(":")) {
1612 cutZerosStr.Remove(cutZerosStr.First(":"));
1614 cutsStr += cutZerosStr.Data();
1616 if (fChkAddCuts->GetState() == kButtonDown) cutsStr += " && ";
1618 if (fChkAddCuts->GetState() == kButtonDown)
1619 cutsStr += fComboAddCuts->GetTextEntry()->GetText();
1621 // try to add forgotten '~'
1622 if (fChkAutoAppend->GetState() == kButtonDown)
1623 cutsStr = TString(fViewer->AddAbbreviations((char*)cutsStr.Data()));
1624 return new TString(cutsStr.Data());
1628 void AliTPCCalibViewerGUI::DoDraw() {
1630 // main method for drawing according to user selection
1633 // specify data to plot:
1634 if (!GetDrawString()) return;
1635 TString desiredData(GetDrawString()->Data());
1637 TString sectorStr(GetSectorString()->Data());
1639 TString cutsStr(GetCutString()->Data());
1641 TString addDrawOpt("");
1642 if (fChkAddDrawOpt->GetState() == kButtonDown)
1643 addDrawOpt += fComboAddDrawOpt->GetTextEntry()->GetText();
1645 // remove last picture
1646 if (!addDrawOpt.Contains("same"))
1647 for (Int_t i = 0; i < fCanvMain->GetCanvas()->GetListOfPrimitives()->GetEntries(); i++) {
1648 if (strcmp(fCanvMain->GetCanvas()->GetListOfPrimitives()->At(i)->ClassName(), "TFrame") != 0)
1649 fCanvMain->GetCanvas()->GetListOfPrimitives()->At(i)->Delete();
1651 //fCanvMain->GetCanvas()->Clear();
1652 fCanvMain->GetCanvas()->cd();
1655 if (fRadio1D->GetState() == kButtonDown){
1657 TString strSigmaMax(fTxtSigmaMax->GetText()); // get sigmaMax from text enty
1658 Double_t sigmaMax = (strSigmaMax.IsFloat()) ? strSigmaMax.Atof() : 5; // convert to double, if not convertable, set to 5
1659 Bool_t plotMean = fChkMean->GetState() == kButtonDown;
1660 Bool_t plotMedian = fChkMedian->GetState() == kButtonDown;
1661 Bool_t plotLTM = fChkLTM->GetState() == kButtonDown;
1662 if (fRadioNorm->GetState() == kButtonDown) // normal 1D drawing
1663 entries = fViewer->EasyDraw1D(desiredData.Data(), sectorStr.Data(), cutsStr.Data(), addDrawOpt.Data());
1664 if (fRadioSigma->GetState() == kButtonDown) // sigma 1D drawing
1665 entries = fViewer->DrawHisto1D(desiredData.Data(), sectorStr.Data(), cutsStr.Data(), //
1666 fTxtSigmas->GetText(), plotMean, plotMedian, plotLTM);
1667 if (fRadioCumulative->GetState() == kButtonDown) // cumulative 1D drawing
1668 entries = fViewer->SigmaCut(desiredData.Data(), sectorStr.Data(), cutsStr.Data(), //
1669 sigmaMax, plotMean, plotMedian, plotLTM, //
1670 fCheckCumulativePM->GetState() == kButtonDown, fTxtSigmas->GetText(), /* Float_t sigmaStep =*/ -1);
1671 if (fRadioIntegrate->GetState() == kButtonDown) // integral 1D drawing
1672 entries = fViewer->Integrate(desiredData.Data(), sectorStr.Data(), cutsStr.Data(), //
1673 sigmaMax, plotMean, plotMedian, plotLTM, //
1674 fTxtSigmas->GetText(), /* Float_t sigmaStep =*/ -1);
1676 else if (fRadio2D->GetState() == kButtonDown) {
1678 entries = fViewer->EasyDraw(desiredData.Data(), sectorStr.Data(), cutsStr.Data(), addDrawOpt.Data());
1680 if (entries == -1) return; // nothing was drawn, there is no histogram to get min and max
1683 fCanvMain->GetCanvas()->Update();
1687 void AliTPCCalibViewerGUI::DoFit() {
1689 // main method for fitting
1693 TVectorD fitParam(0);
1694 TMatrixD covMatrix(0,0);
1696 TString formulaStr("");
1697 TString *returnStr = new TString("");
1699 // specify data to plot:
1700 TString drawStr(GetDrawString()->Data());
1702 // ********** create cut string **********
1703 if (fRadioTPC->GetState() == kButtonDown)
1704 cutStr += ""; // whole TPC is used for fitting
1705 if (fRadioSideA->GetState() == kButtonDown)
1706 cutStr += "(sector/18)%2==0"; // side A
1707 if (fRadioSideC->GetState() == kButtonDown)
1708 cutStr+= "(sector/18)%2==1"; // side C
1709 if (fRadioSector->GetState() == kButtonDown) {
1710 Int_t sector = (Int_t)(fNmbSector->GetNumber());
1711 cutStr += "sector==";
1714 if (fChkAddCuts->GetState() == kButtonDown && strcmp(fComboAddCuts->GetTextEntry()->GetText(), "") != 0){
1715 if (fRadioTPC->GetState() != kButtonDown) cutStr += " && ";
1716 cutStr += fComboAddCuts->GetTextEntry()->GetText();
1718 // try to add forgotten '~'
1719 if (fChkAutoAppend->GetState() == kButtonDown)
1720 cutStr = TString(fViewer->AddAbbreviations((char*)cutStr.Data()));
1722 // ********** get formula string **********
1723 formulaStr += fComboCustomFit->GetTextEntry()->GetText();
1724 if (fChkAutoAppend->GetState() == kButtonDown)
1725 formulaStr = TString(fViewer->AddAbbreviations((char*)formulaStr.Data()));
1727 // ********** call AliTPCCalibViewer's fit-function
1728 returnStr = fViewer->Fit(drawStr.Data(), formulaStr.Data(), cutStr.Data(), chi2, fitParam, covMatrix);
1730 std::cout << std::endl;
1731 std::cout << "Your fit formula reads as follows:" << std::endl;
1732 std::cout << returnStr->Data() << std::endl;
1733 std::cout << "chi2 = " << chi2 << std::endl;
1737 void AliTPCCalibViewerGUI::DoExport() {
1739 // function to export a CalPad to Cint
1741 if ( fRadio2D->GetState() != kButtonDown){
1742 Error("ExportCalPad", "Export of AliTPCCalPad to CINT works only in 2D mode.");
1745 // specify data to plot:
1746 TString desiredData(GetDrawString()->Data());
1748 TString cutsStr(GetCutString()->Data());
1749 // get name for the calPad
1750 const char* calPadName = fComboExportName->GetTextEntry()->GetText();
1751 // create calPad according to drawCommand and cuts
1752 AliTPCCalPad *calPad = fViewer->GetCalPad(desiredData.Data(), (char*)cutsStr.Data(), (char*)calPadName);
1753 // finally export calPad to Cint:
1754 gROOT->ProcessLine(Form("AliTPCCalPad* %s = (AliTPCCalPad*)0x%lx;", calPadName, calPad));
1755 fPreprocessor->AddComponent(calPad);
1756 Info("ExportCalPad", "Current 2D view has been exported to an AliTPCCalPad* with name '%s'", calPadName);
1760 void AliTPCCalibViewerGUI::DoExportNorm() {
1762 // function to export a CalPad to Cint
1765 if ( fRadio2D->GetState() != kButtonDown){
1766 Error("ExportCalPad", "Adding an AliTPCCalPad to the normalization works only in 2D mode.");
1770 Error("DoExportNorm", "Not yet implemented.");
1773 // specify data to plot:
1774 TString desiredData(GetDrawString()->Data());
1776 TString sectorStr(GetSectorString()->Data());
1778 TString cutsStr(GetCutString()->Data());
1780 // get name for the calPad
1781 const char* calPadName = fComboExportName->GetTextEntry()->GetText();
1782 // create calPad according to drawCommand and cuts
1783 AliTPCCalPad *calPad = fViewer->GetCalPad(desiredData.Data(), (char*)cutsStr.Data(), (char*)fComboExportName->GetTextEntry()->GetText());
1784 // finally export calPad to Cint:
1785 gROOT->ProcessLine(Form("AliTPCCalPad* %s = (AliTPCCalPad*)0x%lx;", calPadName, calPad));
1786 Info("ExportCalPad", "Current 2D view has been exported to an AliTPCCalPad* with name '%s'", calPadName);
1790 void AliTPCCalibViewerGUI::GetMinMax() {
1792 // Read current Min & Max from the plot and set it to fTxtSetMin & fTxtSetMax
1794 if (fChkGetMinMaxAuto->GetState() == kButtonUp) return;
1795 TList* listOfPrimitives = fCanvMain->GetCanvas()->GetListOfPrimitives();
1797 for (Int_t i = 0; i < listOfPrimitives->GetEntries(); i++) {
1798 ptr = listOfPrimitives->At(i);
1799 if ( ptr->InheritsFrom("TH1") ) break;
1801 if ( ptr != 0 && !ptr->InheritsFrom("TH1") ) return; // if the loop did not find a TH1
1802 TH1 *hist = (TH1*)ptr;
1804 // Double_t histMax = hist->GetMaximum();
1805 // Double_t histMin = hist->GetMinimum();
1806 // fTxtSetMax->SetText(Form("%f",histMax));
1807 // fTxtSetMin->SetText(Form("%f",histMin));
1809 if (fRadio2D->GetState() == kButtonDown) {
1810 if (fChkSetMax->GetState() == kButtonUp)
1811 fTxtSetMax->SetText(Form("%f", hist->GetMaximum()));
1812 if (fChkSetMin->GetState() == kButtonUp)
1813 fTxtSetMin->SetText(Form("%f", hist->GetMinimum()));
1815 else if (fRadio1D->GetState() == kButtonDown) {
1816 if (fChkSetMax->GetState() == kButtonUp)
1817 fTxtSetMax->SetText( Form("%f", hist->GetXaxis()->GetXmax()) );
1818 if (fChkSetMin->GetState() == kButtonUp)
1819 fTxtSetMin->SetText( Form("%f", hist->GetXaxis()->GetXmin()) );
1824 void AliTPCCalibViewerGUI::SetMinMaxLabel() {
1826 // Set Minimum, Maximum and labels without redrawing the plot
1830 // search for histogram
1831 TList* listOfPrimitives = fCanvMain->GetCanvas()->GetListOfPrimitives();
1833 for (Int_t i = 0; i < listOfPrimitives->GetEntries(); i++) {
1834 ptr = listOfPrimitives->At(i);
1835 if ( ptr->InheritsFrom("TH1") ) break;
1837 if ( ptr == 0 || !ptr->InheritsFrom("TH1") ) { // if the loop did not find a TH1
1838 fCanvMain->GetCanvas()->Update();
1839 Warning("SetMinMaxLabel","No Histogram found!");
1841 // unable to find histogram, no min and max wil be read out
1844 TH1 *hist = (TH1*)ptr;
1845 TString minTxt(fTxtSetMin->GetText());
1846 TString maxTxt(fTxtSetMax->GetText());
1848 // set min and max according to specified values, if checkbox is checked
1849 if (fRadio2D->GetState() == kButtonDown) {
1850 if (fChkSetMax->GetState() == kButtonDown && fChkSetMax->GetState() == kButtonDown &&(maxTxt.IsDigit() || maxTxt.IsFloat()) )
1851 hist->SetMaximum(maxTxt.Atof());
1852 if (fChkSetMax->GetState() == kButtonUp)
1853 hist->SetMaximum(-1111); // default value, to unzoom
1854 if (fChkSetMin->GetState() == kButtonDown && (minTxt.IsDigit() || minTxt.IsFloat()) )
1855 hist->SetMinimum(minTxt.Atof());
1856 if (fChkSetMin->GetState() == kButtonUp)
1857 hist->SetMinimum(-1111); // default value, to unzoom
1859 else if (fRadio2D->GetState() == kButtonDown) {
1860 if (fChkSetMin->GetState() == kButtonDown &&
1861 fChkSetMax->GetState() == kButtonDown && hist->GetXaxis())
1862 hist->GetXaxis()->SetRangeUser(hist->GetXaxis()->GetXmin(), hist->GetXaxis()->GetXmax());
1863 else if (fChkSetMax->GetState() == kButtonDown && hist->GetXaxis())
1864 hist->GetXaxis()->SetRangeUser(hist->GetXaxis()->GetXmin(), maxTxt.Atof());
1865 else if (fChkSetMin->GetState() == kButtonDown && hist->GetXaxis())
1866 hist->GetXaxis()->SetRangeUser(minTxt.Atof(), hist->GetXaxis()->GetXmax());
1867 hist->SetTitle(hist->GetTitle()); // trick to update the histogram
1870 // get min and max from plot
1873 // set labels according to specification, if cehckboxes are checked
1874 if (fChkLabelTitle->GetState() == kButtonDown)
1875 hist->SetTitle(fTxtLabelTitle->GetText());
1876 if (fChkLabelXaxis->GetState() == kButtonDown)
1877 hist->GetXaxis()->SetTitle(fTxtLabelXaxis->GetText());
1878 if (fChkLabelYaxis->GetState() == kButtonDown)
1879 hist->GetYaxis()->SetTitle(fTxtLabelYaxis->GetText());
1880 // get and/or set labels and title
1881 if (fChkLabelGetAuto->GetState() == kButtonDown) {
1882 fTxtLabelTitle->SetText(hist->GetTitle());
1883 fTxtLabelXaxis->SetTitle(hist->GetXaxis()->GetTitle());
1884 fTxtLabelYaxis->SetTitle(hist->GetYaxis()->GetTitle());
1886 hist->SetTitle(hist->GetTitle()); // trick to update the histogram
1887 fCanvMain->GetCanvas()->Update();
1891 void AliTPCCalibViewerGUI::ChangeSector(){
1893 // function that is called, when the number of the sector is changed
1894 // to change the sector label
1896 Int_t sector = (Int_t)(fNmbSector->GetNumber());
1897 char* secLabel = "";
1898 if (sector >= 0 && sector <= 17) // IROC, Side A
1899 secLabel = "IROC, A";
1900 if (sector >= 18 && sector <= 35) // IROC, Side C
1901 secLabel = "IROC, C";
1902 if (sector >= 36 && sector <= 53) // OROC, Side A
1903 secLabel = "OROC, A";
1904 if (sector >= 54 && sector <= 71) // OROC, Side C
1905 secLabel = "OROC, C";
1906 fLblSector->SetText(secLabel);
1911 void AliTPCCalibViewerGUI::AddFitFunction() const {
1913 // adds the last fit function to the normalization list
1915 std::cout << "Not yet implemented." << std::endl;
1919 void AliTPCCalibViewerGUI::UnchekAllStat() {
1921 // Disable all statistical legend entries, no statistical legend.
1923 fChkStatName->SetState(kButtonUp);
1924 fChkStatEntries->SetState(kButtonUp);
1925 fChkStatMean->SetState(kButtonUp);
1926 fChkStatMeanPM->SetState(kButtonUp);
1927 fChkStatRMS->SetState(kButtonUp);
1928 fChkStatRMSPM->SetState(kButtonUp);
1929 fChkStatUnderflow->SetState(kButtonUp);
1930 fChkStatOverflow->SetState(kButtonUp);
1931 fChkStatIntegral->SetState(kButtonUp);
1932 fChkStatSkewness->SetState(kButtonUp);
1933 fChkStatSkewnessPM->SetState(kButtonUp);
1934 fChkStatKurtosis->SetState(kButtonUp);
1935 fChkStatKurtosisPM->SetState(kButtonUp);
1937 HandleButtonsStat(0);
1941 void AliTPCCalibViewerGUI::MouseMove(Int_t event, Int_t x, Int_t y, TObject *selectedObject) {
1944 // zoom to sector works ONLY in 2D mode, if one side is specified
1946 Double_t pi = TMath::Pi();
1947 if (event != kButton1Double )
1949 if (!selectedObject->InheritsFrom("TH2")) return;
1950 // zoom to sector works ONLY in 2D mode, if one side is specified
1951 if (fRadio2D->GetState() == kButtonUp) return;
1952 if (fRadioSector->GetState() == kButtonDown) { // return to full side view
1953 // return to full side view
1954 Int_t sector = (Int_t)(fNmbSector->GetNumber());
1955 if ( (sector >= 0 && sector <= 17) || (sector >= 36 && sector <= 53) ) {
1957 fRadioSideA->Clicked();
1958 fRadioSideA->SetState(kButtonDown);
1961 if ( (sector >= 18 && sector <= 35) || (sector >= 54 && sector <= 71) ) {
1963 fRadioSideC->Clicked();
1964 fRadioSideC->SetState(kButtonDown);
1969 if (!(fRadioSideA->GetState() == kButtonDown || fRadioSideC->GetState() == kButtonDown)) return;
1971 // Int_t px = gPad->GetEventX();
1972 // Int_t py = gPad->GetEventY();
1973 Float_t upy = gPad->AbsPixeltoY(y);
1974 Float_t upx = gPad->AbsPixeltoX(x);
1975 Float_t gy = gPad->PadtoY(upy);
1976 Float_t gx = gPad->PadtoX(upx);
1977 Int_t quadrant = -1;
1978 if (gx >= 0 && gy >= 0) quadrant = 1;
1979 if (gx < 0 && gy >= 0) quadrant = 2;
1980 if (gx < 0 && gy < 0) quadrant = 3;
1981 if (gx >= 0 && gy < 0) quadrant = 4;
1982 gx = TMath::Abs(gx);
1983 gy = TMath::Abs(gy);
1984 Double_t phi = TMath::ATan(gy/gx); // angle phi is in Pi- units
1985 Double_t r = TMath::Sqrt(gx*gx + gy*gy);
1986 if (quadrant == 2) phi = pi - phi;
1987 if (quadrant == 3) phi = pi + phi;
1988 if (quadrant == 4) phi = 2 * pi - phi;
1989 Double_t phiGrad = phi / pi * 180;
1990 Int_t sector = (Int_t) phiGrad / 20; // one sector coresponds to 20°
1991 // IROC starts at 84.5 cm
1992 // IROC ends at 135.5 cm, OROC begins
1993 // OROC ends at 250 cm
1994 if (r < 84.5 || r > 250) return; // outside TPC
1995 if (r < 135.5) { // IROC
1996 if (fRadioSideC->GetState() == kButtonDown) sector += 18;
2000 if (fRadioSideC->GetState() == kButtonDown) sector += 18;
2002 // printf("r: %f, phi: %f, phiGrad: %f, gy/gx: %f, quadrant: %i, sector: %i \n", r, phi, phiGrad, gy/gx, quadrant, sector);
2003 fNmbSector->SetNumber(sector);
2004 fRadioSector->Clicked();
2005 fRadioSector->SetState(kButtonDown);
2010 void AliTPCCalibViewerGUI::SavePicture() {
2012 // saves the current picture
2014 // use the following combination of file type and save options:
2015 // (see also TCanvas::Print)
2017 // "ps" - Postscript file is produced (see special cases below)
2018 // "Portrait" - Postscript file is produced (Portrait)
2019 // "Landscape" - Postscript file is produced (Landscape)
2020 // "eps" - an Encapsulated Postscript file is produced
2021 // "Preview" - an Encapsulated Postscript file with preview is produced.
2022 // "pdf" - a PDF file is produced
2023 // "svg" - a SVG file is produced
2024 // "gif" - a GIF file is produced
2025 // "gif+NN" - an animated GIF file is produced, where NN is delay in 10ms units
2026 // "xpm" - a XPM file is produced
2027 // "png" - a PNG file is produced
2028 // "jpg" - a JPEG file is produced
2029 // "tiff" - a TIFF file is produced
2030 // "cxx" - a C++ macro file is produced
2031 // "xml" - a XML file
2032 // "root" - a ROOT binary file
2034 const char *kSaveAsTypes[] = {
2035 "Postscript", "*.ps",
2036 "Encapsulated Postscript", "*.eps",
2045 "C++ macro", "*.cxx",
2046 "Macro file", "*.C",
2047 "ROOT file", "*.root",
2051 TString addSaveOpt("");
2052 if (fChkAddSaveOpt->GetState() == kButtonDown)
2053 addSaveOpt += fComboAddSaveOpt->GetTextEntry()->GetText();
2056 fi.fFileTypes = kSaveAsTypes;
2057 // fi.fIniDir = StrDup(dir);
2058 fi.fOverwrite = kFALSE;
2059 new TGFileDialog(gClient->GetRoot(), gClient->GetRoot(), kFDSave, &fi);
2060 if (fi.fFilename && strlen(fi.fFilename)) {
2061 if (addSaveOpt != "")
2062 fCanvMain->GetCanvas()->Print(fi.fFilename, addSaveOpt.Data());
2064 fCanvMain->GetCanvas()->Print(fi.fFilename);
2067 // TList* fFileNamesList list of selected file names
2068 // Int_t fFileTypeIdx selected file type, index in fFileTypes
2069 // const char** fFileTypes file types used to filter selectable files
2070 // char* fFilename selected file name
2071 // char* fIniDir on input: initial directory, on output: new directory
2072 // Bool_t fMultipleSelection if true, allow multiple file selection
2073 // Bool_t fOverwrite if true overwrite the file with existing name on save
2078 void AliTPCCalibViewerGUI::DoDumpToFile() {
2080 // This function is called, when the "Dump to File" button is pressed.
2081 // All the exported CalPads will be written into an new CalibTree,
2082 // a Save File dialog will appear to specify the filename
2084 const char *kSaveAsTypes[] = {
2085 "ROOT file", "*.root",
2090 fi.fFileTypes = kSaveAsTypes;
2091 // fi.fIniDir = StrDup(dir);
2092 fi.fOverwrite = kFALSE;
2093 new TGFileDialog(gClient->GetRoot(), gClient->GetRoot(), kFDSave, &fi);
2094 if (fi.fFilename && strlen(fi.fFilename)) {
2095 fPreprocessor->DumpToFile(fi.fFilename);
2096 Info("DumpToFile", Form("New CalibTree has been writen to file '%s'", fi.fFilename));
2101 void AliTPCCalibViewerGUI::DoLoadTree() {
2102 // function to load a new calib tree
2105 const char *kFileTypes[] = {
2106 "ROOT file", "*.root",
2111 fi.fFileTypes = kFileTypes;
2112 // fi.fIniDir = StrDup(dir);
2113 fi.fOverwrite = kFALSE;
2114 new TGFileDialog(gClient->GetRoot(), gClient->GetRoot(), kFDOpen, &fi);
2115 if (fi.fFilename && strlen(fi.fFilename) && fChkAddAsReference->GetState() == kButtonUp) {
2116 Initialize(fi.fFilename);
2119 else if (fi.fFilename && strlen(fi.fFilename) && fChkAddAsReference->GetState() == kButtonDown) {
2120 fViewer->AddReferenceTree(fi.fFilename, "calPads", fTxtRefName->GetText());
2126 TObjArray* AliTPCCalibViewerGUI::ShowGUI(const char* fileName) {
2128 // Initialize and show GUI for presentation for demonstration purposes
2129 // or for fast standalone use
2131 TGMainFrame* frmMain = new TGMainFrame(gClient->GetRoot(), 1000, 600);
2132 frmMain->SetWindowName("AliTPCCalibViewer GUI");
2133 frmMain->SetCleanup(kDeepCleanup);
2135 TGTab* tabMain = new TGTab(frmMain, 1000, 600);
2136 frmMain->AddFrame(tabMain, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
2138 TGCompositeFrame* tabCont1 = tabMain->AddTab("Viewer 1");
2139 TGCompositeFrame* tabCont2 = tabMain->AddTab("Viewer 2");
2141 AliTPCCalibViewerGUI* calibViewer1 = new AliTPCCalibViewerGUI(tabCont1, 1000, 600, (char*)fileName);
2142 tabCont1->AddFrame(calibViewer1, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
2144 AliTPCCalibViewerGUI* calibViewer2 = new AliTPCCalibViewerGUI(tabCont2, 1000, 600, (char*)fileName);
2145 tabCont2->AddFrame(calibViewer2, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
2147 TObjArray *guiArray = new TObjArray();
2148 guiArray->Add(calibViewer1);
2149 guiArray->Add(calibViewer2);
2151 frmMain->MapSubwindows();
2153 frmMain->MapWindow();