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