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"
35 #include "AliTPCCalPad.h"
40 #include <TVirtualPad.h>
44 #include <TObjArray.h>
45 #include <TObjString.h>
50 #include "TGFileDialog.h"
51 #include "TGInputDialog.h"
52 #include "AliTPCCalibViewer.h"
53 #include "AliTPCPreprocessorOnline.h"
55 // #include "TGListBox.h"
56 // #include "TGNumberEntry"
57 // #include "TGSplitter"
60 // #include "TGButtonGroup"
61 // #include "TGComboBox"
62 // #include "TRootEmbeddedCanvas"
63 // #include "TGButton"
64 // #include "TGRadioButton"
65 // #include "GTCheckButton"
66 // #include "TGTextEntry"
71 ClassImp(AliTPCCalibViewerGUI)
73 AliTPCCalibViewerGUI::AliTPCCalibViewerGUI(const TGWindow *p, UInt_t w, UInt_t h, char* fileName)
74 : TGCompositeFrame(p, w, h),
90 fContDrawOptSub1D2D(0),
105 fBtnAddFitFunction(0),
123 fListNormalization(0),
136 fChkGetMinMaxAuto(0),
140 fcontDrawOpt1DSubLR(0),
141 fContDrawOpt1DSubNSC(0),
151 fCheckCumulativePM(0),
153 fContDrawOpt1DSubMML(0),
166 fChkStatUnderflow(0),
171 fChkStatSkewnessPM(0),
174 fChkStatKurtosisPM(0),
197 fChkAddAsReference(0),
202 // AliTPCCalibViewerGUI constructor; fileName specifies the ROOT tree used for drawing
206 fPreprocessor = new AliTPCPreprocessorOnline();
208 // initialize the AliTPCCalibViewer:
209 if (fileName) Initialize(fileName);
210 // set default button states:
213 if (fileName) DoDraw();
217 void AliTPCCalibViewerGUI::DrawGUI(const TGWindow */*p*/, UInt_t w, UInt_t h) {
221 // ======================================================================
222 // ************************* Display everything *************************
223 // ======================================================================
225 SetCleanup(kDeepCleanup);
227 // *****************************************************************************
228 // ************************* content of this MainFrame *************************
229 // *****************************************************************************
230 // top level container with horizontal layout
231 fContTopBottom = new TGCompositeFrame(this, w, h, kVerticalFrame | kFixedWidth | kFixedHeight);
232 AddFrame(fContTopBottom, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
234 fContLCR = new TGCompositeFrame(fContTopBottom, w, h, kHorizontalFrame | kFixedWidth | kFixedHeight);
235 fContTopBottom->AddFrame(fContLCR, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
237 // ***********************************************************************
238 // ************************* content of fContLCR *************************
239 // ***********************************************************************
241 fContLeft = new TGCompositeFrame(fContLCR, 200, 200, kVerticalFrame | kFixedWidth | kFitHeight);
242 fContLCR->AddFrame(fContLeft, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandY, 5, 3, 3, 3));
244 // left vertical splitter
245 TGVSplitter *splitLeft = new TGVSplitter(fContLCR);
246 splitLeft->SetFrame(fContLeft, kTRUE);
247 fContLCR->AddFrame(splitLeft, new TGLayoutHints(kLHintsLeft | kLHintsExpandY, 0, 0, 0, 0));
250 fContRight = new TGCompositeFrame(fContLCR, 150, 200, kVerticalFrame | kFixedWidth | kFitHeight);
251 fContLCR->AddFrame(fContRight, new TGLayoutHints(kLHintsTop | kLHintsRight | kLHintsExpandY, 3, 5, 3, 3));
254 fContCenter = new TGCompositeFrame(fContLCR, 200, 200, kVerticalFrame | kFixedWidth | kFitHeight);
255 fContLCR->AddFrame(fContCenter, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
257 // right vertical splitter
258 TGVSplitter *splitRight = new TGVSplitter(fContLCR);
259 splitRight->SetFrame(fContRight, kFALSE);
260 fContLCR->AddFrame(splitRight, new TGLayoutHints(kLHintsLeft | kLHintsExpandY, 0, 0, 0, 0));
263 // ========================================================================
264 // ************************* content of fContLeft *************************
265 // ========================================================================
266 // --- draw button and tabLeft ---
268 fBtnDraw = new TGTextButton(fContLeft, "&Draw");
269 fContLeft->AddFrame(fBtnDraw, new TGLayoutHints(kLHintsExpandX, 10, 10, 0, 0));
270 //fBtnDraw->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoTest(=\"fBtnDraw clicked\")");
271 fBtnDraw->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoDraw()");
272 fBtnDraw->SetToolTipText("Press here to draw according to selections.");
274 // tabs on the left side:
275 ftabLeft = new TGTab(fContLeft);
276 fContLeft->AddFrame(ftabLeft, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 8, 0));
277 ftabLeft0 = ftabLeft->AddTab("General");
278 ftabLeft1 = ftabLeft->AddTab("More plot options");
281 // **************************** content of tabLeft0 *******************************
283 // draw options container *** fcontDrawOpt *** " Plot options "
284 fContDrawOpt = new TGGroupFrame(ftabLeft0, "Plot options", kVerticalFrame | kFitWidth | kFitHeight);
285 ftabLeft0->AddFrame(fContDrawOpt, new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0));
286 fContDrawOptSub1D2D = new TGCompositeFrame(fContDrawOpt, 200, 23, kHorizontalFrame | kFitWidth | kFixedHeight);
287 fContDrawOpt->AddFrame(fContDrawOptSub1D2D, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
289 // ------------------------- content of fContDrawOpt -------------------------
290 // -- radio1D, radio2D, chkAuto
292 fRadio1D = new TGRadioButton(fContDrawOptSub1D2D, "1D", 30);
293 fContDrawOptSub1D2D->AddFrame(fRadio1D, new TGLayoutHints(kLHintsNormal, 0, 2, 0, 0));
294 fRadio1D->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsGeneral()");
295 fRadio1D->SetToolTipText("1D drawing \nSelect this if you want to have the full control for the custom draw.");
298 fRadio2D = new TGRadioButton(fContDrawOptSub1D2D, "2D", 31);
299 fContDrawOptSub1D2D->AddFrame(fRadio2D, new TGLayoutHints(kLHintsNormal, 2, 2, 0, 0));
300 fRadio2D->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsGeneral()");
301 fRadio2D->SetToolTipText("2D drawing");
303 // additional draw options container
304 fContAddDrawOpt = new TGCompositeFrame(fContDrawOpt, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
305 fContDrawOpt->AddFrame(fContAddDrawOpt, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
307 // content of --- fContAddDrawOpt ---
308 // addition draw options label
309 fChkAddDrawOpt = new TGCheckButton(fContAddDrawOpt, "Draw options:");
310 //fChkAddDrawOpt->SetTextJustify(kTextLeft);
311 fContAddDrawOpt->AddFrame(fChkAddDrawOpt, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
312 fChkAddDrawOpt->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoNewSelection()");
313 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).");
315 // additional draw options combo box
316 fComboAddDrawOpt = new TGComboBox(fContAddDrawOpt);
317 fComboAddDrawOpt->Resize(0, fBtnDraw->GetDefaultHeight());
318 fComboAddDrawOpt->EnableTextInput(kTRUE);
319 fContAddDrawOpt->AddFrame(fComboAddDrawOpt, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
320 fComboAddDrawOpt->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsGeneral(=14)");
321 fComboAddDrawOpt->Connect("Selected(Int_t)", "AliTPCCalibViewerGUI", this, "DoNewSelection()");
323 // automatic redraw check button
324 fChkAuto = new TGCheckButton(fContDrawOpt, "Auto redraw");
325 fContDrawOpt->AddFrame(fChkAuto, new TGLayoutHints(kLHintsNormal, 0, 2, 0, 0));
326 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'.");
328 // automatic append ending check button
329 fChkAutoAppend = new TGCheckButton(fContDrawOpt, "Auto add appending");
330 fContDrawOpt->AddFrame(fChkAutoAppend, new TGLayoutHints(kLHintsNormal, 0, 2, 0, 0));
331 fChkAutoAppend->SetToolTipText("Tries to repair your custom draw string or custom cut string, if you forgot '~' or '.fElements' \nThis function may be buggy!");
334 // *** predefined radio button *** " Predefined "
335 fRadioPredefined = new TGRadioButton(ftabLeft0, "Predefined: ", 13);
336 ftabLeft0->AddFrame(fRadioPredefined, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
337 fRadioPredefined->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsGeneral()");
338 fRadioPredefined->SetToolTipText("Draw predefined variables according to selection.");
341 fListVariables = new TGListBox(ftabLeft0);
342 ftabLeft0->AddFrame(fListVariables, new TGLayoutHints(kLHintsNormal | kLHintsExpandX | kLHintsExpandY, 10, 0, 0, 0));
343 fListVariables->Connect("Selected(Int_t)", "AliTPCCalibViewerGUI", this, "DoNewSelection()");
346 // normalization options container *** fContPlotOpt ***
347 //fContPlotOpt = new TGCompositeFrame(fContLeft, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
348 fContPlotOpt = new TGGroupFrame(ftabLeft0, "Normalization options", kVerticalFrame | kFitWidth | kFitHeight);
349 ftabLeft0->AddFrame(fContPlotOpt, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10, 0, 0, 0));
351 // ------------------------- content of fContPlotOpt -------------------------
353 fRadioRaw = new TGRadioButton(fContPlotOpt, "Raw", 10);
354 fContPlotOpt->AddFrame(fRadioRaw, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
355 fRadioRaw->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsGeneral()");
356 fRadioRaw->SetToolTipText("Plot without normalization");
358 // normalized radio button
359 fRadioNormalized = new TGRadioButton(fContPlotOpt, "Normalized", 11);
360 fContPlotOpt->AddFrame(fRadioNormalized, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
361 fRadioNormalized->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsGeneral()");
362 fRadioNormalized->SetToolTipText("Normalize data");
364 // normalized options container *** fContNormalized ***
365 fContNormalized = new TGCompositeFrame(fContPlotOpt, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
366 fContPlotOpt->AddFrame(fContNormalized, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 15, 0, 0, 0));
368 // --- content of fContNormalized ---
369 // --- combo box to select 'subtract' or 'divide', list of normalization variables
370 // method drop down combo box
371 fComboMethod = new TGComboBox(fContNormalized);
372 fComboMethod->Resize(0, fBtnDraw->GetDefaultHeight());
373 fContNormalized->AddFrame(fComboMethod, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
374 fComboMethod->Connect("Selected(Int_t)", "AliTPCCalibViewerGUI", this, "DoNewSelection()");
376 // list of normalization variables
377 fListNormalization = new TGListBox(fContNormalized);
378 fContNormalized->AddFrame(fListNormalization, new TGLayoutHints(kLHintsNormal | kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
379 fListNormalization->Connect("Selected(Int_t)", "AliTPCCalibViewerGUI", this, "DoNewSelection()");
381 // custom radio button
382 fRadioCustom = new TGRadioButton(ftabLeft0, "Custom: ", 12);
383 ftabLeft0->AddFrame(fRadioCustom, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
384 fRadioCustom->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsGeneral()");
385 fRadioCustom->SetToolTipText("Draw data according to user specific text entry in the 'Custom Draw' line. Remember '~' (= '.fElements')!");
386 // custom options container is located further down
388 // **************************** content of tabLeft1 *******************************
390 // draw options container *** fcontDrawOpt1D *** " Plot options "
391 fContDrawOpt1D = new TGGroupFrame(ftabLeft1, "1D Plot options", kVerticalFrame | kFitWidth | kFitHeight);
392 ftabLeft1->AddFrame(fContDrawOpt1D, new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0));
394 fcontDrawOpt1DSubLR = new TGCompositeFrame(fContDrawOpt1D, 1, 1, kVerticalFrame | kFitWidth | kFitHeight);
395 fContDrawOpt1D->AddFrame(fcontDrawOpt1DSubLR, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
397 // ***** content of fContDrawOpt1DSubLR *****
398 fContDrawOpt1DSubNSC = new TGCompositeFrame(fcontDrawOpt1DSubLR, 200, 23, kVerticalFrame | kFitWidth | kFitHeight);
399 fcontDrawOpt1DSubLR->AddFrame(fContDrawOpt1DSubNSC, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
401 // --------------------------- content of fContDrawOpt1DSubNSC -----------------
402 fRadioNorm = new TGRadioButton(fContDrawOpt1DSubNSC, "Normal", 110);
403 fContDrawOpt1DSubNSC->AddFrame(fRadioNorm, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
404 fRadioNorm->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtons1D()");
405 fRadioNorm->SetToolTipText("Produce a normal 1D plot, a histogram of the selected data.");
407 fRadioSigma = new TGRadioButton(fContDrawOpt1DSubNSC, "Sigma", 111);
408 fContDrawOpt1DSubNSC->AddFrame(fRadioSigma, new TGLayoutHints(kLHintsNormal, 0, 0, 5, 0));
409 fRadioSigma->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtons1D()");
410 fRadioSigma->SetToolTipText("Draw a normal histogram, but also lines that indicate the mean/median/LTM \nand sigmas of the selected data.");
412 fTxtSigmas = new TGTextEntry(fContDrawOpt1DSubNSC, "2; 4; 6", 111);
413 fContDrawOpt1DSubNSC->AddFrame(fTxtSigmas, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 10, 15, 0, 0));
414 fTxtSigmas->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtons1D(=111)");
415 fTxtSigmas->SetToolTipText("Enter sigma intervals you would like to be indicated by lines. \nExample: '2; 4; 6'");
417 fContCumuLR = new TGCompositeFrame(fContDrawOpt1DSubNSC, 200, 23, kHorizontalFrame | kFitWidth | kFitHeight);
418 fContDrawOpt1DSubNSC->AddFrame(fContCumuLR, new TGLayoutHints(kLHintsExpandX, 0, 0, 5, 0));
420 fContCumLeft = new TGCompositeFrame(fContCumuLR, 200, 23, kVerticalFrame | kFitWidth | kFitHeight);
421 fContCumuLR->AddFrame(fContCumLeft, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
423 fRadioCumulative = new TGRadioButton(fContCumLeft, "Cumulative", 112);
424 fContCumLeft->AddFrame(fRadioCumulative, new TGLayoutHints(kLHintsNormal, 0, 10, 0, 0));
425 fRadioCumulative->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtons1D()");
426 fRadioCumulative->SetToolTipText("Draw the cumulative (SigmaCut) of the given selection. \nThe data distribution is integrated, starting from the mean/median/LTM.");
428 fCheckCumulativePM = new TGCheckButton(fContCumLeft, "Plus/Minus");
429 fContCumLeft->AddFrame(fCheckCumulativePM, new TGLayoutHints(kLHintsNormal, 10, 15, 0, 0));
430 fCheckCumulativePM->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtons1D()");
431 fCheckCumulativePM->SetToolTipText("Decide whether you want the cumulative integration for each direction (+/-) \nor only for the absolute distance to the mean/median/LTM value.");
433 fRadioIntegrate = new TGRadioButton(fContCumLeft, "Integrate", 113);
434 fContCumLeft->AddFrame(fRadioIntegrate, new TGLayoutHints(kLHintsNormal, 0, 0, 5, 0));
435 fRadioIntegrate->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtons1D()");
436 fRadioIntegrate->SetToolTipText("Draw the integral of the given selection.");
438 fContCumRight = new TGCompositeFrame(fContCumuLR, 200, 23, kVerticalFrame | kFitWidth | kFitHeight);
439 fContCumuLR->AddFrame(fContCumRight, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
441 fLblSigmaMax = new TGLabel(fContCumRight, "SigmaMax:");
442 fLblSigmaMax->SetTextJustify(kTextLeft);
443 fContCumRight->AddFrame(fLblSigmaMax, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 5, 0, 0, 0));
445 fTxtSigmaMax = new TGTextEntry(fContCumRight, "5", 112);
446 fContCumRight->AddFrame(fTxtSigmaMax, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 10, 15, 0, 0));
447 fTxtSigmaMax->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtons1D(=112)");
448 fTxtSigmaMax->SetToolTipText("Enter up to which multiple of sigma you want to integrate.");
451 fContDrawOpt1DSubMML = new TGCompositeFrame(fcontDrawOpt1DSubLR, 200, 23, kHorizontalFrame | kFitWidth | kFitHeight);
452 fcontDrawOpt1DSubLR->AddFrame(fContDrawOpt1DSubMML, new TGLayoutHints(kLHintsExpandX, 0, 0, 5, 0));
454 // -------------- content of fcontDrawOpt1DSubLR
455 fChkMean = new TGCheckButton(fContDrawOpt1DSubMML, "Mean");
456 fContDrawOpt1DSubMML->AddFrame(fChkMean, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
457 fChkMean->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtons1D()");
458 fChkMean->SetToolTipText("Activate Mean for Sigma/Cumulative/Integrate");
460 fChkMedian = new TGCheckButton(fContDrawOpt1DSubMML, "Median");
461 fContDrawOpt1DSubMML->AddFrame(fChkMedian, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
462 fChkMedian->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtons1D()");
463 fChkMedian->SetToolTipText("Activate Median for Sigma/Cumulative/Integrate");
465 fChkLTM = new TGCheckButton(fContDrawOpt1DSubMML, "LTM");
466 fContDrawOpt1DSubMML->AddFrame(fChkLTM, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
467 fChkLTM->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtons1D()");
468 fChkLTM->SetToolTipText("Activate LTM for Sigma/Cumulative/Integrate");
471 // statistic options container *** fcontStatOpt1D *** " Statistic options "
472 fContStatOpt = new TGGroupFrame(ftabLeft1, "Statistic options", kVerticalFrame | kFitWidth | kFitHeight);
473 ftabLeft1->AddFrame(fContStatOpt, new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0));
475 fChkStatName = new TGCheckButton(fContStatOpt, "Name");
476 fContStatOpt->AddFrame(fChkStatName, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
477 fChkStatName->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
478 fChkStatName->SetToolTipText("Display the name in the statistics legend.");
480 fChkStatEntries = new TGCheckButton(fContStatOpt, "Entries");
481 fContStatOpt->AddFrame(fChkStatEntries, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
482 fChkStatEntries->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
483 fChkStatEntries->SetToolTipText("Display the number of entries in the statistics legend.");
485 fContStatMean = new TGCompositeFrame(fContStatOpt, 1, 1, kHorizontalFrame | kFitWidth | kFitHeight);
486 fContStatOpt->AddFrame(fContStatMean, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
488 fChkStatMean = new TGCheckButton(fContStatMean, "Mean");
489 fContStatMean->AddFrame(fChkStatMean, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
490 fChkStatMean->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
491 fChkStatMean->SetToolTipText("Display the mean value of the data in the statistics legend.");
493 fChkStatMeanPM = new TGCheckButton(fContStatMean, "+- Error");
494 fContStatMean->AddFrame(fChkStatMeanPM, new TGLayoutHints(kLHintsNormal, 10, 0, 0, 0));
495 fChkStatMeanPM->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
496 fChkStatMeanPM->SetToolTipText("Display the mean value's error in the statistics legend.");
498 fContStatRMS = new TGCompositeFrame(fContStatOpt, 1, 1, kHorizontalFrame | kFitWidth | kFitHeight);
499 fContStatOpt->AddFrame(fContStatRMS, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
501 fChkStatRMS = new TGCheckButton(fContStatRMS, "RMS");
502 fContStatRMS->AddFrame(fChkStatRMS, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
503 fChkStatRMS->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
504 fChkStatRMS->SetToolTipText("Display the RMS value of the data in the statistics legend.");
506 fChkStatRMSPM = new TGCheckButton(fContStatRMS, "+- Error");
507 fContStatRMS->AddFrame(fChkStatRMSPM, new TGLayoutHints(kLHintsNormal, 10, 0, 0, 0));
508 fChkStatRMSPM->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
509 fChkStatRMSPM->SetToolTipText("Display the RMS value's error in the statistics legend.");
511 fChkStatUnderflow = new TGCheckButton(fContStatOpt, "Underflow");
512 fContStatOpt->AddFrame(fChkStatUnderflow, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
513 fChkStatUnderflow->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
514 fChkStatUnderflow->SetToolTipText("Display the number of entries in the underflow bin.");
516 fChkStatOverflow = new TGCheckButton(fContStatOpt, "Overflow");
517 fContStatOpt->AddFrame(fChkStatOverflow, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
518 fChkStatOverflow->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
519 fChkStatOverflow->SetToolTipText("Display the number of entries in the overflow bin.");
521 fChkStatIntegral = new TGCheckButton(fContStatOpt, "Integral");
522 fContStatOpt->AddFrame(fChkStatIntegral, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
523 fChkStatIntegral->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
524 fChkStatIntegral->SetToolTipText("Display the integral of the data in the statistics legend.");
526 fContStatSkew = new TGCompositeFrame(fContStatOpt, 1, 1, kHorizontalFrame | kFitWidth | kFitHeight);
527 fContStatOpt->AddFrame(fContStatSkew, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
529 fChkStatSkewness = new TGCheckButton(fContStatSkew, "Skewness");
530 fContStatSkew->AddFrame(fChkStatSkewness, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
531 fChkStatSkewness->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
532 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!");
534 fChkStatSkewnessPM = new TGCheckButton(fContStatSkew, "+- Error");
535 fContStatSkew->AddFrame(fChkStatSkewnessPM, new TGLayoutHints(kLHintsNormal, 10, 0, 0, 0));
536 fChkStatSkewnessPM->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
537 fChkStatSkewnessPM->SetToolTipText("Display the skewness' error in the statistics legend.");
539 fContStatKurt = new TGCompositeFrame(fContStatOpt, 1, 1, kHorizontalFrame | kFitWidth | kFitHeight);
540 fContStatOpt->AddFrame(fContStatKurt, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
542 fChkStatKurtosis = new TGCheckButton(fContStatKurt, "Kurtosis");
543 fContStatKurt->AddFrame(fChkStatKurtosis, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
544 fChkStatKurtosis->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
545 fChkStatKurtosis->SetToolTipText("Display the kurtosis of the data in the statistics legend.");
547 fChkStatKurtosisPM = new TGCheckButton(fContStatKurt, "+- Error");
548 fContStatKurt->AddFrame(fChkStatKurtosisPM, new TGLayoutHints(kLHintsNormal, 10, 0, 0, 0));
549 fChkStatKurtosisPM->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
550 fChkStatKurtosisPM->SetToolTipText("Display the kurtosis' error in the statistics legend.");
552 fBtnUnchekAll = new TGTextButton(fContStatOpt, "&Uncheck all");
553 fContStatOpt->AddFrame(fBtnUnchekAll, new TGLayoutHints(kLHintsExpandX, 10, 10, 0, 0));
554 //fBtnDraw->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoTest(=\"fBtnDraw clicked\")");
555 fBtnUnchekAll->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "UnchekAllStat()");
556 fBtnUnchekAll->SetToolTipText("Disable all statistics legend entries, \nno statistics legend.");
559 // custom options container
560 // --- fComboCustom --- the custom draw line on the very low
561 fContCustom = new TGCompositeFrame(fContTopBottom, 200, 200, kHorizontalFrame | kFitWidth | kFitHeight);
562 fContTopBottom->AddFrame(fContCustom, new TGLayoutHints(kLHintsExpandX, 10, 0, 0, 0));
564 // ------------------------- content of fContCustom -------------------------
565 fLblCustomDraw = new TGLabel(fContCustom, "Custom draw: ");
566 fLblCustomDraw->SetTextJustify(kTextLeft);
567 fContCustom->AddFrame(fLblCustomDraw, new TGLayoutHints(kLHintsNormal, 5, 0, 0, 0));
568 // text field for custom draw command
569 fComboCustom = new TGComboBox(fContCustom);
570 fComboCustom->Resize(0, fBtnDraw->GetDefaultHeight());
571 fComboCustom->EnableTextInput(kTRUE);
572 fContCustom->AddFrame(fComboCustom, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
573 fComboCustom->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsGeneral(=42)");
574 fComboCustom->Connect("Selected(Int_t)", "AliTPCCalibViewerGUI", this, "DoNewSelection()");
577 // additional cuts container
578 fContAddCuts = new TGCompositeFrame(fContTopBottom, 200, 200, kHorizontalFrame | kFitWidth | kFitHeight);
579 fContTopBottom->AddFrame(fContAddCuts, new TGLayoutHints(kLHintsExpandX, 10, 0, 0, 0));
581 // ------------------------- content of fContAddCuts -------------------------
582 fLblAddCuts = new TGLabel(fContAddCuts, "Custom cuts: ");
583 fLblAddCuts->SetTextJustify(kTextLeft);
584 fContAddCuts->AddFrame(fLblAddCuts, new TGLayoutHints(kLHintsNormal, 5, 0, 0, 0));
585 // combo text field for additional cuts
586 fComboAddCuts = new TGComboBox(fContAddCuts);
587 fComboAddCuts->Resize(0, fBtnDraw->GetDefaultHeight());
588 fComboAddCuts->EnableTextInput(kTRUE);
589 fContAddCuts->AddFrame(fComboAddCuts, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
590 fComboAddCuts->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsCuts(=31)");
591 fComboAddCuts->Connect("Selected(Int_t)", "AliTPCCalibViewerGUI", this, "DoNewSelection()");
593 // ==========================================================================
594 // ************************* content of fContCenter *************************
595 // ========================================================================
596 // main drawing canvas
597 fCanvMain = new TRootEmbeddedCanvas("Main_Canvas", fContCenter, 200, 200, kFitWidth | kFitHeight);
598 fContCenter->AddFrame(fCanvMain, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
599 fCanvMain->GetCanvas()->Connect("ProcessedEvent(Int_t, Int_t, Int_t, TObject*)", "AliTPCCalibViewerGUI", this, "MouseMove(Int_t, Int_t, Int_t, TObject*)");
600 fCanvMain->GetCanvas()->Connect("RangeAxisChanged()", "AliTPCCalibViewerGUI", this, "GetMinMax()");
601 fCanvMain->GetCanvas()->SetToolTipText("The Main_Canvas, here your plots are displayed.");
604 // =========================================================================
605 // ************************* content of fContRight *************************
606 // ========================================================================
608 // tabs on the right side:
609 ftabRight = new TGTab(fContRight);
610 fContRight->AddFrame(ftabRight, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 8, 0));
611 fTabRight0 = ftabRight->AddTab("Basic");
612 fTabRight1 = ftabRight->AddTab("Advanced");
615 // **************************** content of tabLeft0 *******************************
616 // cut options container
617 fContCuts = new TGGroupFrame(fTabRight0, "Cuts", kVerticalFrame | kFitWidth | kFitHeight);
618 fTabRight0->AddFrame(fContCuts, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
621 // ************************* content of fContCuts *************************
623 fRadioTPC = new TGRadioButton(fContCuts, "Whole TPC", 20);
624 fContCuts->AddFrame(fRadioTPC, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
625 fRadioTPC->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsCuts()");
626 fRadioTPC->SetToolTipText("No cuts, use the whole TPC. \nIn 2D mode, A side and C side are superimposed!");
628 // side A radio button
629 fRadioSideA = new TGRadioButton(fContCuts, "Side A", 21);
630 fContCuts->AddFrame(fRadioSideA, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
631 fRadioSideA->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsCuts()");
632 fRadioSideA->SetToolTipText("Use only side A.");
634 // side C radio button
635 fRadioSideC = new TGRadioButton(fContCuts, "Side C", 22);
636 fContCuts->AddFrame(fRadioSideC, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
637 fRadioSideC->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsCuts()");
638 fRadioSideC->SetToolTipText("Use only side C.");
641 fRadioROC = new TGRadioButton(fContCuts, "ROC", 23);
642 fContCuts->AddFrame(fRadioROC, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
643 fRadioROC->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsCuts()");
644 fRadioROC->SetToolTipText("Use only one ROC (readout chamber).");
646 // sector radio button
647 fRadioSector = new TGRadioButton(fContCuts, "Sector", 24);
648 fContCuts->AddFrame(fRadioSector, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
649 fRadioSector->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsCuts()");
650 fRadioSector->SetToolTipText("Use only one Sector (0-17 A-Side, 18-35 C-Side).");
652 // sector options container
653 fContSector = new TGCompositeFrame(fContCuts, 200, 200, kHorizontalFrame | kFitWidth | kFitHeight);
654 fContCuts->AddFrame(fContSector, new TGLayoutHints(kLHintsExpandX, 5, 0, 0, 0));
656 // ------------------------- content of fContSector -------------------------
657 // sector number entry
658 fNmbSector = new TGNumberEntry(fContSector, 0, 1, -1, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, 71);
659 fContSector->AddFrame(fNmbSector, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
660 fNmbSector->Connect("ValueSet(Long_t)", "AliTPCCalibViewerGUI", this, "ChangeSector()");
662 // sector number label
663 fLblSector = new TGLabel(fContSector, "IROC, A");
664 fLblSector->SetTextJustify(kTextLeft);
665 fContSector->AddFrame(fLblSector, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 5, 0, 0, 0));
667 // cut zeros check button
668 fChkCutZero = new TGCheckButton(fContCuts, "Cut zeros");
669 fContCuts->AddFrame(fChkCutZero, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
670 fChkCutZero->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoNewSelection()");
671 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.");
673 // additional cuts check button
674 fChkAddCuts = new TGCheckButton(fContCuts, "Custom cuts");
675 fContCuts->AddFrame(fChkAddCuts, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
676 fChkAddCuts->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoNewSelection()");
677 fChkAddCuts->SetToolTipText("Activate the custom cuts on the bottom. Remember '~' (= '.fElements')!");
678 // fContAddCuts' content is locaed further op
681 // Scaling options container
682 fContScaling = new TGGroupFrame(fTabRight0, "Scaling", kVerticalFrame | kFitWidth | kFitHeight);
683 fTabRight0->AddFrame(fContScaling, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
685 // ************************* content of fContScaling *************************
686 // SetMaximum container
687 fContSetMax = new TGCompositeFrame(fContScaling, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
688 fContScaling->AddFrame(fContSetMax, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
690 // ------------------------- content of fContSetMax -------------------------
691 // SetMaximum - checkbox
692 fChkSetMax = new TGCheckButton(fContSetMax, "Set fixed max.");
693 fContSetMax->AddFrame(fChkSetMax, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
694 fChkSetMax->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw()");
695 fChkSetMax->SetToolTipText("Set the maximum fixed to the value specified here.");
697 // text field for maximum value
698 fTxtSetMax = new TGTextEntry(fContSetMax, "", 41);
699 fContSetMax->AddFrame(fTxtSetMax, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
700 fTxtSetMax->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw()");
701 fTxtSetMax->SetToolTipText("maximum value for the drawing");
703 // SetMinimum container
704 fContSetMin = new TGCompositeFrame(fContScaling, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
705 fContScaling->AddFrame(fContSetMin, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
707 // ------------------------- content of fContSetMin -------------------------
708 // SetMinimum - checkbox
709 fChkSetMin = new TGCheckButton(fContSetMin, "Set fixed min.");
710 fContSetMin->AddFrame(fChkSetMin, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
711 fChkSetMin->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw()");
712 fChkSetMin->SetToolTipText("Set the minimum fixed to the value specified here.");
714 // text field for minimum value
715 fTxtSetMin = new TGTextEntry(fContSetMin, "", 40);
716 fContSetMin->AddFrame(fTxtSetMin, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
717 fTxtSetMin->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw()");
718 fTxtSetMin->SetToolTipText("minimum value for the drawing");
720 // get Min & Max from Plot - button
721 fBtnGetMinMax = new TGTextButton(fContScaling, "&Get scale from plot");
722 fContScaling->AddFrame(fBtnGetMinMax, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
723 fBtnGetMinMax->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "GetMinMax()");
724 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'.");
726 // GetMinMaxAuto - checkbox
727 fChkGetMinMaxAuto = new TGCheckButton(fContScaling, "Get Min + Max auto.");
728 fContScaling->AddFrame(fChkGetMinMaxAuto, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
729 fChkGetMinMaxAuto->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw()");
730 fChkGetMinMaxAuto->SetToolTipText("Get minimum and maximum automatically from each new plot. \nDeactivate this, if you want to 'save' your specified minimum and maximum.");
732 // labeling container *** fContLabeling *** " Labeling "
733 fContLabeling = new TGGroupFrame(fTabRight0, "Labeling", kVerticalFrame | kFitWidth | kFitHeight);
734 fTabRight0->AddFrame(fContLabeling, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
736 fChkLabelTitle = new TGCheckButton(fContLabeling, "Set title:");
737 fContLabeling->AddFrame(fChkLabelTitle, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
738 fChkLabelTitle->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw()");
739 fChkLabelTitle->SetToolTipText("Set the plot title.");
741 fTxtLabelTitle = new TGTextEntry(fContLabeling, "Title", 500);
742 fContLabeling->AddFrame(fTxtLabelTitle, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
743 fTxtLabelTitle->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw(=50)");
744 fTxtLabelTitle->SetToolTipText("plot title");
746 fChkLabelXaxis = new TGCheckButton(fContLabeling, "Set X-axis label:");
747 fContLabeling->AddFrame(fChkLabelXaxis, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
748 fChkLabelXaxis->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw()");
749 fChkLabelXaxis->SetToolTipText("Set the X-axis label.");
751 fTxtLabelXaxis = new TGTextEntry(fContLabeling, "XaxisLabel", 500);
752 fContLabeling->AddFrame(fTxtLabelXaxis, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
753 fTxtLabelXaxis->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw(=51)");
754 fTxtLabelXaxis->SetToolTipText("X-axis label");
756 fChkLabelYaxis = new TGCheckButton(fContLabeling, "Set Y-axis label:");
757 fContLabeling->AddFrame(fChkLabelYaxis, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
758 fChkLabelYaxis->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw()");
759 fChkLabelYaxis->SetToolTipText("Set the Y-axis label.");
761 fTxtLabelYaxis = new TGTextEntry(fContLabeling, "YaxisLabel", 500);
762 fContLabeling->AddFrame(fTxtLabelYaxis, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
763 fTxtLabelYaxis->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw(=52)");
764 fTxtLabelYaxis->SetToolTipText("Y-axis label");
766 fChkLabelGetAuto = new TGCheckButton(fContLabeling, "Get labels auto.");
767 fContLabeling->AddFrame(fChkLabelGetAuto, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
768 fChkLabelGetAuto->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw()");
769 fChkLabelGetAuto->SetToolTipText("Get labels automatically from each new plot \nDeactivate this, if you want to 'save' your specified labels.");
772 // **************************** content of ftabRight1 *******************************
774 fContSave = new TGGroupFrame(fTabRight1, "Save", kVerticalFrame | kFitWidth | kFitHeight);
775 fTabRight1->AddFrame(fContSave, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
777 fBtnSave = new TGTextButton(fContSave, "&Save picture");
778 fContSave->AddFrame(fBtnSave, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
779 fBtnSave->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "SavePicture()");
780 fBtnSave->SetToolTipText("Open a 'Save as...' dialog to save the current plot as picture or macro.");
782 // additional save options container
783 fContAddSaveOpt = new TGCompositeFrame(fContSave, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
784 fContSave->AddFrame(fContAddSaveOpt, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
786 // content of --- fContAddSaveOpt ---
787 // addition save options label
788 fChkAddSaveOpt = new TGCheckButton(fContAddSaveOpt, "Save options:");
789 fContAddSaveOpt->AddFrame(fChkAddSaveOpt, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
790 fChkAddSaveOpt->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoNewSelection()");
791 fChkAddSaveOpt->SetToolTipText("Additional save options (see documentation for TPad::Print()).");
793 // additional save options combo box
794 fComboAddSaveOpt = new TGComboBox(fContAddSaveOpt);
795 fContAddSaveOpt->AddFrame(fComboAddSaveOpt, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
796 fComboAddSaveOpt->Resize(0, fBtnDraw->GetDefaultHeight());
797 fComboAddSaveOpt->EnableTextInput(kTRUE);
798 fComboAddSaveOpt->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "SavePicture()");
799 // fComboAddSaveOpt->Connect("Selected(Int_t)", "AliTPCCalibViewerGUI", this, "SavePicture()");
801 // calPad export container
802 fContExport = new TGGroupFrame(fTabRight1, "Export AliTPCCalPad", kVerticalFrame | kFitWidth | kFitHeight);
803 fTabRight1->AddFrame(fContExport, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
805 // ------------------------- content of fContExport -------------------------
806 // container for export name
807 fContAddExport = new TGCompositeFrame(fContExport, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
808 fContExport->AddFrame(fContAddExport, new TGLayoutHints(kLHintsExpandX, -5, -5, 0, 0));
810 fComboExportName = new TGComboBox(fContAddExport);
811 fComboExportName->Resize(0, fBtnDraw->GetDefaultHeight());
812 fContAddExport->AddFrame(fComboExportName, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
813 fComboExportName->AddEntry("calPad", 0); // first default value
814 fComboExportName->Select(0); // select default value before connecting
815 fComboExportName->EnableTextInput(kTRUE);
816 fComboExportName->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "DoExport()");
817 fComboExportName->Connect("Selected(Int_t)", "AliTPCCalibViewerGUI", this, "DoExport()");
820 fBtnExport = new TGTextButton(fContExport, "&Export to CINT");
821 fContExport->AddFrame(fBtnExport, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
822 fBtnExport->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoExport()");
823 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.");
825 // add to normalisation button
826 fBtnAddNorm = new TGTextButton(fContExport, "&Add to normalization");
827 fContExport->AddFrame(fBtnAddNorm, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
828 fBtnAddNorm->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoExportNorm()");
829 fBtnAddNorm->SetToolTipText("Use the current 2D view as normalization variable, use the specified name. \nNot yet working!");
832 fContTree = new TGGroupFrame(fTabRight1, "Tree", kVerticalFrame | kFitWidth | kFitHeight);
833 fTabRight1->AddFrame(fContTree, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
835 // dump tree to file button
836 fBtnDumpToFile = new TGTextButton(fContTree, "&Dump to File");
837 fContTree->AddFrame(fBtnDumpToFile, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
838 fBtnDumpToFile->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoDumpToFile()");
839 fBtnDumpToFile->SetToolTipText("Write the exported CalPads to a new CalibTree");
841 // dump tree to file button
842 fBtnLoadTree = new TGTextButton(fContTree, "&Load Tree");
843 fContTree->AddFrame(fBtnLoadTree, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
844 fBtnLoadTree->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoLoadTree()");
845 fBtnLoadTree->SetToolTipText("Load and initialize a new calibration tree. ");
847 fChkAddAsReference = new TGCheckButton(fContTree, "as reference:");
848 fContTree->AddFrame(fChkAddAsReference, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
849 fChkAddAsReference->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoLoadTree()");
850 fChkAddAsReference->SetToolTipText("To add a new tree as reference tree.");
852 fTxtRefName = new TGTextEntry(fContTree, "R", 500);
853 fContTree->AddFrame(fTxtRefName, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 15, 0, 0, 0));
854 // fTxtRefName->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw(=50)");
855 fTxtRefName->SetToolTipText("Reference Name");
858 // Fit options container
859 fContFit = new TGGroupFrame(fTabRight1, "Custom fit", kVerticalFrame | kFitWidth | kFitHeight);
860 fTabRight1->AddFrame(fContFit, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
862 // ------------------------- content of fContFit -------------------------
863 // container for additional fits
864 fContAddFit = new TGCompositeFrame(fContFit, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
865 fContFit->AddFrame(fContAddFit, new TGLayoutHints(kLHintsExpandX, -5, -5, 0, 0));
867 // --- content of fContAddFit ---
868 // text field for custom fit
869 fComboCustomFit = new TGComboBox(fContAddFit);
870 fComboCustomFit->Resize(0, fBtnDraw->GetDefaultHeight());
871 fComboCustomFit->EnableTextInput(kTRUE);
872 fContAddFit->AddFrame(fComboCustomFit, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
873 fComboCustomFit->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "DoFit()");
874 fComboCustomFit->Connect("Selected(Int_t)", "AliTPCCalibViewerGUI", this, "DoFit()");
877 fBtnFit = new TGTextButton(fContAddFit, "&Fit");
878 fContAddFit->AddFrame(fBtnFit, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
879 fBtnFit->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoFit()");
880 fBtnFit->SetToolTipText("Fit a whole TPC side, e.g. with gx~ ++ gy~, the result is printed to the console \nNot yet final status.");
882 // add fit function button
883 //fBtnAddFitFunction = new TGTextButton(fContAddFit, "&Add fit function to normalization");
884 //fContAddFit->AddFrame(fBtnAddFitFunction, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
885 //fBtnAddFitFunction->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "AddFitFunction()");
887 SetWindowName("AliTPCCalibViewer GUI");
889 Resize(GetDefaultSize());
894 void AliTPCCalibViewerGUI::SetInitialValues() {
896 // Set the default button states
898 fChkAuto->SetState(kButtonUp);
899 fRadioPredefined->SetState(kButtonDown);
900 fRadioRaw->SetState(kButtonDown);
901 fRadioTPC->SetState(kButtonDown);
902 fRadio1D->SetState(kButtonDown);
903 fChkAddCuts->SetState(kButtonUp);
904 fChkGetMinMaxAuto->SetState(kButtonDown);
905 fChkSetMin->SetState(kButtonUp);
906 fChkSetMax->SetState(kButtonUp);
907 fRadioNorm->SetState(kButtonDown);
908 fRadioSigma->SetState(kButtonUp);
909 fRadioCumulative->SetState(kButtonUp);
910 fChkMean->SetState(kButtonDown);
911 fCheckCumulativePM->SetState(kButtonUp);
913 fChkLabelGetAuto->SetState(kButtonDown);
915 // TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO
916 // TODO Set the checkboxes state as it is really TODO
917 // TODO in gStyle TODO
918 // TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO
919 // k = 1; kurtosis printed
920 // k = 2; kurtosis and kurtosis error printed
921 // s = 1; skewness printed
922 // s = 2; skewness and skewness error printed
923 // i = 1; integral of bins printed
924 // o = 1; number of overflows printed
925 // u = 1; number of underflows printed
926 // r = 1; rms printed
927 // r = 2; rms and rms error printed
928 // m = 1; mean value printed
929 // m = 2; mean and mean error values printed
930 // e = 1; number of entries printed
931 // n = 1; name of histogram is printed
932 // (default = 000001111)
934 Int_t statOpt = gStyle->GetOptStat();
935 if (statOpt == 1) statOpt = 1111;
936 if (statOpt / 200000000 >= 1) {
937 fChkStatKurtosis->SetState(kButtonDown);
938 fChkStatKurtosisPM->SetState(kButtonDown);
939 statOpt -= 200000000;
941 if (statOpt / 100000000 >= 1) {
942 fChkStatKurtosis->SetState(kButtonDown);
943 statOpt -= 100000000;
945 if (statOpt / 20000000 >= 1) {
946 fChkStatSkewness->SetState(kButtonDown);
947 fChkStatSkewnessPM->SetState(kButtonDown);
950 if (statOpt / 10000000 >= 1) {
951 fChkStatSkewness->SetState(kButtonDown);
954 if (statOpt / 1000000 >= 1) {
955 fChkStatIntegral->SetState(kButtonDown);
958 if (statOpt / 100000 >= 1) {
959 fChkStatOverflow->SetState(kButtonDown);
962 if (statOpt / 10000 >= 1) {
963 fChkStatUnderflow->SetState(kButtonDown);
966 if (statOpt / 2000 >= 1) {
967 fChkStatRMS->SetState(kButtonDown);
968 fChkStatRMSPM->SetState(kButtonDown);
971 if (statOpt / 1000 >= 1) {
972 fChkStatRMS->SetState(kButtonDown);
975 if (statOpt / 200 >= 1) {
976 fChkStatMean->SetState(kButtonDown);
977 fChkStatMeanPM->SetState(kButtonDown);
980 if (statOpt / 100 >= 1) {
981 fChkStatMean->SetState(kButtonDown);
984 if (statOpt / 10 >= 1) {
985 fChkStatEntries->SetState(kButtonDown);
988 if (statOpt / 1 >= 1) {
989 fChkStatName->SetState(kButtonDown);
994 fChkStatName->SetState(kButtonDown);
995 fChkStatEntries->SetState(kButtonDown);
996 fChkStatMean->SetState(kButtonDown);
997 fChkStatRMS->SetState(kButtonDown);
999 // fChkStatMeanPM->SetState(kButtonUp);
1000 // fChkStatRMSPM->SetState(kButtonUp);
1001 // fChkStatUnderflow->SetState(kButtonUp);
1002 // fChkStatOverflow->SetState(kButtonUp);
1003 // fChkStatIntegral->SetState(kButtonUp);
1004 // fChkStatSkewness->SetState(kButtonUp);
1005 // fChkStatSkewnessPM->SetState(kButtonUp);
1006 // fChkStatKurtosis->SetState(kButtonDown);
1007 // fChkStatKurtosisPM->SetState(kButtonDown);
1009 // fill fComboAddDrawOpt with some additional drawing options
1010 fComboAddDrawOpt->AddEntry("same", 0);
1011 fComboAddDrawOpt->AddEntry("profbox", 1);
1012 fComboAddDrawOpt->AddEntry("profcolz", 2);
1013 fComboAddDrawOpt->AddEntry("profcont0", 3);
1014 fComboAddDrawOpt->AddEntry("proflego", 4);
1015 fComboAddDrawOpt->AddEntry("proflego2", 5);
1016 fComboAddDrawOpt->AddEntry("profsurf", 6);
1017 fComboAddDrawOpt->AddEntry("profsurf1", 7);
1018 fComboAddDrawOpt->AddEntry("profsurf2", 8);
1019 fComboAddDrawOpt->AddEntry("box", 9);
1020 fComboAddDrawOpt->AddEntry("colz", 10);
1021 fComboAddDrawOpt->AddEntry("cont0", 11);
1022 fComboAddDrawOpt->AddEntry("lego", 12);
1023 fComboAddDrawOpt->AddEntry("lego2", 13);
1024 fComboAddDrawOpt->AddEntry("surf", 14);
1025 fComboAddDrawOpt->AddEntry("surf1", 15);
1026 fComboAddDrawOpt->AddEntry("surf2", 16);
1028 // fill fComboAddSaveOpt with some additional drawing options
1029 fComboAddSaveOpt->AddEntry("Portrait", 0);
1030 fComboAddSaveOpt->AddEntry("Landscape", 1);
1031 fComboAddSaveOpt->AddEntry("Preview", 2);
1032 fComboAddSaveOpt->AddEntry("+50", 3);
1034 // fill fComboMethod
1035 fComboMethod->AddEntry("subtract", 0);
1036 fComboMethod->AddEntry("divide by", 1);
1038 // fill fComboExportName
1039 // fComboExportName->AddEntry("calPad", 0);
1040 // fComboExportName->AddEntry("calPad2", 1);
1041 fBtnExport->SetEnabled(kFALSE);
1042 fBtnAddNorm->SetEnabled(kFALSE);
1044 // select initial variables
1045 fListVariables->Select(0);
1046 fListNormalization->Select(0);
1047 fComboMethod->Select(0);
1048 // fComboExportName->Select(0);
1049 // fComboExportName->EnableTextInput(kTRUE);
1051 //fCanvMain->GetCanvas()->ToggleEventStatus(); // klappt nicht
1052 //fCanvMain->GetCanvas()->GetCanvasImp()->ShowStatusBar(kTRUE); // klappt auch nicht
1053 fListVariables->IntegralHeight(kFALSE); // naja
1054 fListNormalization->IntegralHeight(kFALSE); // naja
1055 fChkAuto->SetState(kButtonDown);
1057 // Make first drawing:
1062 AliTPCCalibViewerGUI::AliTPCCalibViewerGUI(const AliTPCCalibViewerGUI &c)
1063 : TGCompositeFrame(c.fParent, c.fWidth, c.fHeight),
1079 fContDrawOptSub1D2D(0),
1094 fBtnAddFitFunction(0),
1098 fRadioNormalized(0),
1099 fRadioPredefined(0),
1108 fComboAddDrawOpt(0),
1112 fListNormalization(0),
1125 fChkGetMinMaxAuto(0),
1129 fcontDrawOpt1DSubLR(0),
1130 fContDrawOpt1DSubNSC(0),
1139 fRadioCumulative(0),
1140 fCheckCumulativePM(0),
1142 fContDrawOpt1DSubMML(0),
1155 fChkStatUnderflow(0),
1156 fChkStatOverflow(0),
1157 fChkStatIntegral(0),
1159 fChkStatSkewness(0),
1160 fChkStatSkewnessPM(0),
1162 fChkStatKurtosis(0),
1163 fChkStatKurtosisPM(0),
1172 fChkLabelGetAuto(0),
1177 fComboAddSaveOpt(0),
1180 fComboExportName(0),
1186 fChkAddAsReference(0),
1191 // dummy AliTPCCalibViewerGUI copy constructor
1196 AliTPCCalibViewerGUI & AliTPCCalibViewerGUI::operator =(const AliTPCCalibViewerGUI & /*param*/) {
1198 // dummy assignment operator
1204 AliTPCCalibViewerGUI::~AliTPCCalibViewerGUI() {
1208 if (fCanvMain && fCanvMain->GetCanvas()) {
1209 for (Int_t i = 0; i < fCanvMain->GetCanvas()->GetListOfPrimitives()->GetEntries(); i++) {
1210 if (strcmp(fCanvMain->GetCanvas()->GetListOfPrimitives()->At(i)->ClassName(), "TFrame") != 0)
1211 fCanvMain->GetCanvas()->GetListOfPrimitives()->At(i)->Delete();
1215 if (fViewer) fViewer->Delete();
1216 delete fPreprocessor;
1221 void AliTPCCalibViewerGUI::CloseWindow() {
1227 void AliTPCCalibViewerGUI::Initialize(const char* fileName, const char* treeName) {
1229 // initialize the GUI with a calibrationTree from fileName
1232 // create AliTPCCalibViewer object, which will be used for generating all drawings
1233 if (fViewer) delete fViewer;
1234 fViewer = new AliTPCCalibViewer(fileName, treeName);
1235 Initialize(fViewer);
1239 void AliTPCCalibViewerGUI::Initialize(AliTPCCalibViewer *viewer) {
1241 // initializes the GUI with default settings and opens tree for drawing
1245 TString selectedVariable("");
1246 TString selectedNormalization("");
1247 Int_t variableId = -1;
1248 Int_t normalizationId = -1;
1250 // remember the selected entry
1251 if (fListVariables->GetSelectedEntry()) selectedVariable = fListVariables->GetSelectedEntry()->GetTitle();
1252 if (fListNormalization->GetSelectedEntry()) selectedNormalization = fListNormalization->GetSelectedEntry()->GetTitle();
1255 // fill fListVariables, list of drawable variables:
1256 TObjArray* arr = fViewer->GetListOfVariables();
1258 TIterator* iter = arr->MakeIterator();
1260 TObjString* currentStr = 0;
1262 fListVariables->RemoveAll();
1263 while ((currentStr = (TObjString*)(iter->Next()))) {
1264 fListVariables->AddEntry(currentStr->GetString().Data(), id);
1265 if (fInitialized && currentStr->GetString() == selectedVariable) variableId = id;
1269 // fill fListNorm, list of normalization variables:
1270 TObjArray *arrNorm = fViewer->GetListOfNormalizationVariables();
1271 TIterator *iterNorm = arrNorm->MakeIterator();
1275 fListNormalization->RemoveAll();
1276 while ((currentStr = (TObjString*)(iterNorm->Next()))) {
1277 fListNormalization->AddEntry(currentStr->GetString().Data(), id);
1278 if (fInitialized && currentStr->GetString() == selectedNormalization) normalizationId = id;
1283 //Add draw variables to the list of normalisation
1284 while ((currentStr = (TObjString*)(iter->Next()))) {
1285 if (currentStr->GetString().BeginsWith("Map")) continue; //don't add mapping information
1286 fListNormalization->AddEntry(currentStr->GetString().Data(), id);
1287 if (fInitialized && currentStr->GetString() == selectedNormalization) normalizationId = id;
1299 // trick do display the entries corectly after reinitialization
1300 // otherwise all the entries would appear as one kryptic entry
1301 // resizing the listbox somehow fixes the problem...
1302 if (fInitialized) fListVariables->Resize(fListVariables->GetWidth()-1, fListVariables->GetHeight());
1303 if (fInitialized) fListVariables->Resize(fListVariables->GetWidth()+1, fListVariables->GetHeight());
1304 if (fInitialized) fListNormalization->Resize(fListNormalization->GetWidth()-1, fListNormalization->GetHeight());
1305 if (fInitialized) fListNormalization->Resize(fListNormalization->GetWidth()+1, fListNormalization->GetHeight());
1307 // select the last selected variable and normalization
1308 if (fInitialized && variableId != -1) fListVariables->Select(variableId);
1309 if (fInitialized && normalizationId != -1)fListVariables->Select(normalizationId);
1311 if (fInitialized) Info("Initialize", "AliTPCCalibViewerGUI new initialized.");
1312 fInitialized = kTRUE;
1316 void AliTPCCalibViewerGUI::Reset(){
1318 // reset variables, delete calib viewer
1320 if (fViewer) delete fViewer;
1321 fListVariables->RemoveAll();
1322 fListNormalization->RemoveAll();
1323 fInitialized = kFALSE;
1326 void AliTPCCalibViewerGUI::HandleButtonsGeneral(Int_t id) {
1328 // handles mutual radio button exclusions
1332 TGButton *btn = (TGButton *) gTQSender;
1333 id = btn->WidgetId();
1337 case 10: // fRadioRaw
1338 fRadioNormalized->SetState(kButtonUp);
1339 fRadioPredefined->SetState(kButtonDown);
1340 fRadioCustom->SetState(kButtonUp);
1341 // fComboMethod->UnmapWindow();
1342 // fListNormalization->UnmapWindow();
1344 case 11: // fRadioNormalized
1345 fRadioRaw->SetState(kButtonUp);
1346 fRadioPredefined->SetState(kButtonDown);
1347 fRadioCustom->SetState(kButtonUp);
1349 case 12: // fRadioCustom
1350 fRadioPredefined->SetState(kButtonUp);
1351 // fComboCustom->SetEnabled(kFALSE);
1352 // fRadioNormalized->SetState(kButtonUp);
1354 case 14: // select Draw options fComboAddDrawOpt
1355 fChkAddDrawOpt->SetState(kButtonDown);
1357 case 13: // fRadioPredefined
1358 fRadioCustom->SetState(kButtonUp);
1359 // fComboCustom->SetEnabled(kTRUE);
1360 //f RadioNormalized->SetState(kButtonUp);
1363 case 30: // fRadio1D
1364 fRadio2D->SetState(kButtonUp);
1365 fBtnExport->SetEnabled(kFALSE);
1366 fBtnAddNorm->SetEnabled(kFALSE);
1368 case 31: // fRadio2D
1369 fRadio1D->SetState(kButtonUp);
1370 fBtnExport->SetEnabled(kTRUE);
1371 fBtnAddNorm->SetEnabled(kTRUE);
1373 case 42: // fComboCustom
1374 fRadioCustom->SetState(kButtonDown);
1375 fRadioPredefined->SetState(kButtonUp);
1382 void AliTPCCalibViewerGUI::HandleButtons1D(Int_t id) {
1384 // handles mutual radio button exclusions
1389 TGButton *btn = (TGButton *) gTQSender;
1390 id = btn->WidgetId();
1393 case 110: // 1D draw normal
1394 fRadioNorm->SetState(kButtonDown);
1395 fRadioSigma->SetState(kButtonUp);
1396 fRadioCumulative->SetState(kButtonUp);
1397 fRadioIntegrate->SetState(kButtonUp);
1399 case 111: // 1D draw sigma
1400 fRadioNorm->SetState(kButtonUp);
1401 fRadioSigma->SetState(kButtonDown);
1402 fRadioCumulative->SetState(kButtonUp);
1403 fRadioIntegrate->SetState(kButtonUp);
1405 case 112: // 1D draw cumulative
1406 fRadioNorm->SetState(kButtonUp);
1407 fRadioSigma->SetState(kButtonUp);
1408 fRadioCumulative->SetState(kButtonDown);
1409 fRadioIntegrate->SetState(kButtonUp);
1411 case 113: // 1D draw integral
1412 fRadioNorm->SetState(kButtonUp);
1413 fRadioSigma->SetState(kButtonUp);
1414 fRadioCumulative->SetState(kButtonUp);
1415 fRadioIntegrate->SetState(kButtonDown);
1422 void AliTPCCalibViewerGUI::HandleButtonsStat(Int_t id) {
1424 // handles statistic check boxes
1425 // checks each checkbox if checked
1426 // if the checkbox is checked, appends 'n' for name, 'e' for entries, ...
1427 // to a TString, passes this TString to gStyle->SetOptStat(...)
1430 TGButton *btn = (TGButton *) gTQSender;
1431 id = btn->WidgetId();
1433 TString statOpt("");
1434 if (fChkStatName->GetState() == kButtonDown) statOpt.Append("n");
1435 if (fChkStatEntries->GetState() == kButtonDown) statOpt.Append("e");
1436 if (fChkStatMean->GetState() == kButtonDown && fChkStatMeanPM->GetState() == kButtonUp) statOpt.Append("m");
1437 if (fChkStatMeanPM->GetState() == kButtonDown) statOpt.Append("M");
1438 if (fChkStatRMS->GetState() == kButtonDown && fChkStatRMSPM->GetState() == kButtonUp) statOpt.Append("r");
1439 if (fChkStatRMSPM->GetState() == kButtonDown) statOpt.Append("R");
1440 if (fChkStatUnderflow->GetState() == kButtonDown) statOpt.Append("u");
1441 if (fChkStatOverflow->GetState() == kButtonDown) statOpt.Append("o");
1442 if (fChkStatIntegral->GetState() == kButtonDown) statOpt.Append("i");
1443 if (fChkStatSkewness->GetState() == kButtonDown && fChkStatSkewnessPM->GetState() == kButtonUp) statOpt.Append("s");
1444 if (fChkStatSkewnessPM->GetState() == kButtonDown) statOpt.Append("S");
1445 if (fChkStatKurtosis->GetState() == kButtonDown && fChkStatKurtosisPM->GetState() == kButtonUp) statOpt.Append("k");
1446 if (fChkStatKurtosisPM->GetState() == kButtonDown) statOpt.Append("K");
1448 gStyle->SetOptStat(statOpt);
1453 void AliTPCCalibViewerGUI::HandleButtonsCuts(Int_t id) {
1455 // handles mutual radio button exclusions
1456 // right side buttons
1459 TGButton *btn = (TGButton *) gTQSender;
1460 id = btn->WidgetId();
1464 case 20: // fRadioTPC
1465 fRadioSideA->SetState(kButtonUp);
1466 fRadioSideC->SetState(kButtonUp);
1467 fRadioROC->SetState(kButtonUp);
1468 fRadioSector->SetState(kButtonUp);
1470 case 21: // fRadioSideA
1471 fRadioTPC->SetState(kButtonUp);
1472 fRadioSideC->SetState(kButtonUp);
1473 fRadioROC->SetState(kButtonUp);
1474 fRadioSector->SetState(kButtonUp);
1476 case 22: // fRadioSideC
1477 fRadioTPC->SetState(kButtonUp);
1478 fRadioSideA->SetState(kButtonUp);
1479 fRadioROC->SetState(kButtonUp);
1480 fRadioSector->SetState(kButtonUp);
1482 case 23: // fRadioROC
1483 fRadioTPC->SetState(kButtonUp);
1484 fRadioSideA->SetState(kButtonUp);
1485 fRadioSideC->SetState(kButtonUp);
1486 fRadioSector->SetState(kButtonUp);
1488 case 24: // fRadioSector
1489 fRadioTPC->SetState(kButtonUp);
1490 fRadioSideA->SetState(kButtonUp);
1491 fRadioSideC->SetState(kButtonUp);
1492 fRadioROC->SetState(kButtonUp);
1494 case 31: // fComboAddCuts
1495 fChkAddCuts->SetState(kButtonDown);
1502 void AliTPCCalibViewerGUI::HandleButtonsNoRedraw(Int_t id) {
1504 // handles label & scaling checkboxes
1505 // without redrawing (not necessary, faster like this)
1508 TGButton *btn = (TGButton *) gTQSender;
1509 id = btn->WidgetId();
1513 case 40: // fTxtSetMin
1514 fChkSetMin->SetState(kButtonDown);
1516 case 41: // fTxtSetMax
1517 fChkSetMax->SetState(kButtonDown);
1519 case 50: // fTxtLabelTitle
1520 fChkLabelTitle->SetState(kButtonDown);
1522 case 51: // fTxtLabelXaxis
1523 fChkLabelXaxis->SetState(kButtonDown);
1525 case 52: // fTxtLabelXaxis
1526 fChkLabelYaxis->SetState(kButtonDown);
1532 void AliTPCCalibViewerGUI::ReplacePlaceHolders(TString &str)
1535 // replace the defined placeholders in the custom draw string and cut string
1537 TString drawPlaceHolder("#draw#");
1538 TString normPlaceHolder("#norm#");
1540 //current draw variable
1541 TString desiredData("");
1542 if (fListVariables->GetSelectedEntry()){
1543 desiredData += ((TGTextLBEntry*)(fListVariables->GetSelectedEntry()))->GetTitle();
1544 str.ReplaceAll(drawPlaceHolder,desiredData);
1546 // desiredData += fViewer->GetAbbreviation();
1548 //current normalisation
1549 TString normalizationData("");
1550 if (fListNormalization->GetSelectedEntry()){
1551 normalizationData += ((TGTextLBEntry*)(fListNormalization->GetSelectedEntry()))->GetTitle();
1552 if (! (TString(((TGTextLBEntry*)(fListNormalization->GetSelectedEntry()))->GetTitle())).BeginsWith("Fit"))
1553 if ( normalizationData.BeginsWith("_") ) normalizationData = desiredData+normalizationData;
1554 if ( fListVariables->FindEntry(normalizationData.Data()) )
1555 normalizationData+="~";
1556 str.ReplaceAll(normPlaceHolder,normalizationData);
1560 void AliTPCCalibViewerGUI::DoNewSelection() {
1562 // decides whether to redraw if user makes another selection
1564 if (fChkAuto->GetState() == kButtonDown) DoDraw();
1568 TString* AliTPCCalibViewerGUI::GetDrawString() {
1570 // create the draw string out of selection
1573 // specify data to plot
1574 TString desiredData("");
1575 if (!fListVariables->GetSelectedEntry()) return 0;
1576 desiredData += ((TGTextLBEntry*)(fListVariables->GetSelectedEntry()))->GetTitle();
1577 desiredData += fViewer->GetAbbreviation();
1579 // specify normalization
1580 if (fRadioPredefined->GetState() == kButtonDown && fRadioNormalized->GetState() == kButtonDown) {
1582 switch (fComboMethod->GetSelected()) {
1583 case 0: // subtraction
1590 TString normalizationData("");
1591 if (!fListNormalization->GetSelectedEntry()) return 0;
1592 normalizationData += ((TGTextLBEntry*)(fListNormalization->GetSelectedEntry()))->GetTitle();
1594 if ( normalizationData.BeginsWith("Fit")) {
1595 // create fit formula, evaluate it an replace normalizationData-String
1596 // ********** create cut string **********
1598 if (fRadioTPC->GetState() == kButtonDown)
1599 cutStr += ""; // whole TPC is used for fitting
1600 if (fRadioSideA->GetState() == kButtonDown)
1601 cutStr += "(sector/18)%2==0"; // side A
1602 if (fRadioSideC->GetState() == kButtonDown)
1603 cutStr+= "(sector/18)%2==1"; // side C
1604 if (fRadioROC->GetState() == kButtonDown) {
1605 Int_t sector = (Int_t)(fNmbSector->GetNumber());
1606 cutStr += "sector==";
1609 if (fRadioSector->GetState() == kButtonDown) {
1610 Int_t sector = ((Int_t)(fNmbSector->GetNumber()))%36;
1611 cutStr += "sector%36==";
1614 if (fChkAddCuts->GetState() == kButtonDown && strcmp(fComboAddCuts->GetTextEntry()->GetText(), "") != 0){
1615 if (fRadioTPC->GetState() != kButtonDown) cutStr += " && ";
1616 cutStr += fComboAddCuts->GetTextEntry()->GetText();
1619 TVectorD fitParam(0);
1620 TMatrixD covMatrix(0,0);
1621 TString formulaStr("");
1622 if (normalizationData.CompareTo("FitLinLocal") == 0)
1623 formulaStr = "lx~ ++ ly~";
1624 if (normalizationData.CompareTo("FitLinGlobal") == 0)
1625 formulaStr = "gx~ ++ gy~";
1626 if (normalizationData.CompareTo("FitParLocal") == 0)
1627 formulaStr = "lx~ ++ ly~ ++ lx~^2 ++ ly~^2 ++ lx~*ly~";
1628 if (normalizationData.CompareTo("FitParGlobal") == 0)
1629 formulaStr = "gx~ ++ gy~ ++ gx~^2 ++ gy~^2 ++ gx~*gy~";
1630 formulaStr.ReplaceAll("~", fViewer->GetAbbreviation());
1631 normalizationData = *fViewer->Fit(desiredData.Data(), formulaStr.Data(), cutStr.Data(), chi2, fitParam, covMatrix);
1632 } // if ( normalizationData.BeginsWith("Fit")
1635 if (! (TString(((TGTextLBEntry*)(fListNormalization->GetSelectedEntry()))->GetTitle())).BeginsWith("Fit"))
1636 if ( normalizationData.BeginsWith("_") ) desiredData += ((TGTextLBEntry*)(fListVariables->GetSelectedEntry()))->GetTitle();
1637 if ( fListVariables->FindEntry(normalizationData.Data()) )
1638 normalizationData+="~";
1639 desiredData += normalizationData;
1641 else if (fRadioCustom->GetState() == kButtonDown) {
1642 desiredData = fComboCustom->GetTextEntry()->GetText();
1643 if (desiredData == "") return 0;
1644 ReplacePlaceHolders(desiredData);
1647 // try to add forgotten '~'
1648 if (fChkAutoAppend->GetState() == kButtonDown)
1649 desiredData = TString(fViewer->AddAbbreviations((char*)desiredData.Data()));
1650 return new TString(desiredData.Data());
1654 TString* AliTPCCalibViewerGUI::GetSectorString() {
1656 // create the sector string out of selection
1659 TString sectorStr("");
1660 if (fRadioTPC->GetState() == kButtonDown)
1662 if (fRadioSideA->GetState() == kButtonDown)
1663 sectorStr += "A"; //cuts += "(sector/18)%2==0";
1664 if (fRadioSideC->GetState() == kButtonDown)
1665 sectorStr+= "C"; //cuts += "(sector/18)%2==1";
1666 if (fRadioROC->GetState() == kButtonDown) {
1667 Int_t sector = (Int_t)(fNmbSector->GetNumber());
1668 sectorStr += sector; //cuts += "sector==";
1670 if (fRadioSector->GetState() == kButtonDown) {
1671 Int_t sector = ((Int_t)(fNmbSector->GetNumber()))%36;
1673 sectorStr += sector; //cuts += "sector%36==";
1675 return new TString(sectorStr.Data());
1679 TString* AliTPCCalibViewerGUI::GetCutString() {
1681 // create the cut string out of selection
1684 TString cutsStr("");
1685 if (fChkCutZero->GetState() == kButtonDown) {
1686 TString cutZerosStr(GetDrawString()->Data());
1687 if (cutZerosStr.Contains(">>")) {
1688 cutZerosStr.Remove(cutZerosStr.First(">>"));
1690 if (cutZerosStr.Contains(":")) {
1691 cutZerosStr.Remove(cutZerosStr.First(":"));
1693 cutsStr += cutZerosStr.Data();
1695 if (fChkAddCuts->GetState() == kButtonDown) cutsStr += " && ";
1697 if (fChkAddCuts->GetState() == kButtonDown){
1698 cutsStr += fComboAddCuts->GetTextEntry()->GetText();
1699 ReplacePlaceHolders(cutsStr);
1703 // try to add forgotten '~'
1704 if (fChkAutoAppend->GetState() == kButtonDown)
1705 cutsStr = TString(fViewer->AddAbbreviations((char*)cutsStr.Data()));
1706 return new TString(cutsStr.Data());
1710 void AliTPCCalibViewerGUI::DoDraw() {
1712 // main method for drawing according to user selection
1715 // specify data to plot:
1716 if (!GetDrawString()) return;
1717 TString desiredData(GetDrawString()->Data());
1719 TString sectorStr(GetSectorString()->Data());
1721 TString cutsStr(GetCutString()->Data());
1723 TString addDrawOpt("");
1724 if (fChkAddDrawOpt->GetState() == kButtonDown)
1725 addDrawOpt += fComboAddDrawOpt->GetTextEntry()->GetText();
1727 // remove last picture
1728 if (!addDrawOpt.Contains("same"))
1729 for (Int_t i = 0; i < fCanvMain->GetCanvas()->GetListOfPrimitives()->GetEntries(); i++) {
1730 if (strcmp(fCanvMain->GetCanvas()->GetListOfPrimitives()->At(i)->ClassName(), "TFrame") != 0)
1731 fCanvMain->GetCanvas()->GetListOfPrimitives()->At(i)->Delete();
1733 //fCanvMain->GetCanvas()->Clear();
1734 fCanvMain->GetCanvas()->cd();
1737 if (fRadio1D->GetState() == kButtonDown){
1739 TString strSigmaMax(fTxtSigmaMax->GetText()); // get sigmaMax from text enty
1740 Double_t sigmaMax = (strSigmaMax.IsFloat()) ? strSigmaMax.Atof() : 5; // convert to double, if not convertable, set to 5
1741 Bool_t plotMean = fChkMean->GetState() == kButtonDown;
1742 Bool_t plotMedian = fChkMedian->GetState() == kButtonDown;
1743 Bool_t plotLTM = fChkLTM->GetState() == kButtonDown;
1744 if (fRadioNorm->GetState() == kButtonDown) // normal 1D drawing
1745 entries = fViewer->EasyDraw1D(desiredData.Data(), sectorStr.Data(), cutsStr.Data(), addDrawOpt.Data());
1746 if (fRadioSigma->GetState() == kButtonDown) // sigma 1D drawing
1747 entries = fViewer->DrawHisto1D(desiredData.Data(), sectorStr.Data(), cutsStr.Data(), //
1748 fTxtSigmas->GetText(), plotMean, plotMedian, plotLTM);
1749 if (fRadioCumulative->GetState() == kButtonDown) // cumulative 1D drawing
1750 entries = fViewer->SigmaCut(desiredData.Data(), sectorStr.Data(), cutsStr.Data(), //
1751 sigmaMax, plotMean, plotMedian, plotLTM, //
1752 fCheckCumulativePM->GetState() == kButtonDown, fTxtSigmas->GetText(), /* Float_t sigmaStep =*/ -1);
1753 if (fRadioIntegrate->GetState() == kButtonDown) // integral 1D drawing
1754 entries = fViewer->Integrate(desiredData.Data(), sectorStr.Data(), cutsStr.Data(), //
1755 sigmaMax, plotMean, plotMedian, plotLTM, //
1756 fTxtSigmas->GetText(), /* Float_t sigmaStep =*/ -1);
1758 else if (fRadio2D->GetState() == kButtonDown) {
1760 entries = fViewer->EasyDraw(desiredData.Data(), sectorStr.Data(), cutsStr.Data(), addDrawOpt.Data());
1762 if (entries == -1) return; // nothing was drawn, there is no histogram to get min and max
1765 fCanvMain->GetCanvas()->Update();
1769 void AliTPCCalibViewerGUI::DoFit() {
1771 // main method for fitting
1775 TVectorD fitParam(0);
1776 TMatrixD covMatrix(0,0);
1778 TString formulaStr("");
1780 // specify data to plot:
1781 TString drawStr(GetDrawString()->Data());
1783 // ********** create cut string **********
1784 if (fRadioTPC->GetState() == kButtonDown)
1785 cutStr += ""; // whole TPC is used for fitting
1786 if (fRadioSideA->GetState() == kButtonDown)
1787 cutStr += "(sector/18)%2==0"; // side A
1788 if (fRadioSideC->GetState() == kButtonDown)
1789 cutStr+= "(sector/18)%2==1"; // side C
1790 if (fRadioROC->GetState() == kButtonDown) {
1791 Int_t sector = (Int_t)(fNmbSector->GetNumber());
1792 cutStr += "sector==";
1795 if (fRadioSector->GetState() == kButtonDown) {
1796 Int_t sector = (Int_t)(fNmbSector->GetNumber())%36;
1797 cutStr += "sector%36==";
1800 if (fChkAddCuts->GetState() == kButtonDown && strcmp(fComboAddCuts->GetTextEntry()->GetText(), "") != 0){
1801 if (fRadioTPC->GetState() != kButtonDown) cutStr += " && ";
1802 cutStr += fComboAddCuts->GetTextEntry()->GetText();
1804 // try to add forgotten '~'
1805 if (fChkAutoAppend->GetState() == kButtonDown)
1806 cutStr = TString(fViewer->AddAbbreviations((char*)cutStr.Data()));
1808 // ********** get formula string **********
1809 formulaStr += fComboCustomFit->GetTextEntry()->GetText();
1810 if (fChkAutoAppend->GetState() == kButtonDown)
1811 formulaStr = TString(fViewer->AddAbbreviations((char*)formulaStr.Data()));
1813 // ********** call AliTPCCalibViewer's fit-function
1814 ReplacePlaceHolders(drawStr);
1815 ReplacePlaceHolders(cutStr);
1816 TString *returnStr = fViewer->Fit(drawStr.Data(), formulaStr.Data(), cutStr.Data(), chi2, fitParam, covMatrix);
1818 std::cout << std::endl;
1819 std::cout << "Your fit formula reads as follows:" << std::endl;
1820 std::cout << returnStr->Data() << std::endl;
1821 std::cout << "chi2 = " << chi2 << std::endl;
1827 void AliTPCCalibViewerGUI::DoExport() {
1829 // function to export a CalPad to Cint
1831 if ( fRadio2D->GetState() != kButtonDown){
1832 Error("ExportCalPad", "Export of AliTPCCalPad to CINT works only in 2D mode.");
1835 // specify data to plot:
1836 TString desiredData(GetDrawString()->Data());
1838 TString cutsStr(GetCutString()->Data());
1839 // get name for the calPad
1840 const char* calPadName = fComboExportName->GetTextEntry()->GetText();
1841 // create calPad according to drawCommand and cuts
1842 AliTPCCalPad *calPad = fViewer->GetCalPad(desiredData.Data(), (char*)cutsStr.Data(), (char*)calPadName);
1843 // finally export calPad to Cint:
1844 gROOT->ProcessLine(Form("AliTPCCalPad* %s = (AliTPCCalPad*)0x%lx;", calPadName, (ULong_t)calPad));
1845 fPreprocessor->AddComponent(calPad);
1846 Info("ExportCalPad", "Current 2D view has been exported to an AliTPCCalPad* with name '%s'", calPadName);
1850 void AliTPCCalibViewerGUI::DoExportNorm() {
1852 // function to export a CalPad to Cint
1855 if ( fRadio2D->GetState() != kButtonDown){
1856 Error("ExportCalPad", "Adding an AliTPCCalPad to the normalization works only in 2D mode.");
1860 Error("DoExportNorm", "Not yet implemented.");
1864 // specify data to plot:
1865 TString desiredData(GetDrawString()->Data());
1867 TString sectorStr(GetSectorString()->Data());
1869 TString cutsStr(GetCutString()->Data());
1871 // get name for the calPad
1872 const char* calPadName = fComboExportName->GetTextEntry()->GetText();
1873 // create calPad according to drawCommand and cuts
1874 AliTPCCalPad *calPad = fViewer->GetCalPad(desiredData.Data(), (char*)cutsStr.Data(), (char*)fComboExportName->GetTextEntry()->GetText());
1875 // finally export calPad to Cint:
1876 gROOT->ProcessLine(Form("AliTPCCalPad* %s = (AliTPCCalPad*)0x%lx;", calPadName, (ULong_t) calPad));
1877 Info("ExportCalPad", "Current 2D view has been exported to an AliTPCCalPad* with name '%s'", calPadName);
1882 void AliTPCCalibViewerGUI::GetMinMax() {
1884 // Read current Min & Max from the plot and set it to fTxtSetMin & fTxtSetMax
1886 if (fChkGetMinMaxAuto->GetState() == kButtonUp) return;
1887 TList* listOfPrimitives = fCanvMain->GetCanvas()->GetListOfPrimitives();
1889 for (Int_t i = 0; i < listOfPrimitives->GetEntries(); i++) {
1890 ptr = listOfPrimitives->At(i);
1891 if ( ptr->InheritsFrom("TH1") ) break;
1893 if ( !ptr || !ptr->InheritsFrom("TH1") ) return; // if the loop did not find a TH1
1894 TH1 *hist = (TH1*)ptr;
1896 // Double_t histMax = hist->GetMaximum();
1897 // Double_t histMin = hist->GetMinimum();
1898 // fTxtSetMax->SetText(Form("%f",histMax));
1899 // fTxtSetMin->SetText(Form("%f",histMin));
1901 if (fRadio2D->GetState() == kButtonDown) {
1902 if (fChkSetMax->GetState() == kButtonUp)
1903 fTxtSetMax->SetText(Form("%f", hist->GetMaximum()));
1904 if (fChkSetMin->GetState() == kButtonUp)
1905 fTxtSetMin->SetText(Form("%f", hist->GetMinimum()));
1907 else if (fRadio1D->GetState() == kButtonDown) {
1908 if (fChkSetMax->GetState() == kButtonUp)
1909 fTxtSetMax->SetText( Form("%f", hist->GetXaxis()->GetXmax()) );
1910 if (fChkSetMin->GetState() == kButtonUp)
1911 fTxtSetMin->SetText( Form("%f", hist->GetXaxis()->GetXmin()) );
1916 void AliTPCCalibViewerGUI::SetMinMaxLabel() {
1918 // Set Minimum, Maximum and labels without redrawing the plot
1922 // search for histogram
1923 TList* listOfPrimitives = fCanvMain->GetCanvas()->GetListOfPrimitives();
1925 for (Int_t i = 0; i < listOfPrimitives->GetEntries(); i++) {
1926 ptr = listOfPrimitives->At(i);
1927 if ( ptr->InheritsFrom("TH1") ) break;
1929 if ( ptr == 0 || !ptr->InheritsFrom("TH1") ) { // if the loop did not find a TH1
1930 fCanvMain->GetCanvas()->Update();
1931 Warning("SetMinMaxLabel","No Histogram found!");
1933 // unable to find histogram, no min and max wil be read out
1936 TH1 *hist = (TH1*)ptr;
1937 TString minTxt(fTxtSetMin->GetText());
1938 TString maxTxt(fTxtSetMax->GetText());
1940 // set min and max according to specified values, if checkbox is checked
1941 if (fRadio2D->GetState() == kButtonDown) {
1942 if (fChkSetMax->GetState() == kButtonDown && fChkSetMax->GetState() == kButtonDown &&(maxTxt.IsDigit() || maxTxt.IsFloat()) )
1943 hist->SetMaximum(maxTxt.Atof());
1944 if (fChkSetMax->GetState() == kButtonUp)
1945 hist->SetMaximum(-1111); // default value, to unzoom
1946 if (fChkSetMin->GetState() == kButtonDown && (minTxt.IsDigit() || minTxt.IsFloat()) )
1947 hist->SetMinimum(minTxt.Atof());
1948 if (fChkSetMin->GetState() == kButtonUp)
1949 hist->SetMinimum(-1111); // default value, to unzoom
1951 else if (fRadio2D->GetState() == kButtonDown) {
1952 if (fChkSetMin->GetState() == kButtonDown &&
1953 fChkSetMax->GetState() == kButtonDown && hist->GetXaxis())
1954 hist->GetXaxis()->SetRangeUser(hist->GetXaxis()->GetXmin(), hist->GetXaxis()->GetXmax());
1955 else if (fChkSetMax->GetState() == kButtonDown && hist->GetXaxis())
1956 hist->GetXaxis()->SetRangeUser(hist->GetXaxis()->GetXmin(), maxTxt.Atof());
1957 else if (fChkSetMin->GetState() == kButtonDown && hist->GetXaxis())
1958 hist->GetXaxis()->SetRangeUser(minTxt.Atof(), hist->GetXaxis()->GetXmax());
1959 hist->SetTitle(hist->GetTitle()); // trick to update the histogram
1962 // get min and max from plot
1965 // set labels according to specification, if cehckboxes are checked
1966 if (fChkLabelTitle->GetState() == kButtonDown)
1967 hist->SetTitle(fTxtLabelTitle->GetText());
1968 if (fChkLabelXaxis->GetState() == kButtonDown)
1969 hist->GetXaxis()->SetTitle(fTxtLabelXaxis->GetText());
1970 if (fChkLabelYaxis->GetState() == kButtonDown)
1971 hist->GetYaxis()->SetTitle(fTxtLabelYaxis->GetText());
1972 // get and/or set labels and title
1973 if (fChkLabelGetAuto->GetState() == kButtonDown) {
1974 fTxtLabelTitle->SetText(hist->GetTitle());
1975 fTxtLabelXaxis->SetTitle(hist->GetXaxis()->GetTitle());
1976 fTxtLabelYaxis->SetTitle(hist->GetYaxis()->GetTitle());
1978 hist->SetTitle(hist->GetTitle()); // trick to update the histogram
1979 fCanvMain->GetCanvas()->Update();
1983 void AliTPCCalibViewerGUI::ChangeSector(){
1985 // function that is called, when the number of the sector is changed
1986 // to change the sector label
1988 if ( fRadioROC->GetState()!=kButtonDown && fRadioSector->GetState()!=kButtonDown ){
1989 fLblSector->SetText("not used");
1993 Int_t sector = (Int_t)(fNmbSector->GetNumber());
1994 TString secLabel = "";
2000 if (fRadioSector->GetState()==kButtonDown)
2003 if ( sector%36<18 ) //A-Side
2008 secLabel += Form("%02d",sector%18);
2010 fLblSector->SetText(secLabel);
2015 void AliTPCCalibViewerGUI::AddFitFunction() const {
2017 // adds the last fit function to the normalization list
2019 std::cout << "Not yet implemented." << std::endl;
2023 void AliTPCCalibViewerGUI::UnchekAllStat() {
2025 // Disable all statistical legend entries, no statistical legend.
2027 fChkStatName->SetState(kButtonUp);
2028 fChkStatEntries->SetState(kButtonUp);
2029 fChkStatMean->SetState(kButtonUp);
2030 fChkStatMeanPM->SetState(kButtonUp);
2031 fChkStatRMS->SetState(kButtonUp);
2032 fChkStatRMSPM->SetState(kButtonUp);
2033 fChkStatUnderflow->SetState(kButtonUp);
2034 fChkStatOverflow->SetState(kButtonUp);
2035 fChkStatIntegral->SetState(kButtonUp);
2036 fChkStatSkewness->SetState(kButtonUp);
2037 fChkStatSkewnessPM->SetState(kButtonUp);
2038 fChkStatKurtosis->SetState(kButtonUp);
2039 fChkStatKurtosisPM->SetState(kButtonUp);
2041 HandleButtonsStat(0);
2045 void AliTPCCalibViewerGUI::MouseMove(Int_t event, Int_t x, Int_t y, TObject *selectedObject) {
2048 // zoom to sector works ONLY in 2D mode, if one side is specified
2050 Double_t pi = TMath::Pi();
2051 if (event != kButton1Double )
2053 if (!selectedObject->InheritsFrom("TH2")) return;
2054 // zoom to sector works ONLY in 2D mode, if one side is specified
2055 if (fRadio2D->GetState() == kButtonUp) return;
2056 if (fRadioROC->GetState() == kButtonDown) { // return to full side view
2057 // return to full side view
2058 Int_t sector = (Int_t)(fNmbSector->GetNumber());
2059 if ( (sector >= 0 && sector <= 17) || (sector >= 36 && sector <= 53) ) {
2061 fRadioSideA->Clicked();
2062 fRadioSideA->SetState(kButtonDown);
2065 if ( (sector >= 18 && sector <= 35) || (sector >= 54 && sector <= 71) ) {
2067 fRadioSideC->Clicked();
2068 fRadioSideC->SetState(kButtonDown);
2073 if (!(fRadioSideA->GetState() == kButtonDown || fRadioSideC->GetState() == kButtonDown)) return;
2075 // Int_t px = gPad->GetEventX();
2076 // Int_t py = gPad->GetEventY();
2077 Float_t upy = gPad->AbsPixeltoY(y);
2078 Float_t upx = gPad->AbsPixeltoX(x);
2079 Float_t gy = gPad->PadtoY(upy);
2080 Float_t gx = gPad->PadtoX(upx);
2081 Int_t quadrant = -1;
2082 if (gx >= 0 && gy >= 0) quadrant = 1;
2083 if (gx < 0 && gy >= 0) quadrant = 2;
2084 if (gx < 0 && gy < 0) quadrant = 3;
2085 if (gx >= 0 && gy < 0) quadrant = 4;
2086 gx = TMath::Abs(gx);
2087 gy = TMath::Abs(gy);
2088 Double_t phi = TMath::ATan(gy/gx); // angle phi is in Pi- units
2089 Double_t r = TMath::Sqrt(gx*gx + gy*gy);
2090 if (quadrant == 2) phi = pi - phi;
2091 if (quadrant == 3) phi = pi + phi;
2092 if (quadrant == 4) phi = 2 * pi - phi;
2093 Double_t phiGrad = phi / pi * 180;
2094 Int_t sector = (Int_t) phiGrad / 20; // one sector coresponds to 20�
2095 // IROC starts at 84.5 cm
2096 // IROC ends at 135.5 cm, OROC begins
2097 // OROC ends at 250 cm
2098 if (r < 84.5 || r > 250) return; // outside TPC
2099 if (r < 135.5) { // IROC
2100 if (fRadioSideC->GetState() == kButtonDown) sector += 18;
2104 if (fRadioSideC->GetState() == kButtonDown) sector += 18;
2106 // printf("r: %f, phi: %f, phiGrad: %f, gy/gx: %f, quadrant: %i, sector: %i \n", r, phi, phiGrad, gy/gx, quadrant, sector);
2107 fNmbSector->SetNumber(sector);
2108 fRadioROC->Clicked();
2109 fRadioROC->SetState(kButtonDown);
2114 void AliTPCCalibViewerGUI::SavePicture() {
2116 // saves the current picture
2118 // use the following combination of file type and save options:
2119 // (see also TCanvas::Print)
2121 // "ps" - Postscript file is produced (see special cases below)
2122 // "Portrait" - Postscript file is produced (Portrait)
2123 // "Landscape" - Postscript file is produced (Landscape)
2124 // "eps" - an Encapsulated Postscript file is produced
2125 // "Preview" - an Encapsulated Postscript file with preview is produced.
2126 // "pdf" - a PDF file is produced
2127 // "svg" - a SVG file is produced
2128 // "gif" - a GIF file is produced
2129 // "gif+NN" - an animated GIF file is produced, where NN is delay in 10ms units
2130 // "xpm" - a XPM file is produced
2131 // "png" - a PNG file is produced
2132 // "jpg" - a JPEG file is produced
2133 // "tiff" - a TIFF file is produced
2134 // "cxx" - a C++ macro file is produced
2135 // "xml" - a XML file
2136 // "root" - a ROOT binary file
2138 const char *kSaveAsTypes[] = {
2139 "Postscript", "*.ps",
2140 "Encapsulated Postscript", "*.eps",
2149 "C++ macro", "*.cxx",
2150 "Macro file", "*.C",
2151 "ROOT file", "*.root",
2155 TString addSaveOpt("");
2156 if (fChkAddSaveOpt->GetState() == kButtonDown)
2157 addSaveOpt += fComboAddSaveOpt->GetTextEntry()->GetText();
2160 fi.fFileTypes = kSaveAsTypes;
2161 // fi.fIniDir = StrDup(dir);
2162 fi.fOverwrite = kFALSE;
2163 new TGFileDialog(gClient->GetRoot(), gClient->GetRoot(), kFDSave, &fi);
2164 if (fi.fFilename && strlen(fi.fFilename)) {
2165 if (addSaveOpt != "")
2166 fCanvMain->GetCanvas()->Print(fi.fFilename, addSaveOpt.Data());
2168 fCanvMain->GetCanvas()->Print(fi.fFilename);
2171 // TList* fFileNamesList list of selected file names
2172 // Int_t fFileTypeIdx selected file type, index in fFileTypes
2173 // const char** fFileTypes file types used to filter selectable files
2174 // char* fFilename selected file name
2175 // char* fIniDir on input: initial directory, on output: new directory
2176 // Bool_t fMultipleSelection if true, allow multiple file selection
2177 // Bool_t fOverwrite if true overwrite the file with existing name on save
2182 void AliTPCCalibViewerGUI::DoDumpToFile() {
2184 // This function is called, when the "Dump to File" button is pressed.
2185 // All the exported CalPads will be written into an new CalibTree,
2186 // a Save File dialog will appear to specify the filename
2188 const char *kSaveAsTypes[] = {
2189 "ROOT file", "*.root",
2194 fi.fFileTypes = kSaveAsTypes;
2195 // fi.fIniDir = StrDup(dir);
2196 fi.fOverwrite = kFALSE;
2197 new TGFileDialog(gClient->GetRoot(), gClient->GetRoot(), kFDSave, &fi);
2198 if (fi.fFilename && strlen(fi.fFilename)) {
2199 fPreprocessor->DumpToFile(fi.fFilename);
2200 Info("DumpToFile","New CalibTree has been writen to file '%s'", fi.fFilename);
2205 void AliTPCCalibViewerGUI::DoLoadTree() {
2206 // function to load a new calib tree
2209 const char *kFileTypes[] = {
2210 "ROOT file", "*.root",
2215 fi.fFileTypes = kFileTypes;
2216 // fi.fIniDir = StrDup(dir);
2217 fi.fOverwrite = kFALSE;
2218 new TGFileDialog(gClient->GetRoot(), gClient->GetRoot(), kFDOpen, &fi);
2219 if (fi.fFilename && strlen(fi.fFilename) && fChkAddAsReference->GetState() == kButtonUp) {
2220 Initialize(fi.fFilename);
2223 else if (fi.fFilename && strlen(fi.fFilename) && fChkAddAsReference->GetState() == kButtonDown) {
2224 fViewer->AddReferenceTree(fi.fFilename, "calPads", fTxtRefName->GetText());
2230 TObjArray* AliTPCCalibViewerGUI::ShowGUI(const char* fileName) {
2232 // Initialize and show GUI for presentation for demonstration purposes
2233 // or for fast standalone use
2235 TGMainFrame* frmMain = new TGMainFrame(gClient->GetRoot(), 1000, 600);
2236 frmMain->SetWindowName("AliTPCCalibViewer GUI");
2237 frmMain->SetCleanup(kDeepCleanup);
2239 TGTab* tabMain = new TGTab(frmMain, 1000, 600);
2240 frmMain->AddFrame(tabMain, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
2242 TGCompositeFrame* tabCont1 = tabMain->AddTab("Viewer 1");
2243 TGCompositeFrame* tabCont2 = tabMain->AddTab("Viewer 2");
2245 AliTPCCalibViewerGUI* calibViewer1 = new AliTPCCalibViewerGUI(tabCont1, 1000, 600, (char*)fileName);
2246 tabCont1->AddFrame(calibViewer1, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
2248 AliTPCCalibViewerGUI* calibViewer2 = new AliTPCCalibViewerGUI(tabCont2, 1000, 600, (char*)fileName);
2249 tabCont2->AddFrame(calibViewer2, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
2251 TObjArray *guiArray = new TObjArray();
2252 guiArray->Add(calibViewer1);
2253 guiArray->Add(calibViewer2);
2255 frmMain->MapSubwindows();
2257 frmMain->MapWindow();