]>
Commit | Line | Data |
---|---|---|
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 // | |
20 | // used for the calibration monitor // | |
21 | // All functionalities of the AliTPCCalibViewer are here available | |
22 | // | |
23 | // Example usage: // | |
24 | /* | |
25 | aliroot | |
26 | AliTPCCalibViewerGUI::ShowGUI("CalibTree.root") | |
27 | ||
28 | */ | |
29 | // // | |
30 | // // | |
31 | /////////////////////////////////////////////////////////////////////////////// | |
32 | ||
33 | ||
34 | #include "AliTPCCalibViewerGUI.h" | |
35 | #include "AliTPCCalPad.h" | |
36 | #include <iostream> | |
37 | ||
38 | #include <TCanvas.h> | |
39 | #include <TPad.h> | |
40 | #include <TVirtualPad.h> | |
41 | ||
42 | #include <TROOT.h> | |
43 | #include <TMath.h> | |
44 | #include <TObjArray.h> | |
45 | #include <TObjString.h> | |
46 | #include <TVector.h> | |
47 | #include <string.h> | |
48 | #include <TH1.h> | |
49 | #include "TStyle.h" | |
50 | #include "TGFileDialog.h" | |
51 | #include "TGInputDialog.h" | |
52 | #include "AliTPCCalibViewer.h" | |
53 | #include "AliTPCPreprocessorOnline.h" | |
54 | ||
55 | // #include "TGListBox.h" | |
56 | // #include "TGNumberEntry" | |
57 | // #include "TGSplitter" | |
58 | // #include "TGTab" | |
59 | // #include "TGLabel" | |
60 | // #include "TGButtonGroup" | |
61 | // #include "TGComboBox" | |
62 | // #include "TRootEmbeddedCanvas" | |
63 | // #include "TGButton" | |
64 | // #include "TGRadioButton" | |
65 | // #include "GTCheckButton" | |
66 | // #include "TGTextEntry" | |
67 | ||
68 | ||
69 | ||
70 | ||
71 | ClassImp(AliTPCCalibViewerGUI) | |
72 | ||
73 | AliTPCCalibViewerGUI::AliTPCCalibViewerGUI(const TGWindow *p, UInt_t w, UInt_t h, char* fileName) | |
74 | : TGCompositeFrame(p, w, h), | |
75 | fViewer(0), | |
76 | fPreprocessor(0), | |
77 | fContTopBottom(0), | |
78 | fContLCR(0), | |
79 | fContLeft(0), | |
80 | ftabLeft(0), | |
81 | ftabLeft0(0), | |
82 | ftabLeft1(0), | |
83 | ftabRight(0), | |
84 | fTabRight0(0), | |
85 | fTabRight1(0), | |
86 | fContRight(0), | |
87 | fContCenter(0), | |
88 | fContPlotOpt(0), | |
89 | fContDrawOpt(0), | |
90 | fContDrawOptSub1D2D(0), | |
91 | fContNormalized(0), | |
92 | fContCustom(0), | |
93 | fContCuts(0), | |
94 | fContSector(0), | |
95 | fContAddCuts(0), | |
96 | fContFit(0), | |
97 | fContAddFit(0), | |
98 | fContScaling(0), | |
99 | fContSetMax(0), | |
100 | fContSetMin(0), | |
101 | fContAddDrawOpt(0), | |
102 | fListVariables(0), | |
103 | fBtnDraw(0), | |
104 | fBtnFit(0), | |
105 | fBtnAddFitFunction(0), | |
106 | fBtnGetMinMax(0), | |
107 | fCanvMain(0), | |
108 | fRadioRaw(0), | |
109 | fRadioNormalized(0), | |
110 | fRadioPredefined(0), | |
111 | fRadioCustom(0), | |
112 | fRadio1D(0), | |
113 | fRadio2D(0), | |
114 | fRadioTPC(0), | |
115 | fRadioSideA(0), | |
116 | fRadioSideC(0), | |
117 | fRadioROC(0), | |
118 | fRadioSector(0), | |
119 | fComboAddDrawOpt(0), | |
120 | fChkAuto(0), | |
121 | fChkAutoAppend(0), | |
122 | fComboMethod(0), | |
123 | fListNormalization(0), | |
124 | fComboCustom(0), | |
125 | fLblCustomDraw(0), | |
126 | fChkAddDrawOpt(0), | |
127 | fNmbSector(0), | |
128 | fLblSector(0), | |
129 | fChkCutZero(0), | |
130 | fChkAddCuts(0), | |
131 | fLblAddCuts(0), | |
132 | fComboAddCuts(0), | |
133 | fComboCustomFit(0), | |
134 | fChkSetMax(0), | |
135 | fChkSetMin(0), | |
136 | fChkGetMinMaxAuto(0), | |
137 | fTxtSetMax(0), | |
138 | fTxtSetMin(0) , | |
139 | fContDrawOpt1D(0), | |
140 | fcontDrawOpt1DSubLR(0), | |
141 | fContDrawOpt1DSubNSC(0), | |
142 | fRadioNorm(0), | |
143 | fRadioSigma(0), | |
144 | fTxtSigmas(0), | |
145 | fContCumuLR(0), | |
146 | fContCumLeft(0), | |
147 | fContCumRight(0), | |
148 | fLblSigmaMax(0), | |
149 | fTxtSigmaMax(0), | |
150 | fRadioCumulative(0), | |
151 | fCheckCumulativePM(0), | |
152 | fRadioIntegrate(0), | |
153 | fContDrawOpt1DSubMML(0), | |
154 | fChkMean(0), | |
155 | fChkMedian(0), | |
156 | fChkLTM(0), | |
157 | fContStatOpt(0), | |
158 | fChkStatName(0), | |
159 | fChkStatEntries(0), | |
160 | fContStatMean(0), | |
161 | fChkStatMean(0), | |
162 | fChkStatMeanPM(0), | |
163 | fContStatRMS(0), | |
164 | fChkStatRMS(0), | |
165 | fChkStatRMSPM(0), | |
166 | fChkStatUnderflow(0), | |
167 | fChkStatOverflow(0), | |
168 | fChkStatIntegral(0), | |
169 | fContStatSkew(0), | |
170 | fChkStatSkewness(0), | |
171 | fChkStatSkewnessPM(0), | |
172 | fContStatKurt(0), | |
173 | fChkStatKurtosis(0), | |
174 | fChkStatKurtosisPM(0), | |
175 | fBtnUnchekAll(0), | |
176 | fContLabeling(0), | |
177 | fChkLabelTitle(0), | |
178 | fTxtLabelTitle(0), | |
179 | fChkLabelXaxis(0), | |
180 | fTxtLabelXaxis(0), | |
181 | fChkLabelYaxis(0), | |
182 | fTxtLabelYaxis(0), | |
183 | fChkLabelGetAuto(0), | |
184 | fContSave(0), | |
185 | fBtnSave(0), | |
186 | fContAddSaveOpt(0), | |
187 | fChkAddSaveOpt(0), | |
188 | fComboAddSaveOpt(0), | |
189 | fContExport(0), | |
190 | fContAddExport(0), | |
191 | fComboExportName(0), | |
192 | fBtnExport(0), | |
193 | fBtnAddNorm(0), | |
194 | fContTree(0), | |
195 | fBtnDumpToFile(0), | |
196 | fBtnLoadTree(0), | |
197 | fChkAddAsReference(0), | |
198 | fTxtRefName(0), | |
199 | fInitialized(0) | |
200 | { | |
201 | // | |
202 | // AliTPCCalibViewerGUI constructor; fileName specifies the ROOT tree used for drawing | |
203 | // | |
204 | ||
205 | // draw the GUI: | |
206 | fPreprocessor = new AliTPCPreprocessorOnline(); | |
207 | DrawGUI(p, w, h); | |
208 | // initialize the AliTPCCalibViewer: | |
209 | if (fileName) Initialize(fileName); | |
210 | // set default button states: | |
211 | SetInitialValues(); | |
212 | // do first drawing: | |
213 | if (fileName) DoDraw(); | |
214 | } | |
215 | ||
216 | ||
217 | void AliTPCCalibViewerGUI::DrawGUI(const TGWindow *p, UInt_t w, UInt_t h) { | |
218 | // | |
219 | // draw the GUI | |
220 | // | |
221 | // ====================================================================== | |
222 | // ************************* Display everything ************************* | |
223 | // ====================================================================== | |
224 | ||
225 | SetCleanup(kDeepCleanup); | |
226 | p = p; // to avoid compiler warnings | |
227 | ||
228 | // ***************************************************************************** | |
229 | // ************************* content of this MainFrame ************************* | |
230 | // ***************************************************************************** | |
231 | // top level container with horizontal layout | |
232 | fContTopBottom = new TGCompositeFrame(this, w, h, kVerticalFrame | kFixedWidth | kFixedHeight); | |
233 | AddFrame(fContTopBottom, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0)); | |
234 | ||
235 | fContLCR = new TGCompositeFrame(fContTopBottom, w, h, kHorizontalFrame | kFixedWidth | kFixedHeight); | |
236 | fContTopBottom->AddFrame(fContLCR, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0)); | |
237 | ||
238 | // *********************************************************************** | |
239 | // ************************* content of fContLCR ************************* | |
240 | // *********************************************************************** | |
241 | // left container | |
242 | fContLeft = new TGCompositeFrame(fContLCR, 200, 200, kVerticalFrame | kFixedWidth | kFitHeight); | |
243 | fContLCR->AddFrame(fContLeft, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandY, 5, 3, 3, 3)); | |
244 | ||
245 | // left vertical splitter | |
246 | TGVSplitter *splitLeft = new TGVSplitter(fContLCR); | |
247 | splitLeft->SetFrame(fContLeft, kTRUE); | |
248 | fContLCR->AddFrame(splitLeft, new TGLayoutHints(kLHintsLeft | kLHintsExpandY, 0, 0, 0, 0)); | |
249 | ||
250 | // right container | |
251 | fContRight = new TGCompositeFrame(fContLCR, 150, 200, kVerticalFrame | kFixedWidth | kFitHeight); | |
252 | fContLCR->AddFrame(fContRight, new TGLayoutHints(kLHintsTop | kLHintsRight | kLHintsExpandY, 3, 5, 3, 3)); | |
253 | ||
254 | // center container | |
255 | fContCenter = new TGCompositeFrame(fContLCR, 200, 200, kVerticalFrame | kFixedWidth | kFitHeight); | |
256 | fContLCR->AddFrame(fContCenter, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0)); | |
257 | ||
258 | // right vertical splitter | |
259 | TGVSplitter *splitRight = new TGVSplitter(fContLCR); | |
260 | splitRight->SetFrame(fContRight, kFALSE); | |
261 | fContLCR->AddFrame(splitRight, new TGLayoutHints(kLHintsLeft | kLHintsExpandY, 0, 0, 0, 0)); | |
262 | ||
263 | ||
264 | // ======================================================================== | |
265 | // ************************* content of fContLeft ************************* | |
266 | // ======================================================================== | |
267 | // --- draw button and tabLeft --- | |
268 | // draw button | |
269 | fBtnDraw = new TGTextButton(fContLeft, "&Draw"); | |
270 | fContLeft->AddFrame(fBtnDraw, new TGLayoutHints(kLHintsExpandX, 10, 10, 0, 0)); | |
271 | //fBtnDraw->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoTest(=\"fBtnDraw clicked\")"); | |
272 | fBtnDraw->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoDraw()"); | |
273 | fBtnDraw->SetToolTipText("Press here to draw according to selections."); | |
274 | ||
275 | // tabs on the left side: | |
276 | ftabLeft = new TGTab(fContLeft); | |
277 | fContLeft->AddFrame(ftabLeft, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 8, 0)); | |
278 | ftabLeft0 = ftabLeft->AddTab("General"); | |
279 | ftabLeft1 = ftabLeft->AddTab("More plot options"); | |
280 | ||
281 | ||
282 | // **************************** content of tabLeft0 ******************************* | |
283 | ||
284 | // draw options container *** fcontDrawOpt *** " Plot options " | |
285 | fContDrawOpt = new TGGroupFrame(ftabLeft0, "Plot options", kVerticalFrame | kFitWidth | kFitHeight); | |
286 | ftabLeft0->AddFrame(fContDrawOpt, new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0)); | |
287 | fContDrawOptSub1D2D = new TGCompositeFrame(fContDrawOpt, 200, 23, kHorizontalFrame | kFitWidth | kFixedHeight); | |
288 | fContDrawOpt->AddFrame(fContDrawOptSub1D2D, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0)); | |
289 | ||
290 | // ------------------------- content of fContDrawOpt ------------------------- | |
291 | // -- radio1D, radio2D, chkAuto | |
292 | // 1D radio button | |
293 | fRadio1D = new TGRadioButton(fContDrawOptSub1D2D, "1D", 30); | |
294 | fContDrawOptSub1D2D->AddFrame(fRadio1D, new TGLayoutHints(kLHintsNormal, 0, 2, 0, 0)); | |
295 | fRadio1D->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsGeneral()"); | |
296 | fRadio1D->SetToolTipText("1D drawing \nSelect this if you want to have the full control for the custom draw."); | |
297 | ||
298 | // 2D radio button | |
299 | fRadio2D = new TGRadioButton(fContDrawOptSub1D2D, "2D", 31); | |
300 | fContDrawOptSub1D2D->AddFrame(fRadio2D, new TGLayoutHints(kLHintsNormal, 2, 2, 0, 0)); | |
301 | fRadio2D->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsGeneral()"); | |
302 | fRadio2D->SetToolTipText("2D drawing"); | |
303 | ||
304 | // additional draw options container | |
305 | fContAddDrawOpt = new TGCompositeFrame(fContDrawOpt, 200, 200, kVerticalFrame | kFitWidth | kFitHeight); | |
306 | fContDrawOpt->AddFrame(fContAddDrawOpt, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0)); | |
307 | ||
308 | // content of --- fContAddDrawOpt --- | |
309 | // addition draw options label | |
310 | fChkAddDrawOpt = new TGCheckButton(fContAddDrawOpt, "Draw options:"); | |
311 | //fChkAddDrawOpt->SetTextJustify(kTextLeft); | |
312 | fContAddDrawOpt->AddFrame(fChkAddDrawOpt, new TGLayoutHints(kLHintsNormal | kLHintsExpandX)); | |
313 | fChkAddDrawOpt->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoNewSelection()"); | |
314 | fChkAddDrawOpt->SetToolTipText("Enter additional draw options like 'prof' or 'colz' here.\nBe careful with the option 'same' for 2D drawings as it will crash (ROOT feature)."); | |
315 | ||
316 | // additional draw options combo box | |
317 | fComboAddDrawOpt = new TGComboBox(fContAddDrawOpt); | |
318 | fComboAddDrawOpt->Resize(0, fBtnDraw->GetDefaultHeight()); | |
319 | fComboAddDrawOpt->EnableTextInput(kTRUE); | |
320 | fContAddDrawOpt->AddFrame(fComboAddDrawOpt, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0)); | |
321 | fComboAddDrawOpt->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsGeneral(=14)"); | |
322 | fComboAddDrawOpt->Connect("Selected(Int_t)", "AliTPCCalibViewerGUI", this, "DoNewSelection()"); | |
323 | ||
324 | // automatic redraw check button | |
325 | fChkAuto = new TGCheckButton(fContDrawOpt, "Auto redraw"); | |
326 | fContDrawOpt->AddFrame(fChkAuto, new TGLayoutHints(kLHintsNormal, 0, 2, 0, 0)); | |
327 | fChkAuto->SetToolTipText("Decide if you want an automatic redraw on each new selection.\nNot recommended on a slow machine, during remote connection or if your draw option is 'same'."); | |
328 | ||
329 | // automatic append ending check button | |
330 | fChkAutoAppend = new TGCheckButton(fContDrawOpt, "Auto add appending"); | |
331 | fContDrawOpt->AddFrame(fChkAutoAppend, new TGLayoutHints(kLHintsNormal, 0, 2, 0, 0)); | |
332 | fChkAutoAppend->SetToolTipText("Tries to repair your custom draw string or custom cut string, if you forgot '~' or '.fElements' \nThis function may be buggy!"); | |
333 | ||
334 | ||
335 | // *** predefined radio button *** " Predefined " | |
336 | fRadioPredefined = new TGRadioButton(ftabLeft0, "Predefined: ", 13); | |
337 | ftabLeft0->AddFrame(fRadioPredefined, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0)); | |
338 | fRadioPredefined->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsGeneral()"); | |
339 | fRadioPredefined->SetToolTipText("Draw predefined variables according to selection."); | |
340 | ||
341 | // list of variables | |
342 | fListVariables = new TGListBox(ftabLeft0); | |
343 | ftabLeft0->AddFrame(fListVariables, new TGLayoutHints(kLHintsNormal | kLHintsExpandX | kLHintsExpandY, 10, 0, 0, 0)); | |
344 | fListVariables->Connect("Selected(Int_t)", "AliTPCCalibViewerGUI", this, "DoNewSelection()"); | |
345 | ||
346 | ||
347 | // normalization options container *** fContPlotOpt *** | |
348 | //fContPlotOpt = new TGCompositeFrame(fContLeft, 200, 200, kVerticalFrame | kFitWidth | kFitHeight); | |
349 | fContPlotOpt = new TGGroupFrame(ftabLeft0, "Normalization options", kVerticalFrame | kFitWidth | kFitHeight); | |
350 | ftabLeft0->AddFrame(fContPlotOpt, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10, 0, 0, 0)); | |
351 | ||
352 | // ------------------------- content of fContPlotOpt ------------------------- | |
353 | // raw radio button | |
354 | fRadioRaw = new TGRadioButton(fContPlotOpt, "Raw", 10); | |
355 | fContPlotOpt->AddFrame(fRadioRaw, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0)); | |
356 | fRadioRaw->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsGeneral()"); | |
357 | fRadioRaw->SetToolTipText("Plot without normalization"); | |
358 | ||
359 | // normalized radio button | |
360 | fRadioNormalized = new TGRadioButton(fContPlotOpt, "Normalized", 11); | |
361 | fContPlotOpt->AddFrame(fRadioNormalized, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0)); | |
362 | fRadioNormalized->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsGeneral()"); | |
363 | fRadioNormalized->SetToolTipText("Normalize data"); | |
364 | ||
365 | // normalized options container *** fContNormalized *** | |
366 | fContNormalized = new TGCompositeFrame(fContPlotOpt, 200, 200, kVerticalFrame | kFitWidth | kFitHeight); | |
367 | fContPlotOpt->AddFrame(fContNormalized, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 15, 0, 0, 0)); | |
368 | ||
369 | // --- content of fContNormalized --- | |
370 | // --- combo box to select 'subtract' or 'divide', list of normalization variables | |
371 | // method drop down combo box | |
372 | fComboMethod = new TGComboBox(fContNormalized); | |
373 | fComboMethod->Resize(0, fBtnDraw->GetDefaultHeight()); | |
374 | fContNormalized->AddFrame(fComboMethod, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0)); | |
375 | fComboMethod->Connect("Selected(Int_t)", "AliTPCCalibViewerGUI", this, "DoNewSelection()"); | |
376 | ||
377 | // list of normalization variables | |
378 | fListNormalization = new TGListBox(fContNormalized); | |
379 | fContNormalized->AddFrame(fListNormalization, new TGLayoutHints(kLHintsNormal | kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0)); | |
380 | fListNormalization->Connect("Selected(Int_t)", "AliTPCCalibViewerGUI", this, "DoNewSelection()"); | |
381 | ||
382 | // custom radio button | |
383 | fRadioCustom = new TGRadioButton(ftabLeft0, "Custom: ", 12); | |
384 | ftabLeft0->AddFrame(fRadioCustom, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0)); | |
385 | fRadioCustom->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsGeneral()"); | |
386 | fRadioCustom->SetToolTipText("Draw data according to user specific text entry in the 'Custom Draw' line. Remember '~' (= '.fElements')!"); | |
387 | // custom options container is located further down | |
388 | ||
389 | // **************************** content of tabLeft1 ******************************* | |
390 | ||
391 | // draw options container *** fcontDrawOpt1D *** " Plot options " | |
392 | fContDrawOpt1D = new TGGroupFrame(ftabLeft1, "1D Plot options", kVerticalFrame | kFitWidth | kFitHeight); | |
393 | ftabLeft1->AddFrame(fContDrawOpt1D, new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0)); | |
394 | ||
395 | fcontDrawOpt1DSubLR = new TGCompositeFrame(fContDrawOpt1D, 1, 1, kVerticalFrame | kFitWidth | kFitHeight); | |
396 | fContDrawOpt1D->AddFrame(fcontDrawOpt1DSubLR, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0)); | |
397 | ||
398 | // ***** content of fContDrawOpt1DSubLR ***** | |
399 | fContDrawOpt1DSubNSC = new TGCompositeFrame(fcontDrawOpt1DSubLR, 200, 23, kVerticalFrame | kFitWidth | kFitHeight); | |
400 | fcontDrawOpt1DSubLR->AddFrame(fContDrawOpt1DSubNSC, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0)); | |
401 | ||
402 | // --------------------------- content of fContDrawOpt1DSubNSC ----------------- | |
403 | fRadioNorm = new TGRadioButton(fContDrawOpt1DSubNSC, "Normal", 110); | |
404 | fContDrawOpt1DSubNSC->AddFrame(fRadioNorm, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0)); | |
405 | fRadioNorm->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtons1D()"); | |
406 | fRadioNorm->SetToolTipText("Produce a normal 1D plot, a histogram of the selected data."); | |
407 | ||
408 | fRadioSigma = new TGRadioButton(fContDrawOpt1DSubNSC, "Sigma", 111); | |
409 | fContDrawOpt1DSubNSC->AddFrame(fRadioSigma, new TGLayoutHints(kLHintsNormal, 0, 0, 5, 0)); | |
410 | fRadioSigma->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtons1D()"); | |
411 | fRadioSigma->SetToolTipText("Draw a normal histogram, but also lines that indicate the mean/median/LTM \nand sigmas of the selected data."); | |
412 | ||
413 | fTxtSigmas = new TGTextEntry(fContDrawOpt1DSubNSC, "2; 4; 6", 111); | |
414 | fContDrawOpt1DSubNSC->AddFrame(fTxtSigmas, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 10, 15, 0, 0)); | |
415 | fTxtSigmas->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtons1D(=111)"); | |
416 | fTxtSigmas->SetToolTipText("Enter sigma intervals you would like to be indicated by lines. \nExample: '2; 4; 6'"); | |
417 | ||
418 | fContCumuLR = new TGCompositeFrame(fContDrawOpt1DSubNSC, 200, 23, kHorizontalFrame | kFitWidth | kFitHeight); | |
419 | fContDrawOpt1DSubNSC->AddFrame(fContCumuLR, new TGLayoutHints(kLHintsExpandX, 0, 0, 5, 0)); | |
420 | ||
421 | fContCumLeft = new TGCompositeFrame(fContCumuLR, 200, 23, kVerticalFrame | kFitWidth | kFitHeight); | |
422 | fContCumuLR->AddFrame(fContCumLeft, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0)); | |
423 | ||
424 | fRadioCumulative = new TGRadioButton(fContCumLeft, "Cumulative", 112); | |
425 | fContCumLeft->AddFrame(fRadioCumulative, new TGLayoutHints(kLHintsNormal, 0, 10, 0, 0)); | |
426 | fRadioCumulative->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtons1D()"); | |
427 | fRadioCumulative->SetToolTipText("Draw the cumulative (SigmaCut) of the given selection. \nThe data distribution is integrated, starting from the mean/median/LTM."); | |
428 | ||
429 | fCheckCumulativePM = new TGCheckButton(fContCumLeft, "Plus/Minus"); | |
430 | fContCumLeft->AddFrame(fCheckCumulativePM, new TGLayoutHints(kLHintsNormal, 10, 15, 0, 0)); | |
431 | fCheckCumulativePM->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtons1D()"); | |
432 | fCheckCumulativePM->SetToolTipText("Decide whether you want the cumulative integration for each direction (+/-) \nor only for the absolute distance to the mean/median/LTM value."); | |
433 | ||
434 | fRadioIntegrate = new TGRadioButton(fContCumLeft, "Integrate", 113); | |
435 | fContCumLeft->AddFrame(fRadioIntegrate, new TGLayoutHints(kLHintsNormal, 0, 0, 5, 0)); | |
436 | fRadioIntegrate->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtons1D()"); | |
437 | fRadioIntegrate->SetToolTipText("Draw the integral of the given selection."); | |
438 | ||
439 | fContCumRight = new TGCompositeFrame(fContCumuLR, 200, 23, kVerticalFrame | kFitWidth | kFitHeight); | |
440 | fContCumuLR->AddFrame(fContCumRight, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0)); | |
441 | ||
442 | fLblSigmaMax = new TGLabel(fContCumRight, "SigmaMax:"); | |
443 | fLblSigmaMax->SetTextJustify(kTextLeft); | |
444 | fContCumRight->AddFrame(fLblSigmaMax, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 5, 0, 0, 0)); | |
445 | ||
446 | fTxtSigmaMax = new TGTextEntry(fContCumRight, "5", 112); | |
447 | fContCumRight->AddFrame(fTxtSigmaMax, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 10, 15, 0, 0)); | |
448 | fTxtSigmaMax->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtons1D(=112)"); | |
449 | fTxtSigmaMax->SetToolTipText("Enter up to which multiple of sigma you want to integrate."); | |
450 | ||
451 | ||
452 | fContDrawOpt1DSubMML = new TGCompositeFrame(fcontDrawOpt1DSubLR, 200, 23, kHorizontalFrame | kFitWidth | kFitHeight); | |
453 | fcontDrawOpt1DSubLR->AddFrame(fContDrawOpt1DSubMML, new TGLayoutHints(kLHintsExpandX, 0, 0, 5, 0)); | |
454 | ||
455 | // -------------- content of fcontDrawOpt1DSubLR | |
456 | fChkMean = new TGCheckButton(fContDrawOpt1DSubMML, "Mean"); | |
457 | fContDrawOpt1DSubMML->AddFrame(fChkMean, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0)); | |
458 | fChkMean->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtons1D()"); | |
459 | fChkMean->SetToolTipText("Activate Mean for Sigma/Cumulative/Integrate"); | |
460 | ||
461 | fChkMedian = new TGCheckButton(fContDrawOpt1DSubMML, "Median"); | |
462 | fContDrawOpt1DSubMML->AddFrame(fChkMedian, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0)); | |
463 | fChkMedian->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtons1D()"); | |
464 | fChkMedian->SetToolTipText("Activate Median for Sigma/Cumulative/Integrate"); | |
465 | ||
466 | fChkLTM = new TGCheckButton(fContDrawOpt1DSubMML, "LTM"); | |
467 | fContDrawOpt1DSubMML->AddFrame(fChkLTM, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0)); | |
468 | fChkLTM->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtons1D()"); | |
469 | fChkLTM->SetToolTipText("Activate LTM for Sigma/Cumulative/Integrate"); | |
470 | ||
471 | ||
472 | // statistic options container *** fcontStatOpt1D *** " Statistic options " | |
473 | fContStatOpt = new TGGroupFrame(ftabLeft1, "Statistic options", kVerticalFrame | kFitWidth | kFitHeight); | |
474 | ftabLeft1->AddFrame(fContStatOpt, new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0)); | |
475 | ||
476 | fChkStatName = new TGCheckButton(fContStatOpt, "Name"); | |
477 | fContStatOpt->AddFrame(fChkStatName, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0)); | |
478 | fChkStatName->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()"); | |
479 | fChkStatName->SetToolTipText("Display the name in the statistics legend."); | |
480 | ||
481 | fChkStatEntries = new TGCheckButton(fContStatOpt, "Entries"); | |
482 | fContStatOpt->AddFrame(fChkStatEntries, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0)); | |
483 | fChkStatEntries->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()"); | |
484 | fChkStatEntries->SetToolTipText("Display the number of entries in the statistics legend."); | |
485 | ||
486 | fContStatMean = new TGCompositeFrame(fContStatOpt, 1, 1, kHorizontalFrame | kFitWidth | kFitHeight); | |
487 | fContStatOpt->AddFrame(fContStatMean, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0)); | |
488 | ||
489 | fChkStatMean = new TGCheckButton(fContStatMean, "Mean"); | |
490 | fContStatMean->AddFrame(fChkStatMean, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0)); | |
491 | fChkStatMean->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()"); | |
492 | fChkStatMean->SetToolTipText("Display the mean value of the data in the statistics legend."); | |
493 | ||
494 | fChkStatMeanPM = new TGCheckButton(fContStatMean, "+- Error"); | |
495 | fContStatMean->AddFrame(fChkStatMeanPM, new TGLayoutHints(kLHintsNormal, 10, 0, 0, 0)); | |
496 | fChkStatMeanPM->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()"); | |
497 | fChkStatMeanPM->SetToolTipText("Display the mean value's error in the statistics legend."); | |
498 | ||
499 | fContStatRMS = new TGCompositeFrame(fContStatOpt, 1, 1, kHorizontalFrame | kFitWidth | kFitHeight); | |
500 | fContStatOpt->AddFrame(fContStatRMS, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0)); | |
501 | ||
502 | fChkStatRMS = new TGCheckButton(fContStatRMS, "RMS"); | |
503 | fContStatRMS->AddFrame(fChkStatRMS, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0)); | |
504 | fChkStatRMS->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()"); | |
505 | fChkStatRMS->SetToolTipText("Display the RMS value of the data in the statistics legend."); | |
506 | ||
507 | fChkStatRMSPM = new TGCheckButton(fContStatRMS, "+- Error"); | |
508 | fContStatRMS->AddFrame(fChkStatRMSPM, new TGLayoutHints(kLHintsNormal, 10, 0, 0, 0)); | |
509 | fChkStatRMSPM->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()"); | |
510 | fChkStatRMSPM->SetToolTipText("Display the RMS value's error in the statistics legend."); | |
511 | ||
512 | fChkStatUnderflow = new TGCheckButton(fContStatOpt, "Underflow"); | |
513 | fContStatOpt->AddFrame(fChkStatUnderflow, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0)); | |
514 | fChkStatUnderflow->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()"); | |
515 | fChkStatUnderflow->SetToolTipText("Display the number of entries in the underflow bin."); | |
516 | ||
517 | fChkStatOverflow = new TGCheckButton(fContStatOpt, "Overflow"); | |
518 | fContStatOpt->AddFrame(fChkStatOverflow, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0)); | |
519 | fChkStatOverflow->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()"); | |
520 | fChkStatOverflow->SetToolTipText("Display the number of entries in the overflow bin."); | |
521 | ||
522 | fChkStatIntegral = new TGCheckButton(fContStatOpt, "Integral"); | |
523 | fContStatOpt->AddFrame(fChkStatIntegral, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0)); | |
524 | fChkStatIntegral->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()"); | |
525 | fChkStatIntegral->SetToolTipText("Display the integral of the data in the statistics legend."); | |
526 | ||
527 | fContStatSkew = new TGCompositeFrame(fContStatOpt, 1, 1, kHorizontalFrame | kFitWidth | kFitHeight); | |
528 | fContStatOpt->AddFrame(fContStatSkew, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0)); | |
529 | ||
530 | fChkStatSkewness = new TGCheckButton(fContStatSkew, "Skewness"); | |
531 | fContStatSkew->AddFrame(fChkStatSkewness, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0)); | |
532 | fChkStatSkewness->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()"); | |
533 | fChkStatSkewness->SetToolTipText("Display the skewness of the data in the statistics legend. \nBe careful! Sometimes the skewness causes a floating point exception that hangs the GUI!"); | |
534 | ||
535 | fChkStatSkewnessPM = new TGCheckButton(fContStatSkew, "+- Error"); | |
536 | fContStatSkew->AddFrame(fChkStatSkewnessPM, new TGLayoutHints(kLHintsNormal, 10, 0, 0, 0)); | |
537 | fChkStatSkewnessPM->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()"); | |
538 | fChkStatSkewnessPM->SetToolTipText("Display the skewness' error in the statistics legend."); | |
539 | ||
540 | fContStatKurt = new TGCompositeFrame(fContStatOpt, 1, 1, kHorizontalFrame | kFitWidth | kFitHeight); | |
541 | fContStatOpt->AddFrame(fContStatKurt, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0)); | |
542 | ||
543 | fChkStatKurtosis = new TGCheckButton(fContStatKurt, "Kurtosis"); | |
544 | fContStatKurt->AddFrame(fChkStatKurtosis, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0)); | |
545 | fChkStatKurtosis->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()"); | |
546 | fChkStatKurtosis->SetToolTipText("Display the kurtosis of the data in the statistics legend."); | |
547 | ||
548 | fChkStatKurtosisPM = new TGCheckButton(fContStatKurt, "+- Error"); | |
549 | fContStatKurt->AddFrame(fChkStatKurtosisPM, new TGLayoutHints(kLHintsNormal, 10, 0, 0, 0)); | |
550 | fChkStatKurtosisPM->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsStat()"); | |
551 | fChkStatKurtosisPM->SetToolTipText("Display the kurtosis' error in the statistics legend."); | |
552 | ||
553 | fBtnUnchekAll = new TGTextButton(fContStatOpt, "&Uncheck all"); | |
554 | fContStatOpt->AddFrame(fBtnUnchekAll, new TGLayoutHints(kLHintsExpandX, 10, 10, 0, 0)); | |
555 | //fBtnDraw->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoTest(=\"fBtnDraw clicked\")"); | |
556 | fBtnUnchekAll->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "UnchekAllStat()"); | |
557 | fBtnUnchekAll->SetToolTipText("Disable all statistics legend entries, \nno statistics legend."); | |
558 | ||
559 | ||
560 | // custom options container | |
561 | // --- fComboCustom --- the custom draw line on the very low | |
562 | fContCustom = new TGCompositeFrame(fContTopBottom, 200, 200, kHorizontalFrame | kFitWidth | kFitHeight); | |
563 | fContTopBottom->AddFrame(fContCustom, new TGLayoutHints(kLHintsExpandX, 10, 0, 0, 0)); | |
564 | ||
565 | // ------------------------- content of fContCustom ------------------------- | |
566 | fLblCustomDraw = new TGLabel(fContCustom, "Custom draw: "); | |
567 | fLblCustomDraw->SetTextJustify(kTextLeft); | |
568 | fContCustom->AddFrame(fLblCustomDraw, new TGLayoutHints(kLHintsNormal, 5, 0, 0, 0)); | |
569 | // text field for custom draw command | |
570 | fComboCustom = new TGComboBox(fContCustom); | |
571 | fComboCustom->Resize(0, fBtnDraw->GetDefaultHeight()); | |
572 | fComboCustom->EnableTextInput(kTRUE); | |
573 | fContCustom->AddFrame(fComboCustom, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0)); | |
574 | fComboCustom->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsGeneral(=42)"); | |
575 | fComboCustom->Connect("Selected(Int_t)", "AliTPCCalibViewerGUI", this, "DoNewSelection()"); | |
576 | ||
577 | ||
578 | // additional cuts container | |
579 | fContAddCuts = new TGCompositeFrame(fContTopBottom, 200, 200, kHorizontalFrame | kFitWidth | kFitHeight); | |
580 | fContTopBottom->AddFrame(fContAddCuts, new TGLayoutHints(kLHintsExpandX, 10, 0, 0, 0)); | |
581 | ||
582 | // ------------------------- content of fContAddCuts ------------------------- | |
583 | fLblAddCuts = new TGLabel(fContAddCuts, "Custom cuts: "); | |
584 | fLblAddCuts->SetTextJustify(kTextLeft); | |
585 | fContAddCuts->AddFrame(fLblAddCuts, new TGLayoutHints(kLHintsNormal, 5, 0, 0, 0)); | |
586 | // combo text field for additional cuts | |
587 | fComboAddCuts = new TGComboBox(fContAddCuts); | |
588 | fComboAddCuts->Resize(0, fBtnDraw->GetDefaultHeight()); | |
589 | fComboAddCuts->EnableTextInput(kTRUE); | |
590 | fContAddCuts->AddFrame(fComboAddCuts, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0)); | |
591 | fComboAddCuts->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsCuts(=31)"); | |
592 | fComboAddCuts->Connect("Selected(Int_t)", "AliTPCCalibViewerGUI", this, "DoNewSelection()"); | |
593 | ||
594 | // ========================================================================== | |
595 | // ************************* content of fContCenter ************************* | |
596 | // ======================================================================== | |
597 | // main drawing canvas | |
598 | fCanvMain = new TRootEmbeddedCanvas("Main_Canvas", fContCenter, 200, 200, kFitWidth | kFitHeight); | |
599 | fContCenter->AddFrame(fCanvMain, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0)); | |
600 | fCanvMain->GetCanvas()->Connect("ProcessedEvent(Int_t, Int_t, Int_t, TObject*)", "AliTPCCalibViewerGUI", this, "MouseMove(Int_t, Int_t, Int_t, TObject*)"); | |
601 | fCanvMain->GetCanvas()->Connect("RangeAxisChanged()", "AliTPCCalibViewerGUI", this, "GetMinMax()"); | |
602 | fCanvMain->GetCanvas()->SetToolTipText("The Main_Canvas, here your plots are displayed."); | |
603 | ||
604 | ||
605 | // ========================================================================= | |
606 | // ************************* content of fContRight ************************* | |
607 | // ======================================================================== | |
608 | ||
609 | // tabs on the right side: | |
610 | ftabRight = new TGTab(fContRight); | |
611 | fContRight->AddFrame(ftabRight, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 8, 0)); | |
612 | fTabRight0 = ftabRight->AddTab("Basic"); | |
613 | fTabRight1 = ftabRight->AddTab("Advanced"); | |
614 | ||
615 | ||
616 | // **************************** content of tabLeft0 ******************************* | |
617 | // cut options container | |
618 | fContCuts = new TGGroupFrame(fTabRight0, "Cuts", kVerticalFrame | kFitWidth | kFitHeight); | |
619 | fTabRight0->AddFrame(fContCuts, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0)); | |
620 | ||
621 | ||
622 | // ************************* content of fContCuts ************************* | |
623 | // TPC radio button | |
624 | fRadioTPC = new TGRadioButton(fContCuts, "Whole TPC", 20); | |
625 | fContCuts->AddFrame(fRadioTPC, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0)); | |
626 | fRadioTPC->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsCuts()"); | |
627 | fRadioTPC->SetToolTipText("No cuts, use the whole TPC. \nIn 2D mode, A side and C side are superimposed!"); | |
628 | ||
629 | // side A radio button | |
630 | fRadioSideA = new TGRadioButton(fContCuts, "Side A", 21); | |
631 | fContCuts->AddFrame(fRadioSideA, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0)); | |
632 | fRadioSideA->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsCuts()"); | |
633 | fRadioSideA->SetToolTipText("Use only side A."); | |
634 | ||
635 | // side C radio button | |
636 | fRadioSideC = new TGRadioButton(fContCuts, "Side C", 22); | |
637 | fContCuts->AddFrame(fRadioSideC, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0)); | |
638 | fRadioSideC->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsCuts()"); | |
639 | fRadioSideC->SetToolTipText("Use only side C."); | |
640 | ||
641 | // roc radio button | |
642 | fRadioROC = new TGRadioButton(fContCuts, "ROC", 23); | |
643 | fContCuts->AddFrame(fRadioROC, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0)); | |
644 | fRadioROC->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsCuts()"); | |
645 | fRadioROC->SetToolTipText("Use only one ROC (readout chamber)."); | |
646 | ||
647 | // sector radio button | |
648 | fRadioSector = new TGRadioButton(fContCuts, "Sector", 24); | |
649 | fContCuts->AddFrame(fRadioSector, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0)); | |
650 | fRadioSector->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsCuts()"); | |
651 | fRadioSector->SetToolTipText("Use only one Sector (0-17 A-Side, 18-35 C-Side)."); | |
652 | ||
653 | // sector options container | |
654 | fContSector = new TGCompositeFrame(fContCuts, 200, 200, kHorizontalFrame | kFitWidth | kFitHeight); | |
655 | fContCuts->AddFrame(fContSector, new TGLayoutHints(kLHintsExpandX, 5, 0, 0, 0)); | |
656 | ||
657 | // ------------------------- content of fContSector ------------------------- | |
658 | // sector number entry | |
659 | fNmbSector = new TGNumberEntry(fContSector, 0, 1, -1, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, 71); | |
660 | fContSector->AddFrame(fNmbSector, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0)); | |
661 | fNmbSector->Connect("ValueSet(Long_t)", "AliTPCCalibViewerGUI", this, "ChangeSector()"); | |
662 | ||
663 | // sector number label | |
664 | fLblSector = new TGLabel(fContSector, "IROC, A"); | |
665 | fLblSector->SetTextJustify(kTextLeft); | |
666 | fContSector->AddFrame(fLblSector, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 5, 0, 0, 0)); | |
667 | ||
668 | // cut zeros check button | |
669 | fChkCutZero = new TGCheckButton(fContCuts, "Cut zeros"); | |
670 | fContCuts->AddFrame(fChkCutZero, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0)); | |
671 | fChkCutZero->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoNewSelection()"); | |
672 | fChkCutZero->SetToolTipText("Use only values that are not zero. \nWhen doing a custom draw this cut is composed of the draw string\nup to the first ':' or '>>' and the condition that this should not be zero."); | |
673 | ||
674 | // additional cuts check button | |
675 | fChkAddCuts = new TGCheckButton(fContCuts, "Custom cuts"); | |
676 | fContCuts->AddFrame(fChkAddCuts, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0)); | |
677 | fChkAddCuts->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoNewSelection()"); | |
678 | fChkAddCuts->SetToolTipText("Activate the custom cuts on the bottom. Remember '~' (= '.fElements')!"); | |
679 | // fContAddCuts' content is locaed further op | |
680 | ||
681 | ||
682 | // Scaling options container | |
683 | fContScaling = new TGGroupFrame(fTabRight0, "Scaling", kVerticalFrame | kFitWidth | kFitHeight); | |
684 | fTabRight0->AddFrame(fContScaling, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0)); | |
685 | ||
686 | // ************************* content of fContScaling ************************* | |
687 | // SetMaximum container | |
688 | fContSetMax = new TGCompositeFrame(fContScaling, 200, 200, kVerticalFrame | kFitWidth | kFitHeight); | |
689 | fContScaling->AddFrame(fContSetMax, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0)); | |
690 | ||
691 | // ------------------------- content of fContSetMax ------------------------- | |
692 | // SetMaximum - checkbox | |
693 | fChkSetMax = new TGCheckButton(fContSetMax, "Set fixed max."); | |
694 | fContSetMax->AddFrame(fChkSetMax, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0)); | |
695 | fChkSetMax->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw()"); | |
696 | fChkSetMax->SetToolTipText("Set the maximum fixed to the value specified here."); | |
697 | ||
698 | // text field for maximum value | |
699 | fTxtSetMax = new TGTextEntry(fContSetMax, "", 41); | |
700 | fContSetMax->AddFrame(fTxtSetMax, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0)); | |
701 | fTxtSetMax->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw()"); | |
702 | fTxtSetMax->SetToolTipText("maximum value for the drawing"); | |
703 | ||
704 | // SetMinimum container | |
705 | fContSetMin = new TGCompositeFrame(fContScaling, 200, 200, kVerticalFrame | kFitWidth | kFitHeight); | |
706 | fContScaling->AddFrame(fContSetMin, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0)); | |
707 | ||
708 | // ------------------------- content of fContSetMin ------------------------- | |
709 | // SetMinimum - checkbox | |
710 | fChkSetMin = new TGCheckButton(fContSetMin, "Set fixed min."); | |
711 | fContSetMin->AddFrame(fChkSetMin, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0)); | |
712 | fChkSetMin->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw()"); | |
713 | fChkSetMin->SetToolTipText("Set the minimum fixed to the value specified here."); | |
714 | ||
715 | // text field for minimum value | |
716 | fTxtSetMin = new TGTextEntry(fContSetMin, "", 40); | |
717 | fContSetMin->AddFrame(fTxtSetMin, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0)); | |
718 | fTxtSetMin->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw()"); | |
719 | fTxtSetMin->SetToolTipText("minimum value for the drawing"); | |
720 | ||
721 | // get Min & Max from Plot - button | |
722 | fBtnGetMinMax = new TGTextButton(fContScaling, "&Get scale from plot"); | |
723 | fContScaling->AddFrame(fBtnGetMinMax, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0)); | |
724 | fBtnGetMinMax->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "GetMinMax()"); | |
725 | fBtnGetMinMax->SetToolTipText("Get min and max from plot, e.g. after rescaling by dragging the palette. \nObsolete! The button's function will change to 'Unzoom all'."); | |
726 | ||
727 | // GetMinMaxAuto - checkbox | |
728 | fChkGetMinMaxAuto = new TGCheckButton(fContScaling, "Get Min + Max auto."); | |
729 | fContScaling->AddFrame(fChkGetMinMaxAuto, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0)); | |
730 | fChkGetMinMaxAuto->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw()"); | |
731 | fChkGetMinMaxAuto->SetToolTipText("Get minimum and maximum automatically from each new plot. \nDeactivate this, if you want to 'save' your specified minimum and maximum."); | |
732 | ||
733 | // labeling container *** fContLabeling *** " Labeling " | |
734 | fContLabeling = new TGGroupFrame(fTabRight0, "Labeling", kVerticalFrame | kFitWidth | kFitHeight); | |
735 | fTabRight0->AddFrame(fContLabeling, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0)); | |
736 | ||
737 | fChkLabelTitle = new TGCheckButton(fContLabeling, "Set title:"); | |
738 | fContLabeling->AddFrame(fChkLabelTitle, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0)); | |
739 | fChkLabelTitle->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw()"); | |
740 | fChkLabelTitle->SetToolTipText("Set the plot title."); | |
741 | ||
742 | fTxtLabelTitle = new TGTextEntry(fContLabeling, "Title", 500); | |
743 | fContLabeling->AddFrame(fTxtLabelTitle, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0)); | |
744 | fTxtLabelTitle->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw(=50)"); | |
745 | fTxtLabelTitle->SetToolTipText("plot title"); | |
746 | ||
747 | fChkLabelXaxis = new TGCheckButton(fContLabeling, "Set X-axis label:"); | |
748 | fContLabeling->AddFrame(fChkLabelXaxis, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0)); | |
749 | fChkLabelXaxis->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw()"); | |
750 | fChkLabelXaxis->SetToolTipText("Set the X-axis label."); | |
751 | ||
752 | fTxtLabelXaxis = new TGTextEntry(fContLabeling, "XaxisLabel", 500); | |
753 | fContLabeling->AddFrame(fTxtLabelXaxis, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0)); | |
754 | fTxtLabelXaxis->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw(=51)"); | |
755 | fTxtLabelXaxis->SetToolTipText("X-axis label"); | |
756 | ||
757 | fChkLabelYaxis = new TGCheckButton(fContLabeling, "Set Y-axis label:"); | |
758 | fContLabeling->AddFrame(fChkLabelYaxis, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0)); | |
759 | fChkLabelYaxis->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw()"); | |
760 | fChkLabelYaxis->SetToolTipText("Set the Y-axis label."); | |
761 | ||
762 | fTxtLabelYaxis = new TGTextEntry(fContLabeling, "YaxisLabel", 500); | |
763 | fContLabeling->AddFrame(fTxtLabelYaxis, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0)); | |
764 | fTxtLabelYaxis->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw(=52)"); | |
765 | fTxtLabelYaxis->SetToolTipText("Y-axis label"); | |
766 | ||
767 | fChkLabelGetAuto = new TGCheckButton(fContLabeling, "Get labels auto."); | |
768 | fContLabeling->AddFrame(fChkLabelGetAuto, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0)); | |
769 | fChkLabelGetAuto->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw()"); | |
770 | fChkLabelGetAuto->SetToolTipText("Get labels automatically from each new plot \nDeactivate this, if you want to 'save' your specified labels."); | |
771 | ||
772 | ||
773 | // **************************** content of ftabRight1 ******************************* | |
774 | // Save container | |
775 | fContSave = new TGGroupFrame(fTabRight1, "Save", kVerticalFrame | kFitWidth | kFitHeight); | |
776 | fTabRight1->AddFrame(fContSave, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0)); | |
777 | // save button | |
778 | fBtnSave = new TGTextButton(fContSave, "&Save picture"); | |
779 | fContSave->AddFrame(fBtnSave, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0)); | |
780 | fBtnSave->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "SavePicture()"); | |
781 | fBtnSave->SetToolTipText("Open a 'Save as...' dialog to save the current plot as picture or macro."); | |
782 | ||
783 | // additional save options container | |
784 | fContAddSaveOpt = new TGCompositeFrame(fContSave, 200, 200, kVerticalFrame | kFitWidth | kFitHeight); | |
785 | fContSave->AddFrame(fContAddSaveOpt, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0)); | |
786 | ||
787 | // content of --- fContAddSaveOpt --- | |
788 | // addition save options label | |
789 | fChkAddSaveOpt = new TGCheckButton(fContAddSaveOpt, "Save options:"); | |
790 | fContAddSaveOpt->AddFrame(fChkAddSaveOpt, new TGLayoutHints(kLHintsNormal | kLHintsExpandX)); | |
791 | fChkAddSaveOpt->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoNewSelection()"); | |
792 | fChkAddSaveOpt->SetToolTipText("Additional save options (see documentation for TPad::Print())."); | |
793 | ||
794 | // additional save options combo box | |
795 | fComboAddSaveOpt = new TGComboBox(fContAddSaveOpt); | |
796 | fContAddSaveOpt->AddFrame(fComboAddSaveOpt, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0)); | |
797 | fComboAddSaveOpt->Resize(0, fBtnDraw->GetDefaultHeight()); | |
798 | fComboAddSaveOpt->EnableTextInput(kTRUE); | |
799 | fComboAddSaveOpt->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "SavePicture()"); | |
800 | // fComboAddSaveOpt->Connect("Selected(Int_t)", "AliTPCCalibViewerGUI", this, "SavePicture()"); | |
801 | ||
802 | // calPad export container | |
803 | fContExport = new TGGroupFrame(fTabRight1, "Export AliTPCCalPad", kVerticalFrame | kFitWidth | kFitHeight); | |
804 | fTabRight1->AddFrame(fContExport, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0)); | |
805 | ||
806 | // ------------------------- content of fContExport ------------------------- | |
807 | // container for export name | |
808 | fContAddExport = new TGCompositeFrame(fContExport, 200, 200, kVerticalFrame | kFitWidth | kFitHeight); | |
809 | fContExport->AddFrame(fContAddExport, new TGLayoutHints(kLHintsExpandX, -5, -5, 0, 0)); | |
810 | ||
811 | fComboExportName = new TGComboBox(fContAddExport); | |
812 | fComboExportName->Resize(0, fBtnDraw->GetDefaultHeight()); | |
813 | fContAddExport->AddFrame(fComboExportName, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0)); | |
814 | fComboExportName->AddEntry("calPad", 0); // first default value | |
815 | fComboExportName->Select(0); // select default value before connecting | |
816 | fComboExportName->EnableTextInput(kTRUE); | |
817 | fComboExportName->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "DoExport()"); | |
818 | fComboExportName->Connect("Selected(Int_t)", "AliTPCCalibViewerGUI", this, "DoExport()"); | |
819 | ||
820 | // export button | |
821 | fBtnExport = new TGTextButton(fContExport, "&Export to CINT"); | |
822 | fContExport->AddFrame(fBtnExport, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0)); | |
823 | fBtnExport->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoExport()"); | |
824 | fBtnExport->SetToolTipText("Export the current 2D view as AliTPCCalPad to the CINT command line interpreter, use the specified name. \nThis works only in 2D mode."); | |
825 | ||
826 | // add to normalisation button | |
827 | fBtnAddNorm = new TGTextButton(fContExport, "&Add to normalization"); | |
828 | fContExport->AddFrame(fBtnAddNorm, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0)); | |
829 | fBtnAddNorm->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoExportNorm()"); | |
830 | fBtnAddNorm->SetToolTipText("Use the current 2D view as normalization variable, use the specified name. \nNot yet working!"); | |
831 | ||
832 | // Tree container | |
833 | fContTree = new TGGroupFrame(fTabRight1, "Tree", kVerticalFrame | kFitWidth | kFitHeight); | |
834 | fTabRight1->AddFrame(fContTree, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0)); | |
835 | ||
836 | // dump tree to file button | |
837 | fBtnDumpToFile = new TGTextButton(fContTree, "&Dump to File"); | |
838 | fContTree->AddFrame(fBtnDumpToFile, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0)); | |
839 | fBtnDumpToFile->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoDumpToFile()"); | |
840 | fBtnDumpToFile->SetToolTipText("Write the exported CalPads to a new CalibTree"); | |
841 | ||
842 | // dump tree to file button | |
843 | fBtnLoadTree = new TGTextButton(fContTree, "&Load Tree"); | |
844 | fContTree->AddFrame(fBtnLoadTree, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0)); | |
845 | fBtnLoadTree->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoLoadTree()"); | |
846 | fBtnLoadTree->SetToolTipText("Load and initialize a new calibration tree. "); | |
847 | ||
848 | fChkAddAsReference = new TGCheckButton(fContTree, "as reference:"); | |
849 | fContTree->AddFrame(fChkAddAsReference, new TGLayoutHints(kLHintsNormal | kLHintsExpandX)); | |
850 | fChkAddAsReference->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoLoadTree()"); | |
851 | fChkAddAsReference->SetToolTipText("To add a new tree as reference tree."); | |
852 | ||
853 | fTxtRefName = new TGTextEntry(fContTree, "R", 500); | |
854 | fContTree->AddFrame(fTxtRefName, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 15, 0, 0, 0)); | |
855 | // fTxtRefName->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw(=50)"); | |
856 | fTxtRefName->SetToolTipText("Reference Name"); | |
857 | ||
858 | ||
859 | // Fit options container | |
860 | fContFit = new TGGroupFrame(fTabRight1, "Custom fit", kVerticalFrame | kFitWidth | kFitHeight); | |
861 | fTabRight1->AddFrame(fContFit, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0)); | |
862 | ||
863 | // ------------------------- content of fContFit ------------------------- | |
864 | // container for additional fits | |
865 | fContAddFit = new TGCompositeFrame(fContFit, 200, 200, kVerticalFrame | kFitWidth | kFitHeight); | |
866 | fContFit->AddFrame(fContAddFit, new TGLayoutHints(kLHintsExpandX, -5, -5, 0, 0)); | |
867 | ||
868 | // --- content of fContAddFit --- | |
869 | // text field for custom fit | |
870 | fComboCustomFit = new TGComboBox(fContAddFit); | |
871 | fComboCustomFit->Resize(0, fBtnDraw->GetDefaultHeight()); | |
872 | fComboCustomFit->EnableTextInput(kTRUE); | |
873 | fContAddFit->AddFrame(fComboCustomFit, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0)); | |
874 | fComboCustomFit->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "DoFit()"); | |
875 | fComboCustomFit->Connect("Selected(Int_t)", "AliTPCCalibViewerGUI", this, "DoFit()"); | |
876 | ||
877 | // fit button | |
878 | fBtnFit = new TGTextButton(fContAddFit, "&Fit"); | |
879 | fContAddFit->AddFrame(fBtnFit, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0)); | |
880 | fBtnFit->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoFit()"); | |
881 | fBtnFit->SetToolTipText("Fit a whole TPC side, e.g. with gx~ ++ gy~, the result is printed to the console \nNot yet final status."); | |
882 | ||
883 | // add fit function button | |
884 | //fBtnAddFitFunction = new TGTextButton(fContAddFit, "&Add fit function to normalization"); | |
885 | //fContAddFit->AddFrame(fBtnAddFitFunction, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0)); | |
886 | //fBtnAddFitFunction->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "AddFitFunction()"); | |
887 | ||
888 | SetWindowName("AliTPCCalibViewer GUI"); | |
889 | MapSubwindows(); | |
890 | Resize(GetDefaultSize()); | |
891 | MapWindow(); | |
892 | } | |
893 | ||
894 | ||
895 | void AliTPCCalibViewerGUI::SetInitialValues() { | |
896 | // | |
897 | // Set the default button states | |
898 | // | |
899 | fChkAuto->SetState(kButtonUp); | |
900 | fRadioPredefined->SetState(kButtonDown); | |
901 | fRadioRaw->SetState(kButtonDown); | |
902 | fRadioTPC->SetState(kButtonDown); | |
903 | fRadio1D->SetState(kButtonDown); | |
904 | fChkAddCuts->SetState(kButtonUp); | |
905 | fChkGetMinMaxAuto->SetState(kButtonDown); | |
906 | fChkSetMin->SetState(kButtonUp); | |
907 | fChkSetMax->SetState(kButtonUp); | |
908 | fRadioNorm->SetState(kButtonDown); | |
909 | fRadioSigma->SetState(kButtonUp); | |
910 | fRadioCumulative->SetState(kButtonUp); | |
911 | fChkMean->SetState(kButtonDown); | |
912 | fCheckCumulativePM->SetState(kButtonUp); | |
913 | ||
914 | fChkLabelGetAuto->SetState(kButtonDown); | |
915 | ||
916 | // TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO | |
917 | // TODO Set the checkboxes state as it is really TODO | |
918 | // TODO in gStyle TODO | |
919 | // TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO | |
920 | // k = 1; kurtosis printed | |
921 | // k = 2; kurtosis and kurtosis error printed | |
922 | // s = 1; skewness printed | |
923 | // s = 2; skewness and skewness error printed | |
924 | // i = 1; integral of bins printed | |
925 | // o = 1; number of overflows printed | |
926 | // u = 1; number of underflows printed | |
927 | // r = 1; rms printed | |
928 | // r = 2; rms and rms error printed | |
929 | // m = 1; mean value printed | |
930 | // m = 2; mean and mean error values printed | |
931 | // e = 1; number of entries printed | |
932 | // n = 1; name of histogram is printed | |
933 | // (default = 000001111) | |
934 | ||
935 | Int_t statOpt = gStyle->GetOptStat(); | |
936 | if (statOpt == 1) statOpt = 1111; | |
937 | if (statOpt / 200000000 >= 1) { | |
938 | fChkStatKurtosis->SetState(kButtonDown); | |
939 | fChkStatKurtosisPM->SetState(kButtonDown); | |
940 | statOpt -= 200000000; | |
941 | } | |
942 | if (statOpt / 100000000 >= 1) { | |
943 | fChkStatKurtosis->SetState(kButtonDown); | |
944 | statOpt -= 100000000; | |
945 | } | |
946 | if (statOpt / 20000000 >= 1) { | |
947 | fChkStatSkewness->SetState(kButtonDown); | |
948 | fChkStatSkewnessPM->SetState(kButtonDown); | |
949 | statOpt -= 20000000; | |
950 | } | |
951 | if (statOpt / 10000000 >= 1) { | |
952 | fChkStatSkewness->SetState(kButtonDown); | |
953 | statOpt -= 10000000; | |
954 | } | |
955 | if (statOpt / 1000000 >= 1) { | |
956 | fChkStatIntegral->SetState(kButtonDown); | |
957 | statOpt -= 1000000; | |
958 | } | |
959 | if (statOpt / 100000 >= 1) { | |
960 | fChkStatOverflow->SetState(kButtonDown); | |
961 | statOpt -= 100000; | |
962 | } | |
963 | if (statOpt / 10000 >= 1) { | |
964 | fChkStatUnderflow->SetState(kButtonDown); | |
965 | statOpt -= 10000; | |
966 | } | |
967 | if (statOpt / 2000 >= 1) { | |
968 | fChkStatRMS->SetState(kButtonDown); | |
969 | fChkStatRMSPM->SetState(kButtonDown); | |
970 | statOpt -= 2000; | |
971 | } | |
972 | if (statOpt / 1000 >= 1) { | |
973 | fChkStatRMS->SetState(kButtonDown); | |
974 | statOpt -= 1000; | |
975 | } | |
976 | if (statOpt / 200 >= 1) { | |
977 | fChkStatMean->SetState(kButtonDown); | |
978 | fChkStatMeanPM->SetState(kButtonDown); | |
979 | statOpt -= 200; | |
980 | } | |
981 | if (statOpt / 100 >= 1) { | |
982 | fChkStatMean->SetState(kButtonDown); | |
983 | statOpt -= 100; | |
984 | } | |
985 | if (statOpt / 10 >= 1) { | |
986 | fChkStatEntries->SetState(kButtonDown); | |
987 | statOpt -= 10; | |
988 | } | |
989 | if (statOpt / 1 >= 1) { | |
990 | fChkStatName->SetState(kButtonDown); | |
991 | statOpt -= 1; | |
992 | } | |
993 | ||
994 | /* | |
995 | fChkStatName->SetState(kButtonDown); | |
996 | fChkStatEntries->SetState(kButtonDown); | |
997 | fChkStatMean->SetState(kButtonDown); | |
998 | fChkStatRMS->SetState(kButtonDown); | |
999 | */ | |
1000 | // fChkStatMeanPM->SetState(kButtonUp); | |
1001 | // fChkStatRMSPM->SetState(kButtonUp); | |
1002 | // fChkStatUnderflow->SetState(kButtonUp); | |
1003 | // fChkStatOverflow->SetState(kButtonUp); | |
1004 | // fChkStatIntegral->SetState(kButtonUp); | |
1005 | // fChkStatSkewness->SetState(kButtonUp); | |
1006 | // fChkStatSkewnessPM->SetState(kButtonUp); | |
1007 | // fChkStatKurtosis->SetState(kButtonDown); | |
1008 | // fChkStatKurtosisPM->SetState(kButtonDown); | |
1009 | ||
1010 | // fill fComboAddDrawOpt with some additional drawing options | |
1011 | fComboAddDrawOpt->AddEntry("same", 0); | |
1012 | fComboAddDrawOpt->AddEntry("profbox", 1); | |
1013 | fComboAddDrawOpt->AddEntry("profcolz", 2); | |
1014 | fComboAddDrawOpt->AddEntry("profcont0", 3); | |
1015 | fComboAddDrawOpt->AddEntry("proflego", 4); | |
1016 | fComboAddDrawOpt->AddEntry("proflego2", 5); | |
1017 | fComboAddDrawOpt->AddEntry("profsurf", 6); | |
1018 | fComboAddDrawOpt->AddEntry("profsurf1", 7); | |
1019 | fComboAddDrawOpt->AddEntry("profsurf2", 8); | |
1020 | fComboAddDrawOpt->AddEntry("box", 9); | |
1021 | fComboAddDrawOpt->AddEntry("colz", 10); | |
1022 | fComboAddDrawOpt->AddEntry("cont0", 11); | |
1023 | fComboAddDrawOpt->AddEntry("lego", 12); | |
1024 | fComboAddDrawOpt->AddEntry("lego2", 13); | |
1025 | fComboAddDrawOpt->AddEntry("surf", 14); | |
1026 | fComboAddDrawOpt->AddEntry("surf1", 15); | |
1027 | fComboAddDrawOpt->AddEntry("surf2", 16); | |
1028 | ||
1029 | // fill fComboAddSaveOpt with some additional drawing options | |
1030 | fComboAddSaveOpt->AddEntry("Portrait", 0); | |
1031 | fComboAddSaveOpt->AddEntry("Landscape", 1); | |
1032 | fComboAddSaveOpt->AddEntry("Preview", 2); | |
1033 | fComboAddSaveOpt->AddEntry("+50", 3); | |
1034 | ||
1035 | // fill fComboMethod | |
1036 | fComboMethod->AddEntry("subtract", 0); | |
1037 | fComboMethod->AddEntry("divide by", 1); | |
1038 | ||
1039 | // fill fComboExportName | |
1040 | // fComboExportName->AddEntry("calPad", 0); | |
1041 | // fComboExportName->AddEntry("calPad2", 1); | |
1042 | fBtnExport->SetEnabled(kFALSE); | |
1043 | fBtnAddNorm->SetEnabled(kFALSE); | |
1044 | ||
1045 | // select initial variables | |
1046 | fListVariables->Select(0); | |
1047 | fListNormalization->Select(0); | |
1048 | fComboMethod->Select(0); | |
1049 | // fComboExportName->Select(0); | |
1050 | // fComboExportName->EnableTextInput(kTRUE); | |
1051 | ||
1052 | //fCanvMain->GetCanvas()->ToggleEventStatus(); // klappt nicht | |
1053 | //fCanvMain->GetCanvas()->GetCanvasImp()->ShowStatusBar(kTRUE); // klappt auch nicht | |
1054 | fListVariables->IntegralHeight(kFALSE); // naja | |
1055 | fListNormalization->IntegralHeight(kFALSE); // naja | |
1056 | fChkAuto->SetState(kButtonDown); | |
1057 | ||
1058 | // Make first drawing: | |
1059 | // DoDraw(); | |
1060 | } | |
1061 | ||
1062 | ||
1063 | AliTPCCalibViewerGUI::AliTPCCalibViewerGUI(const AliTPCCalibViewerGUI &c) | |
1064 | : TGCompositeFrame(c.fParent, c.fWidth, c.fHeight), | |
1065 | fViewer(0), | |
1066 | fPreprocessor(0), | |
1067 | fContTopBottom(0), | |
1068 | fContLCR(0), | |
1069 | fContLeft(0), | |
1070 | ftabLeft(0), | |
1071 | ftabLeft0(0), | |
1072 | ftabLeft1(0), | |
1073 | ftabRight(0), | |
1074 | fTabRight0(0), | |
1075 | fTabRight1(0), | |
1076 | fContRight(0), | |
1077 | fContCenter(0), | |
1078 | fContPlotOpt(0), | |
1079 | fContDrawOpt(0), | |
1080 | fContDrawOptSub1D2D(0), | |
1081 | fContNormalized(0), | |
1082 | fContCustom(0), | |
1083 | fContCuts(0), | |
1084 | fContSector(0), | |
1085 | fContAddCuts(0), | |
1086 | fContFit(0), | |
1087 | fContAddFit(0), | |
1088 | fContScaling(0), | |
1089 | fContSetMax(0), | |
1090 | fContSetMin(0), | |
1091 | fContAddDrawOpt(0), | |
1092 | fListVariables(0), | |
1093 | fBtnDraw(0), | |
1094 | fBtnFit(0), | |
1095 | fBtnAddFitFunction(0), | |
1096 | fBtnGetMinMax(0), | |
1097 | fCanvMain(0), | |
1098 | fRadioRaw(0), | |
1099 | fRadioNormalized(0), | |
1100 | fRadioPredefined(0), | |
1101 | fRadioCustom(0), | |
1102 | fRadio1D(0), | |
1103 | fRadio2D(0), | |
1104 | fRadioTPC(0), | |
1105 | fRadioSideA(0), | |
1106 | fRadioSideC(0), | |
1107 | fRadioROC(0), | |
1108 | fRadioSector(0), | |
1109 | fComboAddDrawOpt(0), | |
1110 | fChkAuto(0), | |
1111 | fChkAutoAppend(0), | |
1112 | fComboMethod(0), | |
1113 | fListNormalization(0), | |
1114 | fComboCustom(0), | |
1115 | fLblCustomDraw(0), | |
1116 | fChkAddDrawOpt(0), | |
1117 | fNmbSector(0), | |
1118 | fLblSector(0), | |
1119 | fChkCutZero(0), | |
1120 | fChkAddCuts(0), | |
1121 | fLblAddCuts(0), | |
1122 | fComboAddCuts(0), | |
1123 | fComboCustomFit(0), | |
1124 | fChkSetMax(0), | |
1125 | fChkSetMin(0), | |
1126 | fChkGetMinMaxAuto(0), | |
1127 | fTxtSetMax(0), | |
1128 | fTxtSetMin(0), | |
1129 | fContDrawOpt1D(0), | |
1130 | fcontDrawOpt1DSubLR(0), | |
1131 | fContDrawOpt1DSubNSC(0), | |
1132 | fRadioNorm(0), | |
1133 | fRadioSigma(0), | |
1134 | fTxtSigmas(0), | |
1135 | fContCumuLR(0), | |
1136 | fContCumLeft(0), | |
1137 | fContCumRight(0), | |
1138 | fLblSigmaMax(0), | |
1139 | fTxtSigmaMax(0), | |
1140 | fRadioCumulative(0), | |
1141 | fCheckCumulativePM(0), | |
1142 | fRadioIntegrate(0), | |
1143 | fContDrawOpt1DSubMML(0), | |
1144 | fChkMean(0), | |
1145 | fChkMedian(0), | |
1146 | fChkLTM(0), | |
1147 | fContStatOpt(0), | |
1148 | fChkStatName(0), | |
1149 | fChkStatEntries(0), | |
1150 | fContStatMean(0), | |
1151 | fChkStatMean(0), | |
1152 | fChkStatMeanPM(0), | |
1153 | fContStatRMS(0), | |
1154 | fChkStatRMS(0), | |
1155 | fChkStatRMSPM(0), | |
1156 | fChkStatUnderflow(0), | |
1157 | fChkStatOverflow(0), | |
1158 | fChkStatIntegral(0), | |
1159 | fContStatSkew(0), | |
1160 | fChkStatSkewness(0), | |
1161 | fChkStatSkewnessPM(0), | |
1162 | fContStatKurt(0), | |
1163 | fChkStatKurtosis(0), | |
1164 | fChkStatKurtosisPM(0), | |
1165 | fBtnUnchekAll(0), | |
1166 | fContLabeling(0), | |
1167 | fChkLabelTitle(0), | |
1168 | fTxtLabelTitle(0), | |
1169 | fChkLabelXaxis(0), | |
1170 | fTxtLabelXaxis(0), | |
1171 | fChkLabelYaxis(0), | |
1172 | fTxtLabelYaxis(0), | |
1173 | fChkLabelGetAuto(0), | |
1174 | fContSave(0), | |
1175 | fBtnSave(0), | |
1176 | fContAddSaveOpt(0), | |
1177 | fChkAddSaveOpt(0), | |
1178 | fComboAddSaveOpt(0), | |
1179 | fContExport(0), | |
1180 | fContAddExport(0), | |
1181 | fComboExportName(0), | |
1182 | fBtnExport(0), | |
1183 | fBtnAddNorm(0), | |
1184 | fContTree(0), | |
1185 | fBtnDumpToFile(0), | |
1186 | fBtnLoadTree(0), | |
1187 | fChkAddAsReference(0), | |
1188 | fTxtRefName(0), | |
1189 | fInitialized(0) | |
1190 | { | |
1191 | // | |
1192 | // dummy AliTPCCalibViewerGUI copy constructor | |
1193 | // | |
1194 | } | |
1195 | ||
1196 | ||
1197 | AliTPCCalibViewerGUI & AliTPCCalibViewerGUI::operator =(const AliTPCCalibViewerGUI & /*param*/) { | |
1198 | // | |
1199 | // dummy assignment operator | |
1200 | // | |
1201 | return (*this); | |
1202 | } | |
1203 | ||
1204 | ||
1205 | AliTPCCalibViewerGUI::~AliTPCCalibViewerGUI() { | |
1206 | // | |
1207 | // Destructor | |
1208 | // | |
1209 | if (fCanvMain && fCanvMain->GetCanvas()) { | |
1210 | for (Int_t i = 0; i < fCanvMain->GetCanvas()->GetListOfPrimitives()->GetEntries(); i++) { | |
1211 | if (strcmp(fCanvMain->GetCanvas()->GetListOfPrimitives()->At(i)->ClassName(), "TFrame") != 0) | |
1212 | fCanvMain->GetCanvas()->GetListOfPrimitives()->At(i)->Delete(); | |
1213 | } | |
1214 | } | |
1215 | Cleanup(); | |
1216 | if (fViewer) fViewer->Delete(); | |
1217 | delete fPreprocessor; | |
1218 | } | |
1219 | ||
1220 | ||
1221 | /* | |
1222 | void AliTPCCalibViewerGUI::CloseWindow() { | |
1223 | DeleteWindow(); | |
1224 | } | |
1225 | */ | |
1226 | ||
1227 | ||
1228 | void AliTPCCalibViewerGUI::Initialize(const char* fileName, const char* treeName) { | |
1229 | // | |
1230 | // initialize the GUI with a calibrationTree from fileName | |
1231 | // | |
1232 | ||
1233 | // create AliTPCCalibViewer object, which will be used for generating all drawings | |
1234 | if (fViewer) delete fViewer; | |
1235 | fViewer = new AliTPCCalibViewer(fileName, treeName); | |
1236 | Initialize(fViewer); | |
1237 | } | |
1238 | ||
1239 | ||
1240 | void AliTPCCalibViewerGUI::Initialize(AliTPCCalibViewer *viewer) { | |
1241 | // | |
1242 | // initializes the GUI with default settings and opens tree for drawing | |
1243 | // | |
1244 | ||
1245 | fViewer = viewer; | |
1246 | TString selectedVariable(""); | |
1247 | TString selectedNormalization(""); | |
1248 | Int_t variableId = -1; | |
1249 | Int_t normalizationId = -1; | |
1250 | if (fInitialized) { | |
1251 | // remember the selected entry | |
1252 | if (fListVariables->GetSelectedEntry()) selectedVariable = fListVariables->GetSelectedEntry()->GetTitle(); | |
1253 | if (fListNormalization->GetSelectedEntry()) selectedNormalization = fListNormalization->GetSelectedEntry()->GetTitle(); | |
1254 | } | |
1255 | ||
1256 | // fill fListVariables, list of drawable variables: | |
1257 | TObjArray* arr = fViewer->GetListOfVariables(); | |
1258 | if (!arr) return; | |
1259 | TIterator* iter = arr->MakeIterator(); | |
1260 | iter->Reset(); | |
1261 | TObjString* currentStr = 0; | |
1262 | Int_t id = 0; | |
1263 | fListVariables->RemoveAll(); | |
1264 | while ((currentStr = (TObjString*)(iter->Next()))) { | |
1265 | fListVariables->AddEntry(currentStr->GetString().Data(), id); | |
1266 | if (fInitialized && currentStr->GetString() == selectedVariable) variableId = id; | |
1267 | id++; | |
1268 | } | |
1269 | ||
1270 | // fill fListNorm, list of normalization variables: | |
1271 | TObjArray *arrNorm = fViewer->GetListOfNormalizationVariables(); | |
1272 | TIterator *iterNorm = arrNorm->MakeIterator(); | |
1273 | iterNorm->Reset(); | |
1274 | currentStr = 0; | |
1275 | id = 0; | |
1276 | fListNormalization->RemoveAll(); | |
1277 | while ((currentStr = (TObjString*)(iterNorm->Next()))) { | |
1278 | fListNormalization->AddEntry(currentStr->GetString().Data(), id); | |
1279 | if (fInitialized && currentStr->GetString() == selectedNormalization) normalizationId = id; | |
1280 | id++; | |
1281 | } | |
1282 | currentStr = 0; | |
1283 | iter->Reset(); | |
1284 | //Add draw variables to the list of normalisation | |
1285 | while ((currentStr = (TObjString*)(iter->Next()))) { | |
1286 | if (currentStr->GetString().BeginsWith("Map")) continue; //don't add mapping information | |
1287 | fListNormalization->AddEntry(currentStr->GetString().Data(), id); | |
1288 | if (fInitialized && currentStr->GetString() == selectedNormalization) normalizationId = id; | |
1289 | id++; | |
1290 | } | |
1291 | ||
1292 | delete iterNorm; | |
1293 | arrNorm->Delete(); | |
1294 | delete arrNorm; | |
1295 | ||
1296 | delete iter; | |
1297 | arr->Delete(); | |
1298 | delete arr; | |
1299 | ||
1300 | // trick do display the entries corectly after reinitialization | |
1301 | // otherwise all the entries would appear as one kryptic entry | |
1302 | // resizing the listbox somehow fixes the problem... | |
1303 | if (fInitialized) fListVariables->Resize(fListVariables->GetWidth()-1, fListVariables->GetHeight()); | |
1304 | if (fInitialized) fListVariables->Resize(fListVariables->GetWidth()+1, fListVariables->GetHeight()); | |
1305 | if (fInitialized) fListNormalization->Resize(fListNormalization->GetWidth()-1, fListNormalization->GetHeight()); | |
1306 | if (fInitialized) fListNormalization->Resize(fListNormalization->GetWidth()+1, fListNormalization->GetHeight()); | |
1307 | ||
1308 | // select the last selected variable and normalization | |
1309 | if (fInitialized && variableId != -1) fListVariables->Select(variableId); | |
1310 | if (fInitialized && normalizationId != -1)fListVariables->Select(normalizationId); | |
1311 | ||
1312 | if (fInitialized) Info("Initialize", "AliTPCCalibViewerGUI new initialized."); | |
1313 | fInitialized = kTRUE; | |
1314 | ||
1315 | } | |
1316 | ||
1317 | void AliTPCCalibViewerGUI::Reset(){ | |
1318 | // | |
1319 | // reset variables, delete calib viewer | |
1320 | // | |
1321 | if (fViewer) delete fViewer; | |
1322 | fListVariables->RemoveAll(); | |
1323 | fListNormalization->RemoveAll(); | |
1324 | fInitialized = kFALSE; | |
1325 | } | |
1326 | ||
1327 | void AliTPCCalibViewerGUI::HandleButtonsGeneral(Int_t id) { | |
1328 | // | |
1329 | // handles mutual radio button exclusions | |
1330 | // for general Tab | |
1331 | // | |
1332 | if (id == -1) { | |
1333 | TGButton *btn = (TGButton *) gTQSender; | |
1334 | id = btn->WidgetId(); | |
1335 | } | |
1336 | ||
1337 | switch (id) { | |
1338 | case 10: // fRadioRaw | |
1339 | fRadioNormalized->SetState(kButtonUp); | |
1340 | fRadioPredefined->SetState(kButtonDown); | |
1341 | fRadioCustom->SetState(kButtonUp); | |
1342 | // fComboMethod->UnmapWindow(); | |
1343 | // fListNormalization->UnmapWindow(); | |
1344 | break; | |
1345 | case 11: // fRadioNormalized | |
1346 | fRadioRaw->SetState(kButtonUp); | |
1347 | fRadioPredefined->SetState(kButtonDown); | |
1348 | fRadioCustom->SetState(kButtonUp); | |
1349 | break; | |
1350 | case 12: // fRadioCustom | |
1351 | fRadioPredefined->SetState(kButtonUp); | |
1352 | // fComboCustom->SetEnabled(kFALSE); | |
1353 | // fRadioNormalized->SetState(kButtonUp); | |
1354 | break; | |
1355 | case 14: // select Draw options fComboAddDrawOpt | |
1356 | fChkAddDrawOpt->SetState(kButtonDown); | |
1357 | break; | |
1358 | case 13: // fRadioPredefined | |
1359 | fRadioCustom->SetState(kButtonUp); | |
1360 | // fComboCustom->SetEnabled(kTRUE); | |
1361 | //f RadioNormalized->SetState(kButtonUp); | |
1362 | break; | |
1363 | //-------- | |
1364 | case 30: // fRadio1D | |
1365 | fRadio2D->SetState(kButtonUp); | |
1366 | fBtnExport->SetEnabled(kFALSE); | |
1367 | fBtnAddNorm->SetEnabled(kFALSE); | |
1368 | break; | |
1369 | case 31: // fRadio2D | |
1370 | fRadio1D->SetState(kButtonUp); | |
1371 | fBtnExport->SetEnabled(kTRUE); | |
1372 | fBtnAddNorm->SetEnabled(kTRUE); | |
1373 | break; | |
1374 | case 42: // fComboCustom | |
1375 | fRadioCustom->SetState(kButtonDown); | |
1376 | fRadioPredefined->SetState(kButtonUp); | |
1377 | break; | |
1378 | } | |
1379 | DoNewSelection(); | |
1380 | } | |
1381 | ||
1382 | ||
1383 | void AliTPCCalibViewerGUI::HandleButtons1D(Int_t id) { | |
1384 | // | |
1385 | // handles mutual radio button exclusions | |
1386 | // 1D-Tab buttons | |
1387 | // | |
1388 | ||
1389 | if (id == -1) { | |
1390 | TGButton *btn = (TGButton *) gTQSender; | |
1391 | id = btn->WidgetId(); | |
1392 | } | |
1393 | switch (id) { | |
1394 | case 110: // 1D draw normal | |
1395 | fRadioNorm->SetState(kButtonDown); | |
1396 | fRadioSigma->SetState(kButtonUp); | |
1397 | fRadioCumulative->SetState(kButtonUp); | |
1398 | fRadioIntegrate->SetState(kButtonUp); | |
1399 | break; | |
1400 | case 111: // 1D draw sigma | |
1401 | fRadioNorm->SetState(kButtonUp); | |
1402 | fRadioSigma->SetState(kButtonDown); | |
1403 | fRadioCumulative->SetState(kButtonUp); | |
1404 | fRadioIntegrate->SetState(kButtonUp); | |
1405 | break; | |
1406 | case 112: // 1D draw cumulative | |
1407 | fRadioNorm->SetState(kButtonUp); | |
1408 | fRadioSigma->SetState(kButtonUp); | |
1409 | fRadioCumulative->SetState(kButtonDown); | |
1410 | fRadioIntegrate->SetState(kButtonUp); | |
1411 | break; | |
1412 | case 113: // 1D draw integral | |
1413 | fRadioNorm->SetState(kButtonUp); | |
1414 | fRadioSigma->SetState(kButtonUp); | |
1415 | fRadioCumulative->SetState(kButtonUp); | |
1416 | fRadioIntegrate->SetState(kButtonDown); | |
1417 | break; | |
1418 | } | |
1419 | DoNewSelection(); | |
1420 | } | |
1421 | ||
1422 | ||
1423 | void AliTPCCalibViewerGUI::HandleButtonsStat(Int_t id) { | |
1424 | // | |
1425 | // handles statistic check boxes | |
1426 | // checks each checkbox if checked | |
1427 | // if the checkbox is checked, appends 'n' for name, 'e' for entries, ... | |
1428 | // to a TString, passes this TString to gStyle->SetOptStat(...) | |
1429 | // | |
1430 | if (id == -1) { | |
1431 | TGButton *btn = (TGButton *) gTQSender; | |
1432 | id = btn->WidgetId(); | |
1433 | } | |
1434 | TString statOpt(""); | |
1435 | if (fChkStatName->GetState() == kButtonDown) statOpt.Append("n"); | |
1436 | if (fChkStatEntries->GetState() == kButtonDown) statOpt.Append("e"); | |
1437 | if (fChkStatMean->GetState() == kButtonDown && fChkStatMeanPM->GetState() == kButtonUp) statOpt.Append("m"); | |
1438 | if (fChkStatMeanPM->GetState() == kButtonDown) statOpt.Append("M"); | |
1439 | if (fChkStatRMS->GetState() == kButtonDown && fChkStatRMSPM->GetState() == kButtonUp) statOpt.Append("r"); | |
1440 | if (fChkStatRMSPM->GetState() == kButtonDown) statOpt.Append("R"); | |
1441 | if (fChkStatUnderflow->GetState() == kButtonDown) statOpt.Append("u"); | |
1442 | if (fChkStatOverflow->GetState() == kButtonDown) statOpt.Append("o"); | |
1443 | if (fChkStatIntegral->GetState() == kButtonDown) statOpt.Append("i"); | |
1444 | if (fChkStatSkewness->GetState() == kButtonDown && fChkStatSkewnessPM->GetState() == kButtonUp) statOpt.Append("s"); | |
1445 | if (fChkStatSkewnessPM->GetState() == kButtonDown) statOpt.Append("S"); | |
1446 | if (fChkStatKurtosis->GetState() == kButtonDown && fChkStatKurtosisPM->GetState() == kButtonUp) statOpt.Append("k"); | |
1447 | if (fChkStatKurtosisPM->GetState() == kButtonDown) statOpt.Append("K"); | |
1448 | ||
1449 | gStyle->SetOptStat(statOpt); | |
1450 | DoNewSelection(); | |
1451 | } | |
1452 | ||
1453 | ||
1454 | void AliTPCCalibViewerGUI::HandleButtonsCuts(Int_t id) { | |
1455 | // | |
1456 | // handles mutual radio button exclusions | |
1457 | // right side buttons | |
1458 | // | |
1459 | if (id == -1) { | |
1460 | TGButton *btn = (TGButton *) gTQSender; | |
1461 | id = btn->WidgetId(); | |
1462 | } | |
1463 | ||
1464 | switch (id) { | |
1465 | case 20: // fRadioTPC | |
1466 | fRadioSideA->SetState(kButtonUp); | |
1467 | fRadioSideC->SetState(kButtonUp); | |
1468 | fRadioROC->SetState(kButtonUp); | |
1469 | fRadioSector->SetState(kButtonUp); | |
1470 | break; | |
1471 | case 21: // fRadioSideA | |
1472 | fRadioTPC->SetState(kButtonUp); | |
1473 | fRadioSideC->SetState(kButtonUp); | |
1474 | fRadioROC->SetState(kButtonUp); | |
1475 | fRadioSector->SetState(kButtonUp); | |
1476 | break; | |
1477 | case 22: // fRadioSideC | |
1478 | fRadioTPC->SetState(kButtonUp); | |
1479 | fRadioSideA->SetState(kButtonUp); | |
1480 | fRadioROC->SetState(kButtonUp); | |
1481 | fRadioSector->SetState(kButtonUp); | |
1482 | break; | |
1483 | case 23: // fRadioROC | |
1484 | fRadioTPC->SetState(kButtonUp); | |
1485 | fRadioSideA->SetState(kButtonUp); | |
1486 | fRadioSideC->SetState(kButtonUp); | |
1487 | fRadioSector->SetState(kButtonUp); | |
1488 | break; | |
1489 | case 24: // fRadioSector | |
1490 | fRadioTPC->SetState(kButtonUp); | |
1491 | fRadioSideA->SetState(kButtonUp); | |
1492 | fRadioSideC->SetState(kButtonUp); | |
1493 | fRadioROC->SetState(kButtonUp); | |
1494 | break; | |
1495 | case 31: // fComboAddCuts | |
1496 | fChkAddCuts->SetState(kButtonDown); | |
1497 | break; | |
1498 | } | |
1499 | DoNewSelection(); | |
1500 | } | |
1501 | ||
1502 | ||
1503 | void AliTPCCalibViewerGUI::HandleButtonsNoRedraw(Int_t id) { | |
1504 | // | |
1505 | // handles label & scaling checkboxes | |
1506 | // without redrawing (not necessary, faster like this) | |
1507 | // | |
1508 | if (id == -1) { | |
1509 | TGButton *btn = (TGButton *) gTQSender; | |
1510 | id = btn->WidgetId(); | |
1511 | } | |
1512 | ||
1513 | switch (id) { | |
1514 | case 40: // fTxtSetMin | |
1515 | fChkSetMin->SetState(kButtonDown); | |
1516 | break; | |
1517 | case 41: // fTxtSetMax | |
1518 | fChkSetMax->SetState(kButtonDown); | |
1519 | break; | |
1520 | case 50: // fTxtLabelTitle | |
1521 | fChkLabelTitle->SetState(kButtonDown); | |
1522 | break; | |
1523 | case 51: // fTxtLabelXaxis | |
1524 | fChkLabelXaxis->SetState(kButtonDown); | |
1525 | break; | |
1526 | case 52: // fTxtLabelXaxis | |
1527 | fChkLabelYaxis->SetState(kButtonDown); | |
1528 | break; | |
1529 | } | |
1530 | SetMinMaxLabel(); | |
1531 | } | |
1532 | ||
1533 | void AliTPCCalibViewerGUI::ReplacePlaceHolders(TString &str) | |
1534 | { | |
1535 | // | |
1536 | // replace the defined placeholders in the custom draw string and cut string | |
1537 | // | |
1538 | TString drawPlaceHolder("#draw#"); | |
1539 | TString normPlaceHolder("#norm#"); | |
1540 | ||
1541 | //current draw variable | |
1542 | TString desiredData(""); | |
1543 | if (fListVariables->GetSelectedEntry()){ | |
1544 | desiredData += ((TGTextLBEntry*)(fListVariables->GetSelectedEntry()))->GetTitle(); | |
1545 | str.ReplaceAll(drawPlaceHolder,desiredData); | |
1546 | } | |
1547 | // desiredData += fViewer->GetAbbreviation(); | |
1548 | ||
1549 | //current normalisation | |
1550 | TString normalizationData(""); | |
1551 | if (fListNormalization->GetSelectedEntry()){ | |
1552 | normalizationData += ((TGTextLBEntry*)(fListNormalization->GetSelectedEntry()))->GetTitle(); | |
1553 | if (! (TString(((TGTextLBEntry*)(fListNormalization->GetSelectedEntry()))->GetTitle())).BeginsWith("Fit")) | |
1554 | if ( normalizationData.BeginsWith("_") ) normalizationData = desiredData+normalizationData; | |
1555 | if ( fListVariables->FindEntry(normalizationData.Data()) ) | |
1556 | normalizationData+="~"; | |
1557 | str.ReplaceAll(normPlaceHolder,normalizationData); | |
1558 | } | |
1559 | } | |
1560 | ||
1561 | void AliTPCCalibViewerGUI::DoNewSelection() { | |
1562 | // | |
1563 | // decides whether to redraw if user makes another selection | |
1564 | // | |
1565 | if (fChkAuto->GetState() == kButtonDown) DoDraw(); | |
1566 | } | |
1567 | ||
1568 | ||
1569 | TString* AliTPCCalibViewerGUI::GetDrawString() { | |
1570 | // | |
1571 | // create the draw string out of selection | |
1572 | // | |
1573 | ||
1574 | // specify data to plot | |
1575 | TString desiredData(""); | |
1576 | if (!fListVariables->GetSelectedEntry()) return 0; | |
1577 | desiredData += ((TGTextLBEntry*)(fListVariables->GetSelectedEntry()))->GetTitle(); | |
1578 | desiredData += fViewer->GetAbbreviation(); | |
1579 | ||
1580 | // specify normalization | |
1581 | if (fRadioPredefined->GetState() == kButtonDown && fRadioNormalized->GetState() == kButtonDown) { | |
1582 | TString op(""); | |
1583 | switch (fComboMethod->GetSelected()) { | |
1584 | case 0: // subtraction | |
1585 | op += "-"; | |
1586 | break; | |
1587 | case 1: // division | |
1588 | op += "/"; | |
1589 | break; | |
1590 | } | |
1591 | TString normalizationData(""); | |
1592 | if (!fListNormalization->GetSelectedEntry()) return 0; | |
1593 | normalizationData += ((TGTextLBEntry*)(fListNormalization->GetSelectedEntry()))->GetTitle(); | |
1594 | ||
1595 | if ( normalizationData.BeginsWith("Fit")) { | |
1596 | // create fit formula, evaluate it an replace normalizationData-String | |
1597 | // ********** create cut string ********** | |
1598 | TString cutStr(""); | |
1599 | if (fRadioTPC->GetState() == kButtonDown) | |
1600 | cutStr += ""; // whole TPC is used for fitting | |
1601 | if (fRadioSideA->GetState() == kButtonDown) | |
1602 | cutStr += "(sector/18)%2==0"; // side A | |
1603 | if (fRadioSideC->GetState() == kButtonDown) | |
1604 | cutStr+= "(sector/18)%2==1"; // side C | |
1605 | if (fRadioROC->GetState() == kButtonDown) { | |
1606 | Int_t sector = (Int_t)(fNmbSector->GetNumber()); | |
1607 | cutStr += "sector=="; | |
1608 | cutStr += sector; | |
1609 | } | |
1610 | if (fRadioSector->GetState() == kButtonDown) { | |
1611 | Int_t sector = ((Int_t)(fNmbSector->GetNumber()))%36; | |
1612 | cutStr += "sector%36=="; | |
1613 | cutStr += sector; | |
1614 | } | |
1615 | if (fChkAddCuts->GetState() == kButtonDown && strcmp(fComboAddCuts->GetTextEntry()->GetText(), "") != 0){ | |
1616 | if (fRadioTPC->GetState() != kButtonDown) cutStr += " && "; | |
1617 | cutStr += fComboAddCuts->GetTextEntry()->GetText(); | |
1618 | } | |
1619 | Double_t chi2 = 0; | |
1620 | TVectorD fitParam(0); | |
1621 | TMatrixD covMatrix(0,0); | |
1622 | TString formulaStr(""); | |
1623 | if (normalizationData.CompareTo("FitLinLocal") == 0) | |
1624 | formulaStr = "lx~ ++ ly~"; | |
1625 | if (normalizationData.CompareTo("FitLinGlobal") == 0) | |
1626 | formulaStr = "gx~ ++ gy~"; | |
1627 | if (normalizationData.CompareTo("FitParLocal") == 0) | |
1628 | formulaStr = "lx~ ++ ly~ ++ lx~^2 ++ ly~^2 ++ lx~*ly~"; | |
1629 | if (normalizationData.CompareTo("FitParGlobal") == 0) | |
1630 | formulaStr = "gx~ ++ gy~ ++ gx~^2 ++ gy~^2 ++ gx~*gy~"; | |
1631 | formulaStr.ReplaceAll("~", fViewer->GetAbbreviation()); | |
1632 | normalizationData = *fViewer->Fit(desiredData.Data(), formulaStr.Data(), cutStr.Data(), chi2, fitParam, covMatrix); | |
1633 | } // if ( normalizationData.BeginsWith("Fit") | |
1634 | ||
1635 | desiredData += op; | |
1636 | if (! (TString(((TGTextLBEntry*)(fListNormalization->GetSelectedEntry()))->GetTitle())).BeginsWith("Fit")) | |
1637 | if ( normalizationData.BeginsWith("_") ) desiredData += ((TGTextLBEntry*)(fListVariables->GetSelectedEntry()))->GetTitle(); | |
1638 | if ( fListVariables->FindEntry(normalizationData.Data()) ) | |
1639 | normalizationData+="~"; | |
1640 | desiredData += normalizationData; | |
1641 | } | |
1642 | else if (fRadioCustom->GetState() == kButtonDown) { | |
1643 | desiredData = fComboCustom->GetTextEntry()->GetText(); | |
1644 | if (desiredData == "") return 0; | |
1645 | ReplacePlaceHolders(desiredData); | |
1646 | } | |
1647 | ||
1648 | // try to add forgotten '~' | |
1649 | if (fChkAutoAppend->GetState() == kButtonDown) | |
1650 | desiredData = TString(fViewer->AddAbbreviations((char*)desiredData.Data())); | |
1651 | return new TString(desiredData.Data()); | |
1652 | } | |
1653 | ||
1654 | ||
1655 | TString* AliTPCCalibViewerGUI::GetSectorString() { | |
1656 | // | |
1657 | // create the sector string out of selection | |
1658 | // | |
1659 | ||
1660 | TString sectorStr(""); | |
1661 | if (fRadioTPC->GetState() == kButtonDown) | |
1662 | sectorStr += "ALL"; | |
1663 | if (fRadioSideA->GetState() == kButtonDown) | |
1664 | sectorStr += "A"; //cuts += "(sector/18)%2==0"; | |
1665 | if (fRadioSideC->GetState() == kButtonDown) | |
1666 | sectorStr+= "C"; //cuts += "(sector/18)%2==1"; | |
1667 | if (fRadioROC->GetState() == kButtonDown) { | |
1668 | Int_t sector = (Int_t)(fNmbSector->GetNumber()); | |
1669 | sectorStr += sector; //cuts += "sector=="; | |
1670 | } | |
1671 | if (fRadioSector->GetState() == kButtonDown) { | |
1672 | Int_t sector = ((Int_t)(fNmbSector->GetNumber()))%36; | |
1673 | sectorStr += "S"; | |
1674 | sectorStr += sector; //cuts += "sector%36=="; | |
1675 | } | |
1676 | return new TString(sectorStr.Data()); | |
1677 | } | |
1678 | ||
1679 | ||
1680 | TString* AliTPCCalibViewerGUI::GetCutString() { | |
1681 | // | |
1682 | // create the cut string out of selection | |
1683 | // | |
1684 | ||
1685 | TString cutsStr(""); | |
1686 | if (fChkCutZero->GetState() == kButtonDown) { | |
1687 | TString cutZerosStr(GetDrawString()->Data()); | |
1688 | if (cutZerosStr.Contains(">>")) { | |
1689 | cutZerosStr.Remove(cutZerosStr.First(">>")); | |
1690 | } | |
1691 | if (cutZerosStr.Contains(":")) { | |
1692 | cutZerosStr.Remove(cutZerosStr.First(":")); | |
1693 | } | |
1694 | cutsStr += cutZerosStr.Data(); | |
1695 | cutsStr += "!=0"; | |
1696 | if (fChkAddCuts->GetState() == kButtonDown) cutsStr += " && "; | |
1697 | } | |
1698 | if (fChkAddCuts->GetState() == kButtonDown){ | |
1699 | cutsStr += fComboAddCuts->GetTextEntry()->GetText(); | |
1700 | ReplacePlaceHolders(cutsStr); | |
1701 | } | |
1702 | ||
1703 | ||
1704 | // try to add forgotten '~' | |
1705 | if (fChkAutoAppend->GetState() == kButtonDown) | |
1706 | cutsStr = TString(fViewer->AddAbbreviations((char*)cutsStr.Data())); | |
1707 | return new TString(cutsStr.Data()); | |
1708 | } | |
1709 | ||
1710 | ||
1711 | void AliTPCCalibViewerGUI::DoDraw() { | |
1712 | // | |
1713 | // main method for drawing according to user selection | |
1714 | // | |
1715 | ||
1716 | // specify data to plot: | |
1717 | if (!GetDrawString()) return; | |
1718 | TString desiredData(GetDrawString()->Data()); | |
1719 | // specify sector: | |
1720 | TString sectorStr(GetSectorString()->Data()); | |
1721 | // specify cuts: | |
1722 | TString cutsStr(GetCutString()->Data()); | |
1723 | ||
1724 | TString addDrawOpt(""); | |
1725 | if (fChkAddDrawOpt->GetState() == kButtonDown) | |
1726 | addDrawOpt += fComboAddDrawOpt->GetTextEntry()->GetText(); | |
1727 | ||
1728 | // remove last picture | |
1729 | if (!addDrawOpt.Contains("same")) | |
1730 | for (Int_t i = 0; i < fCanvMain->GetCanvas()->GetListOfPrimitives()->GetEntries(); i++) { | |
1731 | if (strcmp(fCanvMain->GetCanvas()->GetListOfPrimitives()->At(i)->ClassName(), "TFrame") != 0) | |
1732 | fCanvMain->GetCanvas()->GetListOfPrimitives()->At(i)->Delete(); | |
1733 | } | |
1734 | //fCanvMain->GetCanvas()->Clear(); | |
1735 | fCanvMain->GetCanvas()->cd(); | |
1736 | Int_t entries = -1; | |
1737 | // draw finally | |
1738 | if (fRadio1D->GetState() == kButtonDown){ | |
1739 | // 1D-Drawing | |
1740 | TString strSigmaMax(fTxtSigmaMax->GetText()); // get sigmaMax from text enty | |
1741 | Double_t sigmaMax = (strSigmaMax.IsFloat()) ? strSigmaMax.Atof() : 5; // convert to double, if not convertable, set to 5 | |
1742 | Bool_t plotMean = fChkMean->GetState() == kButtonDown; | |
1743 | Bool_t plotMedian = fChkMedian->GetState() == kButtonDown; | |
1744 | Bool_t plotLTM = fChkLTM->GetState() == kButtonDown; | |
1745 | if (fRadioNorm->GetState() == kButtonDown) // normal 1D drawing | |
1746 | entries = fViewer->EasyDraw1D(desiredData.Data(), sectorStr.Data(), cutsStr.Data(), addDrawOpt.Data()); | |
1747 | if (fRadioSigma->GetState() == kButtonDown) // sigma 1D drawing | |
1748 | entries = fViewer->DrawHisto1D(desiredData.Data(), sectorStr.Data(), cutsStr.Data(), // | |
1749 | fTxtSigmas->GetText(), plotMean, plotMedian, plotLTM); | |
1750 | if (fRadioCumulative->GetState() == kButtonDown) // cumulative 1D drawing | |
1751 | entries = fViewer->SigmaCut(desiredData.Data(), sectorStr.Data(), cutsStr.Data(), // | |
1752 | sigmaMax, plotMean, plotMedian, plotLTM, // | |
1753 | fCheckCumulativePM->GetState() == kButtonDown, fTxtSigmas->GetText(), /* Float_t sigmaStep =*/ -1); | |
1754 | if (fRadioIntegrate->GetState() == kButtonDown) // integral 1D drawing | |
1755 | entries = fViewer->Integrate(desiredData.Data(), sectorStr.Data(), cutsStr.Data(), // | |
1756 | sigmaMax, plotMean, plotMedian, plotLTM, // | |
1757 | fTxtSigmas->GetText(), /* Float_t sigmaStep =*/ -1); | |
1758 | } | |
1759 | else if (fRadio2D->GetState() == kButtonDown) { | |
1760 | // 2D-Drawing | |
1761 | entries = fViewer->EasyDraw(desiredData.Data(), sectorStr.Data(), cutsStr.Data(), addDrawOpt.Data()); | |
1762 | } | |
1763 | if (entries == -1) return; // nothing was drawn, there is no histogram to get min and max | |
1764 | ||
1765 | SetMinMaxLabel(); | |
1766 | fCanvMain->GetCanvas()->Update(); | |
1767 | } | |
1768 | ||
1769 | ||
1770 | void AliTPCCalibViewerGUI::DoFit() { | |
1771 | // | |
1772 | // main method for fitting | |
1773 | // | |
1774 | ||
1775 | Double_t chi2 = 0; | |
1776 | TVectorD fitParam(0); | |
1777 | TMatrixD covMatrix(0,0); | |
1778 | TString cutStr(""); | |
1779 | TString formulaStr(""); | |
1780 | ||
1781 | // specify data to plot: | |
1782 | TString drawStr(GetDrawString()->Data()); | |
1783 | ||
1784 | // ********** create cut string ********** | |
1785 | if (fRadioTPC->GetState() == kButtonDown) | |
1786 | cutStr += ""; // whole TPC is used for fitting | |
1787 | if (fRadioSideA->GetState() == kButtonDown) | |
1788 | cutStr += "(sector/18)%2==0"; // side A | |
1789 | if (fRadioSideC->GetState() == kButtonDown) | |
1790 | cutStr+= "(sector/18)%2==1"; // side C | |
1791 | if (fRadioROC->GetState() == kButtonDown) { | |
1792 | Int_t sector = (Int_t)(fNmbSector->GetNumber()); | |
1793 | cutStr += "sector=="; | |
1794 | cutStr += sector; | |
1795 | } | |
1796 | if (fRadioSector->GetState() == kButtonDown) { | |
1797 | Int_t sector = (Int_t)(fNmbSector->GetNumber())%36; | |
1798 | cutStr += "sector%36=="; | |
1799 | cutStr += sector; | |
1800 | } | |
1801 | if (fChkAddCuts->GetState() == kButtonDown && strcmp(fComboAddCuts->GetTextEntry()->GetText(), "") != 0){ | |
1802 | if (fRadioTPC->GetState() != kButtonDown) cutStr += " && "; | |
1803 | cutStr += fComboAddCuts->GetTextEntry()->GetText(); | |
1804 | } | |
1805 | // try to add forgotten '~' | |
1806 | if (fChkAutoAppend->GetState() == kButtonDown) | |
1807 | cutStr = TString(fViewer->AddAbbreviations((char*)cutStr.Data())); | |
1808 | ||
1809 | // ********** get formula string ********** | |
1810 | formulaStr += fComboCustomFit->GetTextEntry()->GetText(); | |
1811 | if (fChkAutoAppend->GetState() == kButtonDown) | |
1812 | formulaStr = TString(fViewer->AddAbbreviations((char*)formulaStr.Data())); | |
1813 | ||
1814 | // ********** call AliTPCCalibViewer's fit-function | |
1815 | ReplacePlaceHolders(drawStr); | |
1816 | ReplacePlaceHolders(cutStr); | |
1817 | TString *returnStr = fViewer->Fit(drawStr.Data(), formulaStr.Data(), cutStr.Data(), chi2, fitParam, covMatrix); | |
1818 | ||
1819 | std::cout << std::endl; | |
1820 | std::cout << "Your fit formula reads as follows:" << std::endl; | |
1821 | std::cout << returnStr->Data() << std::endl; | |
1822 | std::cout << "chi2 = " << chi2 << std::endl; | |
1823 | ||
1824 | delete returnStr; | |
1825 | } | |
1826 | ||
1827 | ||
1828 | void AliTPCCalibViewerGUI::DoExport() { | |
1829 | // | |
1830 | // function to export a CalPad to Cint | |
1831 | // | |
1832 | if ( fRadio2D->GetState() != kButtonDown){ | |
1833 | Error("ExportCalPad", "Export of AliTPCCalPad to CINT works only in 2D mode."); | |
1834 | return; | |
1835 | } | |
1836 | // specify data to plot: | |
1837 | TString desiredData(GetDrawString()->Data()); | |
1838 | // specify cuts: | |
1839 | TString cutsStr(GetCutString()->Data()); | |
1840 | // get name for the calPad | |
1841 | const char* calPadName = fComboExportName->GetTextEntry()->GetText(); | |
1842 | // create calPad according to drawCommand and cuts | |
1843 | AliTPCCalPad *calPad = fViewer->GetCalPad(desiredData.Data(), (char*)cutsStr.Data(), (char*)calPadName); | |
1844 | // finally export calPad to Cint: | |
1845 | gROOT->ProcessLine(Form("AliTPCCalPad* %s = (AliTPCCalPad*)0x%lx;", calPadName, (ULong_t)calPad)); | |
1846 | fPreprocessor->AddComponent(calPad); | |
1847 | Info("ExportCalPad", "Current 2D view has been exported to an AliTPCCalPad* with name '%s'", calPadName); | |
1848 | } | |
1849 | ||
1850 | ||
1851 | void AliTPCCalibViewerGUI::DoExportNorm() { | |
1852 | // | |
1853 | // function to export a CalPad to Cint | |
1854 | // | |
1855 | ||
1856 | if ( fRadio2D->GetState() != kButtonDown){ | |
1857 | Error("ExportCalPad", "Adding an AliTPCCalPad to the normalization works only in 2D mode."); | |
1858 | return; | |
1859 | } | |
1860 | ||
1861 | Error("DoExportNorm", "Not yet implemented."); | |
1862 | /* | |
1863 | return; | |
1864 | ||
1865 | // specify data to plot: | |
1866 | TString desiredData(GetDrawString()->Data()); | |
1867 | // specify sector: | |
1868 | TString sectorStr(GetSectorString()->Data()); | |
1869 | // specify cuts: | |
1870 | TString cutsStr(GetCutString()->Data()); | |
1871 | ||
1872 | // get name for the calPad | |
1873 | const char* calPadName = fComboExportName->GetTextEntry()->GetText(); | |
1874 | // create calPad according to drawCommand and cuts | |
1875 | AliTPCCalPad *calPad = fViewer->GetCalPad(desiredData.Data(), (char*)cutsStr.Data(), (char*)fComboExportName->GetTextEntry()->GetText()); | |
1876 | // finally export calPad to Cint: | |
1877 | gROOT->ProcessLine(Form("AliTPCCalPad* %s = (AliTPCCalPad*)0x%lx;", calPadName, (ULong_t) calPad)); | |
1878 | Info("ExportCalPad", "Current 2D view has been exported to an AliTPCCalPad* with name '%s'", calPadName); | |
1879 | */ | |
1880 | } | |
1881 | ||
1882 | ||
1883 | void AliTPCCalibViewerGUI::GetMinMax() { | |
1884 | // | |
1885 | // Read current Min & Max from the plot and set it to fTxtSetMin & fTxtSetMax | |
1886 | // | |
1887 | if (fChkGetMinMaxAuto->GetState() == kButtonUp) return; | |
1888 | TList* listOfPrimitives = fCanvMain->GetCanvas()->GetListOfPrimitives(); | |
1889 | TObject* ptr = 0; | |
1890 | for (Int_t i = 0; i < listOfPrimitives->GetEntries(); i++) { | |
1891 | ptr = listOfPrimitives->At(i); | |
1892 | if ( ptr->InheritsFrom("TH1") ) break; | |
1893 | } | |
1894 | if ( !ptr || !ptr->InheritsFrom("TH1") ) return; // if the loop did not find a TH1 | |
1895 | TH1 *hist = (TH1*)ptr; | |
1896 | ||
1897 | // Double_t histMax = hist->GetMaximum(); | |
1898 | // Double_t histMin = hist->GetMinimum(); | |
1899 | // fTxtSetMax->SetText(Form("%f",histMax)); | |
1900 | // fTxtSetMin->SetText(Form("%f",histMin)); | |
1901 | ||
1902 | if (fRadio2D->GetState() == kButtonDown) { | |
1903 | if (fChkSetMax->GetState() == kButtonUp) | |
1904 | fTxtSetMax->SetText(Form("%f", hist->GetMaximum())); | |
1905 | if (fChkSetMin->GetState() == kButtonUp) | |
1906 | fTxtSetMin->SetText(Form("%f", hist->GetMinimum())); | |
1907 | } | |
1908 | else if (fRadio1D->GetState() == kButtonDown) { | |
1909 | if (fChkSetMax->GetState() == kButtonUp) | |
1910 | fTxtSetMax->SetText( Form("%f", hist->GetXaxis()->GetXmax()) ); | |
1911 | if (fChkSetMin->GetState() == kButtonUp) | |
1912 | fTxtSetMin->SetText( Form("%f", hist->GetXaxis()->GetXmin()) ); | |
1913 | } | |
1914 | } | |
1915 | ||
1916 | ||
1917 | void AliTPCCalibViewerGUI::SetMinMaxLabel() { | |
1918 | // | |
1919 | // Set Minimum, Maximum and labels without redrawing the plot | |
1920 | // (faster) | |
1921 | // | |
1922 | ||
1923 | // search for histogram | |
1924 | TList* listOfPrimitives = fCanvMain->GetCanvas()->GetListOfPrimitives(); | |
1925 | TObject* ptr = 0; | |
1926 | for (Int_t i = 0; i < listOfPrimitives->GetEntries(); i++) { | |
1927 | ptr = listOfPrimitives->At(i); | |
1928 | if ( ptr->InheritsFrom("TH1") ) break; | |
1929 | } | |
1930 | if ( ptr == 0 || !ptr->InheritsFrom("TH1") ) { // if the loop did not find a TH1 | |
1931 | fCanvMain->GetCanvas()->Update(); | |
1932 | Warning("SetMinMaxLabel","No Histogram found!"); | |
1933 | return; | |
1934 | // unable to find histogram, no min and max wil be read out | |
1935 | } | |
1936 | ||
1937 | TH1 *hist = (TH1*)ptr; | |
1938 | TString minTxt(fTxtSetMin->GetText()); | |
1939 | TString maxTxt(fTxtSetMax->GetText()); | |
1940 | ||
1941 | // set min and max according to specified values, if checkbox is checked | |
1942 | if (fRadio2D->GetState() == kButtonDown) { | |
1943 | if (fChkSetMax->GetState() == kButtonDown && fChkSetMax->GetState() == kButtonDown &&(maxTxt.IsDigit() || maxTxt.IsFloat()) ) | |
1944 | hist->SetMaximum(maxTxt.Atof()); | |
1945 | if (fChkSetMax->GetState() == kButtonUp) | |
1946 | hist->SetMaximum(-1111); // default value, to unzoom | |
1947 | if (fChkSetMin->GetState() == kButtonDown && (minTxt.IsDigit() || minTxt.IsFloat()) ) | |
1948 | hist->SetMinimum(minTxt.Atof()); | |
1949 | if (fChkSetMin->GetState() == kButtonUp) | |
1950 | hist->SetMinimum(-1111); // default value, to unzoom | |
1951 | } | |
1952 | else if (fRadio2D->GetState() == kButtonDown) { | |
1953 | if (fChkSetMin->GetState() == kButtonDown && | |
1954 | fChkSetMax->GetState() == kButtonDown && hist->GetXaxis()) | |
1955 | hist->GetXaxis()->SetRangeUser(hist->GetXaxis()->GetXmin(), hist->GetXaxis()->GetXmax()); | |
1956 | else if (fChkSetMax->GetState() == kButtonDown && hist->GetXaxis()) | |
1957 | hist->GetXaxis()->SetRangeUser(hist->GetXaxis()->GetXmin(), maxTxt.Atof()); | |
1958 | else if (fChkSetMin->GetState() == kButtonDown && hist->GetXaxis()) | |
1959 | hist->GetXaxis()->SetRangeUser(minTxt.Atof(), hist->GetXaxis()->GetXmax()); | |
1960 | hist->SetTitle(hist->GetTitle()); // trick to update the histogram | |
1961 | } | |
1962 | ||
1963 | // get min and max from plot | |
1964 | GetMinMax(); | |
1965 | ||
1966 | // set labels according to specification, if cehckboxes are checked | |
1967 | if (fChkLabelTitle->GetState() == kButtonDown) | |
1968 | hist->SetTitle(fTxtLabelTitle->GetText()); | |
1969 | if (fChkLabelXaxis->GetState() == kButtonDown) | |
1970 | hist->GetXaxis()->SetTitle(fTxtLabelXaxis->GetText()); | |
1971 | if (fChkLabelYaxis->GetState() == kButtonDown) | |
1972 | hist->GetYaxis()->SetTitle(fTxtLabelYaxis->GetText()); | |
1973 | // get and/or set labels and title | |
1974 | if (fChkLabelGetAuto->GetState() == kButtonDown) { | |
1975 | fTxtLabelTitle->SetText(hist->GetTitle()); | |
1976 | fTxtLabelXaxis->SetTitle(hist->GetXaxis()->GetTitle()); | |
1977 | fTxtLabelYaxis->SetTitle(hist->GetYaxis()->GetTitle()); | |
1978 | } | |
1979 | hist->SetTitle(hist->GetTitle()); // trick to update the histogram | |
1980 | fCanvMain->GetCanvas()->Update(); | |
1981 | } | |
1982 | ||
1983 | ||
1984 | void AliTPCCalibViewerGUI::ChangeSector(){ | |
1985 | // | |
1986 | // function that is called, when the number of the sector is changed | |
1987 | // to change the sector label | |
1988 | // | |
1989 | if ( fRadioROC->GetState()!=kButtonDown && fRadioSector->GetState()!=kButtonDown ){ | |
1990 | fLblSector->SetText("not used"); | |
1991 | return; | |
1992 | } | |
1993 | ||
1994 | Int_t sector = (Int_t)(fNmbSector->GetNumber()); | |
1995 | TString secLabel = ""; | |
1996 | if ( sector < 36 ) | |
1997 | secLabel = "IROC"; | |
1998 | else | |
1999 | secLabel = "OROC"; | |
2000 | ||
2001 | if (fRadioSector->GetState()==kButtonDown) | |
2002 | secLabel="Sector"; | |
2003 | ||
2004 | if ( sector%36<18 ) //A-Side | |
2005 | secLabel += ", A"; | |
2006 | else | |
2007 | secLabel += ", C"; | |
2008 | ||
2009 | secLabel += Form("%02d",sector%18); | |
2010 | ||
2011 | fLblSector->SetText(secLabel); | |
2012 | DoNewSelection(); | |
2013 | } | |
2014 | ||
2015 | ||
2016 | void AliTPCCalibViewerGUI::AddFitFunction() const { | |
2017 | // | |
2018 | // adds the last fit function to the normalization list | |
2019 | // | |
2020 | std::cout << "Not yet implemented." << std::endl; | |
2021 | } | |
2022 | ||
2023 | ||
2024 | void AliTPCCalibViewerGUI::UnchekAllStat() { | |
2025 | // | |
2026 | // Disable all statistical legend entries, no statistical legend. | |
2027 | // | |
2028 | fChkStatName->SetState(kButtonUp); | |
2029 | fChkStatEntries->SetState(kButtonUp); | |
2030 | fChkStatMean->SetState(kButtonUp); | |
2031 | fChkStatMeanPM->SetState(kButtonUp); | |
2032 | fChkStatRMS->SetState(kButtonUp); | |
2033 | fChkStatRMSPM->SetState(kButtonUp); | |
2034 | fChkStatUnderflow->SetState(kButtonUp); | |
2035 | fChkStatOverflow->SetState(kButtonUp); | |
2036 | fChkStatIntegral->SetState(kButtonUp); | |
2037 | fChkStatSkewness->SetState(kButtonUp); | |
2038 | fChkStatSkewnessPM->SetState(kButtonUp); | |
2039 | fChkStatKurtosis->SetState(kButtonUp); | |
2040 | fChkStatKurtosisPM->SetState(kButtonUp); | |
2041 | ||
2042 | HandleButtonsStat(0); | |
2043 | } | |
2044 | ||
2045 | ||
2046 | void AliTPCCalibViewerGUI::MouseMove(Int_t event, Int_t x, Int_t y, TObject *selectedObject) { | |
2047 | // | |
2048 | // mouse move | |
2049 | // zoom to sector works ONLY in 2D mode, if one side is specified | |
2050 | // | |
2051 | Double_t pi = TMath::Pi(); | |
2052 | if (event != kButton1Double ) | |
2053 | return; | |
2054 | if (!selectedObject->InheritsFrom("TH2")) return; | |
2055 | // zoom to sector works ONLY in 2D mode, if one side is specified | |
2056 | if (fRadio2D->GetState() == kButtonUp) return; | |
2057 | if (fRadioROC->GetState() == kButtonDown) { // return to full side view | |
2058 | // return to full side view | |
2059 | Int_t sector = (Int_t)(fNmbSector->GetNumber()); | |
2060 | if ( (sector >= 0 && sector <= 17) || (sector >= 36 && sector <= 53) ) { | |
2061 | // A-Side | |
2062 | fRadioSideA->Clicked(); | |
2063 | fRadioSideA->SetState(kButtonDown); | |
2064 | DoNewSelection(); | |
2065 | } | |
2066 | if ( (sector >= 18 && sector <= 35) || (sector >= 54 && sector <= 71) ) { | |
2067 | // C-Side | |
2068 | fRadioSideC->Clicked(); | |
2069 | fRadioSideC->SetState(kButtonDown); | |
2070 | DoNewSelection(); | |
2071 | } | |
2072 | return; | |
2073 | } | |
2074 | if (!(fRadioSideA->GetState() == kButtonDown || fRadioSideC->GetState() == kButtonDown)) return; | |
2075 | ||
2076 | // Int_t px = gPad->GetEventX(); | |
2077 | // Int_t py = gPad->GetEventY(); | |
2078 | Float_t upy = gPad->AbsPixeltoY(y); | |
2079 | Float_t upx = gPad->AbsPixeltoX(x); | |
2080 | Float_t gy = gPad->PadtoY(upy); | |
2081 | Float_t gx = gPad->PadtoX(upx); | |
2082 | Int_t quadrant = -1; | |
2083 | if (gx >= 0 && gy >= 0) quadrant = 1; | |
2084 | if (gx < 0 && gy >= 0) quadrant = 2; | |
2085 | if (gx < 0 && gy < 0) quadrant = 3; | |
2086 | if (gx >= 0 && gy < 0) quadrant = 4; | |
2087 | gx = TMath::Abs(gx); | |
2088 | gy = TMath::Abs(gy); | |
2089 | Double_t phi = TMath::ATan(gy/gx); // angle phi is in Pi- units | |
2090 | Double_t r = TMath::Sqrt(gx*gx + gy*gy); | |
2091 | if (quadrant == 2) phi = pi - phi; | |
2092 | if (quadrant == 3) phi = pi + phi; | |
2093 | if (quadrant == 4) phi = 2 * pi - phi; | |
2094 | Double_t phiGrad = phi / pi * 180; | |
2095 | Int_t sector = (Int_t) phiGrad / 20; // one sector coresponds to 20� | |
2096 | // IROC starts at 84.5 cm | |
2097 | // IROC ends at 135.5 cm, OROC begins | |
2098 | // OROC ends at 250 cm | |
2099 | if (r < 84.5 || r > 250) return; // outside TPC | |
2100 | if (r < 135.5) { // IROC | |
2101 | if (fRadioSideC->GetState() == kButtonDown) sector += 18; | |
2102 | } | |
2103 | else {// OROC | |
2104 | sector += 36; | |
2105 | if (fRadioSideC->GetState() == kButtonDown) sector += 18; | |
2106 | } | |
2107 | // printf("r: %f, phi: %f, phiGrad: %f, gy/gx: %f, quadrant: %i, sector: %i \n", r, phi, phiGrad, gy/gx, quadrant, sector); | |
2108 | fNmbSector->SetNumber(sector); | |
2109 | fRadioROC->Clicked(); | |
2110 | fRadioROC->SetState(kButtonDown); | |
2111 | ChangeSector(); | |
2112 | } | |
2113 | ||
2114 | ||
2115 | void AliTPCCalibViewerGUI::SavePicture() { | |
2116 | // | |
2117 | // saves the current picture | |
2118 | // | |
2119 | // use the following combination of file type and save options: | |
2120 | // (see also TCanvas::Print) | |
2121 | // | |
2122 | // "ps" - Postscript file is produced (see special cases below) | |
2123 | // "Portrait" - Postscript file is produced (Portrait) | |
2124 | // "Landscape" - Postscript file is produced (Landscape) | |
2125 | // "eps" - an Encapsulated Postscript file is produced | |
2126 | // "Preview" - an Encapsulated Postscript file with preview is produced. | |
2127 | // "pdf" - a PDF file is produced | |
2128 | // "svg" - a SVG file is produced | |
2129 | // "gif" - a GIF file is produced | |
2130 | // "gif+NN" - an animated GIF file is produced, where NN is delay in 10ms units | |
2131 | // "xpm" - a XPM file is produced | |
2132 | // "png" - a PNG file is produced | |
2133 | // "jpg" - a JPEG file is produced | |
2134 | // "tiff" - a TIFF file is produced | |
2135 | // "cxx" - a C++ macro file is produced | |
2136 | // "xml" - a XML file | |
2137 | // "root" - a ROOT binary file | |
2138 | ||
2139 | const char *kSaveAsTypes[] = { | |
2140 | "Postscript", "*.ps", | |
2141 | "Encapsulated Postscript", "*.eps", | |
2142 | "PDF", "*.pdf", | |
2143 | "JPEG", "*.jpg", | |
2144 | "PNG", "*.png", | |
2145 | "TIFF", "*.tiff", | |
2146 | "GIF", "*.gif", | |
2147 | "XPM", "*.xpm", | |
2148 | "SVG", "*.svg", | |
2149 | "XML", "*.xml", | |
2150 | "C++ macro", "*.cxx", | |
2151 | "Macro file", "*.C", | |
2152 | "ROOT file", "*.root", | |
2153 | "All file", "*", | |
2154 | 0, 0 | |
2155 | }; | |
2156 | TString addSaveOpt(""); | |
2157 | if (fChkAddSaveOpt->GetState() == kButtonDown) | |
2158 | addSaveOpt += fComboAddSaveOpt->GetTextEntry()->GetText(); | |
2159 | TString dir("."); | |
2160 | TGFileInfo fi; | |
2161 | fi.fFileTypes = kSaveAsTypes; | |
2162 | // fi.fIniDir = StrDup(dir); | |
2163 | fi.fOverwrite = kFALSE; | |
2164 | new TGFileDialog(gClient->GetRoot(), gClient->GetRoot(), kFDSave, &fi); | |
2165 | if (fi.fFilename && strlen(fi.fFilename)) { | |
2166 | if (addSaveOpt != "") | |
2167 | fCanvMain->GetCanvas()->Print(fi.fFilename, addSaveOpt.Data()); | |
2168 | else | |
2169 | fCanvMain->GetCanvas()->Print(fi.fFilename); | |
2170 | } | |
2171 | ||
2172 | // TList* fFileNamesList list of selected file names | |
2173 | // Int_t fFileTypeIdx selected file type, index in fFileTypes | |
2174 | // const char** fFileTypes file types used to filter selectable files | |
2175 | // char* fFilename selected file name | |
2176 | // char* fIniDir on input: initial directory, on output: new directory | |
2177 | // Bool_t fMultipleSelection if true, allow multiple file selection | |
2178 | // Bool_t fOverwrite if true overwrite the file with existing name on save | |
2179 | ||
2180 | } | |
2181 | ||
2182 | ||
2183 | void AliTPCCalibViewerGUI::DoDumpToFile() { | |
2184 | // | |
2185 | // This function is called, when the "Dump to File" button is pressed. | |
2186 | // All the exported CalPads will be written into an new CalibTree, | |
2187 | // a Save File dialog will appear to specify the filename | |
2188 | // | |
2189 | const char *kSaveAsTypes[] = { | |
2190 | "ROOT file", "*.root", | |
2191 | 0, 0 | |
2192 | }; | |
2193 | TString dir("."); | |
2194 | TGFileInfo fi; | |
2195 | fi.fFileTypes = kSaveAsTypes; | |
2196 | // fi.fIniDir = StrDup(dir); | |
2197 | fi.fOverwrite = kFALSE; | |
2198 | new TGFileDialog(gClient->GetRoot(), gClient->GetRoot(), kFDSave, &fi); | |
2199 | if (fi.fFilename && strlen(fi.fFilename)) { | |
2200 | fPreprocessor->DumpToFile(fi.fFilename); | |
2201 | Info("DumpToFile", Form("New CalibTree has been writen to file '%s'", fi.fFilename)); | |
2202 | } | |
2203 | } | |
2204 | ||
2205 | ||
2206 | void AliTPCCalibViewerGUI::DoLoadTree() { | |
2207 | // function to load a new calib tree | |
2208 | // | |
2209 | // | |
2210 | const char *kFileTypes[] = { | |
2211 | "ROOT file", "*.root", | |
2212 | 0, 0 | |
2213 | }; | |
2214 | TString dir("."); | |
2215 | TGFileInfo fi; | |
2216 | fi.fFileTypes = kFileTypes; | |
2217 | // fi.fIniDir = StrDup(dir); | |
2218 | fi.fOverwrite = kFALSE; | |
2219 | new TGFileDialog(gClient->GetRoot(), gClient->GetRoot(), kFDOpen, &fi); | |
2220 | if (fi.fFilename && strlen(fi.fFilename) && fChkAddAsReference->GetState() == kButtonUp) { | |
2221 | Initialize(fi.fFilename); | |
2222 | Reload(); | |
2223 | } | |
2224 | else if (fi.fFilename && strlen(fi.fFilename) && fChkAddAsReference->GetState() == kButtonDown) { | |
2225 | fViewer->AddReferenceTree(fi.fFilename, "calPads", fTxtRefName->GetText()); | |
2226 | Reload(); | |
2227 | } | |
2228 | } | |
2229 | ||
2230 | ||
2231 | TObjArray* AliTPCCalibViewerGUI::ShowGUI(const char* fileName) { | |
2232 | // | |
2233 | // Initialize and show GUI for presentation for demonstration purposes | |
2234 | // or for fast standalone use | |
2235 | // | |
2236 | TGMainFrame* frmMain = new TGMainFrame(gClient->GetRoot(), 1000, 600); | |
2237 | frmMain->SetWindowName("AliTPCCalibViewer GUI"); | |
2238 | frmMain->SetCleanup(kDeepCleanup); | |
2239 | ||
2240 | TGTab* tabMain = new TGTab(frmMain, 1000, 600); | |
2241 | frmMain->AddFrame(tabMain, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0)); | |
2242 | ||
2243 | TGCompositeFrame* tabCont1 = tabMain->AddTab("Viewer 1"); | |
2244 | TGCompositeFrame* tabCont2 = tabMain->AddTab("Viewer 2"); | |
2245 | ||
2246 | AliTPCCalibViewerGUI* calibViewer1 = new AliTPCCalibViewerGUI(tabCont1, 1000, 600, (char*)fileName); | |
2247 | tabCont1->AddFrame(calibViewer1, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0)); | |
2248 | ||
2249 | AliTPCCalibViewerGUI* calibViewer2 = new AliTPCCalibViewerGUI(tabCont2, 1000, 600, (char*)fileName); | |
2250 | tabCont2->AddFrame(calibViewer2, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0)); | |
2251 | ||
2252 | TObjArray *guiArray = new TObjArray(); | |
2253 | guiArray->Add(calibViewer1); | |
2254 | guiArray->Add(calibViewer2); | |
2255 | ||
2256 | frmMain->MapSubwindows(); | |
2257 | frmMain->Resize(); | |
2258 | frmMain->MapWindow(); | |
2259 | ||
2260 | return guiArray; | |
2261 | } | |
2262 |