Memory leak corrected. (D. Perrino)
[u/mrichter/AliRoot.git] / TPC / AliTPCCalibViewerGUI.cxx
CommitLineData
39bcd65d 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16
17///////////////////////////////////////////////////////////////////////////////
18// //
19// GUI for the AliTPCCalibViewer //
a6d2bd0c 20// used for the calibration monitor //
72d0ab7e 21// All functionalities of the AliTPCCalibViewer are here available
22//
a6d2bd0c 23// Example usage: //
39bcd65d 24/*
25 aliroot
72d0ab7e 26 AliTPCCalibViewerGUI::ShowGUI("CalibTree.root")
832bb12c 27
a6d2bd0c 28*/
72d0ab7e 29// //
39bcd65d 30// //
31///////////////////////////////////////////////////////////////////////////////
32
33
34#include "AliTPCCalibViewerGUI.h"
72d0ab7e 35#include <iostream>
39bcd65d 36
37#include <TCanvas.h>
38#include <TPad.h>
39#include <TVirtualPad.h>
40
832bb12c 41#include <TROOT.h>
39bcd65d 42#include <TObjArray.h>
43#include <TObjString.h>
44#include <TVector.h>
a6d2bd0c 45#include <string.h>
46#include <TH1.h>
72d0ab7e 47#include "TStyle.h"
4f3934a1 48#include "TGFileDialog.h"
8192627b 49#include "TGInputDialog.h"
50#include "AliTPCCalibViewer.h"
51#include "AliTPCPreprocessorOnline.h"
72d0ab7e 52
53// #include "TGListBox.h"
54// #include "TGNumberEntry"
55// #include "TGSplitter"
56// #include "TGTab"
57// #include "TGLabel"
58// #include "TGButtonGroup"
59// #include "TGComboBox"
60// #include "TRootEmbeddedCanvas"
61// #include "TGButton"
62// #include "TGRadioButton"
63// #include "GTCheckButton"
64// #include "TGTextEntry"
65
66
a6d2bd0c 67
39bcd65d 68
69ClassImp(AliTPCCalibViewerGUI)
70
71AliTPCCalibViewerGUI::AliTPCCalibViewerGUI(const TGWindow *p, UInt_t w, UInt_t h, char* fileName)
a6d2bd0c 72 : TGCompositeFrame(p, w, h),
39bcd65d 73 fViewer(0),
8192627b 74 fPreprocessor(0),
a6d2bd0c 75 fContTopBottom(0),
76 fContLCR(0),
39bcd65d 77 fContLeft(0),
72d0ab7e 78 ftabLeft(0),
79 ftabLeft0(0),
80 ftabLeft1(0),
4f3934a1 81 ftabRight(0),
82 fTabRight0(0),
83 fTabRight1(0),
39bcd65d 84 fContRight(0),
85 fContCenter(0),
86 fContPlotOpt(0),
87 fContDrawOpt(0),
a6d2bd0c 88 fContDrawOptSub1D2D(0),
39bcd65d 89 fContNormalized(0),
90 fContCustom(0),
91 fContCuts(0),
92 fContSector(0),
93 fContAddCuts(0),
a6d2bd0c 94 fContFit(0),
95 fContAddFit(0),
96 fContScaling(0),
97 fContSetMax(0),
98 fContSetMin(0),
72d0ab7e 99 fContAddDrawOpt(0),
39bcd65d 100 fListVariables(0),
101 fBtnDraw(0),
a6d2bd0c 102 fBtnFit(0),
103 fBtnAddFitFunction(0),
104 fBtnGetMinMax(0),
39bcd65d 105 fCanvMain(0),
106 fRadioRaw(0),
107 fRadioNormalized(0),
a6d2bd0c 108 fRadioPredefined(0),
39bcd65d 109 fRadioCustom(0),
110 fRadio1D(0),
111 fRadio2D(0),
112 fRadioTPC(0),
113 fRadioSideA(0),
114 fRadioSideC(0),
115 fRadioSector(0),
72d0ab7e 116 fComboAddDrawOpt(0),
39bcd65d 117 fChkAuto(0),
8192627b 118 fChkAutoAppend(0),
39bcd65d 119 fComboMethod(0),
120 fListNormalization(0),
a6d2bd0c 121 fComboCustom(0),
4f3934a1 122 fLblCustomDraw(0),
72d0ab7e 123 fChkAddDrawOpt(0),
39bcd65d 124 fNmbSector(0),
a6d2bd0c 125 fLblSector(0),
72d0ab7e 126 fChkCutZero(0),
39bcd65d 127 fChkAddCuts(0),
4f3934a1 128 fLblAddCuts(0),
a6d2bd0c 129 fComboAddCuts(0),
130 fComboCustomFit(0),
131 fChkSetMax(0),
132 fChkSetMin(0),
133 fChkGetMinMaxAuto(0),
134 fTxtSetMax(0),
72d0ab7e 135 fTxtSetMin(0) ,
136 fContDrawOpt1D(0),
137 fcontDrawOpt1DSubLR(0),
138 fContDrawOpt1DSubNSC(0),
139 fRadioNorm(0),
140 fRadioSigma(0),
141 fTxtSigmas(0),
142 fContCumuLR(0),
143 fContCumLeft(0),
144 fContCumRight(0),
145 fLblSigmaMax(0),
146 fTxtSigmaMax(0),
147 fRadioCumulative(0),
148 fCheckCumulativePM(0),
149 fRadioIntegrate(0),
150 fContDrawOpt1DSubMML(0),
151 fChkMean(0),
152 fChkMedian(0),
153 fChkLTM(0),
154 fContStatOpt(0),
155 fChkStatName(0),
156 fChkStatEntries(0),
157 fContStatMean(0),
158 fChkStatMean(0),
159 fChkStatMeanPM(0),
160 fContStatRMS(0),
161 fChkStatRMS(0),
162 fChkStatRMSPM(0),
163 fChkStatUnderflow(0),
164 fChkStatOverflow(0),
165 fChkStatIntegral(0),
166 fContStatSkew(0),
167 fChkStatSkewness(0),
168 fChkStatSkewnessPM(0),
169 fContStatKurt(0),
170 fChkStatKurtosis(0),
4f3934a1 171 fChkStatKurtosisPM(0),
832bb12c 172 fBtnUnchekAll(0),
4f3934a1 173 fContLabeling(0),
174 fChkLabelTitle(0),
175 fTxtLabelTitle(0),
176 fChkLabelXaxis(0),
177 fTxtLabelXaxis(0),
178 fChkLabelYaxis(0),
179 fTxtLabelYaxis(0),
180 fChkLabelGetAuto(0),
181 fContSave(0),
182 fBtnSave(0),
183 fContAddSaveOpt(0),
184 fChkAddSaveOpt(0),
832bb12c 185 fComboAddSaveOpt(0),
186 fContExport(0),
187 fContAddExport(0),
188 fComboExportName(0),
189 fBtnExport(0),
8192627b 190 fBtnAddNorm(0),
191 fContTree(0),
192 fBtnDumpToFile(0),
193 fBtnLoadTree(0),
194 fChkAddAsReference(0),
195 fTxtRefName(0),
196 fInitialized(0)
39bcd65d 197{
72d0ab7e 198 //
199 // AliTPCCalibViewerGUI constructor; fileName specifies the ROOT tree used for drawing
200 //
832bb12c 201
202 // draw the GUI:
8192627b 203 fPreprocessor = new AliTPCPreprocessorOnline();
832bb12c 204 DrawGUI(p, w, h);
205 // initialize the AliTPCCalibViewer:
206 if (fileName) Initialize(fileName);
207 // set default button states:
208 SetInitialValues();
209 // do first drawing:
8192627b 210 if (fileName) DoDraw();
832bb12c 211}
212
213
214void AliTPCCalibViewerGUI::DrawGUI(const TGWindow *p, UInt_t w, UInt_t h) {
215 //
216 // draw the GUI
217 //
218 // ======================================================================
219 // ************************* Display everything *************************
220 // ======================================================================
39bcd65d 221
832bb12c 222 SetCleanup(kDeepCleanup);
8192627b 223 p = p; // to avoid compiler warnings
832bb12c 224
72d0ab7e 225 // *****************************************************************************
39bcd65d 226 // ************************* content of this MainFrame *************************
72d0ab7e 227 // *****************************************************************************
39bcd65d 228 // top level container with horizontal layout
a6d2bd0c 229 fContTopBottom = new TGCompositeFrame(this, w, h, kVerticalFrame | kFixedWidth | kFixedHeight);
230 AddFrame(fContTopBottom, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
231
232 fContLCR = new TGCompositeFrame(fContTopBottom, w, h, kHorizontalFrame | kFixedWidth | kFixedHeight);
233 fContTopBottom->AddFrame(fContLCR, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
234
72d0ab7e 235 // ***********************************************************************
a6d2bd0c 236 // ************************* content of fContLCR *************************
72d0ab7e 237 // ***********************************************************************
39bcd65d 238 // left container
a6d2bd0c 239 fContLeft = new TGCompositeFrame(fContLCR, 200, 200, kVerticalFrame | kFixedWidth | kFitHeight);
240 fContLCR->AddFrame(fContLeft, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandY, 5, 3, 3, 3));
39bcd65d 241
242 // left vertical splitter
a6d2bd0c 243 TGVSplitter *splitLeft = new TGVSplitter(fContLCR);
39bcd65d 244 splitLeft->SetFrame(fContLeft, kTRUE);
a6d2bd0c 245 fContLCR->AddFrame(splitLeft, new TGLayoutHints(kLHintsLeft | kLHintsExpandY, 0, 0, 0, 0));
39bcd65d 246
247 // right container
a6d2bd0c 248 fContRight = new TGCompositeFrame(fContLCR, 150, 200, kVerticalFrame | kFixedWidth | kFitHeight);
249 fContLCR->AddFrame(fContRight, new TGLayoutHints(kLHintsTop | kLHintsRight | kLHintsExpandY, 3, 5, 3, 3));
39bcd65d 250
251 // center container
a6d2bd0c 252 fContCenter = new TGCompositeFrame(fContLCR, 200, 200, kVerticalFrame | kFixedWidth | kFitHeight);
253 fContLCR->AddFrame(fContCenter, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
39bcd65d 254
255 // right vertical splitter
a6d2bd0c 256 TGVSplitter *splitRight = new TGVSplitter(fContLCR);
39bcd65d 257 splitRight->SetFrame(fContRight, kFALSE);
a6d2bd0c 258 fContLCR->AddFrame(splitRight, new TGLayoutHints(kLHintsLeft | kLHintsExpandY, 0, 0, 0, 0));
39bcd65d 259
72d0ab7e 260
261 // ========================================================================
39bcd65d 262 // ************************* content of fContLeft *************************
72d0ab7e 263 // ========================================================================
264 // --- draw button and tabLeft ---
a6d2bd0c 265 // draw button
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()");
832bb12c 270 fBtnDraw->SetToolTipText("Press here to draw according to selections.");
a6d2bd0c 271
4f3934a1 272 // tabs on the left side:
72d0ab7e 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");
277
a6d2bd0c 278
72d0ab7e 279 // **************************** content of tabLeft0 *******************************
280
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));
286
287 // ------------------------- content of fContDrawOpt -------------------------
288 // -- radio1D, radio2D, chkAuto
289 // 1D radio button
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()");
832bb12c 293 fRadio1D->SetToolTipText("1D drawing \nSelect this if you want to have the full control for the custom draw.");
72d0ab7e 294
295 // 2D radio button
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()");
832bb12c 299 fRadio2D->SetToolTipText("2D drawing");
72d0ab7e 300
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));
304
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()");
832bb12c 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).");
72d0ab7e 312
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));
832bb12c 318 fComboAddDrawOpt->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsGeneral(=14)");
72d0ab7e 319 fComboAddDrawOpt->Connect("Selected(Int_t)", "AliTPCCalibViewerGUI", this, "DoNewSelection()");
320
321 // automatic redraw check button
832bb12c 322 fChkAuto = new TGCheckButton(fContDrawOpt, "Auto redraw");
72d0ab7e 323 fContDrawOpt->AddFrame(fChkAuto, new TGLayoutHints(kLHintsNormal, 0, 2, 0, 0));
832bb12c 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'.");
8192627b 325
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!");
72d0ab7e 330
331
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()");
832bb12c 336 fRadioPredefined->SetToolTipText("Draw predefined variables according to selection.");
72d0ab7e 337
338 // list of variables
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()");
a6d2bd0c 342
72d0ab7e 343
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));
348
349 // ------------------------- content of fContPlotOpt -------------------------
350 // raw radio button
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()");
832bb12c 354 fRadioRaw->SetToolTipText("Plot without normalization");
72d0ab7e 355
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()");
832bb12c 360 fRadioNormalized->SetToolTipText("Normalize data");
72d0ab7e 361
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));
365
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()");
373
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()");
39bcd65d 378
72d0ab7e 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()");
832bb12c 383 fRadioCustom->SetToolTipText("Draw data according to user specific text entry in the 'Custom Draw' line. Remember '~' (= '.fElements')!");
4f3934a1 384 // custom options container is located further down
72d0ab7e 385
386 // **************************** content of tabLeft1 *******************************
387
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));
391
392 fcontDrawOpt1DSubLR = new TGCompositeFrame(fContDrawOpt1D, 1, 1, kVerticalFrame | kFitWidth | kFitHeight);
393 fContDrawOpt1D->AddFrame(fcontDrawOpt1DSubLR, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
394
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));
398
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()");
832bb12c 403 fRadioNorm->SetToolTipText("Produce a normal 1D plot, a histogram of the selected data.");
72d0ab7e 404
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()");
832bb12c 408 fRadioSigma->SetToolTipText("Draw a normal histogram, but also lines that indicate the mean/median/LTM \nand sigmas of the selected data.");
72d0ab7e 409
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)");
832bb12c 413 fTxtSigmas->SetToolTipText("Enter sigma intervals you would like to be indicated by lines. \nExample: '2; 4; 6'");
72d0ab7e 414
415 fContCumuLR = new TGCompositeFrame(fContDrawOpt1DSubNSC, 200, 23, kHorizontalFrame | kFitWidth | kFitHeight);
416 fContDrawOpt1DSubNSC->AddFrame(fContCumuLR, new TGLayoutHints(kLHintsExpandX, 0, 0, 5, 0));
417
418 fContCumLeft = new TGCompositeFrame(fContCumuLR, 200, 23, kVerticalFrame | kFitWidth | kFitHeight);
419 fContCumuLR->AddFrame(fContCumLeft, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
420
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()");
832bb12c 424 fRadioCumulative->SetToolTipText("Draw the cumulative (SigmaCut) of the given selection. \nThe data distribution is integrated, starting from the mean/median/LTM.");
72d0ab7e 425
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()");
832bb12c 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.");
72d0ab7e 430
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()");
832bb12c 434 fRadioIntegrate->SetToolTipText("Draw the integral of the given selection.");
72d0ab7e 435
436 fContCumRight = new TGCompositeFrame(fContCumuLR, 200, 23, kVerticalFrame | kFitWidth | kFitHeight);
437 fContCumuLR->AddFrame(fContCumRight, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
438
439 fLblSigmaMax = new TGLabel(fContCumRight, "SigmaMax:");
440 fLblSigmaMax->SetTextJustify(kTextLeft);
441 fContCumRight->AddFrame(fLblSigmaMax, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 5, 0, 0, 0));
442
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)");
832bb12c 446 fTxtSigmaMax->SetToolTipText("Enter up to which multiple of sigma you want to integrate.");
72d0ab7e 447
448
449 fContDrawOpt1DSubMML = new TGCompositeFrame(fcontDrawOpt1DSubLR, 200, 23, kHorizontalFrame | kFitWidth | kFitHeight);
450 fcontDrawOpt1DSubLR->AddFrame(fContDrawOpt1DSubMML, new TGLayoutHints(kLHintsExpandX, 0, 0, 5, 0));
451
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()");
832bb12c 456 fChkMean->SetToolTipText("Activate Mean for Sigma/Cumulative/Integrate");
72d0ab7e 457
458 fChkMedian = new TGCheckButton(fContDrawOpt1DSubMML, "Median");
459 fContDrawOpt1DSubMML->AddFrame(fChkMedian, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
460 fChkMedian->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtons1D()");
832bb12c 461 fChkMedian->SetToolTipText("Activate Median for Sigma/Cumulative/Integrate");
72d0ab7e 462
463 fChkLTM = new TGCheckButton(fContDrawOpt1DSubMML, "LTM");
464 fContDrawOpt1DSubMML->AddFrame(fChkLTM, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
465 fChkLTM->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtons1D()");
832bb12c 466 fChkLTM->SetToolTipText("Activate LTM for Sigma/Cumulative/Integrate");
72d0ab7e 467
468
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));
472
473 fChkStatName = new TGCheckButton(fContStatOpt, "Name");
474 fContStatOpt->AddFrame(fChkStatName, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
475 fChkStatName->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
832bb12c 476 fChkStatName->SetToolTipText("Display the name in the statistics legend.");
72d0ab7e 477
478 fChkStatEntries = new TGCheckButton(fContStatOpt, "Entries");
479 fContStatOpt->AddFrame(fChkStatEntries, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
480 fChkStatEntries->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
832bb12c 481 fChkStatEntries->SetToolTipText("Display the number of entries in the statistics legend.");
72d0ab7e 482
483 fContStatMean = new TGCompositeFrame(fContStatOpt, 1, 1, kHorizontalFrame | kFitWidth | kFitHeight);
484 fContStatOpt->AddFrame(fContStatMean, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
485
486 fChkStatMean = new TGCheckButton(fContStatMean, "Mean");
487 fContStatMean->AddFrame(fChkStatMean, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
488 fChkStatMean->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
832bb12c 489 fChkStatMean->SetToolTipText("Display the mean value of the data in the statistics legend.");
72d0ab7e 490
491 fChkStatMeanPM = new TGCheckButton(fContStatMean, "+- Error");
492 fContStatMean->AddFrame(fChkStatMeanPM, new TGLayoutHints(kLHintsNormal, 10, 0, 0, 0));
493 fChkStatMeanPM->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
832bb12c 494 fChkStatMeanPM->SetToolTipText("Display the mean value's error in the statistics legend.");
a6d2bd0c 495
72d0ab7e 496 fContStatRMS = new TGCompositeFrame(fContStatOpt, 1, 1, kHorizontalFrame | kFitWidth | kFitHeight);
497 fContStatOpt->AddFrame(fContStatRMS, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
498
499 fChkStatRMS = new TGCheckButton(fContStatRMS, "RMS");
500 fContStatRMS->AddFrame(fChkStatRMS, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
501 fChkStatRMS->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
832bb12c 502 fChkStatRMS->SetToolTipText("Display the RMS value of the data in the statistics legend.");
72d0ab7e 503
504 fChkStatRMSPM = new TGCheckButton(fContStatRMS, "+- Error");
505 fContStatRMS->AddFrame(fChkStatRMSPM, new TGLayoutHints(kLHintsNormal, 10, 0, 0, 0));
506 fChkStatRMSPM->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
832bb12c 507 fChkStatRMSPM->SetToolTipText("Display the RMS value's error in the statistics legend.");
a6d2bd0c 508
72d0ab7e 509 fChkStatUnderflow = new TGCheckButton(fContStatOpt, "Underflow");
510 fContStatOpt->AddFrame(fChkStatUnderflow, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
511 fChkStatUnderflow->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
832bb12c 512 fChkStatUnderflow->SetToolTipText("Display the number of entries in the underflow bin.");
72d0ab7e 513
514 fChkStatOverflow = new TGCheckButton(fContStatOpt, "Overflow");
515 fContStatOpt->AddFrame(fChkStatOverflow, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
516 fChkStatOverflow->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
832bb12c 517 fChkStatOverflow->SetToolTipText("Display the number of entries in the overflow bin.");
72d0ab7e 518
519 fChkStatIntegral = new TGCheckButton(fContStatOpt, "Integral");
520 fContStatOpt->AddFrame(fChkStatIntegral, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
521 fChkStatIntegral->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
832bb12c 522 fChkStatIntegral->SetToolTipText("Display the integral of the data in the statistics legend.");
72d0ab7e 523
524 fContStatSkew = new TGCompositeFrame(fContStatOpt, 1, 1, kHorizontalFrame | kFitWidth | kFitHeight);
525 fContStatOpt->AddFrame(fContStatSkew, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
526
527 fChkStatSkewness = new TGCheckButton(fContStatSkew, "Skewness");
528 fContStatSkew->AddFrame(fChkStatSkewness, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
529 fChkStatSkewness->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
832bb12c 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!");
72d0ab7e 531
532 fChkStatSkewnessPM = new TGCheckButton(fContStatSkew, "+- Error");
533 fContStatSkew->AddFrame(fChkStatSkewnessPM, new TGLayoutHints(kLHintsNormal, 10, 0, 0, 0));
534 fChkStatSkewnessPM->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
832bb12c 535 fChkStatSkewnessPM->SetToolTipText("Display the skewness' error in the statistics legend.");
72d0ab7e 536
537 fContStatKurt = new TGCompositeFrame(fContStatOpt, 1, 1, kHorizontalFrame | kFitWidth | kFitHeight);
538 fContStatOpt->AddFrame(fContStatKurt, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
539
540 fChkStatKurtosis = new TGCheckButton(fContStatKurt, "Kurtosis");
541 fContStatKurt->AddFrame(fChkStatKurtosis, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
542 fChkStatKurtosis->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
832bb12c 543 fChkStatKurtosis->SetToolTipText("Display the kurtosis of the data in the statistics legend.");
72d0ab7e 544
545 fChkStatKurtosisPM = new TGCheckButton(fContStatKurt, "+- Error");
546 fContStatKurt->AddFrame(fChkStatKurtosisPM, new TGLayoutHints(kLHintsNormal, 10, 0, 0, 0));
547 fChkStatKurtosisPM->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
832bb12c 548 fChkStatKurtosisPM->SetToolTipText("Display the kurtosis' error in the statistics legend.");
549
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.");
72d0ab7e 555
4f3934a1 556
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));
561
562 // ------------------------- content of fContCustom -------------------------
832bb12c 563 fLblCustomDraw = new TGLabel(fContCustom, "Custom draw: ");
4f3934a1 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()");
573
574
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));
578
579 // ------------------------- content of fContAddCuts -------------------------
832bb12c 580 fLblAddCuts = new TGLabel(fContAddCuts, "Custom cuts: ");
4f3934a1 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));
832bb12c 588 fComboAddCuts->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsCuts(=31)");
4f3934a1 589 fComboAddCuts->Connect("Selected(Int_t)", "AliTPCCalibViewerGUI", this, "DoNewSelection()");
72d0ab7e 590
72d0ab7e 591 // ==========================================================================
592 // ************************* content of fContCenter *************************
593 // ========================================================================
594 // main drawing canvas
832bb12c 595 fCanvMain = new TRootEmbeddedCanvas("Main_Canvas", fContCenter, 200, 200, kFitWidth | kFitHeight);
72d0ab7e 596 fContCenter->AddFrame(fCanvMain, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
832bb12c 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.");
72d0ab7e 600
601
602 // =========================================================================
39bcd65d 603 // ************************* content of fContRight *************************
72d0ab7e 604 // ========================================================================
72d0ab7e 605
4f3934a1 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");
611
72d0ab7e 612
4f3934a1 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));
72d0ab7e 617
72d0ab7e 618
4f3934a1 619 // ************************* content of fContCuts *************************
620 // TPC radio button
832bb12c 621 fRadioTPC = new TGRadioButton(fContCuts, "Whole TPC", 20);
4f3934a1 622 fContCuts->AddFrame(fRadioTPC, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
832bb12c 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!");
72d0ab7e 625
4f3934a1 626 // side A radio button
832bb12c 627 fRadioSideA = new TGRadioButton(fContCuts, "Side A", 21);
4f3934a1 628 fContCuts->AddFrame(fRadioSideA, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
832bb12c 629 fRadioSideA->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsCuts()");
630 fRadioSideA->SetToolTipText("Use only side A.");
72d0ab7e 631
4f3934a1 632 // side C radio button
832bb12c 633 fRadioSideC = new TGRadioButton(fContCuts, "Side C", 22);
4f3934a1 634 fContCuts->AddFrame(fRadioSideC, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
832bb12c 635 fRadioSideC->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsCuts()");
636 fRadioSideC->SetToolTipText("Use only side C.");
72d0ab7e 637
4f3934a1 638 // sector radio button
832bb12c 639 fRadioSector = new TGRadioButton(fContCuts, "ROC", 23);
4f3934a1 640 fContCuts->AddFrame(fRadioSector, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
832bb12c 641 fRadioSector->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsCuts()");
642 fRadioSector->SetToolTipText("Use only one ROC (readout chamber).");
72d0ab7e 643
4f3934a1 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));
72d0ab7e 647
4f3934a1 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()");
653
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));
658
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()");
832bb12c 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.");
72d0ab7e 664
4f3934a1 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()");
832bb12c 669 fChkAddCuts->SetToolTipText("Activate the custom cuts on the bottom. Remember '~' (= '.fElements')!");
4f3934a1 670 // fContAddCuts' content is locaed further op
72d0ab7e 671
72d0ab7e 672
4f3934a1 673 // Scaling options container
674 fContScaling = new TGGroupFrame(fTabRight0, "Scaling", kVerticalFrame | kFitWidth | kFitHeight);
675 fTabRight0->AddFrame(fContScaling, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
39bcd65d 676
4f3934a1 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));
681
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));
832bb12c 686 fChkSetMax->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw()");
687 fChkSetMax->SetToolTipText("Set the maximum fixed to the value specified here.");
4f3934a1 688
689 // text field for maximum value
690 fTxtSetMax = new TGTextEntry(fContSetMax, "", 41);
691 fContSetMax->AddFrame(fTxtSetMax, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
832bb12c 692 fTxtSetMax->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw()");
693 fTxtSetMax->SetToolTipText("maximum value for the drawing");
4f3934a1 694
695 // SetMinimum container
696 fContSetMin = new TGCompositeFrame(fContScaling, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
697 fContScaling->AddFrame(fContSetMin, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
698
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));
832bb12c 703 fChkSetMin->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw()");
704 fChkSetMin->SetToolTipText("Set the minimum fixed to the value specified here.");
4f3934a1 705
706 // text field for minimum value
707 fTxtSetMin = new TGTextEntry(fContSetMin, "", 40);
708 fContSetMin->AddFrame(fTxtSetMin, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
832bb12c 709 fTxtSetMin->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw()");
710 fTxtSetMin->SetToolTipText("minimum value for the drawing");
4f3934a1 711
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()");
832bb12c 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'.");
4f3934a1 717
718 // GetMinMaxAuto - checkbox
719 fChkGetMinMaxAuto = new TGCheckButton(fContScaling, "Get Min + Max auto.");
720 fContScaling->AddFrame(fChkGetMinMaxAuto, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
832bb12c 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.");
4f3934a1 723
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));
727
728 fChkLabelTitle = new TGCheckButton(fContLabeling, "Set title:");
729 fContLabeling->AddFrame(fChkLabelTitle, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
832bb12c 730 fChkLabelTitle->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw()");
731 fChkLabelTitle->SetToolTipText("Set the plot title.");
4f3934a1 732
733 fTxtLabelTitle = new TGTextEntry(fContLabeling, "Title", 500);
734 fContLabeling->AddFrame(fTxtLabelTitle, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
832bb12c 735 fTxtLabelTitle->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw(=50)");
736 fTxtLabelTitle->SetToolTipText("plot title");
4f3934a1 737
738 fChkLabelXaxis = new TGCheckButton(fContLabeling, "Set X-axis label:");
739 fContLabeling->AddFrame(fChkLabelXaxis, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
832bb12c 740 fChkLabelXaxis->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw()");
741 fChkLabelXaxis->SetToolTipText("Set the X-axis label.");
4f3934a1 742
743 fTxtLabelXaxis = new TGTextEntry(fContLabeling, "XaxisLabel", 500);
744 fContLabeling->AddFrame(fTxtLabelXaxis, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
832bb12c 745 fTxtLabelXaxis->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw(=51)");
746 fTxtLabelXaxis->SetToolTipText("X-axis label");
4f3934a1 747
748 fChkLabelYaxis = new TGCheckButton(fContLabeling, "Set Y-axis label:");
749 fContLabeling->AddFrame(fChkLabelYaxis, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
832bb12c 750 fChkLabelYaxis->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw()");
751 fChkLabelYaxis->SetToolTipText("Set the Y-axis label.");
4f3934a1 752
753 fTxtLabelYaxis = new TGTextEntry(fContLabeling, "YaxisLabel", 500);
754 fContLabeling->AddFrame(fTxtLabelYaxis, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
832bb12c 755 fTxtLabelYaxis->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw(=52)");
756 fTxtLabelYaxis->SetToolTipText("Y-axis label");
4f3934a1 757
758 fChkLabelGetAuto = new TGCheckButton(fContLabeling, "Get labels auto.");
759 fContLabeling->AddFrame(fChkLabelGetAuto, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
832bb12c 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.");
4f3934a1 762
72d0ab7e 763
832bb12c 764 // **************************** content of ftabRight1 *******************************
4f3934a1 765 // Save container
766 fContSave = new TGGroupFrame(fTabRight1, "Save", kVerticalFrame | kFitWidth | kFitHeight);
767 fTabRight1->AddFrame(fContSave, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
768 // save button
832bb12c 769 fBtnSave = new TGTextButton(fContSave, "&Save picture");
4f3934a1 770 fContSave->AddFrame(fBtnSave, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
771 fBtnSave->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "SavePicture()");
832bb12c 772 fBtnSave->SetToolTipText("Open a 'Save as...' dialog to save the current plot as picture or macro.");
4f3934a1 773
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));
72d0ab7e 777
4f3934a1 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()");
832bb12c 783 fChkAddSaveOpt->SetToolTipText("Additional save options (see documentation for TPad::Print()).");
4f3934a1 784
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()");
792
832bb12c 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));
796
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));
801
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()");
810
811 // export button
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.");
816
8192627b 817 // add to normalisation button
832bb12c 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!");
8192627b 822
823 // Tree container
824 fContTree = new TGGroupFrame(fTabRight1, "Tree", kVerticalFrame | kFitWidth | kFitHeight);
825 fTabRight1->AddFrame(fContTree, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
826
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");
832
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. ");
838
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.");
843
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");
848
849
4f3934a1 850 // Fit options container
832bb12c 851 fContFit = new TGGroupFrame(fTabRight1, "Custom fit", kVerticalFrame | kFitWidth | kFitHeight);
4f3934a1 852 fTabRight1->AddFrame(fContFit, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
853
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));
858
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()");
72d0ab7e 867
4f3934a1 868 // fit button
869 fBtnFit = new TGTextButton(fContAddFit, "&Fit");
870 fContAddFit->AddFrame(fBtnFit, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
871 fBtnFit->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoFit()");
832bb12c 872 fBtnFit->SetToolTipText("Fit a whole TPC side, e.g. with gx~ ++ gy~, the result is printed to the console \nNot yet final status.");
4f3934a1 873
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()");
878
832bb12c 879 SetWindowName("AliTPCCalibViewer GUI");
880 MapSubwindows();
881 Resize(GetDefaultSize());
882 MapWindow();
883}
884
885
886void AliTPCCalibViewerGUI::SetInitialValues() {
887 //
888 // Set the default button states
889 //
8192627b 890 fChkAuto->SetState(kButtonUp);
72d0ab7e 891 fRadioPredefined->SetState(kButtonDown);
892 fRadioRaw->SetState(kButtonDown);
893 fRadioTPC->SetState(kButtonDown);
894 fRadio1D->SetState(kButtonDown);
72d0ab7e 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);
904
832bb12c 905 fChkLabelGetAuto->SetState(kButtonDown);
906
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)
925
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;
932 }
933 if (statOpt / 100000000 >= 1) {
934 fChkStatKurtosis->SetState(kButtonDown);
935 statOpt -= 100000000;
936 }
937 if (statOpt / 20000000 >= 1) {
938 fChkStatSkewness->SetState(kButtonDown);
939 fChkStatSkewnessPM->SetState(kButtonDown);
940 statOpt -= 20000000;
941 }
942 if (statOpt / 10000000 >= 1) {
943 fChkStatSkewness->SetState(kButtonDown);
944 statOpt -= 10000000;
945 }
946 if (statOpt / 1000000 >= 1) {
947 fChkStatIntegral->SetState(kButtonDown);
948 statOpt -= 1000000;
949 }
950 if (statOpt / 100000 >= 1) {
951 fChkStatOverflow->SetState(kButtonDown);
952 statOpt -= 100000;
953 }
954 if (statOpt / 10000 >= 1) {
955 fChkStatUnderflow->SetState(kButtonDown);
956 statOpt -= 10000;
957 }
958 if (statOpt / 2000 >= 1) {
959 fChkStatRMS->SetState(kButtonDown);
960 fChkStatRMSPM->SetState(kButtonDown);
961 statOpt -= 2000;
962 }
963 if (statOpt / 1000 >= 1) {
964 fChkStatRMS->SetState(kButtonDown);
965 statOpt -= 1000;
966 }
967 if (statOpt / 200 >= 1) {
968 fChkStatMean->SetState(kButtonDown);
969 fChkStatMeanPM->SetState(kButtonDown);
970 statOpt -= 200;
971 }
972 if (statOpt / 100 >= 1) {
973 fChkStatMean->SetState(kButtonDown);
974 statOpt -= 100;
975 }
976 if (statOpt / 10 >= 1) {
977 fChkStatEntries->SetState(kButtonDown);
978 statOpt -= 10;
979 }
980 if (statOpt / 1 >= 1) {
981 fChkStatName->SetState(kButtonDown);
982 statOpt -= 1;
983 }
984
985 /*
72d0ab7e 986 fChkStatName->SetState(kButtonDown);
987 fChkStatEntries->SetState(kButtonDown);
988 fChkStatMean->SetState(kButtonDown);
989 fChkStatRMS->SetState(kButtonDown);
832bb12c 990 */
72d0ab7e 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);
832bb12c 998// fChkStatKurtosis->SetState(kButtonDown);
999// fChkStatKurtosisPM->SetState(kButtonDown);
1000
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);
39bcd65d 1019
832bb12c 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);
1025
1026 // fill fComboMethod
1027 fComboMethod->AddEntry("subtract", 0);
1028 fComboMethod->AddEntry("divide by", 1);
1029
1030 // fill fComboExportName
1031// fComboExportName->AddEntry("calPad", 0);
1032 // fComboExportName->AddEntry("calPad2", 1);
1033 fBtnExport->SetEnabled(kFALSE);
1034 fBtnAddNorm->SetEnabled(kFALSE);
1035
1036 // select initial variables
1037 fListVariables->Select(0);
1038 fListNormalization->Select(0);
1039 fComboMethod->Select(0);
1040// fComboExportName->Select(0);
1041// fComboExportName->EnableTextInput(kTRUE);
1042
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
8192627b 1047 fChkAuto->SetState(kButtonDown);
1048
832bb12c 1049 // Make first drawing:
1050 // DoDraw();
39bcd65d 1051}
1052
832bb12c 1053
39bcd65d 1054AliTPCCalibViewerGUI::AliTPCCalibViewerGUI(const AliTPCCalibViewerGUI &c)
a6d2bd0c 1055 : TGCompositeFrame(c.fParent, c.fWidth, c.fHeight),
39bcd65d 1056 fViewer(0),
8192627b 1057 fPreprocessor(0),
a6d2bd0c 1058 fContTopBottom(0),
1059 fContLCR(0),
39bcd65d 1060 fContLeft(0),
72d0ab7e 1061 ftabLeft(0),
1062 ftabLeft0(0),
1063 ftabLeft1(0),
4f3934a1 1064 ftabRight(0),
1065 fTabRight0(0),
1066 fTabRight1(0),
39bcd65d 1067 fContRight(0),
1068 fContCenter(0),
1069 fContPlotOpt(0),
1070 fContDrawOpt(0),
a6d2bd0c 1071 fContDrawOptSub1D2D(0),
39bcd65d 1072 fContNormalized(0),
1073 fContCustom(0),
1074 fContCuts(0),
1075 fContSector(0),
1076 fContAddCuts(0),
a6d2bd0c 1077 fContFit(0),
1078 fContAddFit(0),
1079 fContScaling(0),
1080 fContSetMax(0),
1081 fContSetMin(0),
72d0ab7e 1082 fContAddDrawOpt(0),
39bcd65d 1083 fListVariables(0),
1084 fBtnDraw(0),
a6d2bd0c 1085 fBtnFit(0),
1086 fBtnAddFitFunction(0),
1087 fBtnGetMinMax(0),
39bcd65d 1088 fCanvMain(0),
1089 fRadioRaw(0),
1090 fRadioNormalized(0),
a6d2bd0c 1091 fRadioPredefined(0),
39bcd65d 1092 fRadioCustom(0),
1093 fRadio1D(0),
1094 fRadio2D(0),
1095 fRadioTPC(0),
1096 fRadioSideA(0),
1097 fRadioSideC(0),
1098 fRadioSector(0),
72d0ab7e 1099 fComboAddDrawOpt(0),
39bcd65d 1100 fChkAuto(0),
8192627b 1101 fChkAutoAppend(0),
39bcd65d 1102 fComboMethod(0),
1103 fListNormalization(0),
a6d2bd0c 1104 fComboCustom(0),
4f3934a1 1105 fLblCustomDraw(0),
72d0ab7e 1106 fChkAddDrawOpt(0),
39bcd65d 1107 fNmbSector(0),
a6d2bd0c 1108 fLblSector(0),
72d0ab7e 1109 fChkCutZero(0),
39bcd65d 1110 fChkAddCuts(0),
4f3934a1 1111 fLblAddCuts(0),
a6d2bd0c 1112 fComboAddCuts(0),
1113 fComboCustomFit(0),
1114 fChkSetMax(0),
1115 fChkSetMin(0),
1116 fChkGetMinMaxAuto(0),
1117 fTxtSetMax(0),
72d0ab7e 1118 fTxtSetMin(0),
1119 fContDrawOpt1D(0),
1120 fcontDrawOpt1DSubLR(0),
1121 fContDrawOpt1DSubNSC(0),
1122 fRadioNorm(0),
1123 fRadioSigma(0),
1124 fTxtSigmas(0),
1125 fContCumuLR(0),
1126 fContCumLeft(0),
1127 fContCumRight(0),
1128 fLblSigmaMax(0),
1129 fTxtSigmaMax(0),
1130 fRadioCumulative(0),
1131 fCheckCumulativePM(0),
1132 fRadioIntegrate(0),
1133 fContDrawOpt1DSubMML(0),
1134 fChkMean(0),
1135 fChkMedian(0),
1136 fChkLTM(0),
1137 fContStatOpt(0),
1138 fChkStatName(0),
1139 fChkStatEntries(0),
1140 fContStatMean(0),
1141 fChkStatMean(0),
1142 fChkStatMeanPM(0),
1143 fContStatRMS(0),
1144 fChkStatRMS(0),
1145 fChkStatRMSPM(0),
1146 fChkStatUnderflow(0),
1147 fChkStatOverflow(0),
1148 fChkStatIntegral(0),
1149 fContStatSkew(0),
1150 fChkStatSkewness(0),
1151 fChkStatSkewnessPM(0),
1152 fContStatKurt(0),
1153 fChkStatKurtosis(0),
4f3934a1 1154 fChkStatKurtosisPM(0),
832bb12c 1155 fBtnUnchekAll(0),
4f3934a1 1156 fContLabeling(0),
1157 fChkLabelTitle(0),
1158 fTxtLabelTitle(0),
1159 fChkLabelXaxis(0),
1160 fTxtLabelXaxis(0),
1161 fChkLabelYaxis(0),
1162 fTxtLabelYaxis(0),
1163 fChkLabelGetAuto(0),
1164 fContSave(0),
1165 fBtnSave(0),
1166 fContAddSaveOpt(0),
1167 fChkAddSaveOpt(0),
832bb12c 1168 fComboAddSaveOpt(0),
1169 fContExport(0),
1170 fContAddExport(0),
1171 fComboExportName(0),
1172 fBtnExport(0),
8192627b 1173 fBtnAddNorm(0),
1174 fContTree(0),
1175 fBtnDumpToFile(0),
1176 fBtnLoadTree(0),
1177 fChkAddAsReference(0),
1178 fTxtRefName(0),
1179 fInitialized(0)
39bcd65d 1180{
1181 //
1182 // dummy AliTPCCalibViewerGUI copy constructor
1183 //
1184}
1185
832bb12c 1186
2c632057 1187AliTPCCalibViewerGUI & AliTPCCalibViewerGUI::operator =(const AliTPCCalibViewerGUI & /*param*/) {
39bcd65d 1188 //
1189 // dummy assignment operator
1190 //
1191 return (*this);
1192}
1193
832bb12c 1194
39bcd65d 1195AliTPCCalibViewerGUI::~AliTPCCalibViewerGUI() {
72d0ab7e 1196 //
1197 // Destructor
1198 //
a6d2bd0c 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();
1203 }
1204 }
39bcd65d 1205 Cleanup();
a6d2bd0c 1206 if (fViewer) fViewer->Delete();
8192627b 1207 delete fPreprocessor;
39bcd65d 1208}
1209
832bb12c 1210
a6d2bd0c 1211/*
39bcd65d 1212void AliTPCCalibViewerGUI::CloseWindow() {
1213 DeleteWindow();
1214}
a6d2bd0c 1215*/
39bcd65d 1216
832bb12c 1217
1218void AliTPCCalibViewerGUI::Initialize(char* fileName, char* treeName) {
1219 //
1220 // initialize the GUI with a calibrationTree from fileName
1221 //
39bcd65d 1222
1223 // create AliTPCCalibViewer object, which will be used for generating all drawings
a6d2bd0c 1224 if (fViewer) delete fViewer;
832bb12c 1225 fViewer = new AliTPCCalibViewer(fileName, treeName);
1226 Initialize(fViewer);
1227}
1228
39bcd65d 1229
832bb12c 1230void AliTPCCalibViewerGUI::Initialize(AliTPCCalibViewer *viewer) {
1231 //
1232 // initializes the GUI with default settings and opens tree for drawing
1233 //
1234
1235 fViewer = viewer;
1236 TString selectedVariable("");
1237 TString selectedNormalization("");
1238 Int_t variableId = -1;
1239 Int_t normalizationId = -1;
1240 if (fInitialized) {
1241 // remember the selected entry
1242 if (fListVariables->GetSelectedEntry()) selectedVariable = fListVariables->GetSelectedEntry()->GetTitle();
1243 if (fListNormalization->GetSelectedEntry()) selectedNormalization = fListNormalization->GetSelectedEntry()->GetTitle();
1244 }
1245
1246 // fill fListVariables, list of drawable variables:
39bcd65d 1247 TObjArray* arr = fViewer->GetListOfVariables();
596afefb 1248 if (!arr) return;
39bcd65d 1249 TIterator* iter = arr->MakeIterator();
1250 iter->Reset();
1251 TObjString* currentStr = 0;
1252 Int_t id = 0;
832bb12c 1253 fListVariables->RemoveAll();
a6d2bd0c 1254 while ((currentStr = (TObjString*)(iter->Next()))) {
39bcd65d 1255 fListVariables->AddEntry(currentStr->GetString().Data(), id);
832bb12c 1256 if (fInitialized && currentStr->GetString() == selectedVariable) variableId = id;
39bcd65d 1257 id++;
1258 }
1259 delete iter;
1260 arr->Delete();
1261 delete arr;
1262
832bb12c 1263 // fill fListNorm, list of normalization variables:
39bcd65d 1264 arr = fViewer->GetListOfNormalizationVariables();
1265 iter = arr->MakeIterator();
1266 iter->Reset();
1267 currentStr = 0;
1268 id = 0;
832bb12c 1269 fListNormalization->RemoveAll();
a6d2bd0c 1270 while ((currentStr = (TObjString*)(iter->Next()))) {
39bcd65d 1271 fListNormalization->AddEntry(currentStr->GetString().Data(), id);
832bb12c 1272 if (fInitialized && currentStr->GetString() == selectedNormalization) normalizationId = id;
39bcd65d 1273 id++;
1274 }
1275 delete iter;
1276 arr->Delete();
1277 delete arr;
832bb12c 1278
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());
1286
1287 // select the last selected variable and normalization
1288 if (fInitialized && variableId != -1) fListVariables->Select(variableId);
1289 if (fInitialized && normalizationId != -1)fListVariables->Select(normalizationId);
1290
1291 if (fInitialized) Info("Initialize", "AliTPCCalibViewerGUI new initialized.");
1292 fInitialized = kTRUE;
39bcd65d 1293
39bcd65d 1294}
1295
72d0ab7e 1296
72d0ab7e 1297void AliTPCCalibViewerGUI::HandleButtonsGeneral(Int_t id) {
39bcd65d 1298 //
1299 // handles mutual radio button exclusions
72d0ab7e 1300 // for general Tab
39bcd65d 1301 //
1302 if (id == -1) {
1303 TGButton *btn = (TGButton *) gTQSender;
1304 id = btn->WidgetId();
1305 }
a6d2bd0c 1306
39bcd65d 1307 switch (id) {
1308 case 10: // fRadioRaw
1309 fRadioNormalized->SetState(kButtonUp);
a6d2bd0c 1310 fRadioPredefined->SetState(kButtonDown);
39bcd65d 1311 fRadioCustom->SetState(kButtonUp);
72d0ab7e 1312 // fComboMethod->UnmapWindow();
1313 // fListNormalization->UnmapWindow();
39bcd65d 1314 break;
1315 case 11: // fRadioNormalized
1316 fRadioRaw->SetState(kButtonUp);
a6d2bd0c 1317 fRadioPredefined->SetState(kButtonDown);
39bcd65d 1318 fRadioCustom->SetState(kButtonUp);
1319 break;
1320 case 12: // fRadioCustom
a6d2bd0c 1321 fRadioPredefined->SetState(kButtonUp);
72d0ab7e 1322 // fComboCustom->SetEnabled(kFALSE);
1323 // fRadioNormalized->SetState(kButtonUp);
1324 break;
832bb12c 1325 case 14: // select Draw options fComboAddDrawOpt
1326 fChkAddDrawOpt->SetState(kButtonDown);
a6d2bd0c 1327 break;
1328 case 13: // fRadioPredefined
1329 fRadioCustom->SetState(kButtonUp);
72d0ab7e 1330 // fComboCustom->SetEnabled(kTRUE);
1331 //f RadioNormalized->SetState(kButtonUp);
39bcd65d 1332 break;
1333 //--------
72d0ab7e 1334 case 30: // fRadio1D
1335 fRadio2D->SetState(kButtonUp);
832bb12c 1336 fBtnExport->SetEnabled(kFALSE);
1337 fBtnAddNorm->SetEnabled(kFALSE);
72d0ab7e 1338 break;
1339 case 31: // fRadio2D
1340 fRadio1D->SetState(kButtonUp);
832bb12c 1341 fBtnExport->SetEnabled(kTRUE);
1342 fBtnAddNorm->SetEnabled(kTRUE);
1343 break;
1344 case 42: // fComboCustom
1345 fRadioCustom->SetState(kButtonDown);
1346 fRadioPredefined->SetState(kButtonUp);
72d0ab7e 1347 break;
1348 }
1349 DoNewSelection();
1350}
1351
1352
1353void AliTPCCalibViewerGUI::HandleButtons1D(Int_t id) {
1354 //
1355 // handles mutual radio button exclusions
1356 // 1D-Tab buttons
1357 //
1358
1359 if (id == -1) {
1360 TGButton *btn = (TGButton *) gTQSender;
1361 id = btn->WidgetId();
1362 }
1363 switch (id) {
1364 case 110: // 1D draw normal
1365 fRadioNorm->SetState(kButtonDown);
1366 fRadioSigma->SetState(kButtonUp);
1367 fRadioCumulative->SetState(kButtonUp);
1368 fRadioIntegrate->SetState(kButtonUp);
1369 break;
1370 case 111: // 1D draw sigma
1371 fRadioNorm->SetState(kButtonUp);
1372 fRadioSigma->SetState(kButtonDown);
1373 fRadioCumulative->SetState(kButtonUp);
1374 fRadioIntegrate->SetState(kButtonUp);
1375 break;
1376 case 112: // 1D draw cumulative
1377 fRadioNorm->SetState(kButtonUp);
1378 fRadioSigma->SetState(kButtonUp);
1379 fRadioCumulative->SetState(kButtonDown);
1380 fRadioIntegrate->SetState(kButtonUp);
1381 break;
1382 case 113: // 1D draw integral
1383 fRadioNorm->SetState(kButtonUp);
1384 fRadioSigma->SetState(kButtonUp);
1385 fRadioCumulative->SetState(kButtonUp);
1386 fRadioIntegrate->SetState(kButtonDown);
1387 break;
1388 }
1389 DoNewSelection();
1390}
1391
1392
72d0ab7e 1393void AliTPCCalibViewerGUI::HandleButtonsStat(Int_t id) {
1394 //
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(...)
1399 //
4f3934a1 1400 if (id == -1) {
1401 TGButton *btn = (TGButton *) gTQSender;
1402 id = btn->WidgetId();
1403 }
72d0ab7e 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");
832bb12c 1418
72d0ab7e 1419 gStyle->SetOptStat(statOpt);
1420 DoNewSelection();
1421}
1422
1423
832bb12c 1424void AliTPCCalibViewerGUI::HandleButtonsCuts(Int_t id) {
72d0ab7e 1425 //
1426 // handles mutual radio button exclusions
1427 // right side buttons
1428 //
1429 if (id == -1) {
1430 TGButton *btn = (TGButton *) gTQSender;
1431 id = btn->WidgetId();
1432 }
1433
1434 switch (id) {
39bcd65d 1435 case 20: // fRadioTPC
1436 fRadioSideA->SetState(kButtonUp);
1437 fRadioSideC->SetState(kButtonUp);
1438 fRadioSector->SetState(kButtonUp);
1439 break;
1440 case 21: // fRadioSideA
1441 fRadioTPC->SetState(kButtonUp);
1442 fRadioSideC->SetState(kButtonUp);
1443 fRadioSector->SetState(kButtonUp);
1444 break;
1445 case 22: // fRadioSideC
1446 fRadioTPC->SetState(kButtonUp);
1447 fRadioSideA->SetState(kButtonUp);
1448 fRadioSector->SetState(kButtonUp);
1449 break;
1450 case 23: // fRadioSector
1451 fRadioTPC->SetState(kButtonUp);
1452 fRadioSideA->SetState(kButtonUp);
1453 fRadioSideC->SetState(kButtonUp);
1454 break;
4f3934a1 1455 case 31: // fComboAddCuts
1456 fChkAddCuts->SetState(kButtonDown);
1457 break;
832bb12c 1458 }
1459 DoNewSelection();
1460}
1461
1462
1463void AliTPCCalibViewerGUI::HandleButtonsNoRedraw(Int_t id) {
1464 //
1465 // handles label & scaling checkboxes
1466 // without redrawing (not necessary, faster like this)
1467 //
1468 if (id == -1) {
1469 TGButton *btn = (TGButton *) gTQSender;
1470 id = btn->WidgetId();
1471 }
1472
1473 switch (id) {
a6d2bd0c 1474 case 40: // fTxtSetMin
1475 fChkSetMin->SetState(kButtonDown);
1476 break;
1477 case 41: // fTxtSetMax
1478 fChkSetMax->SetState(kButtonDown);
1479 break;
4f3934a1 1480 case 50: // fTxtLabelTitle
1481 fChkLabelTitle->SetState(kButtonDown);
1482 break;
1483 case 51: // fTxtLabelXaxis
1484 fChkLabelXaxis->SetState(kButtonDown);
1485 break;
1486 case 52: // fTxtLabelXaxis
1487 fChkLabelYaxis->SetState(kButtonDown);
1488 break;
39bcd65d 1489 }
832bb12c 1490 SetMinMaxLabel();
39bcd65d 1491}
1492
72d0ab7e 1493
39bcd65d 1494void AliTPCCalibViewerGUI::DoNewSelection() {
1495 //
1496 // decides whether to redraw if user makes another selection
1497 //
39bcd65d 1498 if (fChkAuto->GetState() == kButtonDown) DoDraw();
1499}
1500
72d0ab7e 1501
832bb12c 1502TString* AliTPCCalibViewerGUI::GetDrawString() {
1503 //
1504 // create the draw string out of selection
1505 //
39bcd65d 1506
1507 // specify data to plot
1508 TString desiredData("");
832bb12c 1509 if (!fListVariables->GetSelectedEntry()) return 0;
39bcd65d 1510 desiredData += ((TGTextLBEntry*)(fListVariables->GetSelectedEntry()))->GetTitle();
832bb12c 1511 desiredData += fViewer->GetAbbreviation();
39bcd65d 1512
1513 // specify normalization
a6d2bd0c 1514 if (fRadioPredefined->GetState() == kButtonDown && fRadioNormalized->GetState() == kButtonDown) {
39bcd65d 1515 TString op("");
1516 switch (fComboMethod->GetSelected()) {
1517 case 0: // subtraction
1518 op += "-";
1519 break;
1520 case 1: // division
1521 op += "/";
1522 break;
1523 }
1524 TString normalizationData("");
832bb12c 1525 if (!fListNormalization->GetSelectedEntry()) return 0;
39bcd65d 1526 normalizationData += ((TGTextLBEntry*)(fListNormalization->GetSelectedEntry()))->GetTitle();
a6d2bd0c 1527
1528 if ( normalizationData.BeginsWith("Fit")) {
1529 // create fit formula, evaluate it an replace normalizationData-String
1530 // ********** create cut string **********
1531 TString cutStr("");
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==";
1541 cutStr += sector;
1542 }
1543 if (fChkAddCuts->GetState() == kButtonDown && strcmp(fComboAddCuts->GetTextEntry()->GetText(), "") != 0){
1544 if (fRadioTPC->GetState() != kButtonDown) cutStr += " && ";
1545 cutStr += fComboAddCuts->GetTextEntry()->GetText();
1546 }
1547 Double_t chi2 = 0;
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~";
72d0ab7e 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~";
832bb12c 1559 formulaStr.ReplaceAll("~", fViewer->GetAbbreviation());
a6d2bd0c 1560 normalizationData = *fViewer->Fit(desiredData.Data(), formulaStr.Data(), cutStr.Data(), chi2, fitParam, covMatrix);
832bb12c 1561 } // if ( normalizationData.BeginsWith("Fit")
a6d2bd0c 1562
39bcd65d 1563 desiredData += op;
a6d2bd0c 1564 if (! (TString(((TGTextLBEntry*)(fListNormalization->GetSelectedEntry()))->GetTitle())).BeginsWith("Fit"))
1565 desiredData += ((TGTextLBEntry*)(fListVariables->GetSelectedEntry()))->GetTitle();
39bcd65d 1566 desiredData += normalizationData;
1567 }
1568 else if (fRadioCustom->GetState() == kButtonDown) {
a6d2bd0c 1569 desiredData = fComboCustom->GetTextEntry()->GetText();
832bb12c 1570 if (desiredData == "") return 0;
39bcd65d 1571 }
832bb12c 1572
8192627b 1573 // try to add forgotten '~'
1574 if (fChkAutoAppend->GetState() == kButtonDown)
1575 desiredData = TString(fViewer->AddAbbreviations((char*)desiredData.Data()));
832bb12c 1576 return new TString(desiredData.Data());
1577}
1578
1579
1580TString* AliTPCCalibViewerGUI::GetSectorString() {
1581 //
1582 // create the sector string out of selection
1583 //
39bcd65d 1584
39bcd65d 1585 TString sectorStr("");
1586 if (fRadioTPC->GetState() == kButtonDown)
1587 sectorStr += "ALL";
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==";
1595 }
832bb12c 1596 return new TString(sectorStr.Data());
1597}
1598
1599
1600 TString* AliTPCCalibViewerGUI::GetCutString() {
1601 //
1602 // create the cut string out of selection
1603 //
1604
39bcd65d 1605 TString cutsStr("");
72d0ab7e 1606 if (fChkCutZero->GetState() == kButtonDown) {
832bb12c 1607 TString cutZerosStr(GetDrawString()->Data());
1608 if (cutZerosStr.Contains(">>")) {
1609 cutZerosStr.Remove(cutZerosStr.First(">>"));
1610 }
1611 if (cutZerosStr.Contains(":")) {
1612 cutZerosStr.Remove(cutZerosStr.First(":"));
1613 }
1614 cutsStr += cutZerosStr.Data();
72d0ab7e 1615 cutsStr += "!=0";
1616 if (fChkAddCuts->GetState() == kButtonDown) cutsStr += " && ";
1617 }
39bcd65d 1618 if (fChkAddCuts->GetState() == kButtonDown)
a6d2bd0c 1619 cutsStr += fComboAddCuts->GetTextEntry()->GetText();
8192627b 1620
1621 // try to add forgotten '~'
1622 if (fChkAutoAppend->GetState() == kButtonDown)
1623 cutsStr = TString(fViewer->AddAbbreviations((char*)cutsStr.Data()));
832bb12c 1624 return new TString(cutsStr.Data());
1625}
1626
1627
1628void AliTPCCalibViewerGUI::DoDraw() {
1629 //
1630 // main method for drawing according to user selection
1631 //
1632
1633 // specify data to plot:
596afefb 1634 if (!GetDrawString()) return;
832bb12c 1635 TString desiredData(GetDrawString()->Data());
1636 // specify sector:
1637 TString sectorStr(GetSectorString()->Data());
1638 // specify cuts:
1639 TString cutsStr(GetCutString()->Data());
72d0ab7e 1640
1641 TString addDrawOpt("");
1642 if (fChkAddDrawOpt->GetState() == kButtonDown)
1643 addDrawOpt += fComboAddDrawOpt->GetTextEntry()->GetText();
39bcd65d 1644
832bb12c 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();
1650 }
a6d2bd0c 1651 //fCanvMain->GetCanvas()->Clear();
39bcd65d 1652 fCanvMain->GetCanvas()->cd();
a6d2bd0c 1653 Int_t entries = -1;
832bb12c 1654 // draw finally
72d0ab7e 1655 if (fRadio1D->GetState() == kButtonDown){
1656 // 1D-Drawing
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);
1675 }
1676 else if (fRadio2D->GetState() == kButtonDown) {
1677 // 2D-Drawing
1678 entries = fViewer->EasyDraw(desiredData.Data(), sectorStr.Data(), cutsStr.Data(), addDrawOpt.Data());
1679 }
1680 if (entries == -1) return; // nothing was drawn, there is no histogram to get min and max
1681
832bb12c 1682 SetMinMaxLabel();
39bcd65d 1683 fCanvMain->GetCanvas()->Update();
1684}
a6d2bd0c 1685
1686
1687void AliTPCCalibViewerGUI::DoFit() {
1688 //
1689 // main method for fitting
1690 //
1691
1692 Double_t chi2 = 0;
1693 TVectorD fitParam(0);
1694 TMatrixD covMatrix(0,0);
a6d2bd0c 1695 TString cutStr("");
1696 TString formulaStr("");
1697 TString *returnStr = new TString("");
1698
832bb12c 1699 // specify data to plot:
1700 TString drawStr(GetDrawString()->Data());
8192627b 1701
a6d2bd0c 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==";
1712 cutStr += sector;
1713 }
1714 if (fChkAddCuts->GetState() == kButtonDown && strcmp(fComboAddCuts->GetTextEntry()->GetText(), "") != 0){
1715 if (fRadioTPC->GetState() != kButtonDown) cutStr += " && ";
1716 cutStr += fComboAddCuts->GetTextEntry()->GetText();
1717 }
8192627b 1718 // try to add forgotten '~'
1719 if (fChkAutoAppend->GetState() == kButtonDown)
1720 cutStr = TString(fViewer->AddAbbreviations((char*)cutStr.Data()));
a6d2bd0c 1721
1722 // ********** get formula string **********
1723 formulaStr += fComboCustomFit->GetTextEntry()->GetText();
8192627b 1724 if (fChkAutoAppend->GetState() == kButtonDown)
1725 formulaStr = TString(fViewer->AddAbbreviations((char*)formulaStr.Data()));
a6d2bd0c 1726
1727 // ********** call AliTPCCalibViewer's fit-function
1728 returnStr = fViewer->Fit(drawStr.Data(), formulaStr.Data(), cutStr.Data(), chi2, fitParam, covMatrix);
1729
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;
1734}
1735
832bb12c 1736
1737void AliTPCCalibViewerGUI::DoExport() {
1738 //
1739 // function to export a CalPad to Cint
1740 //
1741 if ( fRadio2D->GetState() != kButtonDown){
1742 Error("ExportCalPad", "Export of AliTPCCalPad to CINT works only in 2D mode.");
1743 return;
1744 }
1745 // specify data to plot:
1746 TString desiredData(GetDrawString()->Data());
1747 // specify cuts:
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));
8192627b 1755 fPreprocessor->AddComponent(calPad);
832bb12c 1756 Info("ExportCalPad", "Current 2D view has been exported to an AliTPCCalPad* with name '%s'", calPadName);
1757}
1758
1759
1760void AliTPCCalibViewerGUI::DoExportNorm() {
1761 //
1762 // function to export a CalPad to Cint
1763 //
1764
1765 if ( fRadio2D->GetState() != kButtonDown){
1766 Error("ExportCalPad", "Adding an AliTPCCalPad to the normalization works only in 2D mode.");
1767 return;
1768 }
1769
1770 Error("DoExportNorm", "Not yet implemented.");
1771 return;
1772
1773 // specify data to plot:
1774 TString desiredData(GetDrawString()->Data());
1775 // specify sector:
1776 TString sectorStr(GetSectorString()->Data());
1777 // specify cuts:
1778 TString cutsStr(GetCutString()->Data());
1779
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);
1787}
1788
1789
a6d2bd0c 1790void AliTPCCalibViewerGUI::GetMinMax() {
1791 //
1792 // Read current Min & Max from the plot and set it to fTxtSetMin & fTxtSetMax
1793 //
832bb12c 1794 if (fChkGetMinMaxAuto->GetState() == kButtonUp) return;
a6d2bd0c 1795 TList* listOfPrimitives = fCanvMain->GetCanvas()->GetListOfPrimitives();
1796 TObject* ptr = 0;
1797 for (Int_t i = 0; i < listOfPrimitives->GetEntries(); i++) {
1798 ptr = listOfPrimitives->At(i);
1799 if ( ptr->InheritsFrom("TH1") ) break;
1800 }
1801 if ( ptr != 0 && !ptr->InheritsFrom("TH1") ) return; // if the loop did not find a TH1
1802 TH1 *hist = (TH1*)ptr;
8192627b 1803
1804// Double_t histMax = hist->GetMaximum();
1805// Double_t histMin = hist->GetMinimum();
1806// fTxtSetMax->SetText(Form("%f",histMax));
1807// fTxtSetMin->SetText(Form("%f",histMin));
1808
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()));
1814 }
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()) );
1820 }
a6d2bd0c 1821}
1822
832bb12c 1823
1824void AliTPCCalibViewerGUI::SetMinMaxLabel() {
1825 //
1826 // Set Minimum, Maximum and labels without redrawing the plot
1827 // (faster)
1828 //
1829
1830 // search for histogram
1831 TList* listOfPrimitives = fCanvMain->GetCanvas()->GetListOfPrimitives();
1832 TObject* ptr = 0;
1833 for (Int_t i = 0; i < listOfPrimitives->GetEntries(); i++) {
1834 ptr = listOfPrimitives->At(i);
1835 if ( ptr->InheritsFrom("TH1") ) break;
1836 }
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!");
1840 return;
1841 // unable to find histogram, no min and max wil be read out
1842 }
1843
1844 TH1 *hist = (TH1*)ptr;
1845 TString minTxt(fTxtSetMin->GetText());
1846 TString maxTxt(fTxtSetMax->GetText());
8192627b 1847
832bb12c 1848 // set min and max according to specified values, if checkbox is checked
8192627b 1849 if (fRadio2D->GetState() == kButtonDown) {
1850 if (fChkSetMax->GetState() == kButtonDown && fChkSetMax->GetState() == kButtonDown &&(maxTxt.IsDigit() || maxTxt.IsFloat()) )
1851 hist->SetMaximum(maxTxt.Atof());
832bb12c 1852 if (fChkSetMax->GetState() == kButtonUp)
8192627b 1853 hist->SetMaximum(-1111); // default value, to unzoom
1854 if (fChkSetMin->GetState() == kButtonDown && (minTxt.IsDigit() || minTxt.IsFloat()) )
1855 hist->SetMinimum(minTxt.Atof());
832bb12c 1856 if (fChkSetMin->GetState() == kButtonUp)
8192627b 1857 hist->SetMinimum(-1111); // default value, to unzoom
1858 }
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
832bb12c 1868 }
1869
8192627b 1870 // get min and max from plot
1871 GetMinMax();
1872
832bb12c 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());
1885 }
1886 hist->SetTitle(hist->GetTitle()); // trick to update the histogram
1887 fCanvMain->GetCanvas()->Update();
1888}
1889
1890
a6d2bd0c 1891void AliTPCCalibViewerGUI::ChangeSector(){
1892 //
1893 // function that is called, when the number of the sector is changed
1894 // to change the sector label
1895 //
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);
1907 DoNewSelection();
1908}
1909
832bb12c 1910
72d0ab7e 1911void AliTPCCalibViewerGUI::AddFitFunction() const {
a6d2bd0c 1912 //
1913 // adds the last fit function to the normalization list
1914 //
1915 std::cout << "Not yet implemented." << std::endl;
1916}
4f3934a1 1917
832bb12c 1918
1919void AliTPCCalibViewerGUI::UnchekAllStat() {
1920 //
1921 // Disable all statistical legend entries, no statistical legend.
1922 //
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);
1936
1937 HandleButtonsStat(0);
1938}
1939
1940
1941void AliTPCCalibViewerGUI::MouseMove(Int_t event, Int_t x, Int_t y, TObject *selectedObject) {
1942 //
1943 // mouse move
1944 // zoom to sector works ONLY in 2D mode, if one side is specified
1945 //
1946 Double_t pi = TMath::Pi();
1947 if (event != kButton1Double )
1948 return;
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) ) {
1956 // A-Side
1957 fRadioSideA->Clicked();
1958 fRadioSideA->SetState(kButtonDown);
1959 DoNewSelection();
1960 }
1961 if ( (sector >= 18 && sector <= 35) || (sector >= 54 && sector <= 71) ) {
1962 // C-Side
1963 fRadioSideC->Clicked();
1964 fRadioSideC->SetState(kButtonDown);
1965 DoNewSelection();
1966 }
1967 return;
1968 }
1969 if (!(fRadioSideA->GetState() == kButtonDown || fRadioSideC->GetState() == kButtonDown)) return;
1970
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;
1997 }
1998 else {// OROC
1999 sector += 36;
2000 if (fRadioSideC->GetState() == kButtonDown) sector += 18;
2001 }
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);
2006 ChangeSector();
2007}
2008
2009
4f3934a1 2010void AliTPCCalibViewerGUI::SavePicture() {
2011 //
2012 // saves the current picture
2013 //
2014 // use the following combination of file type and save options:
2015 // (see also TCanvas::Print)
2016 //
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
2033
4f3934a1 2034 const char *kSaveAsTypes[] = {
2035 "Postscript", "*.ps",
2036 "Encapsulated Postscript", "*.eps",
2037 "PDF", "*.pdf",
2038 "JPEG", "*.jpg",
2039 "PNG", "*.png",
2040 "TIFF", "*.tiff",
2041 "GIF", "*.gif",
2042 "XPM", "*.xpm",
2043 "SVG", "*.svg",
2044 "XML", "*.xml",
2045 "C++ macro", "*.cxx",
2046 "Macro file", "*.C",
2047 "ROOT file", "*.root",
2048 "All file", "*",
2049 0, 0
2050 };
2051 TString addSaveOpt("");
2052 if (fChkAddSaveOpt->GetState() == kButtonDown)
2053 addSaveOpt += fComboAddSaveOpt->GetTextEntry()->GetText();
2054 TString dir(".");
2055 TGFileInfo fi;
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)) {
832bb12c 2061 if (addSaveOpt != "")
2062 fCanvMain->GetCanvas()->Print(fi.fFilename, addSaveOpt.Data());
2063 else
2064 fCanvMain->GetCanvas()->Print(fi.fFilename);
4f3934a1 2065 }
2066
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
2074
2075}
a6d2bd0c 2076
2077
8192627b 2078void AliTPCCalibViewerGUI::DoDumpToFile() {
2079 //
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
2083 //
2084 const char *kSaveAsTypes[] = {
2085 "ROOT file", "*.root",
2086 0, 0
2087 };
2088 TString dir(".");
2089 TGFileInfo fi;
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));
2097 }
2098}
2099
2100
2101void AliTPCCalibViewerGUI::DoLoadTree() {
2102 // function to load a new calib tree
2103 //
2104 //
2105 const char *kFileTypes[] = {
2106 "ROOT file", "*.root",
2107 0, 0
2108 };
2109 TString dir(".");
2110 TGFileInfo fi;
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);
2117 Reload();
2118 }
2119 else if (fi.fFilename && strlen(fi.fFilename) && fChkAddAsReference->GetState() == kButtonDown) {
2120 fViewer->AddReferenceTree(fi.fFilename, "calPads", fTxtRefName->GetText());
2121 Reload();
2122 }
2123}
2124
2125
832bb12c 2126TObjArray* AliTPCCalibViewerGUI::ShowGUI(const char* fileName) {
a6d2bd0c 2127 //
832bb12c 2128 // Initialize and show GUI for presentation for demonstration purposes
2129 // or for fast standalone use
a6d2bd0c 2130 //
2131 TGMainFrame* frmMain = new TGMainFrame(gClient->GetRoot(), 1000, 600);
2132 frmMain->SetWindowName("AliTPCCalibViewer GUI");
2133 frmMain->SetCleanup(kDeepCleanup);
2134
2135 TGTab* tabMain = new TGTab(frmMain, 1000, 600);
2136 frmMain->AddFrame(tabMain, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
2137
2138 TGCompositeFrame* tabCont1 = tabMain->AddTab("Viewer 1");
2139 TGCompositeFrame* tabCont2 = tabMain->AddTab("Viewer 2");
2140
2141 AliTPCCalibViewerGUI* calibViewer1 = new AliTPCCalibViewerGUI(tabCont1, 1000, 600, (char*)fileName);
2142 tabCont1->AddFrame(calibViewer1, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
2143
2144 AliTPCCalibViewerGUI* calibViewer2 = new AliTPCCalibViewerGUI(tabCont2, 1000, 600, (char*)fileName);
2145 tabCont2->AddFrame(calibViewer2, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
2146
832bb12c 2147 TObjArray *guiArray = new TObjArray();
2148 guiArray->Add(calibViewer1);
2149 guiArray->Add(calibViewer2);
2150
a6d2bd0c 2151 frmMain->MapSubwindows();
2152 frmMain->Resize();
2153 frmMain->MapWindow();
832bb12c 2154
2155 return guiArray;
a6d2bd0c 2156}
2157