Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TFitParametersDialog.cxx
Go to the documentation of this file.
1// @(#)root/fitpanel:$Id$
2// Author: Ilka Antcheva, Lorenzo Moneta 03/10/06
3
4/*************************************************************************
5 * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12
13/** \class TFitParametersDialog
14 \ingroup fitpanel
15
16Create a dialog for fit function parameter settings.
17
18*/
19
20
22#include "TF1.h"
23#include "TGButton.h"
24#include "TGLabel.h"
25#include "TGLayout.h"
26#include "TGTextEntry.h"
27#include "TGMsgBox.h"
28#include "TGNumberEntry.h"
29#include "TGTripleSlider.h"
30#include "TVirtualPad.h"
31#include "TMath.h"
32
33#include <limits>
34
35
38 kFIX = 10,
39 kBND = 20,
40 kVAL = 30,
41 kMIN = 40,
42 kMAX = 50,
43 kSLD = 60,
44 kSTP = 70,
45 kERR = 80,
46 kUPDATE = 8888,
51};
52
54
55////////////////////////////////////////////////////////////////////////////////
56
58 const TGWindow *main,
59 TF1 *func,
60 TVirtualPad *pad,
61 Int_t *ret_code) :
63 fFunc (func),
64 fFpad (pad),
65 fHasChanges (kFALSE),
66 fImmediateDraw (kTRUE),
67 fRetCode (ret_code)
68
69{
70 // Create a dialog for fit function parameters' settings.
71
73
75 fNP = fFunc->GetNpar();
76 fPmin = new Double_t[fNP];
77 fPmax = new Double_t[fNP];
78 fPval = new Double_t[fNP];
79 fPerr = new Double_t[fNP];
80 fPstp = new Double_t[fNP];
81
82 for (Int_t i = 0; i < fNP; i++) {
83 fFunc->GetParLimits(i, fPmin[i], fPmax[i]);
84 fPval[i] = fFunc->GetParameter(i);
85 fPerr[i] = fFunc->GetParError(i);
86 if (fPerr[i] > 1E-16)
88 else {
89 if (TMath::Abs(fPval[i]) > 1.)
90 // if error is zero use as step approx 10% of current value
92 else
93 fPstp[i] = 0.1;
94 }
95 }
96 fParNam = new TGTextEntry*[fNP];
103 fParStp = new TGNumberEntry*[fNP];
105
106 memset(fParNam, 0, sizeof(TGTextEntry*)*fNP);
107 memset(fParFix, 0, sizeof(TGCheckButton*)*fNP);
108 memset(fParBnd, 0, sizeof(TGCheckButton*)*fNP);
109 memset(fParVal, 0, sizeof(TGNumberEntry*)*fNP);
110 memset(fParMin, 0, sizeof(TGNumberEntryField*)*fNP);
111 memset(fParMax, 0, sizeof(TGNumberEntryField*)*fNP);
112 memset(fParSld, 0, sizeof(TGTripleHSlider*)*fNP);
113 memset(fParStp, 0, sizeof(TGNumberEntry*)*fNP);
114 memset(fParErr, 0, sizeof(TGNumberEntryField*)*fNP);
115
117 AddFrame(f1, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
118
119 // column 'Name'
121 fContNam->AddFrame(new TGLabel(fContNam,"Name"),
122 new TGLayoutHints(kLHintsTop, 5, 0, 0, 0));
123 for (Int_t i = 0; i < fNP; i++ ) {
124 fParNam[i] = new TGTextEntry(fContNam, new TGTextBuffer(80), kNAME+i);
125 fParNam[i]->SetText(Form("%s", fFunc->GetParName(i)));
128 new TGLayoutHints(kLHintsExpandX, 2, 2, 7, 5));
129 }
130 f1->AddFrame(fContNam, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2));
131
132 // column 'Fix'
134 fContFix->AddFrame(new TGLabel(fContFix,"Fix"),
135 new TGLayoutHints(kLHintsTop, 2, 0, 0, 0));
136 for (Int_t i = 0; i < fNP; i++ ) {
137 fParFix[i] = new TGCheckButton(fContFix, "", kFIX*fNP+i);
138 fParFix[i]->SetToolTipText(Form("Set %s to fixed", fFunc->GetParName(i)));
140 5, 5, 10, 7));
141 if ((fPmin[i] == fPmax[i]) && (fPmin[i] || fPmax[i]))
143 else
145 fParFix[i]->Connect("Toggled(Bool_t)", "TFitParametersDialog", this, "DoParFix(Bool_t)");
146 }
147 f1->AddFrame(fContFix, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2));
148
149 // column 'Bound'
151 fContBnd->AddFrame(new TGLabel(fContBnd,"Bound"),
152 new TGLayoutHints(kLHintsTop, 2, 0, 0, 0));
153 for (Int_t i = 0; i < fNP; i++ ) {
154 fParBnd[i] = new TGCheckButton(fContBnd, "", kBND*fNP+i);
155 fParBnd[i]->SetToolTipText(Form("Set bound to %s", fFunc->GetParName(i)));
157 15, 5, 10, 7));
158 fParBnd[i]->Connect("Toggled(Bool_t)", "TFitParametersDialog", this, "DoParBound(Bool_t)");
159 if ( ((fPmin[i] != fPmax[i]) && (fPmin[i] || fPmax[i])) || (fParMin[i] < fParMax[i]) )
161 else
163 }
164 f1->AddFrame(fContBnd, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2));
165
166 // column 'Value'
168 fContVal->AddFrame(new TGLabel(fContVal,"Value"),
169 new TGLayoutHints(kLHintsTop, 5, 0, 0, 0));
170 for (Int_t i = 0; i < fNP; i++ ) {
171 fParVal[i] = new TGNumberEntry(fContVal, 1.2E-12, 15, kVAL*fNP+i,
173 fParVal[i]->SetNumber(fPval[i]);
176 (fParVal[i]->GetNumberEntry())->SetToolTipText(Form("%s", fFunc->GetParName(i)));
177 (fParVal[i]->GetNumberEntry())->Connect("ReturnPressed()", "TFitParametersDialog",
178 this, "DoParValue()");
179 fParVal[i]->Connect("ValueSet(Long_t)", "TFitParametersDialog", this, "DoParValue()");
180 (fParVal[i]->GetNumberEntry())->Connect("TabPressed()", "TFitParametersDialog", this, "HandleTab()");
181 (fParVal[i]->GetNumberEntry())->Connect("ShiftTabPressed()", "TFitParametersDialog", this, "HandleShiftTab()");
182 fTextEntries.Add(fParVal[i]->GetNumberEntry());
183 }
184 f1->AddFrame(fContVal, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2));
185
186 // column 'Min'
188 fContMin->AddFrame(new TGLabel(fContMin,"Min"),
189 new TGLayoutHints(kLHintsTop, 5, 0, 0, 0));
190 for (Int_t i = 0; i < fNP; i++ ) {
191 fParMin[i] = new TGNumberEntryField(fContMin, kMIN*fNP+i, 0.0,
194 ((TGTextEntry*)fParMin[i])->SetToolTipText(Form("Lower limit of %s",
195 fFunc->GetParName(i)));
197 fParMin[i]->SetNumber(fPmin[i]);
198 fParMin[i]->Connect("ReturnPressed()", "TFitParametersDialog", this,
199 "DoParMinLimit()");
200 fParMin[i]->Connect("TabPressed()", "TFitParametersDialog", this, "HandleTab()");
201 fParMin[i]->Connect("ShiftTabPressed()", "TFitParametersDialog", this, "HandleShiftTab()");
203 }
204 f1->AddFrame(fContMin, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2));
205
206 // column 'Set Range'
208 fContSld->AddFrame(new TGLabel(fContSld,"Set Range"),
209 new TGLayoutHints(kLHintsTop, 5, 0, 0, 0));
210 for (Int_t i = 0; i < fNP; i++ ) {
216 }
217 f1->AddFrame(fContSld, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2));
218
219 // column 'Max'
221 fContMax->AddFrame(new TGLabel(fContMax,"Max"),
222 new TGLayoutHints(kLHintsTop, 5, 0, 0, 0));
223 for (Int_t i = 0; i < fNP; i++ ) {
224 fParMax[i] = new TGNumberEntryField(fContMax, kMAX*fNP+i, 0.0,
227 ((TGTextEntry*)fParMax[i])->SetToolTipText(Form("Upper limit of %s",
228 fFunc->GetParName(i)));
230 fParMax[i]->SetNumber(fPmax[i]);
231 fParMax[i]->Connect("ReturnPressed()", "TFitParametersDialog", this, "DoParMaxLimit()");
232 fParMax[i]->Connect("TabPressed()", "TFitParametersDialog", this, "HandleTab()");
233 fParMax[i]->Connect("ShiftTabPressed()", "TFitParametersDialog", this, "HandleShiftTab()");
235 }
236 f1->AddFrame(fContMax, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2));
237
238 // column 'Step'
240 fContStp->AddFrame(new TGLabel(fContStp,"Step"),
241 new TGLayoutHints(kLHintsTop, 5, 0, 0, 0));
242 for (Int_t i = 0; i < fNP; i++ ) {
243 fParStp[i] = new TGNumberEntry(fContStp, 1.2E-12, 15, kSTP*fNP+i,
245 fParStp[i]->SetNumber(fPstp[i]);
248 (fParStp[i]->GetNumberEntry())->SetToolTipText(Form("%s", fFunc->GetParName(i)));
249 (fParStp[i]->GetNumberEntry())->Connect("ReturnPressed()", "TFitParametersDialog",
250 this, "DoParStep()");
251 fParStp[i]->Connect("ValueSet(Long_t)", "TFitParametersDialog", this, "DoParStep()");
252 (fParStp[i]->GetNumberEntry())->Connect("TabPressed()", "TFitParametersDialog", this, "HandleTab()");
253 (fParStp[i]->GetNumberEntry())->Connect("ShiftTabPressed()", "TFitParametersDialog", this, "HandleShiftTab()");
254 fTextEntries.Add(fParStp[i]->GetNumberEntry());
255 }
256 f1->AddFrame(fContStp, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2));
257
258 // column 'Error'
260 fContErr->AddFrame(new TGLabel(fContErr,"Errors"),
261 new TGLayoutHints(kLHintsTop, 5, 0, 0, 0));
262 for (Int_t i = 0; i < fNP; i++ ) {
263 fParErr[i] = new TGNumberEntryField(fContErr, kERR*fNP+i, 0.0,
266 ((TGTextEntry*)fParErr[i])->SetToolTipText(Form("Error of %s",
267 fFunc->GetParName(i)));
270 if (fPerr[i])
271 fParErr[i]->SetNumber(fPerr[i]);
272 else
273 ((TGTextEntry *)fParErr[i])->SetText("-");
274 }
275 f1->AddFrame(fContErr, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2));
276
277 TGCompositeFrame *f2 = new TGCompositeFrame(this, 270, 20, kHorizontalFrame);
279
280 fUpdate = new TGCheckButton(f2, "&Immediate preview", kUPDATE);
281 fUpdate->SetToolTipText("Immediate function redrawing");
284 fUpdate->Connect("Toggled(Bool_t)", "TFitParametersDialog", this, "HandleButtons(Bool_t)");
285
287 f2->AddFrame(f3, new TGLayoutHints(kLHintsRight));
288
289 fReset = new TGTextButton(f3, "&Reset", kRESET);
291 fReset->SetToolTipText("Reset the parameter settings");
293 fReset->Connect("Clicked()", "TFitParametersDialog", this, "DoReset()");
294
295 fApply = new TGTextButton(f3, "&Apply", kAPPLY);
298 fApply->Connect("Clicked()", "TFitParametersDialog", this, "DoApply()");
299 fApply->SetToolTipText("Apply parameter settings and redraw the function");
300
301 fOK = new TGTextButton(f3, "&OK", kOK);
303 fOK->SetToolTipText("Apply parameter settings, redraw function and close this dialog");
304 fOK->Connect("Clicked()", "TFitParametersDialog", this, "DoOK()");
305
306 fCancel = new TGTextButton(f3, "&Cancel", kCANCEL);
308 fCancel->SetToolTipText("Close this dialog with no parameter changes");
309 fCancel->Connect("Clicked()", "TFitParametersDialog", this, "DoCancel()");
310 *fRetCode = kFPDNoChange; // default setting
311
314 MapWindow();
316 SetWindowName(Form("Set Parameters of %s", fFunc->GetTitle()));
317
318 for (Int_t i = 0; i < fNP; i++ ) {
319 if (fParFix[i]->GetState() == kButtonDown) {
323 fParSld[i]->UnmapWindow();
324 } else {
325 if (fPmin[i]*fPmax[i] == 0 && fPmin[i] >= fPmax[i]) { //init
326 // round again the values on the percent level
328 Double_t roundVal = int(fPval[i]/ u) * u;
329 // set min at +/- 100 step size
330 fParMin[i]->SetNumber( roundVal - 100* fPstp[i]);
331 fParMax[i]->SetNumber( roundVal + 100* fPstp[i]);
332 // if (!fPval[i]) {
333 // fParMin[i]->SetNumber(-10);
334 // fParMax[i]->SetNumber(10);
335 // } else {
336 // fParMin[i]->SetNumber(-3*TMath::Abs(fPval[i]));
337 // fParMax[i]->SetNumber(3*TMath::Abs(fPval[i]));
338 // }
339 }
340 fParSld[i]->SetRange(fParMin[i]->GetNumber(), fParMax[i]->GetNumber());
341 fParSld[i]->SetPosition(fParMin[i]->GetNumber(), fParMax[i]->GetNumber());
342 fParSld[i]->SetPointerPosition(fParVal[i]->GetNumber());
343 fParSld[i]->Connect("PointerPositionChanged()", "TFitParametersDialog",
344 this, "DoSlider()");
345 fParSld[i]->Connect("PositionChanged()", "TFitParametersDialog",
346 this, "DoSlider()");
347 }
348 }
349
350 gClient->WaitFor(this);
351}
352
353////////////////////////////////////////////////////////////////////////////////
354/// Destructor.
355
357{
360 Cleanup();
361 delete [] fPval;
362 delete [] fPmin;
363 delete [] fPmax;
364 delete [] fPerr;
365 delete [] fPstp;
366
367 delete [] fParNam;
368 delete [] fParFix;
369 delete [] fParBnd;
370 delete [] fParVal;
371 delete [] fParMin;
372 delete [] fParMax;
373 delete [] fParSld;
374 delete [] fParStp;
375 delete [] fParErr;
376}
377
378////////////////////////////////////////////////////////////////////////////////
379/// Close parameters' dialog.
380
382{
383 if (fHasChanges) {
384 Int_t ret;
385 const char *txt;
386 txt = "Do you want to apply last parameters' setting?";
388 "Parameters Have Been Changed", txt, kMBIconExclamation,
389 kMBYes | kMBNo | kMBCancel, &ret);
390 if (ret == kMBYes) {
393 }
394 else if (ret == kMBNo)
395 DoReset();
396 else return;
397 }
398
400 DeleteWindow();
401}
402
403////////////////////////////////////////////////////////////////////////////////
404/// Slot related to the Cancel button.
405
407{
408 if (fHasChanges)
409 DoReset();
410 // for (Int_t i = 0; i < fNP; i++ ) {
411 // if (fParBnd[i]->GetState() == kButtonDown)
412 // *fRetCode = kFPDBounded;
413 // }
414 CloseWindow();
415}
416
417////////////////////////////////////////////////////////////////////////////////
418/// Slot related to the Bound check button.
419
421{
422 TGButton *bt = (TGButton *) gTQSender;
423 Int_t id = bt->WidgetId();
425
426 for (Int_t i = 0; i < fNP; i++ ) {
427 if (id == kBND*fNP+i) {
428 if (on) {
429 if (fParMin[i]->GetNumber() >= fParMax[i]->GetNumber()) {
430 Int_t ret;
431 const char *txt;
432 txt = "'Min' value cannot be bigger or equal to 'Max' - set the limits first!";
434 "Parameter Limits", txt, kMBIconExclamation,kMBOk,&ret);
435
437 return;
438 }
439 if ((fParVal[i]->GetNumber() < fParMin[i]->GetNumber()) ||
440 (fParVal[i]->GetNumber() > fParMax[i]->GetNumber())) {
441 Double_t v = (fParMax[i]->GetNumber()+fParMin[i]->GetNumber())/2.;
442 fParVal[i]->SetNumber(v);
443 fFunc->SetParameter(i, v);
445 }
447 fParMin[i]->GetNumber(),
448 fParMax[i]->GetNumber());
450 fFunc->SetParLimits(i, fParMin[i]->GetNumber(),
451 fParMax[i]->GetNumber());
452 } else {
455 fFunc->GetParLimits(i, fPmin[i], fPmax[i]);
456 fPval[i] = fFunc->GetParameter(i);
457 if (fPmin[i]*fPmax[i] == 0 && fPmin[i] >= fPmax[i]) { //init
458 if (!fPval[i]) {
459 fParMin[i]->SetNumber(-10);
460 fParMax[i]->SetNumber(10);
461 } else {
462 fParMin[i]->SetNumber(-10*TMath::Abs(fPval[i]));
463 fParMax[i]->SetNumber(10*TMath::Abs(fPval[i]));
464 }
465 }
466 fParSld[i]->SetRange(fParMin[i]->GetNumber(), fParMax[i]->GetNumber());
467 fParSld[i]->SetPosition(fParMin[i]->GetNumber(), fParMax[i]->GetNumber());
469 }
470 }
471 }
472 if (fUpdate->GetState() == kButtonDown)
473 DrawFunction();
474 else if ((fApply->GetState() == kButtonDisabled) && fHasChanges)
476}
477
478////////////////////////////////////////////////////////////////////////////////
479/// Slot related to parameter step setting.
480
482{
483}
484
485////////////////////////////////////////////////////////////////////////////////
486/// Slot related to the Fix check button.
487
489{
491
492 TGButton *bt = (TGButton *) gTQSender;
493 Int_t id = bt->WidgetId();
495
496 for (Int_t i = 0; i < fNP; i++ ) {
497 if (id == kFIX*fNP+i) {
498 if (on) {
499 // no bound available
500 fParBnd[i]->Disconnect("Toggled(Bool_t)");
502 fParBnd[i]->SetToolTipText(Form("DISABLED - %s is fixed", fFunc->GetParName(i)));
503 if (fParVal[i]->GetNumber() != 0) {
504 fParMin[i]->SetNumber(fParVal[i]->GetNumber());
506 fParMax[i]->SetNumber(fParVal[i]->GetNumber());
508 } else {
509 fParMin[i]->SetNumber(1.);
511 fParMax[i]->SetNumber(1.);
513 }
516 fParSld[i]->Disconnect("PointerPositionChanged()");
517 fParSld[i]->Disconnect("PositionChanged()");
518 fParSld[i]->UnmapWindow();
519 fFunc->FixParameter(i, fParVal[i]->GetNumber());
520 } else if (!fParMin[i]->IsEnabled()) {
521 if (fPmin[i] != fPmax[i]) {
522 if (fPmin[i])
523 fParMin[i]->SetNumber(fPmin[i]);
524 else if (fPerr[i])
525 fParMin[i]->SetNumber(fPval[i]-3*fPerr[i]);
526 else if (fPval[i])
527 fParMin[i]->SetNumber(fPval[i]-0.1*fPval[i]);
528 else
529 fParMin[i]->SetNumber(1.0);
530 if (fPmax[i])
531 fParMax[i]->SetNumber(fPmax[i]);
532 else if (fPerr[i])
533 fParMax[i]->SetNumber(fPval[i]+3*fPerr[i]);
534 else if (fPval[i])
535 fParMax[i]->SetNumber(fPval[i]+0.1*fPval[i]);
536 else
537 fParMax[i]->SetNumber(1.0);
538 } else if (fPval[i]) {
539 fParMin[i]->SetNumber(fPval[i]-0.1*fPval[i]);
540 fParMax[i]->SetNumber(fPval[i]+0.1*fPval[i]);
541 } else {
542 fParMin[i]->SetNumber(1.0);
543 fParMax[i]->SetNumber(1.0);
544 }
545 if (fParMax[i]->GetNumber() < fParMin[i]->GetNumber()){
546 Double_t temp;
547 temp = fParMax[i]->GetNumber();
548 fParMax[i]->SetNumber(fParMin[i]->GetNumber());
549 fParMin[i]->SetNumber(temp);
550 }
552 fParBnd[i]->Connect("Toggled(Bool_t)", "TFitParametersDialog",
553 this, "DoParBound(Bool_t)");
557 fParSld[i]->MapWindow();
560 fParSld[i]->SetRange(fParMin[i]->GetNumber(), fParMax[i]->GetNumber());
561 fParSld[i]->SetPosition(fParMin[i]->GetNumber(), fParMax[i]->GetNumber());
563 fParSld[i]->Connect("PointerPositionChanged()", "TFitParametersDialog",
564 this, "DoSlider()");
565 fParSld[i]->Connect("PositionChanged()", "TFitParametersDialog",
566 this, "DoSlider()");
567 fFunc->SetParLimits(i, fParMin[i]->GetNumber(), fParMax[i]->GetNumber());
568 }
569 }
570 }
571 if (fUpdate->GetState() == kButtonDown)
572 DrawFunction();
573 else if ((fApply->GetState() == kButtonDisabled) && fHasChanges)
575}
576
577////////////////////////////////////////////////////////////////////////////////
578/// Set the parameter values inside the function
579
581{
583 for (Int_t i = 0; i < fNP; i++ ) {
584 // first make sure the current value is up to date
586 if (fParFix[i]->GetState() == kButtonDown) {
587 fFunc->SetParameter(i, fParVal[i]->GetNumber());
588 fFunc->FixParameter(i, fParVal[i]->GetNumber());
590 } else {
591 if (fParBnd[i]->GetState() == kButtonDown) {
592 fFunc->SetParameter(i, fParVal[i]->GetNumber());
593 fFunc->SetParLimits(i, fParMin[i]->GetNumber(), fParMax[i]->GetNumber());
595 } else {
597 }
598 }
599 }
600}
601
602////////////////////////////////////////////////////////////////////////////////
603/// Slot related to the OK button.
604
606{
607 if (fHasChanges)
608 DrawFunction();
609
611
612 // we want here to confirm the parameters settings so
613 // it is like having changed them
615
616
617 CloseWindow();
618}
619
620////////////////////////////////////////////////////////////////////////////////
621/// Slot related to the Preview button.
622
624{
625 DrawFunction();
629}
630
631////////////////////////////////////////////////////////////////////////////////
632/// Slot related to the Reset button.
633
635{
637 Int_t k = fNP;
638 for (Int_t i = 0; i < fNP; i++) {
639 if (fParVal[i]->GetNumber() == fPval[i])
640 k--;
641 else
642 break;
643 }
644
645 if (!k) {
646 if (fReset->GetState() == kButtonUp)
649 return;
650 }
651 for (Int_t i = 0; i < fNP; i++) {
652 fFunc->SetParameter(i, fPval[i]);
653 fFunc->SetParLimits(i, fPmin[i], fPmax[i]);
654 fFunc->SetParError(i, fPerr[i]);
655
656 if (fPmin[i])
657 fParMin[i]->SetNumber(fPmin[i]);
658 else if (fPerr[i])
659 fParMin[i]->SetNumber(fPval[i]-3*fPerr[i]);
660 else if (fPval[i])
661 fParMin[i]->SetNumber(-3*TMath::Abs(fPval[i]));
662 else
663 fParMin[i]->SetNumber(1.0);
664
665 if (fPmax[i])
666 fParMax[i]->SetNumber(fPmax[i]);
667 else if (fPerr[i])
668 fParMax[i]->SetNumber(fPval[i]+3*fPerr[i]);
669 else if (fPval[i])
671 else
672 fParMax[i]->SetNumber(1.0);
673 if (fParMax[i]->GetNumber() < fParMin[i]->GetNumber()){
674 Double_t temp;
675 temp = fParMax[i]->GetNumber();
676 fParMax[i]->SetNumber(fParMin[i]->GetNumber());
677 fParMin[i]->SetNumber(temp);
678 }
679 if (fParMin[i]->GetNumber() == fParMax[i]->GetNumber()) {
684 fParSld[i]->Disconnect("PointerPositionChanged()");
685 fParSld[i]->Disconnect("PositionChanged()");
686 fParSld[i]->UnmapWindow();
687 fParBnd[i]->Disconnect("Toggled(Bool_t)");
689 fFunc->FixParameter(i, fParVal[i]->GetNumber());
691 } else {
693 if (!fParMax[i]->IsEnabled()) {
698 fParSld[i]->SetRange(fParMin[i]->GetNumber(), fParMax[i]->GetNumber());
699 fParSld[i]->SetPosition(fParMin[i]->GetNumber(), fParMax[i]->GetNumber());
701 fParSld[i]->MapWindow();
702 fParSld[i]->Connect("PointerPositionChanged()", "TFitParametersDialog",
703 this, "DoSlider()");
704 fParSld[i]->Connect("PositionChanged()", "TFitParametersDialog",
705 this, "DoSlider()");
707 fParBnd[i]->Connect("Toggled(Bool_t)", "TFitParametersDialog",
708 this, "DoParBound(Bool_t)");
709 }
710 }
711 fParVal[i]->SetNumber(fPval[i]);
712
713 fParSld[i]->SetRange(fParMin[i]->GetNumber(), fParMax[i]->GetNumber());
714 fParSld[i]->SetPosition(fParMin[i]->GetNumber(), fParMax[i]->GetNumber());
716 }
717
718 if (fUpdate->GetState() == kButtonDown)
719 DrawFunction();
720 else if ((fApply->GetState() == kButtonDisabled) && fHasChanges)
725}
726
727////////////////////////////////////////////////////////////////////////////////
728/// Slot related to the parameters' value settings.
729
731{
733 Int_t id = sl->WidgetId();
734
736 for (Int_t i = 0; i < fNP; i++ ) {
737 if (id == kSLD*fNP+i) {
738 fFunc->SetParameter(i,fParSld[i]->GetPointerPosition());
739 fFunc->SetParLimits(i,fParSld[i]->GetMinPosition(),
740 fParSld[i]->GetMaxPosition());
741 fParMin[i]->SetNumber(fParSld[i]->GetMinPosition());
742 fParMax[i]->SetNumber(fParSld[i]->GetMaxPosition());
743 fParVal[i]->SetNumber(fParSld[i]->GetPointerPosition());
744 }
745 }
746 if (fUpdate->GetState() == kButtonDown)
747 DrawFunction();
748 else if ((fApply->GetState() == kButtonDisabled) && fHasChanges)
752}
753
754////////////////////////////////////////////////////////////////////////////////
755/// Slot related to the parameter value settings.
756
758{
760 Int_t id = ne->WidgetId();
761
762 for (Int_t i = 0; i < fNP; i++ ) {
763 if (id == kVAL*fNP+i) {
764 if (fParVal[i]->GetNumber() < fParMin[i]->GetNumber()) {
765 Double_t extraIncrement = (fParMax[i]->GetNumber() - fParMin[i]->GetNumber()) / 4;
766 fParMin[i]->SetNumber(fParVal[i]->GetNumber() - extraIncrement );
768 fParSld[i]->SetRange(fParMin[i]->GetNumber(),
769 fParMax[i]->GetNumber());
770 fParSld[i]->SetPosition(fParMin[i]->GetNumber(),
771 fParMax[i]->GetNumber());
772 }
773 if (fParVal[i]->GetNumber() > fParMax[i]->GetNumber()) {
774 Double_t extraIncrement = (fParMax[i]->GetNumber() - fParMin[i]->GetNumber()) / 4;
775 fParMax[i]->SetNumber(fParVal[i]->GetNumber() + extraIncrement );
777 fParSld[i]->SetRange(fParMin[i]->GetNumber(),
778 fParMax[i]->GetNumber());
779 fParSld[i]->SetPosition(fParMin[i]->GetNumber(),
780 fParMax[i]->GetNumber());
781 }
782 fParSld[i]->SetPointerPosition(fParVal[i]->GetNumber());
784 fFunc->SetParameter(i,fParSld[i]->GetPointerPosition());
785 if (fParBnd[i]->GetState() == kButtonDown)
787 fParSld[i]->GetMaxPosition());
788 else
790 }
791 }
793 if (fUpdate->GetState() == kButtonDown)
794 DrawFunction();
795 else if ((fApply->GetState() == kButtonDisabled) && fHasChanges)
799}
800
801////////////////////////////////////////////////////////////////////////////////
802/// Slot related to the minumum parameter limit settings.
803
805{
807 Int_t id = ne->WidgetId();
808
809 for (Int_t i = 0; i < fNP; i++ ) {
810 if (id == kMIN*fNP+i) {
811 if ((fParMin[i]->GetNumber() >= fParMax[i]->GetNumber()) &&
812 (fParBnd[i]->GetState() == kButtonDown)) {
813 Int_t ret;
814 const char *txt;
815 txt = "'Min' cannot be bigger then 'Max' if this parameter is bounded.";
817 "Parameter Limits", txt, kMBIconExclamation, kMBOk, &ret);
818 fParMin[i]->SetNumber(fParVal[i]->GetNumber()-fParStp[i]->GetNumber());
819 return;
820 }
821 if (fParBnd[i]->GetState() == kButtonDown) {
822 Double_t val = (fParMax[i]->GetNumber()+fParMin[i]->GetNumber())/2.;
823 fParVal[i]->SetNumber(val);
824 fParVal[i]->SetLimitValues(fParMin[i]->GetNumber(),
825 fParMax[i]->GetNumber());
826 }
827 fParSld[i]->SetRange(fParMin[i]->GetNumber(),
828 fParMax[i]->GetNumber());
829 fParSld[i]->SetPosition(fParMin[i]->GetNumber(),
830 fParMax[i]->GetNumber());
831 fParSld[i]->SetPointerPosition(fParVal[i]->GetNumber());
833 }
834 }
836 if (fUpdate->GetState() == kButtonDown)
837 DrawFunction();
838 else if ((fApply->GetState() == kButtonDisabled) && fHasChanges)
842}
843
844////////////////////////////////////////////////////////////////////////////////
845/// Slot related to the maximum parameter limit settings.
846
848{
850 Int_t id = ne->WidgetId();
851
852 for (Int_t i = 0; i < fNP; i++ ) {
853 if (id == kMAX*fNP+i) {
854 if ((fParMin[i]->GetNumber() >= fParMax[i]->GetNumber()) &&
855 (fParBnd[i]->GetState() == kButtonDown)) {
856 Int_t ret;
857 const char *txt;
858 txt = "'Min' cannot be bigger then 'Max' if this parameter is bounded.";
860 "Parameter Limits", txt, kMBIconExclamation, kMBOk, &ret);
861 fParMax[i]->SetNumber(fParVal[i]->GetNumber()+fParStp[i]->GetNumber());
862 return;
863 }
864 if (fParBnd[i]->GetState() == kButtonDown) {
865 Double_t val = (fParMax[i]->GetNumber()+(fParMin[i]->GetNumber()))/2.;
866 fParVal[i]->SetNumber(val);
867 fParVal[i]->SetLimitValues(fParMin[i]->GetNumber(),
868 fParMax[i]->GetNumber());
869 }
870 fParSld[i]->SetRange(fParMin[i]->GetNumber(),
871 fParMax[i]->GetNumber());
872 fParSld[i]->SetPosition(fParMin[i]->GetNumber(),
873 fParMax[i]->GetNumber());
874 fParSld[i]->SetPointerPosition(fParVal[i]->GetNumber());
876 }
877 }
879 if (fUpdate->GetState() == kButtonDown)
880 DrawFunction();
881 else if ((fApply->GetState() == kButtonDisabled) && fHasChanges)
885}
886
887////////////////////////////////////////////////////////////////////////////////
888/// Redraw function graphics.
889
891{
892 if ( !fFpad ) return;
894
895 Style_t st = fFunc->GetLineStyle();
897
898 TString opt = fFunc->GetDrawOption();
899 opt.ToUpper();
900 if (!opt.Contains("SAME"))
901 opt += "SAME";
902 //fFunc->SetRange(fRXmin, fRXmax);
903 fFunc->Draw(opt);
904 gPad->Modified();
905 gPad->Update();
907
908 fFunc->SetLineStyle(st);
910}
911
912////////////////////////////////////////////////////////////////////////////////
913/// Handle the button dependent states in this dialog.
914
916{
917 if (update && fHasChanges)
918 DrawFunction();
919 else if ((fApply->GetState() == kButtonDisabled) && fHasChanges) {
921 }
922}
923
924////////////////////////////////////////////////////////////////////////////////
925/// Disconnect signals from slot methods.
926
928{
929 for (Int_t i = 0; i < fNP; i++ ) {
930 fParFix[i]->Disconnect("Toggled(Bool_t)");
931 fParBnd[i]->Disconnect("Toggled(Bool_t)");
932 fParVal[i]->Disconnect("ValueSet(Long_t)");
933 fParMin[i]->Disconnect("ReturnPressed()");
934 fParMax[i]->Disconnect("ReturnPressed()");
935 fParSld[i]->Disconnect("PointerPositionChanged()");
936 fParSld[i]->Disconnect("PositionChanged()");
937 fParStp[i]->Disconnect("ValueSet(Long_t)");
938 fParVal[i]->Disconnect("TabPressed(Long_t)");
939 fParVal[i]->Disconnect("ShiftTabPressed(Long_t)");
940 fParMin[i]->Disconnect("TabPressed(Long_t)");
941 fParMin[i]->Disconnect("ShiftTabPressed(Long_t)");
942 fParMax[i]->Disconnect("TabPressed(Long_t)");
943 fParMax[i]->Disconnect("ShiftTabPressed(Long_t)");
944 fParStp[i]->Disconnect("TabPressed(Long_t)");
945 fParStp[i]->Disconnect("ShiftTabPressed(Long_t)");
946 }
947 fUpdate->Disconnect("Toggled(Bool_t)");
948 fReset->Disconnect("Clicked()");
949 fApply->Disconnect("Clicked()");
950 fOK->Disconnect("Clicked()");
951 fCancel->Disconnect("Clicked()");
952}
953
954////////////////////////////////////////////////////////////////////////////////
955/// Handle Shift+Tab key event (set focus to the previous number entry field)
956
958{
960 next = (TGNumberEntryField *)fTextEntries.Before((TObject *)sender);
961 if (next == 0)
963 if (next) {
964 next->SetFocus();
965 next->Home();
966 }
967}
968
969////////////////////////////////////////////////////////////////////////////////
970/// Handle Tab key event (set focus to the next number entry field)
971
973{
975 next = (TGNumberEntryField *)fTextEntries.After((TObject *)sender);
976 if (next == 0)
978 if (next) {
979 next->SetFocus();
980 next->Home();
981 }
982}
983
984
985
@ kVerticalFrame
Definition GuiTypes.h:381
@ kFixedWidth
Definition GuiTypes.h:387
@ kHorizontalFrame
Definition GuiTypes.h:382
int main()
Definition Prototype.cxx:12
static void update(gsl_integration_workspace *workspace, double a1, double b1, double area1, double error1, double a2, double b2, double area2, double error2)
short Style_t
Definition RtypesCore.h:89
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
#define ClassImp(name)
Definition Rtypes.h:377
@ kFPDNoChange
@ kFPDBounded
@ kButtonDown
Definition TGButton.h:54
@ kButtonDisabled
Definition TGButton.h:56
@ kButtonUp
Definition TGButton.h:53
#define gClient
Definition TGClient.h:156
@ kDoubleScaleBoth
@ kDeepCleanup
Definition TGFrame.h:42
@ kLHintsRight
Definition TGLayout.h:26
@ kLHintsLeft
Definition TGLayout.h:24
@ kLHintsCenterY
Definition TGLayout.h:28
@ kLHintsTop
Definition TGLayout.h:27
@ kLHintsExpandX
Definition TGLayout.h:30
@ kMBNo
Definition TGMsgBox.h:32
@ kMBYes
Definition TGMsgBox.h:31
@ kMBCancel
Definition TGMsgBox.h:37
@ kMBOk
Definition TGMsgBox.h:33
@ kMBIconExclamation
Definition TGMsgBox.h:24
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
R__EXTERN void * gTQSender
Definition TQObject.h:46
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2489
#define gPad
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
Definition TAttLine.h:42
virtual Style_t GetLineStyle() const
Return the line style.
Definition TAttLine.h:34
1-Dim function class
Definition TF1.h:233
virtual void ReleaseParameter(Int_t ipar)
Release parameter number ipar during a fit operation.
Definition TF1.cxx:3151
virtual void SetParError(Int_t ipar, Double_t error)
Set error for parameter number ipar.
Definition TF1.cxx:3479
virtual void GetParLimits(Int_t ipar, Double_t &parmin, Double_t &parmax) const
Return limits for parameter ipar.
Definition TF1.cxx:1942
virtual Double_t GetParError(Int_t ipar) const
Return value of parameter number ipar.
Definition TF1.cxx:1932
virtual void SetRange(Double_t xmin, Double_t xmax)
Initialize the upper and lower bounds to draw the function.
Definition TF1.cxx:3528
virtual Int_t GetNpar() const
Definition TF1.h:507
void Draw(Option_t *option="") override
Draw this function with its current attributes.
Definition TF1.cxx:1335
virtual void GetRange(Double_t *xmin, Double_t *xmax) const
Return range of a generic N-D function.
Definition TF1.cxx:2281
virtual const char * GetParName(Int_t ipar) const
Definition TF1.h:555
virtual void SetParLimits(Int_t ipar, Double_t parmin, Double_t parmax)
Set lower and upper limits for parameter ipar.
Definition TF1.cxx:3507
virtual void SetParameter(Int_t param, Double_t value)
Definition TF1.h:660
virtual void FixParameter(Int_t ipar, Double_t value)
Fix the value of a parameter for a fit operation The specified value will be used in the fit and the ...
Definition TF1.cxx:1559
virtual Double_t GetParameter(Int_t ipar) const
Definition TF1.h:538
Create a dialog for fit function parameter settings.
Int_t fNP
number of function parameters
TGCompositeFrame * fContMin
container of min range values
virtual void DoReset()
Slot related to the Reset button.
Double_t * fPval
original patameters' values
TFitParametersDialog(const TGWindow *p, const TGWindow *main, TF1 *func, TVirtualPad *pad, Int_t *ret_code=nullptr)
Bool_t fHasChanges
kTRUE if function was redrawn;
Double_t * fPmin
min limits of patameters range
virtual void DoSlider()
Slot related to the parameters' value settings.
TGNumberEntry ** fParStp
step values
TGCompositeFrame * fContVal
container of parameter values
TF1 * fFunc
function passed to this dialog
Double_t fRangexmin
min function range
TGTextButton * fApply
Apply button.
virtual void HandleTab()
Handle Tab key event (set focus to the next number entry field)
TGCheckButton ** fParFix
fix setting switch
TGCheckButton ** fParBnd
bound setting switch
virtual void HandleShiftTab()
Handle Shift+Tab key event (set focus to the previous number entry field)
TGNumberEntryField ** fParErr
error values
TGCompositeFrame * fContStp
container of step values
void DisconnectSlots()
Disconnect signals from slot methods.
TGCompositeFrame * fContNam
container of parameter names
Int_t * fRetCode
address to store return code
Double_t * fPmax
max limits of patameters range
void SetParameters()
Set the parameter values inside the function.
virtual void DoParStep()
Slot related to parameter step setting.
TGTextButton * fCancel
Cancel button.
TGNumberEntry ** fParVal
parameter values
TGTripleHSlider ** fParSld
triple sliders
TGCompositeFrame * fContErr
container of error values
TGCompositeFrame * fContBnd
container of bound settings
virtual void DoApply()
Slot related to the Preview button.
TGNumberEntryField ** fParMax
max range values
virtual void DoCancel()
Slot related to the Cancel button.
virtual void DoParValue()
Slot related to the parameter value settings.
virtual void DoParFix(Bool_t on)
Slot related to the Fix check button.
TList fTextEntries
list of text entries used for keyboard navigation
virtual void HandleButtons(Bool_t update)
Handle the button dependent states in this dialog.
TGCheckButton * fUpdate
immediate update switch
void CloseWindow() override
Close parameters' dialog.
Double_t * fPstp
original patameters' step
Double_t fRangexmax
max function range
Double_t * fPerr
original patameters' errors
TGNumberEntryField ** fParMin
min range values
virtual void DoOK()
Slot related to the OK button.
virtual void DoParBound(Bool_t on)
Slot related to the Bound check button.
TGCompositeFrame * fContFix
container of fix settings
~TFitParametersDialog() override
Destructor.
virtual void DoParMinLimit()
Slot related to the minumum parameter limit settings.
TVirtualPad * fFpad
pad where the function is drawn
virtual void DrawFunction()
Redraw function graphics.
TGCompositeFrame * fContMax
container of max range values
virtual void DoParMaxLimit()
Slot related to the maximum parameter limit settings.
TGTextButton * fReset
Reset button.
TGTextEntry ** fParNam
parameter names
TGCompositeFrame * fContSld
container of sliders
TGTextButton * fOK
OK button.
A button abstract base class.
Definition TGButton.h:68
virtual void SetToolTipText(const char *text, Long_t delayms=400)
Set tool tip text associated with this button.
Definition TGButton.cxx:445
virtual EButtonState GetState() const
Definition TGButton.h:112
virtual void SetEnabled(Bool_t e=kTRUE)
Set enabled or disabled state of button.
Definition TGButton.cxx:459
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set button state.
Definition TGButton.cxx:235
Selects different options.
Definition TGButton.h:264
void SetState(EButtonState state, Bool_t emit=kFALSE) override
Set check button state.
const TGWindow * GetRoot() const
Returns current root (i.e.
Definition TGClient.cxx:224
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition TGClient.cxx:372
The base class for composite widgets (menu bars, list boxes, etc.).
Definition TGFrame.h:287
TGDimension GetDefaultSize() const override
std::cout << fWidth << "x" << fHeight << std::endl;
Definition TGFrame.h:316
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1117
Int_t GetState(TGFrame *f) const
Get state of sub frame.
Definition TGFrame.cxx:1218
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
Definition TGFrame.cxx:967
void MapSubwindows() override
Map all sub windows that are part of the composite frame.
Definition TGFrame.cxx:1164
void SetCleanup(Int_t mode=kLocalCleanup) override
Turn on automatic cleanup of child frames in dtor.
Definition TGFrame.cxx:1072
virtual Float_t GetMaxPosition() const
virtual Float_t GetMinPosition() const
virtual void SetRange(Float_t min, Float_t max)
virtual void SetPosition(Float_t min, Float_t max)
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
Definition TGFrame.cxx:605
void MapWindow() override
map window
Definition TGFrame.h:204
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition TGFrame.cxx:683
virtual void DeleteWindow()
Delete window.
Definition TGFrame.cxx:276
void UnmapWindow() override
unmap window
Definition TGFrame.h:206
This class handles GUI labels.
Definition TGLabel.h:24
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
void SetWindowName(const char *name=nullptr) override
Set window name. This is typically done via the window manager.
Definition TGFrame.cxx:1788
virtual void SetNumber(Double_t val, Bool_t emit=kTRUE)
Set the numeric value (floating point representation).
virtual Double_t GetNumber() const
Get the numeric value (floating point representation).
void ReturnPressed() override
Return was pressed.
TGNumberEntry is a number entry input widget with up/down buttons.
TGNumberEntryField * GetNumberEntry() const
Get the number entry field.
virtual void SetLimits(ELimit limits=TGNumberFormat::kNELNoLimits, Double_t min=0, Double_t max=1)
virtual void SetState(Bool_t enable=kTRUE)
Set the active state.
void SetLimitValues(Double_t min=0, Double_t max=1)
virtual void SetFormat(EStyle style, EAttribute attr=TGNumberFormat::kNEAAnyNumber)
virtual void SetNumber(Double_t val, Bool_t emit=kTRUE)
@ kNEAAnyNumber
Attributes of number entry field.
@ kNESReal
Real number.
@ kNELNoLimits
Limit selection of number entry field.
@ kNELLimitMinMax
Both lower and upper limits.
TGClient * fClient
Connection to display server.
Definition TGObject.h:25
A text buffer is used in several widgets, like TGTextEntry, TGFileDialog, etc.
Yield an action as soon as it is clicked.
Definition TGButton.h:142
A TGTextEntry is a one line text input widget.
Definition TGTextEntry.h:24
virtual void SetFocus()
Set focus to this text entry.
void SetEnabled(Bool_t flag=kTRUE)
virtual void SetText(const char *text, Bool_t emit=kTRUE)
Sets text entry to text, clears the selection and moves the cursor to the end of the line.
void Home(Bool_t mark=kFALSE)
Moves the text cursor to the left end of the line.
Defines transient windows that typically are used for dialogs windows.
Definition TGFrame.h:498
virtual void CenterOnParent(Bool_t croot=kTRUE, EPlacement pos=kCenter)
Position transient frame centered relative to the parent frame.
Definition TGFrame.cxx:1957
TripleSlider inherit from DoubleSlider widgets and allow easy selection of a min, max and pointer val...
virtual void SetPointerPosition(Double_t pos)
Set pointer position in scaled (real) value.
virtual void SetConstrained(Bool_t on=kTRUE)
Set pointer position constrained in the slider range.
Int_t WidgetId() const
Definition TGWidget.h:68
ROOT GUI Window base class.
Definition TGWindow.h:23
virtual const TGWindow * GetMainFrame() const
Returns top level main frame.
Definition TGWindow.cxx:152
TObject * After(const TObject *obj) const override
Returns the object after object obj.
Definition TList.cxx:328
void Clear(Option_t *option="") override
Remove all objects from the list.
Definition TList.cxx:400
TObject * Before(const TObject *obj) const override
Returns the object before object obj.
Definition TList.cxx:369
void Add(TObject *obj) override
Definition TList.h:83
TObject * Last() const override
Return the last object in the list. Returns 0 when list is empty.
Definition TList.cxx:691
TObject * First() const override
Return the first object in the list. Returns 0 when list is empty.
Definition TList.cxx:657
const char * GetTitle() const override
Returns title of object.
Definition TNamed.h:48
Mother of all ROOT objects.
Definition TObject.h:41
virtual Option_t * GetDrawOption() const
Get option used by the graphics system to draw this object.
Definition TObject.cxx:423
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.
Definition TQObject.cxx:869
Bool_t Disconnect(const char *signal=nullptr, void *receiver=nullptr, const char *slot=nullptr)
Disconnects signal of this object from slot of receiver.
Basic string class.
Definition TString.h:139
void ToUpper()
Change string to upper case.
Definition TString.cxx:1195
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:632
small helper class to store/restore gPad context in TPad methods
Definition TVirtualPad.h:61
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition TVirtualPad.h:51
TF1 * f1
Definition legend1.C:11
Double_t Floor(Double_t x)
Rounds x downward, returning the largest integral value that is not greater than x.
Definition TMath.h:680
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Returns x raised to the power y.
Definition TMath.h:721
Double_t Log10(Double_t x)
Returns the common (base-10) logarithm of x.
Definition TMath.h:762
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Definition TMathBase.h:123