Modifying the queries for AliRoot version, used to fill the related fill in OCDB...
[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")
27 Begin_macro(source,gui)
28 {
29 char* fileName = "CalibTreeEmpty.root";
30 AliTPCCalibViewer::MakeTree(fileName, 0, "$ALICE_ROOT/TPC/Calib/MapCalibrationObjects.root");
31 gROOT->SetStyle("Plain");
32 // content of AliTPCCalibViewerGUI::ShowGUI(...)
33 TGMainFrame* frmMain = new TGMainFrame(gClient->GetRoot(), 1000, 600);
34 frmMain->SetWindowName("AliTPCCalibViewer GUI");
35 frmMain->SetCleanup(kDeepCleanup);
36
37 TGTab* tabMain = new TGTab(frmMain, 1000, 600);
38 frmMain->AddFrame(tabMain, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
39
40 TGCompositeFrame* tabCont1 = tabMain->AddTab("Viewer 1");
41 TGCompositeFrame* tabCont2 = tabMain->AddTab("Viewer 2");
42
43 AliTPCCalibViewerGUI* calibViewer1 = new AliTPCCalibViewerGUI(tabCont1, 1000, 600, fileName);
44 tabCont1->AddFrame(calibViewer1, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
45
46 AliTPCCalibViewerGUI* calibViewer2 = new AliTPCCalibViewerGUI(tabCont2, 1000, 600, fileName);
47 tabCont2->AddFrame(calibViewer2, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
48
49 frmMain->MapSubwindows();
50 frmMain->Resize();
51 frmMain->MapWindow();
52
53 return frmMain;
54
55 }
56 End_macro
a6d2bd0c 57*/
72d0ab7e 58// //
39bcd65d 59// //
60///////////////////////////////////////////////////////////////////////////////
61
62
63#include "AliTPCCalibViewerGUI.h"
72d0ab7e 64#include <iostream>
39bcd65d 65
66#include <TCanvas.h>
67#include <TPad.h>
68#include <TVirtualPad.h>
69
70#include <TObjArray.h>
71#include <TObjString.h>
72#include <TVector.h>
a6d2bd0c 73#include <string.h>
74#include <TH1.h>
72d0ab7e 75#include "TStyle.h"
76#include "AliTPCCalibViewer.h"
4f3934a1 77#include "TGFileDialog.h"
78#include "TGFileDialog.h"
72d0ab7e 79
80// #include "TGListBox.h"
81// #include "TGNumberEntry"
82// #include "TGSplitter"
83// #include "TGTab"
84// #include "TGLabel"
85// #include "TGButtonGroup"
86// #include "TGComboBox"
87// #include "TRootEmbeddedCanvas"
88// #include "TGButton"
89// #include "TGRadioButton"
90// #include "GTCheckButton"
91// #include "TGTextEntry"
92
93
a6d2bd0c 94
39bcd65d 95
96ClassImp(AliTPCCalibViewerGUI)
97
98AliTPCCalibViewerGUI::AliTPCCalibViewerGUI(const TGWindow *p, UInt_t w, UInt_t h, char* fileName)
a6d2bd0c 99 : TGCompositeFrame(p, w, h),
39bcd65d 100 fViewer(0),
a6d2bd0c 101 fContTopBottom(0),
102 fContLCR(0),
39bcd65d 103 fContLeft(0),
72d0ab7e 104 ftabLeft(0),
105 ftabLeft0(0),
106 ftabLeft1(0),
4f3934a1 107 ftabRight(0),
108 fTabRight0(0),
109 fTabRight1(0),
39bcd65d 110 fContRight(0),
111 fContCenter(0),
112 fContPlotOpt(0),
113 fContDrawOpt(0),
a6d2bd0c 114 fContDrawOptSub1D2D(0),
39bcd65d 115 fContNormalized(0),
116 fContCustom(0),
117 fContCuts(0),
118 fContSector(0),
119 fContAddCuts(0),
a6d2bd0c 120 fContFit(0),
121 fContAddFit(0),
122 fContScaling(0),
123 fContSetMax(0),
124 fContSetMin(0),
72d0ab7e 125 fContAddDrawOpt(0),
39bcd65d 126 fListVariables(0),
127 fBtnDraw(0),
a6d2bd0c 128 fBtnFit(0),
129 fBtnAddFitFunction(0),
130 fBtnGetMinMax(0),
39bcd65d 131 fCanvMain(0),
132 fRadioRaw(0),
133 fRadioNormalized(0),
a6d2bd0c 134 fRadioPredefined(0),
39bcd65d 135 fRadioCustom(0),
136 fRadio1D(0),
137 fRadio2D(0),
138 fRadioTPC(0),
139 fRadioSideA(0),
140 fRadioSideC(0),
141 fRadioSector(0),
72d0ab7e 142 fComboAddDrawOpt(0),
39bcd65d 143 fChkAuto(0),
144 fComboMethod(0),
145 fListNormalization(0),
a6d2bd0c 146 fComboCustom(0),
4f3934a1 147 fLblCustomDraw(0),
72d0ab7e 148 fChkAddDrawOpt(0),
39bcd65d 149 fNmbSector(0),
a6d2bd0c 150 fLblSector(0),
72d0ab7e 151 fChkCutZero(0),
39bcd65d 152 fChkAddCuts(0),
4f3934a1 153 fLblAddCuts(0),
a6d2bd0c 154 fComboAddCuts(0),
155 fComboCustomFit(0),
156 fChkSetMax(0),
157 fChkSetMin(0),
158 fChkGetMinMaxAuto(0),
159 fTxtSetMax(0),
72d0ab7e 160 fTxtSetMin(0) ,
161 fContDrawOpt1D(0),
162 fcontDrawOpt1DSubLR(0),
163 fContDrawOpt1DSubNSC(0),
164 fRadioNorm(0),
165 fRadioSigma(0),
166 fTxtSigmas(0),
167 fContCumuLR(0),
168 fContCumLeft(0),
169 fContCumRight(0),
170 fLblSigmaMax(0),
171 fTxtSigmaMax(0),
172 fRadioCumulative(0),
173 fCheckCumulativePM(0),
174 fRadioIntegrate(0),
175 fContDrawOpt1DSubMML(0),
176 fChkMean(0),
177 fChkMedian(0),
178 fChkLTM(0),
179 fContStatOpt(0),
180 fChkStatName(0),
181 fChkStatEntries(0),
182 fContStatMean(0),
183 fChkStatMean(0),
184 fChkStatMeanPM(0),
185 fContStatRMS(0),
186 fChkStatRMS(0),
187 fChkStatRMSPM(0),
188 fChkStatUnderflow(0),
189 fChkStatOverflow(0),
190 fChkStatIntegral(0),
191 fContStatSkew(0),
192 fChkStatSkewness(0),
193 fChkStatSkewnessPM(0),
194 fContStatKurt(0),
195 fChkStatKurtosis(0),
4f3934a1 196 fChkStatKurtosisPM(0),
197 fContLabeling(0),
198 fChkLabelTitle(0),
199 fTxtLabelTitle(0),
200 fChkLabelXaxis(0),
201 fTxtLabelXaxis(0),
202 fChkLabelYaxis(0),
203 fTxtLabelYaxis(0),
204 fChkLabelGetAuto(0),
205 fContSave(0),
206 fBtnSave(0),
207 fContAddSaveOpt(0),
208 fChkAddSaveOpt(0),
209 fComboAddSaveOpt(0)
210
39bcd65d 211{
72d0ab7e 212 //
213 // AliTPCCalibViewerGUI constructor; fileName specifies the ROOT tree used for drawing
214 //
39bcd65d 215 SetCleanup(kDeepCleanup);
216
72d0ab7e 217 // *****************************************************************************
39bcd65d 218 // ************************* content of this MainFrame *************************
72d0ab7e 219 // *****************************************************************************
39bcd65d 220 // top level container with horizontal layout
a6d2bd0c 221 fContTopBottom = new TGCompositeFrame(this, w, h, kVerticalFrame | kFixedWidth | kFixedHeight);
222 AddFrame(fContTopBottom, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
223
224 fContLCR = new TGCompositeFrame(fContTopBottom, w, h, kHorizontalFrame | kFixedWidth | kFixedHeight);
225 fContTopBottom->AddFrame(fContLCR, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
226
72d0ab7e 227 // ***********************************************************************
a6d2bd0c 228 // ************************* content of fContLCR *************************
72d0ab7e 229 // ***********************************************************************
39bcd65d 230 // left container
a6d2bd0c 231 fContLeft = new TGCompositeFrame(fContLCR, 200, 200, kVerticalFrame | kFixedWidth | kFitHeight);
232 fContLCR->AddFrame(fContLeft, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandY, 5, 3, 3, 3));
39bcd65d 233
234 // left vertical splitter
a6d2bd0c 235 TGVSplitter *splitLeft = new TGVSplitter(fContLCR);
39bcd65d 236 splitLeft->SetFrame(fContLeft, kTRUE);
a6d2bd0c 237 fContLCR->AddFrame(splitLeft, new TGLayoutHints(kLHintsLeft | kLHintsExpandY, 0, 0, 0, 0));
39bcd65d 238
239 // right container
a6d2bd0c 240 fContRight = new TGCompositeFrame(fContLCR, 150, 200, kVerticalFrame | kFixedWidth | kFitHeight);
241 fContLCR->AddFrame(fContRight, new TGLayoutHints(kLHintsTop | kLHintsRight | kLHintsExpandY, 3, 5, 3, 3));
39bcd65d 242
243 // center container
a6d2bd0c 244 fContCenter = new TGCompositeFrame(fContLCR, 200, 200, kVerticalFrame | kFixedWidth | kFitHeight);
245 fContLCR->AddFrame(fContCenter, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
39bcd65d 246
247 // right vertical splitter
a6d2bd0c 248 TGVSplitter *splitRight = new TGVSplitter(fContLCR);
39bcd65d 249 splitRight->SetFrame(fContRight, kFALSE);
a6d2bd0c 250 fContLCR->AddFrame(splitRight, new TGLayoutHints(kLHintsLeft | kLHintsExpandY, 0, 0, 0, 0));
39bcd65d 251
72d0ab7e 252
253 // ========================================================================
39bcd65d 254 // ************************* content of fContLeft *************************
72d0ab7e 255 // ========================================================================
256 // --- draw button and tabLeft ---
a6d2bd0c 257 // draw button
258 fBtnDraw = new TGTextButton(fContLeft, "&Draw");
259 fContLeft->AddFrame(fBtnDraw, new TGLayoutHints(kLHintsExpandX, 10, 10, 0, 0));
260 //fBtnDraw->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoTest(=\"fBtnDraw clicked\")");
261 fBtnDraw->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoDraw()");
262
4f3934a1 263 // tabs on the left side:
72d0ab7e 264 ftabLeft = new TGTab(fContLeft);
265 fContLeft->AddFrame(ftabLeft, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 8, 0));
266 ftabLeft0 = ftabLeft->AddTab("General");
267 ftabLeft1 = ftabLeft->AddTab("More plot options");
268
a6d2bd0c 269
72d0ab7e 270 // **************************** content of tabLeft0 *******************************
271
272 // draw options container *** fcontDrawOpt *** " Plot options "
273 fContDrawOpt = new TGGroupFrame(ftabLeft0, "Plot options", kVerticalFrame | kFitWidth | kFitHeight);
274 ftabLeft0->AddFrame(fContDrawOpt, new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0));
275 fContDrawOptSub1D2D = new TGCompositeFrame(fContDrawOpt, 200, 23, kHorizontalFrame | kFitWidth | kFixedHeight);
276 fContDrawOpt->AddFrame(fContDrawOptSub1D2D, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
277
278 // ------------------------- content of fContDrawOpt -------------------------
279 // -- radio1D, radio2D, chkAuto
280 // 1D radio button
281 fRadio1D = new TGRadioButton(fContDrawOptSub1D2D, "1D", 30);
282 fContDrawOptSub1D2D->AddFrame(fRadio1D, new TGLayoutHints(kLHintsNormal, 0, 2, 0, 0));
283 fRadio1D->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsGeneral()");
284
285 // 2D radio button
286 fRadio2D = new TGRadioButton(fContDrawOptSub1D2D, "2D", 31);
287 fContDrawOptSub1D2D->AddFrame(fRadio2D, new TGLayoutHints(kLHintsNormal, 2, 2, 0, 0));
288 fRadio2D->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsGeneral()");
289
290 // additional draw options container
291 fContAddDrawOpt = new TGCompositeFrame(fContDrawOpt, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
292 fContDrawOpt->AddFrame(fContAddDrawOpt, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
293
294 // content of --- fContAddDrawOpt ---
295 // addition draw options label
296 fChkAddDrawOpt = new TGCheckButton(fContAddDrawOpt, "Draw options:");
297 //fChkAddDrawOpt->SetTextJustify(kTextLeft);
298 fContAddDrawOpt->AddFrame(fChkAddDrawOpt, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
299 fChkAddDrawOpt->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoNewSelection()");
300
301 // additional draw options combo box
302 fComboAddDrawOpt = new TGComboBox(fContAddDrawOpt);
303 fComboAddDrawOpt->Resize(0, fBtnDraw->GetDefaultHeight());
304 fComboAddDrawOpt->EnableTextInput(kTRUE);
305 fContAddDrawOpt->AddFrame(fComboAddDrawOpt, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
306 fComboAddDrawOpt->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "DoNewSelection()");
307 fComboAddDrawOpt->Connect("Selected(Int_t)", "AliTPCCalibViewerGUI", this, "DoNewSelection()");
308
309 // automatic redraw check button
310 fChkAuto = new TGCheckButton(fContDrawOpt, "auto redraw");
311 fContDrawOpt->AddFrame(fChkAuto, new TGLayoutHints(kLHintsNormal, 0, 2, 0, 0));
312
313
314 // *** predefined radio button *** " Predefined "
315 fRadioPredefined = new TGRadioButton(ftabLeft0, "Predefined: ", 13);
316 ftabLeft0->AddFrame(fRadioPredefined, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
317 fRadioPredefined->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsGeneral()");
318
319 // list of variables
320 fListVariables = new TGListBox(ftabLeft0);
321 ftabLeft0->AddFrame(fListVariables, new TGLayoutHints(kLHintsNormal | kLHintsExpandX | kLHintsExpandY, 10, 0, 0, 0));
322 fListVariables->Connect("Selected(Int_t)", "AliTPCCalibViewerGUI", this, "DoNewSelection()");
a6d2bd0c 323
72d0ab7e 324
325 // normalization options container *** fContPlotOpt ***
326 //fContPlotOpt = new TGCompositeFrame(fContLeft, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
327 fContPlotOpt = new TGGroupFrame(ftabLeft0, "Normalization options", kVerticalFrame | kFitWidth | kFitHeight);
328 ftabLeft0->AddFrame(fContPlotOpt, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10, 0, 0, 0));
329
330 // ------------------------- content of fContPlotOpt -------------------------
331 // raw radio button
332 fRadioRaw = new TGRadioButton(fContPlotOpt, "Raw", 10);
333 fContPlotOpt->AddFrame(fRadioRaw, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
334 fRadioRaw->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsGeneral()");
335
336 // normalized radio button
337 fRadioNormalized = new TGRadioButton(fContPlotOpt, "Normalized", 11);
338 fContPlotOpt->AddFrame(fRadioNormalized, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
339 fRadioNormalized->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsGeneral()");
340
341 // normalized options container *** fContNormalized ***
342 fContNormalized = new TGCompositeFrame(fContPlotOpt, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
343 fContPlotOpt->AddFrame(fContNormalized, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 15, 0, 0, 0));
344
345 // --- content of fContNormalized ---
346 // --- combo box to select 'subtract' or 'divide', list of normalization variables
347 // method drop down combo box
348 fComboMethod = new TGComboBox(fContNormalized);
349 fComboMethod->Resize(0, fBtnDraw->GetDefaultHeight());
350 fContNormalized->AddFrame(fComboMethod, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
351 fComboMethod->Connect("Selected(Int_t)", "AliTPCCalibViewerGUI", this, "DoNewSelection()");
352
353 // list of normalization variables
354 fListNormalization = new TGListBox(fContNormalized);
355 fContNormalized->AddFrame(fListNormalization, new TGLayoutHints(kLHintsNormal | kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
356 fListNormalization->Connect("Selected(Int_t)", "AliTPCCalibViewerGUI", this, "DoNewSelection()");
39bcd65d 357
72d0ab7e 358 // custom radio button
359 fRadioCustom = new TGRadioButton(ftabLeft0, "Custom: ", 12);
360 ftabLeft0->AddFrame(fRadioCustom, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
361 fRadioCustom->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsGeneral()");
4f3934a1 362 // custom options container is located further down
72d0ab7e 363
364 // **************************** content of tabLeft1 *******************************
365
366 // draw options container *** fcontDrawOpt1D *** " Plot options "
367 fContDrawOpt1D = new TGGroupFrame(ftabLeft1, "1D Plot options", kVerticalFrame | kFitWidth | kFitHeight);
368 ftabLeft1->AddFrame(fContDrawOpt1D, new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0));
369
370 fcontDrawOpt1DSubLR = new TGCompositeFrame(fContDrawOpt1D, 1, 1, kVerticalFrame | kFitWidth | kFitHeight);
371 fContDrawOpt1D->AddFrame(fcontDrawOpt1DSubLR, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
372
373 // ***** content of fContDrawOpt1DSubLR *****
374 fContDrawOpt1DSubNSC = new TGCompositeFrame(fcontDrawOpt1DSubLR, 200, 23, kVerticalFrame | kFitWidth | kFitHeight);
375 fcontDrawOpt1DSubLR->AddFrame(fContDrawOpt1DSubNSC, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
376
377 // --------------------------- content of fContDrawOpt1DSubNSC -----------------
378 fRadioNorm = new TGRadioButton(fContDrawOpt1DSubNSC, "Normal", 110);
379 fContDrawOpt1DSubNSC->AddFrame(fRadioNorm, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
380 fRadioNorm->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtons1D()");
381
382 fRadioSigma = new TGRadioButton(fContDrawOpt1DSubNSC, "Sigma", 111);
383 fContDrawOpt1DSubNSC->AddFrame(fRadioSigma, new TGLayoutHints(kLHintsNormal, 0, 0, 5, 0));
384 fRadioSigma->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtons1D()");
385
386 fTxtSigmas = new TGTextEntry(fContDrawOpt1DSubNSC, "2; 4; 6", 111);
387 fContDrawOpt1DSubNSC->AddFrame(fTxtSigmas, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 10, 15, 0, 0));
388 fTxtSigmas->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtons1D(=111)");
389
390 fContCumuLR = new TGCompositeFrame(fContDrawOpt1DSubNSC, 200, 23, kHorizontalFrame | kFitWidth | kFitHeight);
391 fContDrawOpt1DSubNSC->AddFrame(fContCumuLR, new TGLayoutHints(kLHintsExpandX, 0, 0, 5, 0));
392
393 fContCumLeft = new TGCompositeFrame(fContCumuLR, 200, 23, kVerticalFrame | kFitWidth | kFitHeight);
394 fContCumuLR->AddFrame(fContCumLeft, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
395
396 fRadioCumulative = new TGRadioButton(fContCumLeft, "Cumulative", 112);
397 fContCumLeft->AddFrame(fRadioCumulative, new TGLayoutHints(kLHintsNormal, 0, 10, 0, 0));
398 fRadioCumulative->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtons1D()");
399
400 fCheckCumulativePM = new TGCheckButton(fContCumLeft, "Plus/Minus");
401 fContCumLeft->AddFrame(fCheckCumulativePM, new TGLayoutHints(kLHintsNormal, 10, 15, 0, 0));
402 fCheckCumulativePM->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtons1D()");
403
404 fRadioIntegrate = new TGRadioButton(fContCumLeft, "Integrate", 113);
405 fContCumLeft->AddFrame(fRadioIntegrate, new TGLayoutHints(kLHintsNormal, 0, 0, 5, 0));
406 fRadioIntegrate->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtons1D()");
407
408 fContCumRight = new TGCompositeFrame(fContCumuLR, 200, 23, kVerticalFrame | kFitWidth | kFitHeight);
409 fContCumuLR->AddFrame(fContCumRight, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
410
411 fLblSigmaMax = new TGLabel(fContCumRight, "SigmaMax:");
412 fLblSigmaMax->SetTextJustify(kTextLeft);
413 fContCumRight->AddFrame(fLblSigmaMax, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 5, 0, 0, 0));
414
415 fTxtSigmaMax = new TGTextEntry(fContCumRight, "5", 112);
416 fContCumRight->AddFrame(fTxtSigmaMax, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 10, 15, 0, 0));
417 fTxtSigmaMax->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtons1D(=112)");
418
419
420 fContDrawOpt1DSubMML = new TGCompositeFrame(fcontDrawOpt1DSubLR, 200, 23, kHorizontalFrame | kFitWidth | kFitHeight);
421 fcontDrawOpt1DSubLR->AddFrame(fContDrawOpt1DSubMML, new TGLayoutHints(kLHintsExpandX, 0, 0, 5, 0));
422
423 // -------------- content of fcontDrawOpt1DSubLR
424 fChkMean = new TGCheckButton(fContDrawOpt1DSubMML, "Mean");
425 fContDrawOpt1DSubMML->AddFrame(fChkMean, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
426 fChkMean->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtons1D()");
427
428 fChkMedian = new TGCheckButton(fContDrawOpt1DSubMML, "Median");
429 fContDrawOpt1DSubMML->AddFrame(fChkMedian, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
430 fChkMedian->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtons1D()");
431
432 fChkLTM = new TGCheckButton(fContDrawOpt1DSubMML, "LTM");
433 fContDrawOpt1DSubMML->AddFrame(fChkLTM, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
434 fChkLTM->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtons1D()");
435
436
437 // statistic options container *** fcontStatOpt1D *** " Statistic options "
438 fContStatOpt = new TGGroupFrame(ftabLeft1, "Statistic options", kVerticalFrame | kFitWidth | kFitHeight);
439 ftabLeft1->AddFrame(fContStatOpt, new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0));
440
441 fChkStatName = new TGCheckButton(fContStatOpt, "Name");
442 fContStatOpt->AddFrame(fChkStatName, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
443 fChkStatName->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
444
445 fChkStatEntries = new TGCheckButton(fContStatOpt, "Entries");
446 fContStatOpt->AddFrame(fChkStatEntries, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
447 fChkStatEntries->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
448
449 fContStatMean = new TGCompositeFrame(fContStatOpt, 1, 1, kHorizontalFrame | kFitWidth | kFitHeight);
450 fContStatOpt->AddFrame(fContStatMean, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
451
452 fChkStatMean = new TGCheckButton(fContStatMean, "Mean");
453 fContStatMean->AddFrame(fChkStatMean, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
454 fChkStatMean->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
455
456 fChkStatMeanPM = new TGCheckButton(fContStatMean, "+- Error");
457 fContStatMean->AddFrame(fChkStatMeanPM, new TGLayoutHints(kLHintsNormal, 10, 0, 0, 0));
458 fChkStatMeanPM->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
a6d2bd0c 459
72d0ab7e 460 fContStatRMS = new TGCompositeFrame(fContStatOpt, 1, 1, kHorizontalFrame | kFitWidth | kFitHeight);
461 fContStatOpt->AddFrame(fContStatRMS, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
462
463 fChkStatRMS = new TGCheckButton(fContStatRMS, "RMS");
464 fContStatRMS->AddFrame(fChkStatRMS, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
465 fChkStatRMS->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
466
467 fChkStatRMSPM = new TGCheckButton(fContStatRMS, "+- Error");
468 fContStatRMS->AddFrame(fChkStatRMSPM, new TGLayoutHints(kLHintsNormal, 10, 0, 0, 0));
469 fChkStatRMSPM->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
a6d2bd0c 470
72d0ab7e 471 fChkStatUnderflow = new TGCheckButton(fContStatOpt, "Underflow");
472 fContStatOpt->AddFrame(fChkStatUnderflow, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
473 fChkStatUnderflow->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
474
475 fChkStatOverflow = new TGCheckButton(fContStatOpt, "Overflow");
476 fContStatOpt->AddFrame(fChkStatOverflow, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
477 fChkStatOverflow->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
478
479 fChkStatIntegral = new TGCheckButton(fContStatOpt, "Integral");
480 fContStatOpt->AddFrame(fChkStatIntegral, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
481 fChkStatIntegral->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
482
483 fContStatSkew = new TGCompositeFrame(fContStatOpt, 1, 1, kHorizontalFrame | kFitWidth | kFitHeight);
484 fContStatOpt->AddFrame(fContStatSkew, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
485
486 fChkStatSkewness = new TGCheckButton(fContStatSkew, "Skewness");
487 fContStatSkew->AddFrame(fChkStatSkewness, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
488 fChkStatSkewness->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
489
490 fChkStatSkewnessPM = new TGCheckButton(fContStatSkew, "+- Error");
491 fContStatSkew->AddFrame(fChkStatSkewnessPM, new TGLayoutHints(kLHintsNormal, 10, 0, 0, 0));
492 fChkStatSkewnessPM->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
493
494 fContStatKurt = new TGCompositeFrame(fContStatOpt, 1, 1, kHorizontalFrame | kFitWidth | kFitHeight);
495 fContStatOpt->AddFrame(fContStatKurt, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
496
497 fChkStatKurtosis = new TGCheckButton(fContStatKurt, "Kurtosis");
498 fContStatKurt->AddFrame(fChkStatKurtosis, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
499 fChkStatKurtosis->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
500
501 fChkStatKurtosisPM = new TGCheckButton(fContStatKurt, "+- Error");
502 fContStatKurt->AddFrame(fChkStatKurtosisPM, new TGLayoutHints(kLHintsNormal, 10, 0, 0, 0));
503 fChkStatKurtosisPM->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()");
504
4f3934a1 505
506 // custom options container
507 // --- fComboCustom --- the custom draw line on the very low
508 fContCustom = new TGCompositeFrame(fContTopBottom, 200, 200, kHorizontalFrame | kFitWidth | kFitHeight);
509 fContTopBottom->AddFrame(fContCustom, new TGLayoutHints(kLHintsExpandX, 10, 0, 0, 0));
510
511 // ------------------------- content of fContCustom -------------------------
512 fLblCustomDraw = new TGLabel(fContCustom, "Custom Draw: ");
513 fLblCustomDraw->SetTextJustify(kTextLeft);
514 fContCustom->AddFrame(fLblCustomDraw, new TGLayoutHints(kLHintsNormal, 5, 0, 0, 0));
515 // text field for custom draw command
516 fComboCustom = new TGComboBox(fContCustom);
517 fComboCustom->Resize(0, fBtnDraw->GetDefaultHeight());
518 fComboCustom->EnableTextInput(kTRUE);
519 fContCustom->AddFrame(fComboCustom, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
520 fComboCustom->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsGeneral(=42)");
521 fComboCustom->Connect("Selected(Int_t)", "AliTPCCalibViewerGUI", this, "DoNewSelection()");
522
523
524 // additional cuts container
525 fContAddCuts = new TGCompositeFrame(fContTopBottom, 200, 200, kHorizontalFrame | kFitWidth | kFitHeight);
526 fContTopBottom->AddFrame(fContAddCuts, new TGLayoutHints(kLHintsExpandX, 10, 0, 0, 0));
527
528 // ------------------------- content of fContAddCuts -------------------------
529 fLblAddCuts = new TGLabel(fContAddCuts, "Custom Cuts: ");
530 fLblAddCuts->SetTextJustify(kTextLeft);
531 fContAddCuts->AddFrame(fLblAddCuts, new TGLayoutHints(kLHintsNormal, 5, 0, 0, 0));
532 // combo text field for additional cuts
533 fComboAddCuts = new TGComboBox(fContAddCuts);
534 fComboAddCuts->Resize(0, fBtnDraw->GetDefaultHeight());
535 fComboAddCuts->EnableTextInput(kTRUE);
536 fContAddCuts->AddFrame(fComboAddCuts, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
537 fComboAddCuts->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsRight(=31)");
538 fComboAddCuts->Connect("Selected(Int_t)", "AliTPCCalibViewerGUI", this, "DoNewSelection()");
72d0ab7e 539
540
541
542 // ==========================================================================
543 // ************************* content of fContCenter *************************
544 // ========================================================================
545 // main drawing canvas
546 fCanvMain = new TRootEmbeddedCanvas("Main Canvas", fContCenter, 200, 200, kFitWidth | kFitHeight);
547 fContCenter->AddFrame(fCanvMain, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
548
549
550
551
552 // =========================================================================
39bcd65d 553 // ************************* content of fContRight *************************
72d0ab7e 554 // ========================================================================
72d0ab7e 555
4f3934a1 556 // tabs on the right side:
557 ftabRight = new TGTab(fContRight);
558 fContRight->AddFrame(ftabRight, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 8, 0));
559 fTabRight0 = ftabRight->AddTab("Basic");
560 fTabRight1 = ftabRight->AddTab("Advanced");
561
72d0ab7e 562
4f3934a1 563 // **************************** content of tabLeft0 *******************************
564 // cut options container
565 fContCuts = new TGGroupFrame(fTabRight0, "Cuts", kVerticalFrame | kFitWidth | kFitHeight);
566 fTabRight0->AddFrame(fContCuts, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
72d0ab7e 567
72d0ab7e 568
4f3934a1 569 // ************************* content of fContCuts *************************
570 // TPC radio button
571 fRadioTPC = new TGRadioButton(fContCuts, "whole TPC", 20);
572 fContCuts->AddFrame(fRadioTPC, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
573 fRadioTPC->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsRight()");
72d0ab7e 574
4f3934a1 575 // side A radio button
576 fRadioSideA = new TGRadioButton(fContCuts, "side A", 21);
577 fContCuts->AddFrame(fRadioSideA, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
578 fRadioSideA->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsRight()");
72d0ab7e 579
4f3934a1 580 // side C radio button
581 fRadioSideC = new TGRadioButton(fContCuts, "side C", 22);
582 fContCuts->AddFrame(fRadioSideC, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
583 fRadioSideC->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsRight()");
72d0ab7e 584
4f3934a1 585 // sector radio button
586 fRadioSector = new TGRadioButton(fContCuts, "sector", 23);
587 fContCuts->AddFrame(fRadioSector, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
588 fRadioSector->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsRight()");
72d0ab7e 589
4f3934a1 590 // sector options container
591 fContSector = new TGCompositeFrame(fContCuts, 200, 200, kHorizontalFrame | kFitWidth | kFitHeight);
592 fContCuts->AddFrame(fContSector, new TGLayoutHints(kLHintsExpandX, 5, 0, 0, 0));
72d0ab7e 593
4f3934a1 594 // ------------------------- content of fContSector -------------------------
595 // sector number entry
596 fNmbSector = new TGNumberEntry(fContSector, 0, 1, -1, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, 71);
597 fContSector->AddFrame(fNmbSector, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
598 fNmbSector->Connect("ValueSet(Long_t)", "AliTPCCalibViewerGUI", this, "ChangeSector()");
599
600 // sector number label
601 fLblSector = new TGLabel(fContSector, "IROC, A");
602 fLblSector->SetTextJustify(kTextLeft);
603 fContSector->AddFrame(fLblSector, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 5, 0, 0, 0));
604
605 // cut zeros check button
606 fChkCutZero = new TGCheckButton(fContCuts, "Cut zeros");
607 fContCuts->AddFrame(fChkCutZero, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
608 fChkCutZero->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoNewSelection()");
72d0ab7e 609
4f3934a1 610 // additional cuts check button
611 fChkAddCuts = new TGCheckButton(fContCuts, "Custom cuts");
612 fContCuts->AddFrame(fChkAddCuts, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
613 fChkAddCuts->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoNewSelection()");
614 // fContAddCuts' content is locaed further op
72d0ab7e 615
72d0ab7e 616
4f3934a1 617 // Scaling options container
618 fContScaling = new TGGroupFrame(fTabRight0, "Scaling", kVerticalFrame | kFitWidth | kFitHeight);
619 fTabRight0->AddFrame(fContScaling, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
39bcd65d 620
4f3934a1 621 // ************************* content of fContScaling *************************
622 // SetMaximum container
623 fContSetMax = new TGCompositeFrame(fContScaling, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
624 fContScaling->AddFrame(fContSetMax, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
625
626 // ------------------------- content of fContSetMax -------------------------
627 // SetMaximum - checkbox
628 fChkSetMax = new TGCheckButton(fContSetMax, "Set fixed max.");
629 fContSetMax->AddFrame(fChkSetMax, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
630 fChkSetMax->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsRight()");
631
632 // text field for maximum value
633 fTxtSetMax = new TGTextEntry(fContSetMax, "", 41);
634 fContSetMax->AddFrame(fTxtSetMax, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
635 fTxtSetMax->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsRight()");
636
637 // SetMinimum container
638 fContSetMin = new TGCompositeFrame(fContScaling, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
639 fContScaling->AddFrame(fContSetMin, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
640
641 // ------------------------- content of fContSetMin -------------------------
642 // SetMinimum - checkbox
643 fChkSetMin = new TGCheckButton(fContSetMin, "Set fixed min.");
644 fContSetMin->AddFrame(fChkSetMin, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
645 fChkSetMin->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoNewSelection()");
646
647 // text field for minimum value
648 fTxtSetMin = new TGTextEntry(fContSetMin, "", 40);
649 fContSetMin->AddFrame(fTxtSetMin, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
650 fTxtSetMin->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsRight()");
651
652 // get Min & Max from Plot - button
653 fBtnGetMinMax = new TGTextButton(fContScaling, "&Get scale from plot");
654 fContScaling->AddFrame(fBtnGetMinMax, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
655 fBtnGetMinMax->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "GetMinMax()");
656
657 // GetMinMaxAuto - checkbox
658 fChkGetMinMaxAuto = new TGCheckButton(fContScaling, "Get Min + Max auto.");
659 fContScaling->AddFrame(fChkGetMinMaxAuto, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
660 fChkGetMinMaxAuto->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoNewSelection()");
661
662 // labeling container *** fContLabeling *** " Labeling "
663 fContLabeling = new TGGroupFrame(fTabRight0, "Labeling", kVerticalFrame | kFitWidth | kFitHeight);
664 fTabRight0->AddFrame(fContLabeling, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
665
666 fChkLabelTitle = new TGCheckButton(fContLabeling, "Set title:");
667 fContLabeling->AddFrame(fChkLabelTitle, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
668 fChkLabelTitle->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsRight()");
669
670 fTxtLabelTitle = new TGTextEntry(fContLabeling, "Title", 500);
671 fContLabeling->AddFrame(fTxtLabelTitle, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
672 fTxtLabelTitle->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsRight(=50)");
673
674 fChkLabelXaxis = new TGCheckButton(fContLabeling, "Set X-axis label:");
675 fContLabeling->AddFrame(fChkLabelXaxis, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
676 fChkLabelXaxis->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsRight()");
677
678 fTxtLabelXaxis = new TGTextEntry(fContLabeling, "XaxisLabel", 500);
679 fContLabeling->AddFrame(fTxtLabelXaxis, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
680 fTxtLabelXaxis->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsRight(=51)");
681
682 fChkLabelYaxis = new TGCheckButton(fContLabeling, "Set Y-axis label:");
683 fContLabeling->AddFrame(fChkLabelYaxis, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
684 fChkLabelYaxis->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsRight()");
685
686 fTxtLabelYaxis = new TGTextEntry(fContLabeling, "YaxisLabel", 500);
687 fContLabeling->AddFrame(fTxtLabelYaxis, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
688 fTxtLabelYaxis->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsRight(=52)");
689
690 fChkLabelGetAuto = new TGCheckButton(fContLabeling, "Get labels auto.");
691 fContLabeling->AddFrame(fChkLabelGetAuto, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
692 fChkLabelGetAuto->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsRight()");
693
72d0ab7e 694
4f3934a1 695 // **************************** content of ftabLeft1 *******************************
696 // Save container
697 fContSave = new TGGroupFrame(fTabRight1, "Save", kVerticalFrame | kFitWidth | kFitHeight);
698 fTabRight1->AddFrame(fContSave, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
699 // save button
700 fBtnSave = new TGTextButton(fContSave, "&Save picute");
701 fContSave->AddFrame(fBtnSave, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
702 fBtnSave->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "SavePicture()");
703
704 // additional save options container
705 fContAddSaveOpt = new TGCompositeFrame(fContSave, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
706 fContSave->AddFrame(fContAddSaveOpt, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
72d0ab7e 707
4f3934a1 708 // content of --- fContAddSaveOpt ---
709 // addition save options label
710 fChkAddSaveOpt = new TGCheckButton(fContAddSaveOpt, "Save options:");
711 fContAddSaveOpt->AddFrame(fChkAddSaveOpt, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
712 fChkAddSaveOpt->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoNewSelection()");
713
714 // additional save options combo box
715 fComboAddSaveOpt = new TGComboBox(fContAddSaveOpt);
716 fContAddSaveOpt->AddFrame(fComboAddSaveOpt, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
717 fComboAddSaveOpt->Resize(0, fBtnDraw->GetDefaultHeight());
718 fComboAddSaveOpt->EnableTextInput(kTRUE);
719 fComboAddSaveOpt->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "SavePicture()");
720 // fComboAddSaveOpt->Connect("Selected(Int_t)", "AliTPCCalibViewerGUI", this, "SavePicture()");
721
722 // Fit options container
723 fContFit = new TGGroupFrame(fTabRight1, "Custom Fit", kVerticalFrame | kFitWidth | kFitHeight);
724 fTabRight1->AddFrame(fContFit, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
725
726 // ------------------------- content of fContFit -------------------------
727 // container for additional fits
728 fContAddFit = new TGCompositeFrame(fContFit, 200, 200, kVerticalFrame | kFitWidth | kFitHeight);
729 fContFit->AddFrame(fContAddFit, new TGLayoutHints(kLHintsExpandX, -5, -5, 0, 0));
730
731 // --- content of fContAddFit ---
732 // text field for custom fit
733 fComboCustomFit = new TGComboBox(fContAddFit);
734 fComboCustomFit->Resize(0, fBtnDraw->GetDefaultHeight());
735 fComboCustomFit->EnableTextInput(kTRUE);
736 fContAddFit->AddFrame(fComboCustomFit, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
737 fComboCustomFit->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "DoFit()");
738 fComboCustomFit->Connect("Selected(Int_t)", "AliTPCCalibViewerGUI", this, "DoFit()");
72d0ab7e 739
4f3934a1 740 // fit button
741 fBtnFit = new TGTextButton(fContAddFit, "&Fit");
742 fContAddFit->AddFrame(fBtnFit, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
743 fBtnFit->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoFit()");
744
745 // add fit function button
746 //fBtnAddFitFunction = new TGTextButton(fContAddFit, "&Add fit function to normalization");
747 //fContAddFit->AddFrame(fBtnAddFitFunction, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
748 //fBtnAddFitFunction->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "AddFitFunction()");
749
750
72d0ab7e 751 // set default button states
752 fRadioPredefined->SetState(kButtonDown);
753 fRadioRaw->SetState(kButtonDown);
754 fRadioTPC->SetState(kButtonDown);
755 fRadio1D->SetState(kButtonDown);
756 fChkAuto->SetState(kButtonDown);
757 fChkAddCuts->SetState(kButtonUp);
758 fChkGetMinMaxAuto->SetState(kButtonDown);
759 fChkSetMin->SetState(kButtonUp);
760 fChkSetMax->SetState(kButtonUp);
761 fRadioNorm->SetState(kButtonDown);
762 fRadioSigma->SetState(kButtonUp);
763 fRadioCumulative->SetState(kButtonUp);
764 fChkMean->SetState(kButtonDown);
765 fCheckCumulativePM->SetState(kButtonUp);
766
767 fChkStatName->SetState(kButtonDown);
768 fChkStatEntries->SetState(kButtonDown);
769 fChkStatMean->SetState(kButtonDown);
770 fChkStatRMS->SetState(kButtonDown);
4f3934a1 771
772 fChkLabelGetAuto->SetState(kButtonDown);
773
774
72d0ab7e 775// fChkStatMeanPM->SetState(kButtonUp);
776// fChkStatRMSPM->SetState(kButtonUp);
777// fChkStatUnderflow->SetState(kButtonUp);
778// fChkStatOverflow->SetState(kButtonUp);
779// fChkStatIntegral->SetState(kButtonUp);
780// fChkStatSkewness->SetState(kButtonUp);
781// fChkStatSkewnessPM->SetState(kButtonUp);
782// fChkStatKurtosis->SetState(kButtonUp);
783// fChkStatKurtosisPM->SetState(kButtonUp);
784
785 // ======================================================================
786 // ************************* Display everything *************************
787 // ======================================================================
39bcd65d 788
72d0ab7e 789 if (fileName) Initialize(fileName);
39bcd65d 790 SetWindowName("AliTPCCalibViewer GUI");
791 MapSubwindows();
792 Resize(GetDefaultSize());
793 MapWindow();
794}
795
796AliTPCCalibViewerGUI::AliTPCCalibViewerGUI(const AliTPCCalibViewerGUI &c)
a6d2bd0c 797 : TGCompositeFrame(c.fParent, c.fWidth, c.fHeight),
39bcd65d 798 fViewer(0),
a6d2bd0c 799 fContTopBottom(0),
800 fContLCR(0),
39bcd65d 801 fContLeft(0),
72d0ab7e 802 ftabLeft(0),
803 ftabLeft0(0),
804 ftabLeft1(0),
4f3934a1 805 ftabRight(0),
806 fTabRight0(0),
807 fTabRight1(0),
39bcd65d 808 fContRight(0),
809 fContCenter(0),
810 fContPlotOpt(0),
811 fContDrawOpt(0),
a6d2bd0c 812 fContDrawOptSub1D2D(0),
39bcd65d 813 fContNormalized(0),
814 fContCustom(0),
815 fContCuts(0),
816 fContSector(0),
817 fContAddCuts(0),
a6d2bd0c 818 fContFit(0),
819 fContAddFit(0),
820 fContScaling(0),
821 fContSetMax(0),
822 fContSetMin(0),
72d0ab7e 823 fContAddDrawOpt(0),
39bcd65d 824 fListVariables(0),
825 fBtnDraw(0),
a6d2bd0c 826 fBtnFit(0),
827 fBtnAddFitFunction(0),
828 fBtnGetMinMax(0),
39bcd65d 829 fCanvMain(0),
830 fRadioRaw(0),
831 fRadioNormalized(0),
a6d2bd0c 832 fRadioPredefined(0),
39bcd65d 833 fRadioCustom(0),
834 fRadio1D(0),
835 fRadio2D(0),
836 fRadioTPC(0),
837 fRadioSideA(0),
838 fRadioSideC(0),
839 fRadioSector(0),
72d0ab7e 840 fComboAddDrawOpt(0),
39bcd65d 841 fChkAuto(0),
842 fComboMethod(0),
843 fListNormalization(0),
a6d2bd0c 844 fComboCustom(0),
4f3934a1 845 fLblCustomDraw(0),
72d0ab7e 846 fChkAddDrawOpt(0),
39bcd65d 847 fNmbSector(0),
a6d2bd0c 848 fLblSector(0),
72d0ab7e 849 fChkCutZero(0),
39bcd65d 850 fChkAddCuts(0),
4f3934a1 851 fLblAddCuts(0),
a6d2bd0c 852 fComboAddCuts(0),
853 fComboCustomFit(0),
854 fChkSetMax(0),
855 fChkSetMin(0),
856 fChkGetMinMaxAuto(0),
857 fTxtSetMax(0),
72d0ab7e 858 fTxtSetMin(0),
859 fContDrawOpt1D(0),
860 fcontDrawOpt1DSubLR(0),
861 fContDrawOpt1DSubNSC(0),
862 fRadioNorm(0),
863 fRadioSigma(0),
864 fTxtSigmas(0),
865 fContCumuLR(0),
866 fContCumLeft(0),
867 fContCumRight(0),
868 fLblSigmaMax(0),
869 fTxtSigmaMax(0),
870 fRadioCumulative(0),
871 fCheckCumulativePM(0),
872 fRadioIntegrate(0),
873 fContDrawOpt1DSubMML(0),
874 fChkMean(0),
875 fChkMedian(0),
876 fChkLTM(0),
877 fContStatOpt(0),
878 fChkStatName(0),
879 fChkStatEntries(0),
880 fContStatMean(0),
881 fChkStatMean(0),
882 fChkStatMeanPM(0),
883 fContStatRMS(0),
884 fChkStatRMS(0),
885 fChkStatRMSPM(0),
886 fChkStatUnderflow(0),
887 fChkStatOverflow(0),
888 fChkStatIntegral(0),
889 fContStatSkew(0),
890 fChkStatSkewness(0),
891 fChkStatSkewnessPM(0),
892 fContStatKurt(0),
893 fChkStatKurtosis(0),
4f3934a1 894 fChkStatKurtosisPM(0),
895 fContLabeling(0),
896 fChkLabelTitle(0),
897 fTxtLabelTitle(0),
898 fChkLabelXaxis(0),
899 fTxtLabelXaxis(0),
900 fChkLabelYaxis(0),
901 fTxtLabelYaxis(0),
902 fChkLabelGetAuto(0),
903 fContSave(0),
904 fBtnSave(0),
905 fContAddSaveOpt(0),
906 fChkAddSaveOpt(0),
907 fComboAddSaveOpt(0)
908
909
39bcd65d 910{
911 //
912 // dummy AliTPCCalibViewerGUI copy constructor
913 //
914}
915
916AliTPCCalibViewerGUI & AliTPCCalibViewerGUI::operator =(const AliTPCCalibViewerGUI & param) {
917 //
918 // dummy assignment operator
919 //
920 return (*this);
921}
922
923AliTPCCalibViewerGUI::~AliTPCCalibViewerGUI() {
72d0ab7e 924 //
925 // Destructor
926 //
a6d2bd0c 927 if (fCanvMain && fCanvMain->GetCanvas()) {
928 for (Int_t i = 0; i < fCanvMain->GetCanvas()->GetListOfPrimitives()->GetEntries(); i++) {
929 if (strcmp(fCanvMain->GetCanvas()->GetListOfPrimitives()->At(i)->ClassName(), "TFrame") != 0)
930 fCanvMain->GetCanvas()->GetListOfPrimitives()->At(i)->Delete();
931 }
932 }
39bcd65d 933 Cleanup();
a6d2bd0c 934 if (fViewer) fViewer->Delete();
39bcd65d 935}
936
a6d2bd0c 937/*
39bcd65d 938void AliTPCCalibViewerGUI::CloseWindow() {
939 DeleteWindow();
940}
a6d2bd0c 941*/
39bcd65d 942
943void AliTPCCalibViewerGUI::Initialize(char* fileName) {
944 //
945 // initializes the GUI with default settings and opens tree for drawing
946 //
947
948 // create AliTPCCalibViewer object, which will be used for generating all drawings
a6d2bd0c 949 if (fViewer) delete fViewer;
39bcd65d 950 fViewer = new AliTPCCalibViewer(fileName);
951
952 // fill fListVariables
953 TObjArray* arr = fViewer->GetListOfVariables();
954 TIterator* iter = arr->MakeIterator();
955 iter->Reset();
956 TObjString* currentStr = 0;
957 Int_t id = 0;
a6d2bd0c 958 while ((currentStr = (TObjString*)(iter->Next()))) {
39bcd65d 959 fListVariables->AddEntry(currentStr->GetString().Data(), id);
960 id++;
961 }
962 delete iter;
963 arr->Delete();
964 delete arr;
965
966 // fill fComboMethod
967 fComboMethod->AddEntry("subtract", 0);
968 fComboMethod->AddEntry("divide by", 1);
969
970 // fill fListNorm
971 arr = fViewer->GetListOfNormalizationVariables();
972 iter = arr->MakeIterator();
973 iter->Reset();
974 currentStr = 0;
975 id = 0;
a6d2bd0c 976 while ((currentStr = (TObjString*)(iter->Next()))) {
39bcd65d 977 fListNormalization->AddEntry(currentStr->GetString().Data(), id);
978 id++;
979 }
980 delete iter;
981 arr->Delete();
982 delete arr;
983
72d0ab7e 984 // fill fComboAddDrawOpt with some additional drawing options
985 fComboAddDrawOpt->AddEntry("profbox", 0);
986 fComboAddDrawOpt->AddEntry("profcolz", 1);
987 fComboAddDrawOpt->AddEntry("profcont0", 2);
988 fComboAddDrawOpt->AddEntry("proflego", 3);
989 fComboAddDrawOpt->AddEntry("proflego2", 4);
990 fComboAddDrawOpt->AddEntry("profsurf", 5);
991 fComboAddDrawOpt->AddEntry("profsurf1", 6);
992 fComboAddDrawOpt->AddEntry("profsurf2", 7);
993 fComboAddDrawOpt->AddEntry("box", 8);
994 fComboAddDrawOpt->AddEntry("colz", 9);
995 fComboAddDrawOpt->AddEntry("cont0", 10);
996 fComboAddDrawOpt->AddEntry("lego", 11);
997 fComboAddDrawOpt->AddEntry("lego2", 12);
998 fComboAddDrawOpt->AddEntry("surf", 13);
999 fComboAddDrawOpt->AddEntry("surf1", 14);
1000 fComboAddDrawOpt->AddEntry("surf2", 15);
1001
4f3934a1 1002 // fill fComboAddSaveOpt with some additional drawing options
1003 fComboAddSaveOpt->AddEntry("Portrait", 0);
1004 fComboAddSaveOpt->AddEntry("Landscape", 1);
1005 fComboAddSaveOpt->AddEntry("Preview", 2);
1006 fComboAddSaveOpt->AddEntry("+50", 3);
72d0ab7e 1007
39bcd65d 1008 fListVariables->Select(0);
1009 fListNormalization->Select(0);
1010 fComboMethod->Select(0);
a6d2bd0c 1011
1012 //fCanvMain->GetCanvas()->ToggleEventStatus(); // klappt nicht
1013 //fCanvMain->GetCanvas()->GetCanvasImp()->ShowStatusBar(kTRUE); // klappt auch nicht
1014 fListVariables->IntegralHeight(kFALSE); // naja
1015 fListNormalization->IntegralHeight(kFALSE); // naja
1016 DoDraw();
39bcd65d 1017}
1018
72d0ab7e 1019
1020
1021void AliTPCCalibViewerGUI::HandleButtonsGeneral(Int_t id) {
39bcd65d 1022 //
1023 // handles mutual radio button exclusions
72d0ab7e 1024 // for general Tab
39bcd65d 1025 //
1026 if (id == -1) {
1027 TGButton *btn = (TGButton *) gTQSender;
1028 id = btn->WidgetId();
1029 }
a6d2bd0c 1030
39bcd65d 1031 switch (id) {
1032 case 10: // fRadioRaw
1033 fRadioNormalized->SetState(kButtonUp);
a6d2bd0c 1034 fRadioPredefined->SetState(kButtonDown);
39bcd65d 1035 fRadioCustom->SetState(kButtonUp);
72d0ab7e 1036 // fComboMethod->UnmapWindow();
1037 // fListNormalization->UnmapWindow();
39bcd65d 1038 break;
1039 case 11: // fRadioNormalized
1040 fRadioRaw->SetState(kButtonUp);
a6d2bd0c 1041 fRadioPredefined->SetState(kButtonDown);
39bcd65d 1042 fRadioCustom->SetState(kButtonUp);
1043 break;
1044 case 12: // fRadioCustom
a6d2bd0c 1045 fRadioPredefined->SetState(kButtonUp);
72d0ab7e 1046 // fComboCustom->SetEnabled(kFALSE);
1047 // fRadioNormalized->SetState(kButtonUp);
1048 break;
1049 case 42: // fComboCustom
1050 fRadioCustom->SetState(kButtonDown);
1051 fRadioPredefined->SetState(kButtonUp);
a6d2bd0c 1052 break;
1053 case 13: // fRadioPredefined
1054 fRadioCustom->SetState(kButtonUp);
72d0ab7e 1055 // fComboCustom->SetEnabled(kTRUE);
1056 //f RadioNormalized->SetState(kButtonUp);
39bcd65d 1057 break;
1058 //--------
72d0ab7e 1059 case 30: // fRadio1D
1060 fRadio2D->SetState(kButtonUp);
1061 break;
1062 case 31: // fRadio2D
1063 fRadio1D->SetState(kButtonUp);
1064 break;
1065 }
1066 DoNewSelection();
1067}
1068
1069
1070void AliTPCCalibViewerGUI::HandleButtons1D(Int_t id) {
1071 //
1072 // handles mutual radio button exclusions
1073 // 1D-Tab buttons
1074 //
1075
1076 if (id == -1) {
1077 TGButton *btn = (TGButton *) gTQSender;
1078 id = btn->WidgetId();
1079 }
1080 switch (id) {
1081 case 110: // 1D draw normal
1082 fRadioNorm->SetState(kButtonDown);
1083 fRadioSigma->SetState(kButtonUp);
1084 fRadioCumulative->SetState(kButtonUp);
1085 fRadioIntegrate->SetState(kButtonUp);
1086 break;
1087 case 111: // 1D draw sigma
1088 fRadioNorm->SetState(kButtonUp);
1089 fRadioSigma->SetState(kButtonDown);
1090 fRadioCumulative->SetState(kButtonUp);
1091 fRadioIntegrate->SetState(kButtonUp);
1092 break;
1093 case 112: // 1D draw cumulative
1094 fRadioNorm->SetState(kButtonUp);
1095 fRadioSigma->SetState(kButtonUp);
1096 fRadioCumulative->SetState(kButtonDown);
1097 fRadioIntegrate->SetState(kButtonUp);
1098 break;
1099 case 113: // 1D draw integral
1100 fRadioNorm->SetState(kButtonUp);
1101 fRadioSigma->SetState(kButtonUp);
1102 fRadioCumulative->SetState(kButtonUp);
1103 fRadioIntegrate->SetState(kButtonDown);
1104 break;
1105 }
1106 DoNewSelection();
1107}
1108
1109
72d0ab7e 1110void AliTPCCalibViewerGUI::HandleButtonsStat(Int_t id) {
1111 //
1112 // handles statistic check boxes
1113 // checks each checkbox if checked
1114 // if the checkbox is checked, appends 'n' for name, 'e' for entries, ...
1115 // to a TString, passes this TString to gStyle->SetOptStat(...)
1116 //
4f3934a1 1117 if (id == -1) {
1118 TGButton *btn = (TGButton *) gTQSender;
1119 id = btn->WidgetId();
1120 }
72d0ab7e 1121 TString statOpt("");
1122 if (fChkStatName->GetState() == kButtonDown) statOpt.Append("n");
1123 if (fChkStatEntries->GetState() == kButtonDown) statOpt.Append("e");
1124 if (fChkStatMean->GetState() == kButtonDown && fChkStatMeanPM->GetState() == kButtonUp) statOpt.Append("m");
1125 if (fChkStatMeanPM->GetState() == kButtonDown) statOpt.Append("M");
1126 if (fChkStatRMS->GetState() == kButtonDown && fChkStatRMSPM->GetState() == kButtonUp) statOpt.Append("r");
1127 if (fChkStatRMSPM->GetState() == kButtonDown) statOpt.Append("R");
1128 if (fChkStatUnderflow->GetState() == kButtonDown) statOpt.Append("u");
1129 if (fChkStatOverflow->GetState() == kButtonDown) statOpt.Append("o");
1130 if (fChkStatIntegral->GetState() == kButtonDown) statOpt.Append("i");
1131 if (fChkStatSkewness->GetState() == kButtonDown && fChkStatSkewnessPM->GetState() == kButtonUp) statOpt.Append("s");
1132 if (fChkStatSkewnessPM->GetState() == kButtonDown) statOpt.Append("S");
1133 if (fChkStatKurtosis->GetState() == kButtonDown && fChkStatKurtosisPM->GetState() == kButtonUp) statOpt.Append("k");
1134 if (fChkStatKurtosisPM->GetState() == kButtonDown) statOpt.Append("K");
1135
1136 gStyle->SetOptStat(statOpt);
1137 DoNewSelection();
1138}
1139
1140
1141void AliTPCCalibViewerGUI::HandleButtonsRight(Int_t id) {
1142 //
1143 // handles mutual radio button exclusions
1144 // right side buttons
1145 //
1146 if (id == -1) {
1147 TGButton *btn = (TGButton *) gTQSender;
1148 id = btn->WidgetId();
1149 }
1150
1151 switch (id) {
39bcd65d 1152 case 20: // fRadioTPC
1153 fRadioSideA->SetState(kButtonUp);
1154 fRadioSideC->SetState(kButtonUp);
1155 fRadioSector->SetState(kButtonUp);
1156 break;
1157 case 21: // fRadioSideA
1158 fRadioTPC->SetState(kButtonUp);
1159 fRadioSideC->SetState(kButtonUp);
1160 fRadioSector->SetState(kButtonUp);
1161 break;
1162 case 22: // fRadioSideC
1163 fRadioTPC->SetState(kButtonUp);
1164 fRadioSideA->SetState(kButtonUp);
1165 fRadioSector->SetState(kButtonUp);
1166 break;
1167 case 23: // fRadioSector
1168 fRadioTPC->SetState(kButtonUp);
1169 fRadioSideA->SetState(kButtonUp);
1170 fRadioSideC->SetState(kButtonUp);
1171 break;
4f3934a1 1172 case 31: // fComboAddCuts
1173 fChkAddCuts->SetState(kButtonDown);
1174 break;
a6d2bd0c 1175 case 40: // fTxtSetMin
1176 fChkSetMin->SetState(kButtonDown);
1177 break;
1178 case 41: // fTxtSetMax
1179 fChkSetMax->SetState(kButtonDown);
1180 break;
4f3934a1 1181 case 50: // fTxtLabelTitle
1182 fChkLabelTitle->SetState(kButtonDown);
1183 break;
1184 case 51: // fTxtLabelXaxis
1185 fChkLabelXaxis->SetState(kButtonDown);
1186 break;
1187 case 52: // fTxtLabelXaxis
1188 fChkLabelYaxis->SetState(kButtonDown);
1189 break;
39bcd65d 1190 }
a6d2bd0c 1191 DoNewSelection();
39bcd65d 1192}
1193
72d0ab7e 1194
1195
39bcd65d 1196void AliTPCCalibViewerGUI::DoNewSelection() {
1197 //
1198 // decides whether to redraw if user makes another selection
1199 //
1200
1201 if (fChkAuto->GetState() == kButtonDown) DoDraw();
1202}
1203
72d0ab7e 1204
39bcd65d 1205void AliTPCCalibViewerGUI::DoDraw() {
1206 //
1207 // main method for drawing according to user selection
1208 //
1209
1210 // specify data to plot
1211 TString desiredData("");
a6d2bd0c 1212 if (!fListVariables->GetSelectedEntry()) return;
39bcd65d 1213 desiredData += ((TGTextLBEntry*)(fListVariables->GetSelectedEntry()))->GetTitle();
72d0ab7e 1214 desiredData += "~";
39bcd65d 1215
1216 // specify normalization
a6d2bd0c 1217 if (fRadioPredefined->GetState() == kButtonDown && fRadioNormalized->GetState() == kButtonDown) {
39bcd65d 1218 TString op("");
1219 switch (fComboMethod->GetSelected()) {
1220 case 0: // subtraction
1221 op += "-";
1222 break;
1223 case 1: // division
1224 op += "/";
1225 break;
1226 }
1227 TString normalizationData("");
a6d2bd0c 1228 if (!fListNormalization->GetSelectedEntry()) return;
39bcd65d 1229 normalizationData += ((TGTextLBEntry*)(fListNormalization->GetSelectedEntry()))->GetTitle();
a6d2bd0c 1230
1231 if ( normalizationData.BeginsWith("Fit")) {
1232 // create fit formula, evaluate it an replace normalizationData-String
1233 // ********** create cut string **********
1234 TString cutStr("");
1235 if (fRadioTPC->GetState() == kButtonDown)
1236 cutStr += ""; // whole TPC is used for fitting
1237 if (fRadioSideA->GetState() == kButtonDown)
1238 cutStr += "(sector/18)%2==0"; // side A
1239 if (fRadioSideC->GetState() == kButtonDown)
1240 cutStr+= "(sector/18)%2==1"; // side C
1241 if (fRadioSector->GetState() == kButtonDown) {
1242 Int_t sector = (Int_t)(fNmbSector->GetNumber());
1243 cutStr += "sector==";
1244 cutStr += sector;
1245 }
1246 if (fChkAddCuts->GetState() == kButtonDown && strcmp(fComboAddCuts->GetTextEntry()->GetText(), "") != 0){
1247 if (fRadioTPC->GetState() != kButtonDown) cutStr += " && ";
1248 cutStr += fComboAddCuts->GetTextEntry()->GetText();
1249 }
1250 Double_t chi2 = 0;
1251 TVectorD fitParam(0);
1252 TMatrixD covMatrix(0,0);
1253 TString formulaStr("");
1254 if (normalizationData.CompareTo("FitLinLocal") == 0)
1255 formulaStr = "lx~ ++ ly~";
1256 if (normalizationData.CompareTo("FitLinGlobal") == 0)
1257 formulaStr = "gx~ ++ gy~";
72d0ab7e 1258 if (normalizationData.CompareTo("FitParLocal") == 0)
1259 formulaStr = "lx~ ++ ly~ ++ lx~^2 ++ ly~^2 ++ lx~*ly~";
1260 if (normalizationData.CompareTo("FitParGlobal") == 0)
1261 formulaStr = "gx~ ++ gy~ ++ gx~^2 ++ gy~^2 ++ gx~*gy~";
a6d2bd0c 1262 normalizationData = *fViewer->Fit(desiredData.Data(), formulaStr.Data(), cutStr.Data(), chi2, fitParam, covMatrix);
1263 }
1264
39bcd65d 1265 desiredData += op;
a6d2bd0c 1266 if (! (TString(((TGTextLBEntry*)(fListNormalization->GetSelectedEntry()))->GetTitle())).BeginsWith("Fit"))
1267 desiredData += ((TGTextLBEntry*)(fListVariables->GetSelectedEntry()))->GetTitle();
39bcd65d 1268 desiredData += normalizationData;
1269 }
1270 else if (fRadioCustom->GetState() == kButtonDown) {
a6d2bd0c 1271 desiredData = fComboCustom->GetTextEntry()->GetText();
39bcd65d 1272 if (desiredData == "") return;
1273 }
1274
1275 // specify cuts
1276 TString sectorStr("");
1277 if (fRadioTPC->GetState() == kButtonDown)
1278 sectorStr += "ALL";
1279 if (fRadioSideA->GetState() == kButtonDown)
1280 sectorStr += "A"; //cuts += "(sector/18)%2==0";
1281 if (fRadioSideC->GetState() == kButtonDown)
1282 sectorStr+= "C"; //cuts += "(sector/18)%2==1";
1283 if (fRadioSector->GetState() == kButtonDown) {
1284 Int_t sector = (Int_t)(fNmbSector->GetNumber());
1285 sectorStr += sector; //cuts += "sector==";
1286 }
1287 TString cutsStr("");
72d0ab7e 1288 if (fChkCutZero->GetState() == kButtonDown) {
1289 cutsStr += desiredData.Data();
1290 cutsStr += "!=0";
1291 if (fChkAddCuts->GetState() == kButtonDown) cutsStr += " && ";
1292 }
39bcd65d 1293 if (fChkAddCuts->GetState() == kButtonDown)
a6d2bd0c 1294 cutsStr += fComboAddCuts->GetTextEntry()->GetText();
72d0ab7e 1295
1296 TString addDrawOpt("");
1297 if (fChkAddDrawOpt->GetState() == kButtonDown)
1298 addDrawOpt += fComboAddDrawOpt->GetTextEntry()->GetText();
39bcd65d 1299
1300 // draw finally
a6d2bd0c 1301 for (Int_t i = 0; i < fCanvMain->GetCanvas()->GetListOfPrimitives()->GetEntries(); i++) {
1302 if (strcmp(fCanvMain->GetCanvas()->GetListOfPrimitives()->At(i)->ClassName(), "TFrame") != 0)
1303 fCanvMain->GetCanvas()->GetListOfPrimitives()->At(i)->Delete();
1304 }
1305 //fCanvMain->GetCanvas()->Clear();
39bcd65d 1306 fCanvMain->GetCanvas()->cd();
a6d2bd0c 1307 Int_t entries = -1;
72d0ab7e 1308 if (fRadio1D->GetState() == kButtonDown){
1309 // 1D-Drawing
1310 TString strSigmaMax(fTxtSigmaMax->GetText()); // get sigmaMax from text enty
1311 Double_t sigmaMax = (strSigmaMax.IsFloat()) ? strSigmaMax.Atof() : 5; // convert to double, if not convertable, set to 5
1312 Bool_t plotMean = fChkMean->GetState() == kButtonDown;
1313 Bool_t plotMedian = fChkMedian->GetState() == kButtonDown;
1314 Bool_t plotLTM = fChkLTM->GetState() == kButtonDown;
1315 if (fRadioNorm->GetState() == kButtonDown) // normal 1D drawing
1316 entries = fViewer->EasyDraw1D(desiredData.Data(), sectorStr.Data(), cutsStr.Data(), addDrawOpt.Data());
1317 if (fRadioSigma->GetState() == kButtonDown) // sigma 1D drawing
1318 entries = fViewer->DrawHisto1D(desiredData.Data(), sectorStr.Data(), cutsStr.Data(), //
1319 fTxtSigmas->GetText(), plotMean, plotMedian, plotLTM);
1320 if (fRadioCumulative->GetState() == kButtonDown) // cumulative 1D drawing
1321 entries = fViewer->SigmaCut(desiredData.Data(), sectorStr.Data(), cutsStr.Data(), //
1322 sigmaMax, plotMean, plotMedian, plotLTM, //
1323 fCheckCumulativePM->GetState() == kButtonDown, fTxtSigmas->GetText(), /* Float_t sigmaStep =*/ -1);
1324 if (fRadioIntegrate->GetState() == kButtonDown) // integral 1D drawing
1325 entries = fViewer->Integrate(desiredData.Data(), sectorStr.Data(), cutsStr.Data(), //
1326 sigmaMax, plotMean, plotMedian, plotLTM, //
1327 fTxtSigmas->GetText(), /* Float_t sigmaStep =*/ -1);
1328 }
1329 else if (fRadio2D->GetState() == kButtonDown) {
1330 // 2D-Drawing
1331 entries = fViewer->EasyDraw(desiredData.Data(), sectorStr.Data(), cutsStr.Data(), addDrawOpt.Data());
1332 }
1333 if (entries == -1) return; // nothing was drawn, there is no histogram to get min and max
1334
a6d2bd0c 1335
72d0ab7e 1336 // get or set Min & Max
1337 //
1338 // search for histogram
a6d2bd0c 1339 TList* listOfPrimitives = fCanvMain->GetCanvas()->GetListOfPrimitives();
1340 TObject* ptr = 0;
1341 for (Int_t i = 0; i < listOfPrimitives->GetEntries(); i++) {
1342 ptr = listOfPrimitives->At(i);
1343 if ( ptr->InheritsFrom("TH1") ) break;
1344 }
72d0ab7e 1345 if ( ptr == 0 || !ptr->InheritsFrom("TH1") ) { // if the loop did not find a TH1
1346 fCanvMain->GetCanvas()->Update();
1347 return;
1348 // unable to find histogram, no min and max wil be read out
1349 }
a6d2bd0c 1350 TH1 *hist = (TH1*)ptr;
1351 TString minTxt(fTxtSetMin->GetText());
1352 TString maxTxt(fTxtSetMax->GetText());
72d0ab7e 1353 // set min and max according to specified values, if checkbox is checked
a6d2bd0c 1354 if (fChkSetMax->GetState() == kButtonDown && (maxTxt.IsDigit() || maxTxt.IsFloat()) )
1355 hist->SetMaximum(maxTxt.Atof());
1356 if (fChkSetMin->GetState() == kButtonDown && (minTxt.IsDigit() || minTxt.IsFloat()) )
1357 hist->SetMinimum(minTxt.Atof());
72d0ab7e 1358 // get min and max from plot
a6d2bd0c 1359 if (fChkGetMinMaxAuto->GetState() == kButtonDown) {
1360 if (fChkSetMax->GetState() == kButtonUp)
1361 fTxtSetMax->SetText(Form("%f", hist->GetMaximum()));
1362 if (fChkSetMin->GetState() == kButtonUp)
1363 fTxtSetMin->SetText(Form("%f", hist->GetMinimum()));
1364 }
39bcd65d 1365
4f3934a1 1366 // set labels accoring to specification, if cehckboxes are checked
1367 if (fChkLabelTitle->GetState() == kButtonDown)
1368 hist->SetTitle(fTxtLabelTitle->GetText());
1369 if (fChkLabelXaxis->GetState() == kButtonDown)
1370 hist->GetXaxis()->SetTitle(fTxtLabelXaxis->GetText());
1371 if (fChkLabelYaxis->GetState() == kButtonDown)
1372 hist->GetYaxis()->SetTitle(fTxtLabelYaxis->GetText());
1373 // get and/or set labels and title
1374 if (fChkLabelGetAuto->GetState() == kButtonDown) {
1375 fTxtLabelTitle->SetText(hist->GetTitle());
1376 fTxtLabelXaxis->SetTitle(hist->GetXaxis()->GetTitle());
1377 fTxtLabelYaxis->SetTitle(hist->GetYaxis()->GetTitle());
1378 }
1379
39bcd65d 1380 fCanvMain->GetCanvas()->Update();
1381}
a6d2bd0c 1382
1383
1384void AliTPCCalibViewerGUI::DoFit() {
1385 //
1386 // main method for fitting
1387 //
1388
1389 Double_t chi2 = 0;
1390 TVectorD fitParam(0);
1391 TMatrixD covMatrix(0,0);
1392 TString drawStr("");
1393 TString cutStr("");
1394 TString formulaStr("");
1395 TString *returnStr = new TString("");
1396
1397
1398 // ******** create draw string *********
1399 if (fRadioCustom->GetState() == kButtonDown) {
1400 // take custom text as draw string
1401 drawStr = fComboCustom->GetTextEntry()->GetText();
1402 if (drawStr == "") return;
1403 }
1404 else if (fRadioPredefined->GetState() == kButtonDown) {
1405 // create drawStr out of selection
1406 drawStr += ((TGTextLBEntry*)(fListVariables->GetSelectedEntry()))->GetTitle();
1407 drawStr += ".fElements";
1408 if (fRadioNormalized->GetState() == kButtonDown) {
1409 // normalize data by selection
1410 TString op("");
1411 switch (fComboMethod->GetSelected()) {
1412 case 0: // subtraction
1413 op += "-";
1414 break;
1415 case 1: // division
1416 op += "/";
1417 break;
1418 }
1419 TString normalizationData("");
1420 normalizationData += ((TGTextLBEntry*)(fListNormalization->GetSelectedEntry()))->GetTitle();
1421 drawStr += op;
1422 drawStr += ((TGTextLBEntry*)(fListVariables->GetSelectedEntry()))->GetTitle();
1423 drawStr += normalizationData;
1424 }
1425 }
1426
1427 // ********** create cut string **********
1428 if (fRadioTPC->GetState() == kButtonDown)
1429 cutStr += ""; // whole TPC is used for fitting
1430 if (fRadioSideA->GetState() == kButtonDown)
1431 cutStr += "(sector/18)%2==0"; // side A
1432 if (fRadioSideC->GetState() == kButtonDown)
1433 cutStr+= "(sector/18)%2==1"; // side C
1434 if (fRadioSector->GetState() == kButtonDown) {
1435 Int_t sector = (Int_t)(fNmbSector->GetNumber());
1436 cutStr += "sector==";
1437 cutStr += sector;
1438 }
1439 if (fChkAddCuts->GetState() == kButtonDown && strcmp(fComboAddCuts->GetTextEntry()->GetText(), "") != 0){
1440 if (fRadioTPC->GetState() != kButtonDown) cutStr += " && ";
1441 cutStr += fComboAddCuts->GetTextEntry()->GetText();
1442 }
1443
1444 // ********** get formula string **********
1445 formulaStr += fComboCustomFit->GetTextEntry()->GetText();
1446
1447 // ********** call AliTPCCalibViewer's fit-function
1448 returnStr = fViewer->Fit(drawStr.Data(), formulaStr.Data(), cutStr.Data(), chi2, fitParam, covMatrix);
1449
1450 std::cout << std::endl;
1451 std::cout << "Your fit formula reads as follows:" << std::endl;
1452 std::cout << returnStr->Data() << std::endl;
1453 std::cout << "chi2 = " << chi2 << std::endl;
1454}
1455
1456void AliTPCCalibViewerGUI::GetMinMax() {
1457 //
1458 // Read current Min & Max from the plot and set it to fTxtSetMin & fTxtSetMax
1459 //
1460 TList* listOfPrimitives = fCanvMain->GetCanvas()->GetListOfPrimitives();
1461 TObject* ptr = 0;
1462 for (Int_t i = 0; i < listOfPrimitives->GetEntries(); i++) {
1463 ptr = listOfPrimitives->At(i);
1464 if ( ptr->InheritsFrom("TH1") ) break;
1465 }
1466 if ( ptr != 0 && !ptr->InheritsFrom("TH1") ) return; // if the loop did not find a TH1
1467 TH1 *hist = (TH1*)ptr;
1468 Double_t histMax = hist->GetMaximum();
1469 Double_t histMin = hist->GetMinimum();
1470 fTxtSetMax->SetText(Form("%f",histMax));
1471 fTxtSetMin->SetText(Form("%f",histMin));
1472}
1473
1474void AliTPCCalibViewerGUI::ChangeSector(){
1475 //
1476 // function that is called, when the number of the sector is changed
1477 // to change the sector label
1478 //
1479 Int_t sector = (Int_t)(fNmbSector->GetNumber());
1480 char* secLabel = "";
1481 if (sector >= 0 && sector <= 17) // IROC, Side A
1482 secLabel = "IROC, A";
1483 if (sector >= 18 && sector <= 35) // IROC, Side C
1484 secLabel = "IROC, C";
1485 if (sector >= 36 && sector <= 53) // OROC, Side A
1486 secLabel = "OROC, A";
1487 if (sector >= 54 && sector <= 71) // OROC, Side C
1488 secLabel = "OROC, C";
1489 fLblSector->SetText(secLabel);
1490 DoNewSelection();
1491}
1492
72d0ab7e 1493void AliTPCCalibViewerGUI::AddFitFunction() const {
a6d2bd0c 1494 //
1495 // adds the last fit function to the normalization list
1496 //
1497 std::cout << "Not yet implemented." << std::endl;
1498}
4f3934a1 1499
1500void AliTPCCalibViewerGUI::SavePicture() {
1501 //
1502 // saves the current picture
1503 //
1504 // use the following combination of file type and save options:
1505 // (see also TCanvas::Print)
1506 //
1507 // "ps" - Postscript file is produced (see special cases below)
1508 // "Portrait" - Postscript file is produced (Portrait)
1509 // "Landscape" - Postscript file is produced (Landscape)
1510 // "eps" - an Encapsulated Postscript file is produced
1511 // "Preview" - an Encapsulated Postscript file with preview is produced.
1512 // "pdf" - a PDF file is produced
1513 // "svg" - a SVG file is produced
1514 // "gif" - a GIF file is produced
1515 // "gif+NN" - an animated GIF file is produced, where NN is delay in 10ms units
1516 // "xpm" - a XPM file is produced
1517 // "png" - a PNG file is produced
1518 // "jpg" - a JPEG file is produced
1519 // "tiff" - a TIFF file is produced
1520 // "cxx" - a C++ macro file is produced
1521 // "xml" - a XML file
1522 // "root" - a ROOT binary file
1523
1524
1525
1526 const char *kSaveAsTypes[] = {
1527 "Postscript", "*.ps",
1528 "Encapsulated Postscript", "*.eps",
1529 "PDF", "*.pdf",
1530 "JPEG", "*.jpg",
1531 "PNG", "*.png",
1532 "TIFF", "*.tiff",
1533 "GIF", "*.gif",
1534 "XPM", "*.xpm",
1535 "SVG", "*.svg",
1536 "XML", "*.xml",
1537 "C++ macro", "*.cxx",
1538 "Macro file", "*.C",
1539 "ROOT file", "*.root",
1540 "All file", "*",
1541 0, 0
1542 };
1543 TString addSaveOpt("");
1544 if (fChkAddSaveOpt->GetState() == kButtonDown)
1545 addSaveOpt += fComboAddSaveOpt->GetTextEntry()->GetText();
1546 TString dir(".");
1547 TGFileInfo fi;
1548 fi.fFileTypes = kSaveAsTypes;
1549 // fi.fIniDir = StrDup(dir);
1550 fi.fOverwrite = kFALSE;
1551 new TGFileDialog(gClient->GetRoot(), gClient->GetRoot(), kFDSave, &fi);
1552 if (fi.fFilename && strlen(fi.fFilename)) {
1553 fCanvMain->GetCanvas()->Print(fi.fFilename, addSaveOpt.Data());
1554 }
1555
1556// TList* fFileNamesList list of selected file names
1557// Int_t fFileTypeIdx selected file type, index in fFileTypes
1558// const char** fFileTypes file types used to filter selectable files
1559// char* fFilename selected file name
1560// char* fIniDir on input: initial directory, on output: new directory
1561// Bool_t fMultipleSelection if true, allow multiple file selection
1562// Bool_t fOverwrite if true overwrite the file with existing name on save
1563
1564}
a6d2bd0c 1565
1566
1567void AliTPCCalibViewerGUI::ShowGUI(const char* fileName) {
1568 //
1569 // initialize and show GUI for presentation
1570 //
1571 TGMainFrame* frmMain = new TGMainFrame(gClient->GetRoot(), 1000, 600);
1572 frmMain->SetWindowName("AliTPCCalibViewer GUI");
1573 frmMain->SetCleanup(kDeepCleanup);
1574
1575 TGTab* tabMain = new TGTab(frmMain, 1000, 600);
1576 frmMain->AddFrame(tabMain, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
1577
1578 TGCompositeFrame* tabCont1 = tabMain->AddTab("Viewer 1");
1579 TGCompositeFrame* tabCont2 = tabMain->AddTab("Viewer 2");
1580
1581 AliTPCCalibViewerGUI* calibViewer1 = new AliTPCCalibViewerGUI(tabCont1, 1000, 600, (char*)fileName);
1582 tabCont1->AddFrame(calibViewer1, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
1583
1584 AliTPCCalibViewerGUI* calibViewer2 = new AliTPCCalibViewerGUI(tabCont2, 1000, 600, (char*)fileName);
1585 tabCont2->AddFrame(calibViewer2, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
1586
1587 frmMain->MapSubwindows();
1588 frmMain->Resize();
1589 frmMain->MapWindow();
1590
1591}
1592