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