common base class for HLT reconstruction classes and global system instance implemented
[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
39bcd65d 1187AliTPCCalibViewerGUI & AliTPCCalibViewerGUI::operator =(const AliTPCCalibViewerGUI & param) {
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();
1248 TIterator* iter = arr->MakeIterator();
1249 iter->Reset();
1250 TObjString* currentStr = 0;
1251 Int_t id = 0;
832bb12c 1252 fListVariables->RemoveAll();
a6d2bd0c 1253 while ((currentStr = (TObjString*)(iter->Next()))) {
39bcd65d 1254 fListVariables->AddEntry(currentStr->GetString().Data(), id);
832bb12c 1255 if (fInitialized && currentStr->GetString() == selectedVariable) variableId = id;
39bcd65d 1256 id++;
1257 }
1258 delete iter;
1259 arr->Delete();
1260 delete arr;
1261
832bb12c 1262 // fill fListNorm, list of normalization variables:
39bcd65d 1263 arr = fViewer->GetListOfNormalizationVariables();
1264 iter = arr->MakeIterator();
1265 iter->Reset();
1266 currentStr = 0;
1267 id = 0;
832bb12c 1268 fListNormalization->RemoveAll();
a6d2bd0c 1269 while ((currentStr = (TObjString*)(iter->Next()))) {
39bcd65d 1270 fListNormalization->AddEntry(currentStr->GetString().Data(), id);
832bb12c 1271 if (fInitialized && currentStr->GetString() == selectedNormalization) normalizationId = id;
39bcd65d 1272 id++;
1273 }
1274 delete iter;
1275 arr->Delete();
1276 delete arr;
832bb12c 1277
1278 // trick do display the entries corectly after reinitialization
1279 // otherwise all the entries would appear as one kryptic entry
1280 // resizing the listbox somehow fixes the problem...
1281 if (fInitialized) fListVariables->Resize(fListVariables->GetWidth()-1, fListVariables->GetHeight());
1282 if (fInitialized) fListVariables->Resize(fListVariables->GetWidth()+1, fListVariables->GetHeight());
1283 if (fInitialized) fListNormalization->Resize(fListNormalization->GetWidth()-1, fListNormalization->GetHeight());
1284 if (fInitialized) fListNormalization->Resize(fListNormalization->GetWidth()+1, fListNormalization->GetHeight());
1285
1286 // select the last selected variable and normalization
1287 if (fInitialized && variableId != -1) fListVariables->Select(variableId);
1288 if (fInitialized && normalizationId != -1)fListVariables->Select(normalizationId);
1289
1290 if (fInitialized) Info("Initialize", "AliTPCCalibViewerGUI new initialized.");
1291 fInitialized = kTRUE;
39bcd65d 1292
39bcd65d 1293}
1294
72d0ab7e 1295
72d0ab7e 1296void AliTPCCalibViewerGUI::HandleButtonsGeneral(Int_t id) {
39bcd65d 1297 //
1298 // handles mutual radio button exclusions
72d0ab7e 1299 // for general Tab
39bcd65d 1300 //
1301 if (id == -1) {
1302 TGButton *btn = (TGButton *) gTQSender;
1303 id = btn->WidgetId();
1304 }
a6d2bd0c 1305
39bcd65d 1306 switch (id) {
1307 case 10: // fRadioRaw
1308 fRadioNormalized->SetState(kButtonUp);
a6d2bd0c 1309 fRadioPredefined->SetState(kButtonDown);
39bcd65d 1310 fRadioCustom->SetState(kButtonUp);
72d0ab7e 1311 // fComboMethod->UnmapWindow();
1312 // fListNormalization->UnmapWindow();
39bcd65d 1313 break;
1314 case 11: // fRadioNormalized
1315 fRadioRaw->SetState(kButtonUp);
a6d2bd0c 1316 fRadioPredefined->SetState(kButtonDown);
39bcd65d 1317 fRadioCustom->SetState(kButtonUp);
1318 break;
1319 case 12: // fRadioCustom
a6d2bd0c 1320 fRadioPredefined->SetState(kButtonUp);
72d0ab7e 1321 // fComboCustom->SetEnabled(kFALSE);
1322 // fRadioNormalized->SetState(kButtonUp);
1323 break;
832bb12c 1324 case 14: // select Draw options fComboAddDrawOpt
1325 fChkAddDrawOpt->SetState(kButtonDown);
a6d2bd0c 1326 break;
1327 case 13: // fRadioPredefined
1328 fRadioCustom->SetState(kButtonUp);
72d0ab7e 1329 // fComboCustom->SetEnabled(kTRUE);
1330 //f RadioNormalized->SetState(kButtonUp);
39bcd65d 1331 break;
1332 //--------
72d0ab7e 1333 case 30: // fRadio1D
1334 fRadio2D->SetState(kButtonUp);
832bb12c 1335 fBtnExport->SetEnabled(kFALSE);
1336 fBtnAddNorm->SetEnabled(kFALSE);
72d0ab7e 1337 break;
1338 case 31: // fRadio2D
1339 fRadio1D->SetState(kButtonUp);
832bb12c 1340 fBtnExport->SetEnabled(kTRUE);
1341 fBtnAddNorm->SetEnabled(kTRUE);
1342 break;
1343 case 42: // fComboCustom
1344 fRadioCustom->SetState(kButtonDown);
1345 fRadioPredefined->SetState(kButtonUp);
72d0ab7e 1346 break;
1347 }
1348 DoNewSelection();
1349}
1350
1351
1352void AliTPCCalibViewerGUI::HandleButtons1D(Int_t id) {
1353 //
1354 // handles mutual radio button exclusions
1355 // 1D-Tab buttons
1356 //
1357
1358 if (id == -1) {
1359 TGButton *btn = (TGButton *) gTQSender;
1360 id = btn->WidgetId();
1361 }
1362 switch (id) {
1363 case 110: // 1D draw normal
1364 fRadioNorm->SetState(kButtonDown);
1365 fRadioSigma->SetState(kButtonUp);
1366 fRadioCumulative->SetState(kButtonUp);
1367 fRadioIntegrate->SetState(kButtonUp);
1368 break;
1369 case 111: // 1D draw sigma
1370 fRadioNorm->SetState(kButtonUp);
1371 fRadioSigma->SetState(kButtonDown);
1372 fRadioCumulative->SetState(kButtonUp);
1373 fRadioIntegrate->SetState(kButtonUp);
1374 break;
1375 case 112: // 1D draw cumulative
1376 fRadioNorm->SetState(kButtonUp);
1377 fRadioSigma->SetState(kButtonUp);
1378 fRadioCumulative->SetState(kButtonDown);
1379 fRadioIntegrate->SetState(kButtonUp);
1380 break;
1381 case 113: // 1D draw integral
1382 fRadioNorm->SetState(kButtonUp);
1383 fRadioSigma->SetState(kButtonUp);
1384 fRadioCumulative->SetState(kButtonUp);
1385 fRadioIntegrate->SetState(kButtonDown);
1386 break;
1387 }
1388 DoNewSelection();
1389}
1390
1391
72d0ab7e 1392void AliTPCCalibViewerGUI::HandleButtonsStat(Int_t id) {
1393 //
1394 // handles statistic check boxes
1395 // checks each checkbox if checked
1396 // if the checkbox is checked, appends 'n' for name, 'e' for entries, ...
1397 // to a TString, passes this TString to gStyle->SetOptStat(...)
1398 //
4f3934a1 1399 if (id == -1) {
1400 TGButton *btn = (TGButton *) gTQSender;
1401 id = btn->WidgetId();
1402 }
72d0ab7e 1403 TString statOpt("");
1404 if (fChkStatName->GetState() == kButtonDown) statOpt.Append("n");
1405 if (fChkStatEntries->GetState() == kButtonDown) statOpt.Append("e");
1406 if (fChkStatMean->GetState() == kButtonDown && fChkStatMeanPM->GetState() == kButtonUp) statOpt.Append("m");
1407 if (fChkStatMeanPM->GetState() == kButtonDown) statOpt.Append("M");
1408 if (fChkStatRMS->GetState() == kButtonDown && fChkStatRMSPM->GetState() == kButtonUp) statOpt.Append("r");
1409 if (fChkStatRMSPM->GetState() == kButtonDown) statOpt.Append("R");
1410 if (fChkStatUnderflow->GetState() == kButtonDown) statOpt.Append("u");
1411 if (fChkStatOverflow->GetState() == kButtonDown) statOpt.Append("o");
1412 if (fChkStatIntegral->GetState() == kButtonDown) statOpt.Append("i");
1413 if (fChkStatSkewness->GetState() == kButtonDown && fChkStatSkewnessPM->GetState() == kButtonUp) statOpt.Append("s");
1414 if (fChkStatSkewnessPM->GetState() == kButtonDown) statOpt.Append("S");
1415 if (fChkStatKurtosis->GetState() == kButtonDown && fChkStatKurtosisPM->GetState() == kButtonUp) statOpt.Append("k");
1416 if (fChkStatKurtosisPM->GetState() == kButtonDown) statOpt.Append("K");
832bb12c 1417
72d0ab7e 1418 gStyle->SetOptStat(statOpt);
1419 DoNewSelection();
1420}
1421
1422
832bb12c 1423void AliTPCCalibViewerGUI::HandleButtonsCuts(Int_t id) {
72d0ab7e 1424 //
1425 // handles mutual radio button exclusions
1426 // right side buttons
1427 //
1428 if (id == -1) {
1429 TGButton *btn = (TGButton *) gTQSender;
1430 id = btn->WidgetId();
1431 }
1432
1433 switch (id) {
39bcd65d 1434 case 20: // fRadioTPC
1435 fRadioSideA->SetState(kButtonUp);
1436 fRadioSideC->SetState(kButtonUp);
1437 fRadioSector->SetState(kButtonUp);
1438 break;
1439 case 21: // fRadioSideA
1440 fRadioTPC->SetState(kButtonUp);
1441 fRadioSideC->SetState(kButtonUp);
1442 fRadioSector->SetState(kButtonUp);
1443 break;
1444 case 22: // fRadioSideC
1445 fRadioTPC->SetState(kButtonUp);
1446 fRadioSideA->SetState(kButtonUp);
1447 fRadioSector->SetState(kButtonUp);
1448 break;
1449 case 23: // fRadioSector
1450 fRadioTPC->SetState(kButtonUp);
1451 fRadioSideA->SetState(kButtonUp);
1452 fRadioSideC->SetState(kButtonUp);
1453 break;
4f3934a1 1454 case 31: // fComboAddCuts
1455 fChkAddCuts->SetState(kButtonDown);
1456 break;
832bb12c 1457 }
1458 DoNewSelection();
1459}
1460
1461
1462void AliTPCCalibViewerGUI::HandleButtonsNoRedraw(Int_t id) {
1463 //
1464 // handles label & scaling checkboxes
1465 // without redrawing (not necessary, faster like this)
1466 //
1467 if (id == -1) {
1468 TGButton *btn = (TGButton *) gTQSender;
1469 id = btn->WidgetId();
1470 }
1471
1472 switch (id) {
a6d2bd0c 1473 case 40: // fTxtSetMin
1474 fChkSetMin->SetState(kButtonDown);
1475 break;
1476 case 41: // fTxtSetMax
1477 fChkSetMax->SetState(kButtonDown);
1478 break;
4f3934a1 1479 case 50: // fTxtLabelTitle
1480 fChkLabelTitle->SetState(kButtonDown);
1481 break;
1482 case 51: // fTxtLabelXaxis
1483 fChkLabelXaxis->SetState(kButtonDown);
1484 break;
1485 case 52: // fTxtLabelXaxis
1486 fChkLabelYaxis->SetState(kButtonDown);
1487 break;
39bcd65d 1488 }
832bb12c 1489 SetMinMaxLabel();
39bcd65d 1490}
1491
72d0ab7e 1492
39bcd65d 1493void AliTPCCalibViewerGUI::DoNewSelection() {
1494 //
1495 // decides whether to redraw if user makes another selection
1496 //
39bcd65d 1497 if (fChkAuto->GetState() == kButtonDown) DoDraw();
1498}
1499
72d0ab7e 1500
832bb12c 1501TString* AliTPCCalibViewerGUI::GetDrawString() {
1502 //
1503 // create the draw string out of selection
1504 //
39bcd65d 1505
1506 // specify data to plot
1507 TString desiredData("");
832bb12c 1508 if (!fListVariables->GetSelectedEntry()) return 0;
39bcd65d 1509 desiredData += ((TGTextLBEntry*)(fListVariables->GetSelectedEntry()))->GetTitle();
832bb12c 1510 desiredData += fViewer->GetAbbreviation();
39bcd65d 1511
1512 // specify normalization
a6d2bd0c 1513 if (fRadioPredefined->GetState() == kButtonDown && fRadioNormalized->GetState() == kButtonDown) {
39bcd65d 1514 TString op("");
1515 switch (fComboMethod->GetSelected()) {
1516 case 0: // subtraction
1517 op += "-";
1518 break;
1519 case 1: // division
1520 op += "/";
1521 break;
1522 }
1523 TString normalizationData("");
832bb12c 1524 if (!fListNormalization->GetSelectedEntry()) return 0;
39bcd65d 1525 normalizationData += ((TGTextLBEntry*)(fListNormalization->GetSelectedEntry()))->GetTitle();
a6d2bd0c 1526
1527 if ( normalizationData.BeginsWith("Fit")) {
1528 // create fit formula, evaluate it an replace normalizationData-String
1529 // ********** create cut string **********
1530 TString cutStr("");
1531 if (fRadioTPC->GetState() == kButtonDown)
1532 cutStr += ""; // whole TPC is used for fitting
1533 if (fRadioSideA->GetState() == kButtonDown)
1534 cutStr += "(sector/18)%2==0"; // side A
1535 if (fRadioSideC->GetState() == kButtonDown)
1536 cutStr+= "(sector/18)%2==1"; // side C
1537 if (fRadioSector->GetState() == kButtonDown) {
1538 Int_t sector = (Int_t)(fNmbSector->GetNumber());
1539 cutStr += "sector==";
1540 cutStr += sector;
1541 }
1542 if (fChkAddCuts->GetState() == kButtonDown && strcmp(fComboAddCuts->GetTextEntry()->GetText(), "") != 0){
1543 if (fRadioTPC->GetState() != kButtonDown) cutStr += " && ";
1544 cutStr += fComboAddCuts->GetTextEntry()->GetText();
1545 }
1546 Double_t chi2 = 0;
1547 TVectorD fitParam(0);
1548 TMatrixD covMatrix(0,0);
1549 TString formulaStr("");
1550 if (normalizationData.CompareTo("FitLinLocal") == 0)
1551 formulaStr = "lx~ ++ ly~";
1552 if (normalizationData.CompareTo("FitLinGlobal") == 0)
1553 formulaStr = "gx~ ++ gy~";
72d0ab7e 1554 if (normalizationData.CompareTo("FitParLocal") == 0)
1555 formulaStr = "lx~ ++ ly~ ++ lx~^2 ++ ly~^2 ++ lx~*ly~";
1556 if (normalizationData.CompareTo("FitParGlobal") == 0)
1557 formulaStr = "gx~ ++ gy~ ++ gx~^2 ++ gy~^2 ++ gx~*gy~";
832bb12c 1558 formulaStr.ReplaceAll("~", fViewer->GetAbbreviation());
a6d2bd0c 1559 normalizationData = *fViewer->Fit(desiredData.Data(), formulaStr.Data(), cutStr.Data(), chi2, fitParam, covMatrix);
832bb12c 1560 } // if ( normalizationData.BeginsWith("Fit")
a6d2bd0c 1561
39bcd65d 1562 desiredData += op;
a6d2bd0c 1563 if (! (TString(((TGTextLBEntry*)(fListNormalization->GetSelectedEntry()))->GetTitle())).BeginsWith("Fit"))
1564 desiredData += ((TGTextLBEntry*)(fListVariables->GetSelectedEntry()))->GetTitle();
39bcd65d 1565 desiredData += normalizationData;
1566 }
1567 else if (fRadioCustom->GetState() == kButtonDown) {
a6d2bd0c 1568 desiredData = fComboCustom->GetTextEntry()->GetText();
832bb12c 1569 if (desiredData == "") return 0;
39bcd65d 1570 }
832bb12c 1571
8192627b 1572 // try to add forgotten '~'
1573 if (fChkAutoAppend->GetState() == kButtonDown)
1574 desiredData = TString(fViewer->AddAbbreviations((char*)desiredData.Data()));
832bb12c 1575 return new TString(desiredData.Data());
1576}
1577
1578
1579TString* AliTPCCalibViewerGUI::GetSectorString() {
1580 //
1581 // create the sector string out of selection
1582 //
39bcd65d 1583
39bcd65d 1584 TString sectorStr("");
1585 if (fRadioTPC->GetState() == kButtonDown)
1586 sectorStr += "ALL";
1587 if (fRadioSideA->GetState() == kButtonDown)
1588 sectorStr += "A"; //cuts += "(sector/18)%2==0";
1589 if (fRadioSideC->GetState() == kButtonDown)
1590 sectorStr+= "C"; //cuts += "(sector/18)%2==1";
1591 if (fRadioSector->GetState() == kButtonDown) {
1592 Int_t sector = (Int_t)(fNmbSector->GetNumber());
1593 sectorStr += sector; //cuts += "sector==";
1594 }
832bb12c 1595 return new TString(sectorStr.Data());
1596}
1597
1598
1599 TString* AliTPCCalibViewerGUI::GetCutString() {
1600 //
1601 // create the cut string out of selection
1602 //
1603
39bcd65d 1604 TString cutsStr("");
72d0ab7e 1605 if (fChkCutZero->GetState() == kButtonDown) {
832bb12c 1606 TString cutZerosStr(GetDrawString()->Data());
1607 if (cutZerosStr.Contains(">>")) {
1608 cutZerosStr.Remove(cutZerosStr.First(">>"));
1609 }
1610 if (cutZerosStr.Contains(":")) {
1611 cutZerosStr.Remove(cutZerosStr.First(":"));
1612 }
1613 cutsStr += cutZerosStr.Data();
72d0ab7e 1614 cutsStr += "!=0";
1615 if (fChkAddCuts->GetState() == kButtonDown) cutsStr += " && ";
1616 }
39bcd65d 1617 if (fChkAddCuts->GetState() == kButtonDown)
a6d2bd0c 1618 cutsStr += fComboAddCuts->GetTextEntry()->GetText();
8192627b 1619
1620 // try to add forgotten '~'
1621 if (fChkAutoAppend->GetState() == kButtonDown)
1622 cutsStr = TString(fViewer->AddAbbreviations((char*)cutsStr.Data()));
832bb12c 1623 return new TString(cutsStr.Data());
1624}
1625
1626
1627void AliTPCCalibViewerGUI::DoDraw() {
1628 //
1629 // main method for drawing according to user selection
1630 //
1631
1632 // specify data to plot:
1633 TString desiredData(GetDrawString()->Data());
1634 // specify sector:
1635 TString sectorStr(GetSectorString()->Data());
1636 // specify cuts:
1637 TString cutsStr(GetCutString()->Data());
72d0ab7e 1638
1639 TString addDrawOpt("");
1640 if (fChkAddDrawOpt->GetState() == kButtonDown)
1641 addDrawOpt += fComboAddDrawOpt->GetTextEntry()->GetText();
39bcd65d 1642
832bb12c 1643 // remove last picture
1644 if (!addDrawOpt.Contains("same"))
1645 for (Int_t i = 0; i < fCanvMain->GetCanvas()->GetListOfPrimitives()->GetEntries(); i++) {
1646 if (strcmp(fCanvMain->GetCanvas()->GetListOfPrimitives()->At(i)->ClassName(), "TFrame") != 0)
1647 fCanvMain->GetCanvas()->GetListOfPrimitives()->At(i)->Delete();
1648 }
a6d2bd0c 1649 //fCanvMain->GetCanvas()->Clear();
39bcd65d 1650 fCanvMain->GetCanvas()->cd();
a6d2bd0c 1651 Int_t entries = -1;
832bb12c 1652 // draw finally
72d0ab7e 1653 if (fRadio1D->GetState() == kButtonDown){
1654 // 1D-Drawing
1655 TString strSigmaMax(fTxtSigmaMax->GetText()); // get sigmaMax from text enty
1656 Double_t sigmaMax = (strSigmaMax.IsFloat()) ? strSigmaMax.Atof() : 5; // convert to double, if not convertable, set to 5
1657 Bool_t plotMean = fChkMean->GetState() == kButtonDown;
1658 Bool_t plotMedian = fChkMedian->GetState() == kButtonDown;
1659 Bool_t plotLTM = fChkLTM->GetState() == kButtonDown;
1660 if (fRadioNorm->GetState() == kButtonDown) // normal 1D drawing
1661 entries = fViewer->EasyDraw1D(desiredData.Data(), sectorStr.Data(), cutsStr.Data(), addDrawOpt.Data());
1662 if (fRadioSigma->GetState() == kButtonDown) // sigma 1D drawing
1663 entries = fViewer->DrawHisto1D(desiredData.Data(), sectorStr.Data(), cutsStr.Data(), //
1664 fTxtSigmas->GetText(), plotMean, plotMedian, plotLTM);
1665 if (fRadioCumulative->GetState() == kButtonDown) // cumulative 1D drawing
1666 entries = fViewer->SigmaCut(desiredData.Data(), sectorStr.Data(), cutsStr.Data(), //
1667 sigmaMax, plotMean, plotMedian, plotLTM, //
1668 fCheckCumulativePM->GetState() == kButtonDown, fTxtSigmas->GetText(), /* Float_t sigmaStep =*/ -1);
1669 if (fRadioIntegrate->GetState() == kButtonDown) // integral 1D drawing
1670 entries = fViewer->Integrate(desiredData.Data(), sectorStr.Data(), cutsStr.Data(), //
1671 sigmaMax, plotMean, plotMedian, plotLTM, //
1672 fTxtSigmas->GetText(), /* Float_t sigmaStep =*/ -1);
1673 }
1674 else if (fRadio2D->GetState() == kButtonDown) {
1675 // 2D-Drawing
1676 entries = fViewer->EasyDraw(desiredData.Data(), sectorStr.Data(), cutsStr.Data(), addDrawOpt.Data());
1677 }
1678 if (entries == -1) return; // nothing was drawn, there is no histogram to get min and max
1679
832bb12c 1680 SetMinMaxLabel();
39bcd65d 1681 fCanvMain->GetCanvas()->Update();
1682}
a6d2bd0c 1683
1684
1685void AliTPCCalibViewerGUI::DoFit() {
1686 //
1687 // main method for fitting
1688 //
1689
1690 Double_t chi2 = 0;
1691 TVectorD fitParam(0);
1692 TMatrixD covMatrix(0,0);
a6d2bd0c 1693 TString cutStr("");
1694 TString formulaStr("");
1695 TString *returnStr = new TString("");
1696
832bb12c 1697 // specify data to plot:
1698 TString drawStr(GetDrawString()->Data());
8192627b 1699
a6d2bd0c 1700 // ********** create cut string **********
1701 if (fRadioTPC->GetState() == kButtonDown)
1702 cutStr += ""; // whole TPC is used for fitting
1703 if (fRadioSideA->GetState() == kButtonDown)
1704 cutStr += "(sector/18)%2==0"; // side A
1705 if (fRadioSideC->GetState() == kButtonDown)
1706 cutStr+= "(sector/18)%2==1"; // side C
1707 if (fRadioSector->GetState() == kButtonDown) {
1708 Int_t sector = (Int_t)(fNmbSector->GetNumber());
1709 cutStr += "sector==";
1710 cutStr += sector;
1711 }
1712 if (fChkAddCuts->GetState() == kButtonDown && strcmp(fComboAddCuts->GetTextEntry()->GetText(), "") != 0){
1713 if (fRadioTPC->GetState() != kButtonDown) cutStr += " && ";
1714 cutStr += fComboAddCuts->GetTextEntry()->GetText();
1715 }
8192627b 1716 // try to add forgotten '~'
1717 if (fChkAutoAppend->GetState() == kButtonDown)
1718 cutStr = TString(fViewer->AddAbbreviations((char*)cutStr.Data()));
a6d2bd0c 1719
1720 // ********** get formula string **********
1721 formulaStr += fComboCustomFit->GetTextEntry()->GetText();
8192627b 1722 if (fChkAutoAppend->GetState() == kButtonDown)
1723 formulaStr = TString(fViewer->AddAbbreviations((char*)formulaStr.Data()));
a6d2bd0c 1724
1725 // ********** call AliTPCCalibViewer's fit-function
1726 returnStr = fViewer->Fit(drawStr.Data(), formulaStr.Data(), cutStr.Data(), chi2, fitParam, covMatrix);
1727
1728 std::cout << std::endl;
1729 std::cout << "Your fit formula reads as follows:" << std::endl;
1730 std::cout << returnStr->Data() << std::endl;
1731 std::cout << "chi2 = " << chi2 << std::endl;
1732}
1733
832bb12c 1734
1735void AliTPCCalibViewerGUI::DoExport() {
1736 //
1737 // function to export a CalPad to Cint
1738 //
1739 if ( fRadio2D->GetState() != kButtonDown){
1740 Error("ExportCalPad", "Export of AliTPCCalPad to CINT works only in 2D mode.");
1741 return;
1742 }
1743 // specify data to plot:
1744 TString desiredData(GetDrawString()->Data());
1745 // specify cuts:
1746 TString cutsStr(GetCutString()->Data());
1747 // get name for the calPad
1748 const char* calPadName = fComboExportName->GetTextEntry()->GetText();
1749 // create calPad according to drawCommand and cuts
1750 AliTPCCalPad *calPad = fViewer->GetCalPad(desiredData.Data(), (char*)cutsStr.Data(), (char*)calPadName);
1751 // finally export calPad to Cint:
1752 gROOT->ProcessLine(Form("AliTPCCalPad* %s = (AliTPCCalPad*)0x%lx;", calPadName, calPad));
8192627b 1753 fPreprocessor->AddComponent(calPad);
832bb12c 1754 Info("ExportCalPad", "Current 2D view has been exported to an AliTPCCalPad* with name '%s'", calPadName);
1755}
1756
1757
1758void AliTPCCalibViewerGUI::DoExportNorm() {
1759 //
1760 // function to export a CalPad to Cint
1761 //
1762
1763 if ( fRadio2D->GetState() != kButtonDown){
1764 Error("ExportCalPad", "Adding an AliTPCCalPad to the normalization works only in 2D mode.");
1765 return;
1766 }
1767
1768 Error("DoExportNorm", "Not yet implemented.");
1769 return;
1770
1771 // specify data to plot:
1772 TString desiredData(GetDrawString()->Data());
1773 // specify sector:
1774 TString sectorStr(GetSectorString()->Data());
1775 // specify cuts:
1776 TString cutsStr(GetCutString()->Data());
1777
1778 // get name for the calPad
1779 const char* calPadName = fComboExportName->GetTextEntry()->GetText();
1780 // create calPad according to drawCommand and cuts
1781 AliTPCCalPad *calPad = fViewer->GetCalPad(desiredData.Data(), (char*)cutsStr.Data(), (char*)fComboExportName->GetTextEntry()->GetText());
1782 // finally export calPad to Cint:
1783 gROOT->ProcessLine(Form("AliTPCCalPad* %s = (AliTPCCalPad*)0x%lx;", calPadName, calPad));
1784 Info("ExportCalPad", "Current 2D view has been exported to an AliTPCCalPad* with name '%s'", calPadName);
1785}
1786
1787
a6d2bd0c 1788void AliTPCCalibViewerGUI::GetMinMax() {
1789 //
1790 // Read current Min & Max from the plot and set it to fTxtSetMin & fTxtSetMax
1791 //
832bb12c 1792 if (fChkGetMinMaxAuto->GetState() == kButtonUp) return;
a6d2bd0c 1793 TList* listOfPrimitives = fCanvMain->GetCanvas()->GetListOfPrimitives();
1794 TObject* ptr = 0;
1795 for (Int_t i = 0; i < listOfPrimitives->GetEntries(); i++) {
1796 ptr = listOfPrimitives->At(i);
1797 if ( ptr->InheritsFrom("TH1") ) break;
1798 }
1799 if ( ptr != 0 && !ptr->InheritsFrom("TH1") ) return; // if the loop did not find a TH1
1800 TH1 *hist = (TH1*)ptr;
8192627b 1801
1802// Double_t histMax = hist->GetMaximum();
1803// Double_t histMin = hist->GetMinimum();
1804// fTxtSetMax->SetText(Form("%f",histMax));
1805// fTxtSetMin->SetText(Form("%f",histMin));
1806
1807 if (fRadio2D->GetState() == kButtonDown) {
1808 if (fChkSetMax->GetState() == kButtonUp)
1809 fTxtSetMax->SetText(Form("%f", hist->GetMaximum()));
1810 if (fChkSetMin->GetState() == kButtonUp)
1811 fTxtSetMin->SetText(Form("%f", hist->GetMinimum()));
1812 }
1813 else if (fRadio1D->GetState() == kButtonDown) {
1814 if (fChkSetMax->GetState() == kButtonUp)
1815 fTxtSetMax->SetText( Form("%f", hist->GetXaxis()->GetXmax()) );
1816 if (fChkSetMin->GetState() == kButtonUp)
1817 fTxtSetMin->SetText( Form("%f", hist->GetXaxis()->GetXmin()) );
1818 }
a6d2bd0c 1819}
1820
832bb12c 1821
1822void AliTPCCalibViewerGUI::SetMinMaxLabel() {
1823 //
1824 // Set Minimum, Maximum and labels without redrawing the plot
1825 // (faster)
1826 //
1827
1828 // search for histogram
1829 TList* listOfPrimitives = fCanvMain->GetCanvas()->GetListOfPrimitives();
1830 TObject* ptr = 0;
1831 for (Int_t i = 0; i < listOfPrimitives->GetEntries(); i++) {
1832 ptr = listOfPrimitives->At(i);
1833 if ( ptr->InheritsFrom("TH1") ) break;
1834 }
1835 if ( ptr == 0 || !ptr->InheritsFrom("TH1") ) { // if the loop did not find a TH1
1836 fCanvMain->GetCanvas()->Update();
1837 Warning("SetMinMaxLabel","No Histogram found!");
1838 return;
1839 // unable to find histogram, no min and max wil be read out
1840 }
1841
1842 TH1 *hist = (TH1*)ptr;
1843 TString minTxt(fTxtSetMin->GetText());
1844 TString maxTxt(fTxtSetMax->GetText());
8192627b 1845
832bb12c 1846 // set min and max according to specified values, if checkbox is checked
8192627b 1847 if (fRadio2D->GetState() == kButtonDown) {
1848 if (fChkSetMax->GetState() == kButtonDown && fChkSetMax->GetState() == kButtonDown &&(maxTxt.IsDigit() || maxTxt.IsFloat()) )
1849 hist->SetMaximum(maxTxt.Atof());
832bb12c 1850 if (fChkSetMax->GetState() == kButtonUp)
8192627b 1851 hist->SetMaximum(-1111); // default value, to unzoom
1852 if (fChkSetMin->GetState() == kButtonDown && (minTxt.IsDigit() || minTxt.IsFloat()) )
1853 hist->SetMinimum(minTxt.Atof());
832bb12c 1854 if (fChkSetMin->GetState() == kButtonUp)
8192627b 1855 hist->SetMinimum(-1111); // default value, to unzoom
1856 }
1857 else if (fRadio2D->GetState() == kButtonDown) {
1858 if (fChkSetMin->GetState() == kButtonDown &&
1859 fChkSetMax->GetState() == kButtonDown && hist->GetXaxis())
1860 hist->GetXaxis()->SetRangeUser(hist->GetXaxis()->GetXmin(), hist->GetXaxis()->GetXmax());
1861 else if (fChkSetMax->GetState() == kButtonDown && hist->GetXaxis())
1862 hist->GetXaxis()->SetRangeUser(hist->GetXaxis()->GetXmin(), maxTxt.Atof());
1863 else if (fChkSetMin->GetState() == kButtonDown && hist->GetXaxis())
1864 hist->GetXaxis()->SetRangeUser(minTxt.Atof(), hist->GetXaxis()->GetXmax());
1865 hist->SetTitle(hist->GetTitle()); // trick to update the histogram
832bb12c 1866 }
1867
8192627b 1868 // get min and max from plot
1869 GetMinMax();
1870
832bb12c 1871 // set labels according to specification, if cehckboxes are checked
1872 if (fChkLabelTitle->GetState() == kButtonDown)
1873 hist->SetTitle(fTxtLabelTitle->GetText());
1874 if (fChkLabelXaxis->GetState() == kButtonDown)
1875 hist->GetXaxis()->SetTitle(fTxtLabelXaxis->GetText());
1876 if (fChkLabelYaxis->GetState() == kButtonDown)
1877 hist->GetYaxis()->SetTitle(fTxtLabelYaxis->GetText());
1878 // get and/or set labels and title
1879 if (fChkLabelGetAuto->GetState() == kButtonDown) {
1880 fTxtLabelTitle->SetText(hist->GetTitle());
1881 fTxtLabelXaxis->SetTitle(hist->GetXaxis()->GetTitle());
1882 fTxtLabelYaxis->SetTitle(hist->GetYaxis()->GetTitle());
1883 }
1884 hist->SetTitle(hist->GetTitle()); // trick to update the histogram
1885 fCanvMain->GetCanvas()->Update();
1886}
1887
1888
a6d2bd0c 1889void AliTPCCalibViewerGUI::ChangeSector(){
1890 //
1891 // function that is called, when the number of the sector is changed
1892 // to change the sector label
1893 //
1894 Int_t sector = (Int_t)(fNmbSector->GetNumber());
1895 char* secLabel = "";
1896 if (sector >= 0 && sector <= 17) // IROC, Side A
1897 secLabel = "IROC, A";
1898 if (sector >= 18 && sector <= 35) // IROC, Side C
1899 secLabel = "IROC, C";
1900 if (sector >= 36 && sector <= 53) // OROC, Side A
1901 secLabel = "OROC, A";
1902 if (sector >= 54 && sector <= 71) // OROC, Side C
1903 secLabel = "OROC, C";
1904 fLblSector->SetText(secLabel);
1905 DoNewSelection();
1906}
1907
832bb12c 1908
72d0ab7e 1909void AliTPCCalibViewerGUI::AddFitFunction() const {
a6d2bd0c 1910 //
1911 // adds the last fit function to the normalization list
1912 //
1913 std::cout << "Not yet implemented." << std::endl;
1914}
4f3934a1 1915
832bb12c 1916
1917void AliTPCCalibViewerGUI::UnchekAllStat() {
1918 //
1919 // Disable all statistical legend entries, no statistical legend.
1920 //
1921 fChkStatName->SetState(kButtonUp);
1922 fChkStatEntries->SetState(kButtonUp);
1923 fChkStatMean->SetState(kButtonUp);
1924 fChkStatMeanPM->SetState(kButtonUp);
1925 fChkStatRMS->SetState(kButtonUp);
1926 fChkStatRMSPM->SetState(kButtonUp);
1927 fChkStatUnderflow->SetState(kButtonUp);
1928 fChkStatOverflow->SetState(kButtonUp);
1929 fChkStatIntegral->SetState(kButtonUp);
1930 fChkStatSkewness->SetState(kButtonUp);
1931 fChkStatSkewnessPM->SetState(kButtonUp);
1932 fChkStatKurtosis->SetState(kButtonUp);
1933 fChkStatKurtosisPM->SetState(kButtonUp);
1934
1935 HandleButtonsStat(0);
1936}
1937
1938
1939void AliTPCCalibViewerGUI::MouseMove(Int_t event, Int_t x, Int_t y, TObject *selectedObject) {
1940 //
1941 // mouse move
1942 // zoom to sector works ONLY in 2D mode, if one side is specified
1943 //
1944 Double_t pi = TMath::Pi();
1945 if (event != kButton1Double )
1946 return;
1947 if (!selectedObject->InheritsFrom("TH2")) return;
1948 // zoom to sector works ONLY in 2D mode, if one side is specified
1949 if (fRadio2D->GetState() == kButtonUp) return;
1950 if (fRadioSector->GetState() == kButtonDown) { // return to full side view
1951 // return to full side view
1952 Int_t sector = (Int_t)(fNmbSector->GetNumber());
1953 if ( (sector >= 0 && sector <= 17) || (sector >= 36 && sector <= 53) ) {
1954 // A-Side
1955 fRadioSideA->Clicked();
1956 fRadioSideA->SetState(kButtonDown);
1957 DoNewSelection();
1958 }
1959 if ( (sector >= 18 && sector <= 35) || (sector >= 54 && sector <= 71) ) {
1960 // C-Side
1961 fRadioSideC->Clicked();
1962 fRadioSideC->SetState(kButtonDown);
1963 DoNewSelection();
1964 }
1965 return;
1966 }
1967 if (!(fRadioSideA->GetState() == kButtonDown || fRadioSideC->GetState() == kButtonDown)) return;
1968
1969 // Int_t px = gPad->GetEventX();
1970 // Int_t py = gPad->GetEventY();
1971 Float_t upy = gPad->AbsPixeltoY(y);
1972 Float_t upx = gPad->AbsPixeltoX(x);
1973 Float_t gy = gPad->PadtoY(upy);
1974 Float_t gx = gPad->PadtoX(upx);
1975 Int_t quadrant = -1;
1976 if (gx >= 0 && gy >= 0) quadrant = 1;
1977 if (gx < 0 && gy >= 0) quadrant = 2;
1978 if (gx < 0 && gy < 0) quadrant = 3;
1979 if (gx >= 0 && gy < 0) quadrant = 4;
1980 gx = TMath::Abs(gx);
1981 gy = TMath::Abs(gy);
1982 Double_t phi = TMath::ATan(gy/gx); // angle phi is in Pi- units
1983 Double_t r = TMath::Sqrt(gx*gx + gy*gy);
1984 if (quadrant == 2) phi = pi - phi;
1985 if (quadrant == 3) phi = pi + phi;
1986 if (quadrant == 4) phi = 2 * pi - phi;
1987 Double_t phiGrad = phi / pi * 180;
1988 Int_t sector = (Int_t) phiGrad / 20; // one sector coresponds to 20°
1989 // IROC starts at 84.5 cm
1990 // IROC ends at 135.5 cm, OROC begins
1991 // OROC ends at 250 cm
1992 if (r < 84.5 || r > 250) return; // outside TPC
1993 if (r < 135.5) { // IROC
1994 if (fRadioSideC->GetState() == kButtonDown) sector += 18;
1995 }
1996 else {// OROC
1997 sector += 36;
1998 if (fRadioSideC->GetState() == kButtonDown) sector += 18;
1999 }
2000 // printf("r: %f, phi: %f, phiGrad: %f, gy/gx: %f, quadrant: %i, sector: %i \n", r, phi, phiGrad, gy/gx, quadrant, sector);
2001 fNmbSector->SetNumber(sector);
2002 fRadioSector->Clicked();
2003 fRadioSector->SetState(kButtonDown);
2004 ChangeSector();
2005}
2006
2007
4f3934a1 2008void AliTPCCalibViewerGUI::SavePicture() {
2009 //
2010 // saves the current picture
2011 //
2012 // use the following combination of file type and save options:
2013 // (see also TCanvas::Print)
2014 //
2015 // "ps" - Postscript file is produced (see special cases below)
2016 // "Portrait" - Postscript file is produced (Portrait)
2017 // "Landscape" - Postscript file is produced (Landscape)
2018 // "eps" - an Encapsulated Postscript file is produced
2019 // "Preview" - an Encapsulated Postscript file with preview is produced.
2020 // "pdf" - a PDF file is produced
2021 // "svg" - a SVG file is produced
2022 // "gif" - a GIF file is produced
2023 // "gif+NN" - an animated GIF file is produced, where NN is delay in 10ms units
2024 // "xpm" - a XPM file is produced
2025 // "png" - a PNG file is produced
2026 // "jpg" - a JPEG file is produced
2027 // "tiff" - a TIFF file is produced
2028 // "cxx" - a C++ macro file is produced
2029 // "xml" - a XML file
2030 // "root" - a ROOT binary file
2031
4f3934a1 2032 const char *kSaveAsTypes[] = {
2033 "Postscript", "*.ps",
2034 "Encapsulated Postscript", "*.eps",
2035 "PDF", "*.pdf",
2036 "JPEG", "*.jpg",
2037 "PNG", "*.png",
2038 "TIFF", "*.tiff",
2039 "GIF", "*.gif",
2040 "XPM", "*.xpm",
2041 "SVG", "*.svg",
2042 "XML", "*.xml",
2043 "C++ macro", "*.cxx",
2044 "Macro file", "*.C",
2045 "ROOT file", "*.root",
2046 "All file", "*",
2047 0, 0
2048 };
2049 TString addSaveOpt("");
2050 if (fChkAddSaveOpt->GetState() == kButtonDown)
2051 addSaveOpt += fComboAddSaveOpt->GetTextEntry()->GetText();
2052 TString dir(".");
2053 TGFileInfo fi;
2054 fi.fFileTypes = kSaveAsTypes;
2055 // fi.fIniDir = StrDup(dir);
2056 fi.fOverwrite = kFALSE;
2057 new TGFileDialog(gClient->GetRoot(), gClient->GetRoot(), kFDSave, &fi);
2058 if (fi.fFilename && strlen(fi.fFilename)) {
832bb12c 2059 if (addSaveOpt != "")
2060 fCanvMain->GetCanvas()->Print(fi.fFilename, addSaveOpt.Data());
2061 else
2062 fCanvMain->GetCanvas()->Print(fi.fFilename);
4f3934a1 2063 }
2064
2065// TList* fFileNamesList list of selected file names
2066// Int_t fFileTypeIdx selected file type, index in fFileTypes
2067// const char** fFileTypes file types used to filter selectable files
2068// char* fFilename selected file name
2069// char* fIniDir on input: initial directory, on output: new directory
2070// Bool_t fMultipleSelection if true, allow multiple file selection
2071// Bool_t fOverwrite if true overwrite the file with existing name on save
2072
2073}
a6d2bd0c 2074
2075
8192627b 2076void AliTPCCalibViewerGUI::DoDumpToFile() {
2077 //
2078 // This function is called, when the "Dump to File" button is pressed.
2079 // All the exported CalPads will be written into an new CalibTree,
2080 // a Save File dialog will appear to specify the filename
2081 //
2082 const char *kSaveAsTypes[] = {
2083 "ROOT file", "*.root",
2084 0, 0
2085 };
2086 TString dir(".");
2087 TGFileInfo fi;
2088 fi.fFileTypes = kSaveAsTypes;
2089 // fi.fIniDir = StrDup(dir);
2090 fi.fOverwrite = kFALSE;
2091 new TGFileDialog(gClient->GetRoot(), gClient->GetRoot(), kFDSave, &fi);
2092 if (fi.fFilename && strlen(fi.fFilename)) {
2093 fPreprocessor->DumpToFile(fi.fFilename);
2094 Info("DumpToFile", Form("New CalibTree has been writen to file '%s'", fi.fFilename));
2095 }
2096}
2097
2098
2099void AliTPCCalibViewerGUI::DoLoadTree() {
2100 // function to load a new calib tree
2101 //
2102 //
2103 const char *kFileTypes[] = {
2104 "ROOT file", "*.root",
2105 0, 0
2106 };
2107 TString dir(".");
2108 TGFileInfo fi;
2109 fi.fFileTypes = kFileTypes;
2110 // fi.fIniDir = StrDup(dir);
2111 fi.fOverwrite = kFALSE;
2112 new TGFileDialog(gClient->GetRoot(), gClient->GetRoot(), kFDOpen, &fi);
2113 if (fi.fFilename && strlen(fi.fFilename) && fChkAddAsReference->GetState() == kButtonUp) {
2114 Initialize(fi.fFilename);
2115 Reload();
2116 }
2117 else if (fi.fFilename && strlen(fi.fFilename) && fChkAddAsReference->GetState() == kButtonDown) {
2118 fViewer->AddReferenceTree(fi.fFilename, "calPads", fTxtRefName->GetText());
2119 Reload();
2120 }
2121}
2122
2123
832bb12c 2124TObjArray* AliTPCCalibViewerGUI::ShowGUI(const char* fileName) {
a6d2bd0c 2125 //
832bb12c 2126 // Initialize and show GUI for presentation for demonstration purposes
2127 // or for fast standalone use
a6d2bd0c 2128 //
2129 TGMainFrame* frmMain = new TGMainFrame(gClient->GetRoot(), 1000, 600);
2130 frmMain->SetWindowName("AliTPCCalibViewer GUI");
2131 frmMain->SetCleanup(kDeepCleanup);
2132
2133 TGTab* tabMain = new TGTab(frmMain, 1000, 600);
2134 frmMain->AddFrame(tabMain, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
2135
2136 TGCompositeFrame* tabCont1 = tabMain->AddTab("Viewer 1");
2137 TGCompositeFrame* tabCont2 = tabMain->AddTab("Viewer 2");
2138
2139 AliTPCCalibViewerGUI* calibViewer1 = new AliTPCCalibViewerGUI(tabCont1, 1000, 600, (char*)fileName);
2140 tabCont1->AddFrame(calibViewer1, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
2141
2142 AliTPCCalibViewerGUI* calibViewer2 = new AliTPCCalibViewerGUI(tabCont2, 1000, 600, (char*)fileName);
2143 tabCont2->AddFrame(calibViewer2, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
2144
832bb12c 2145 TObjArray *guiArray = new TObjArray();
2146 guiArray->Add(calibViewer1);
2147 guiArray->Add(calibViewer2);
2148
a6d2bd0c 2149 frmMain->MapSubwindows();
2150 frmMain->Resize();
2151 frmMain->MapWindow();
832bb12c 2152
2153 return guiArray;
a6d2bd0c 2154}
2155