Logo ROOT  
Reference Guide
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 // //
14 // TFitParametersDialog //
15 // //
16 // Create a dialog for fit function parameter settings. //
17 // //
18 //////////////////////////////////////////////////////////////////////////
19 
20 #include "TFitParametersDialog.h"
21 #include "TF1.h"
22 #include "TGButton.h"
23 #include "TGLabel.h"
24 #include "TGLayout.h"
25 #include "TGTextEntry.h"
26 #include "TGMsgBox.h"
27 #include "TGNumberEntry.h"
28 #include "TGTripleSlider.h"
29 #include "TVirtualPad.h"
30 #include "TMath.h"
31 
32 #include <limits>
33 
34 
37  kFIX = 10,
38  kBND = 20,
39  kVAL = 30,
40  kMIN = 40,
41  kMAX = 50,
42  kSLD = 60,
43  kSTP = 70,
44  kERR = 80,
45  kUPDATE = 8888,
48  kOK,
49  kCANCEL
50 };
51 
53 
54 ////////////////////////////////////////////////////////////////////////////////
55 
57  const TGWindow *main,
58  TF1 *func,
59  TVirtualPad *pad,
60  Int_t *ret_code) :
62  fFunc (func),
63  fFpad (pad),
64  fHasChanges (kFALSE),
65  fImmediateDraw (kTRUE),
66  fRetCode (ret_code)
67 
68 {
69  // Create a dialog for fit function parameters' settings.
70 
72 
74  fNP = fFunc->GetNpar();
75  fPmin = new Double_t[fNP];
76  fPmax = new Double_t[fNP];
77  fPval = new Double_t[fNP];
78  fPerr = new Double_t[fNP];
79  fPstp = new Double_t[fNP];
80 
81  for (Int_t i = 0; i < fNP; i++) {
82  fFunc->GetParLimits(i, fPmin[i], fPmax[i]);
83  fPval[i] = fFunc->GetParameter(i);
84  fPerr[i] = fFunc->GetParError(i);
85  if (fPerr[i] > 1E-16)
87  else {
88  if (TMath::Abs(fPval[i]) > 1.)
89  // if error is zero use as step approx 10% of current value
91  else
92  fPstp[i] = 0.1;
93  }
94  }
95  fParNam = new TGTextEntry*[fNP];
96  fParFix = new TGCheckButton*[fNP];
97  fParBnd = new TGCheckButton*[fNP];
98  fParVal = new TGNumberEntry*[fNP];
101  fParSld = new TGTripleHSlider*[fNP];
102  fParStp = new TGNumberEntry*[fNP];
104 
105  memset(fParNam, 0, sizeof(TGTextEntry*)*fNP);
106  memset(fParFix, 0, sizeof(TGCheckButton*)*fNP);
107  memset(fParBnd, 0, sizeof(TGCheckButton*)*fNP);
108  memset(fParVal, 0, sizeof(TGNumberEntry*)*fNP);
109  memset(fParMin, 0, sizeof(TGNumberEntryField*)*fNP);
110  memset(fParMax, 0, sizeof(TGNumberEntryField*)*fNP);
111  memset(fParSld, 0, sizeof(TGTripleHSlider*)*fNP);
112  memset(fParStp, 0, sizeof(TGNumberEntry*)*fNP);
113  memset(fParErr, 0, sizeof(TGNumberEntryField*)*fNP);
114 
116  AddFrame(f1, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
117 
118  // column 'Name'
120  fContNam->AddFrame(new TGLabel(fContNam,"Name"),
121  new TGLayoutHints(kLHintsTop, 5, 0, 0, 0));
122  for (Int_t i = 0; i < fNP; i++ ) {
123  fParNam[i] = new TGTextEntry(fContNam, new TGTextBuffer(80), kNAME+i);
124  fParNam[i]->SetText(Form("%s", fFunc->GetParName(i)));
127  new TGLayoutHints(kLHintsExpandX, 2, 2, 7, 5));
128  }
129  f1->AddFrame(fContNam, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2));
130 
131  // column 'Fix'
133  fContFix->AddFrame(new TGLabel(fContFix,"Fix"),
134  new TGLayoutHints(kLHintsTop, 2, 0, 0, 0));
135  for (Int_t i = 0; i < fNP; i++ ) {
136  fParFix[i] = new TGCheckButton(fContFix, "", kFIX*fNP+i);
137  fParFix[i]->SetToolTipText(Form("Set %s to fixed", fFunc->GetParName(i)));
139  5, 5, 10, 7));
140  if ((fPmin[i] == fPmax[i]) && (fPmin[i] || fPmax[i]))
142  else
144  fParFix[i]->Connect("Toggled(Bool_t)", "TFitParametersDialog", this, "DoParFix(Bool_t)");
145  }
146  f1->AddFrame(fContFix, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2));
147 
148  // column 'Bound'
150  fContBnd->AddFrame(new TGLabel(fContBnd,"Bound"),
151  new TGLayoutHints(kLHintsTop, 2, 0, 0, 0));
152  for (Int_t i = 0; i < fNP; i++ ) {
153  fParBnd[i] = new TGCheckButton(fContBnd, "", kBND*fNP+i);
154  fParBnd[i]->SetToolTipText(Form("Set bound to %s", fFunc->GetParName(i)));
156  15, 5, 10, 7));
157  fParBnd[i]->Connect("Toggled(Bool_t)", "TFitParametersDialog", this, "DoParBound(Bool_t)");
158  if ( ((fPmin[i] != fPmax[i]) && (fPmin[i] || fPmax[i])) || (fParMin[i] < fParMax[i]) )
160  else
162  }
163  f1->AddFrame(fContBnd, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2));
164 
165  // column 'Value'
167  fContVal->AddFrame(new TGLabel(fContVal,"Value"),
168  new TGLayoutHints(kLHintsTop, 5, 0, 0, 0));
169  for (Int_t i = 0; i < fNP; i++ ) {
170  fParVal[i] = new TGNumberEntry(fContVal, 1.2E-12, 15, kVAL*fNP+i,
172  fParVal[i]->SetNumber(fPval[i]);
174  fContVal->AddFrame(fParVal[i], new TGLayoutHints(kLHintsExpandX, 2, 2, 7, 5));
175  (fParVal[i]->GetNumberEntry())->SetToolTipText(Form("%s", fFunc->GetParName(i)));
176  (fParVal[i]->GetNumberEntry())->Connect("ReturnPressed()", "TFitParametersDialog",
177  this, "DoParValue()");
178  fParVal[i]->Connect("ValueSet(Long_t)", "TFitParametersDialog", this, "DoParValue()");
179  (fParVal[i]->GetNumberEntry())->Connect("TabPressed()", "TFitParametersDialog", this, "HandleTab()");
180  (fParVal[i]->GetNumberEntry())->Connect("ShiftTabPressed()", "TFitParametersDialog", this, "HandleShiftTab()");
181  fTextEntries.Add(fParVal[i]->GetNumberEntry());
182  }
183  f1->AddFrame(fContVal, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2));
184 
185  // column 'Min'
187  fContMin->AddFrame(new TGLabel(fContMin,"Min"),
188  new TGLayoutHints(kLHintsTop, 5, 0, 0, 0));
189  for (Int_t i = 0; i < fNP; i++ ) {
190  fParMin[i] = new TGNumberEntryField(fContMin, kMIN*fNP+i, 0.0,
193  ((TGTextEntry*)fParMin[i])->SetToolTipText(Form("Lower limit of %s",
194  fFunc->GetParName(i)));
195  fContMin->AddFrame(fParMin[i], new TGLayoutHints(kLHintsExpandX, 2, 2, 7, 5));
196  fParMin[i]->SetNumber(fPmin[i]);
197  fParMin[i]->Connect("ReturnPressed()", "TFitParametersDialog", this,
198  "DoParMinLimit()");
199  fParMin[i]->Connect("TabPressed()", "TFitParametersDialog", this, "HandleTab()");
200  fParMin[i]->Connect("ShiftTabPressed()", "TFitParametersDialog", this, "HandleShiftTab()");
202  }
203  f1->AddFrame(fContMin, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2));
204 
205  // column 'Set Range'
207  fContSld->AddFrame(new TGLabel(fContSld,"Set Range"),
208  new TGLayoutHints(kLHintsTop, 5, 0, 0, 0));
209  for (Int_t i = 0; i < fNP; i++ ) {
213  fContSld->AddFrame(fParSld[i], new TGLayoutHints(kLHintsExpandX, 2, 2, 5, 5));
215  }
216  f1->AddFrame(fContSld, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2));
217 
218  // column 'Max'
220  fContMax->AddFrame(new TGLabel(fContMax,"Max"),
221  new TGLayoutHints(kLHintsTop, 5, 0, 0, 0));
222  for (Int_t i = 0; i < fNP; i++ ) {
223  fParMax[i] = new TGNumberEntryField(fContMax, kMAX*fNP+i, 0.0,
226  ((TGTextEntry*)fParMax[i])->SetToolTipText(Form("Upper limit of %s",
227  fFunc->GetParName(i)));
228  fContMax->AddFrame(fParMax[i], new TGLayoutHints(kLHintsExpandX, 2, 2, 7, 5));
229  fParMax[i]->SetNumber(fPmax[i]);
230  fParMax[i]->Connect("ReturnPressed()", "TFitParametersDialog", this, "DoParMaxLimit()");
231  fParMax[i]->Connect("TabPressed()", "TFitParametersDialog", this, "HandleTab()");
232  fParMax[i]->Connect("ShiftTabPressed()", "TFitParametersDialog", this, "HandleShiftTab()");
234  }
235  f1->AddFrame(fContMax, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2));
236 
237  // column 'Step'
239  fContStp->AddFrame(new TGLabel(fContStp,"Step"),
240  new TGLayoutHints(kLHintsTop, 5, 0, 0, 0));
241  for (Int_t i = 0; i < fNP; i++ ) {
242  fParStp[i] = new TGNumberEntry(fContStp, 1.2E-12, 15, kSTP*fNP+i,
244  fParStp[i]->SetNumber(fPstp[i]);
246  fContStp->AddFrame(fParStp[i], new TGLayoutHints(kLHintsExpandX, 2, 2, 7, 5));
247  (fParStp[i]->GetNumberEntry())->SetToolTipText(Form("%s", fFunc->GetParName(i)));
248  (fParStp[i]->GetNumberEntry())->Connect("ReturnPressed()", "TFitParametersDialog",
249  this, "DoParStep()");
250  fParStp[i]->Connect("ValueSet(Long_t)", "TFitParametersDialog", this, "DoParStep()");
251  (fParStp[i]->GetNumberEntry())->Connect("TabPressed()", "TFitParametersDialog", this, "HandleTab()");
252  (fParStp[i]->GetNumberEntry())->Connect("ShiftTabPressed()", "TFitParametersDialog", this, "HandleShiftTab()");
253  fTextEntries.Add(fParStp[i]->GetNumberEntry());
254  }
255  f1->AddFrame(fContStp, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2));
256 
257  // column 'Error'
259  fContErr->AddFrame(new TGLabel(fContErr,"Errors"),
260  new TGLayoutHints(kLHintsTop, 5, 0, 0, 0));
261  for (Int_t i = 0; i < fNP; i++ ) {
262  fParErr[i] = new TGNumberEntryField(fContErr, kERR*fNP+i, 0.0,
265  ((TGTextEntry*)fParErr[i])->SetToolTipText(Form("Error of %s",
266  fFunc->GetParName(i)));
267  fContErr->AddFrame(fParErr[i], new TGLayoutHints(kLHintsExpandX, 2, 2, 7, 5));
269  if (fPerr[i])
270  fParErr[i]->SetNumber(fPerr[i]);
271  else
272  ((TGTextEntry *)fParErr[i])->SetText("-");
273  }
274  f1->AddFrame(fContErr, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2));
275 
276  TGCompositeFrame *f2 = new TGCompositeFrame(this, 270, 20, kHorizontalFrame);
278 
279  fUpdate = new TGCheckButton(f2, "&Immediate preview", kUPDATE);
280  fUpdate->SetToolTipText("Immediate function redrawing");
282  f2->AddFrame(fUpdate, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 5, 5, 5, 5));
283  fUpdate->Connect("Toggled(Bool_t)", "TFitParametersDialog", this, "HandleButtons(Bool_t)");
284 
286  f2->AddFrame(f3, new TGLayoutHints(kLHintsRight));
287 
288  fReset = new TGTextButton(f3, "&Reset", kRESET);
290  fReset->SetToolTipText("Reset the parameter settings");
292  fReset->Connect("Clicked()", "TFitParametersDialog", this, "DoReset()");
293 
294  fApply = new TGTextButton(f3, "&Apply", kAPPLY);
297  fApply->Connect("Clicked()", "TFitParametersDialog", this, "DoApply()");
298  fApply->SetToolTipText("Apply parameter settings and redraw the function");
299 
300  fOK = new TGTextButton(f3, "&OK", kOK);
302  fOK->SetToolTipText("Apply parameter settings, redraw function and close this dialog");
303  fOK->Connect("Clicked()", "TFitParametersDialog", this, "DoOK()");
304 
305  fCancel = new TGTextButton(f3, "&Cancel", kCANCEL);
307  fCancel->SetToolTipText("Close this dialog with no parameter changes");
308  fCancel->Connect("Clicked()", "TFitParametersDialog", this, "DoCancel()");
309  *fRetCode = kFPDNoChange; // default setting
310 
311  MapSubwindows();
313  MapWindow();
315  SetWindowName(Form("Set Parameters of %s", fFunc->GetTitle()));
316 
317  for (Int_t i = 0; i < fNP; i++ ) {
318  if (fParFix[i]->GetState() == kButtonDown) {
319  fParVal[i]->SetState(kFALSE);
322  fParSld[i]->UnmapWindow();
323  } else {
324  if (fPmin[i]*fPmax[i] == 0 && fPmin[i] >= fPmax[i]) { //init
325  // round again the values on the percent level
327  Double_t roundVal = int(fPval[i]/ u) * u;
328  // set min at +/- 100 step size
329  fParMin[i]->SetNumber( roundVal - 100* fPstp[i]);
330  fParMax[i]->SetNumber( roundVal + 100* fPstp[i]);
331  // if (!fPval[i]) {
332  // fParMin[i]->SetNumber(-10);
333  // fParMax[i]->SetNumber(10);
334  // } else {
335  // fParMin[i]->SetNumber(-3*TMath::Abs(fPval[i]));
336  // fParMax[i]->SetNumber(3*TMath::Abs(fPval[i]));
337  // }
338  }
339  fParSld[i]->SetRange(fParMin[i]->GetNumber(), fParMax[i]->GetNumber());
340  fParSld[i]->SetPosition(fParMin[i]->GetNumber(), fParMax[i]->GetNumber());
341  fParSld[i]->SetPointerPosition(fParVal[i]->GetNumber());
342  fParSld[i]->Connect("PointerPositionChanged()", "TFitParametersDialog",
343  this, "DoSlider()");
344  fParSld[i]->Connect("PositionChanged()", "TFitParametersDialog",
345  this, "DoSlider()");
346  }
347  }
348 
349  gClient->WaitFor(this);
350 }
351 
352 ////////////////////////////////////////////////////////////////////////////////
353 /// Destructor.
354 
356 {
357  DisconnectSlots();
359  Cleanup();
360  delete [] fPval;
361  delete [] fPmin;
362  delete [] fPmax;
363  delete [] fPerr;
364  delete [] fPstp;
365 
366  delete [] fParNam;
367  delete [] fParFix;
368  delete [] fParBnd;
369  delete [] fParVal;
370  delete [] fParMin;
371  delete [] fParMax;
372  delete [] fParSld;
373  delete [] fParStp;
374  delete [] fParErr;
375 }
376 
377 ////////////////////////////////////////////////////////////////////////////////
378 /// Close parameters' dialog.
379 
381 {
382  if (fHasChanges) {
383  Int_t ret;
384  const char *txt;
385  txt = "Do you want to apply last parameters' setting?";
387  "Parameters Have Been Changed", txt, kMBIconExclamation,
388  kMBYes | kMBNo | kMBCancel, &ret);
389  if (ret == kMBYes) {
390  SetParameters();
391  *fRetCode = kFPDChange;
392  }
393  else if (ret == kMBNo)
394  DoReset();
395  else return;
396  }
397 
398  DisconnectSlots();
399  DeleteWindow();
400 }
401 
402 ////////////////////////////////////////////////////////////////////////////////
403 /// Slot related to the Cancel button.
404 
406 {
407  if (fHasChanges)
408  DoReset();
409  // for (Int_t i = 0; i < fNP; i++ ) {
410  // if (fParBnd[i]->GetState() == kButtonDown)
411  // *fRetCode = kFPDBounded;
412  // }
413  CloseWindow();
414 }
415 
416 ////////////////////////////////////////////////////////////////////////////////
417 /// Slot related to the Bound check button.
418 
420 {
421  TGButton *bt = (TGButton *) gTQSender;
422  Int_t id = bt->WidgetId();
423  fHasChanges = kTRUE;
424 
425  for (Int_t i = 0; i < fNP; i++ ) {
426  if (id == kBND*fNP+i) {
427  if (on) {
428  if (fParMin[i]->GetNumber() >= fParMax[i]->GetNumber()) {
429  Int_t ret;
430  const char *txt;
431  txt = "'Min' value cannot be bigger or equal to 'Max' - set the limits first!";
433  "Parameter Limits", txt, kMBIconExclamation,kMBOk,&ret);
434 
436  return;
437  }
438  if ((fParVal[i]->GetNumber() < fParMin[i]->GetNumber()) ||
439  (fParVal[i]->GetNumber() > fParMax[i]->GetNumber())) {
440  Double_t v = (fParMax[i]->GetNumber()+fParMin[i]->GetNumber())/2.;
441  fParVal[i]->SetNumber(v);
442  fFunc->SetParameter(i, v);
444  }
446  fParMin[i]->GetNumber(),
447  fParMax[i]->GetNumber());
449  fFunc->SetParLimits(i, fParMin[i]->GetNumber(),
450  fParMax[i]->GetNumber());
451  } else {
454  fFunc->GetParLimits(i, fPmin[i], fPmax[i]);
455  fPval[i] = fFunc->GetParameter(i);
456  if (fPmin[i]*fPmax[i] == 0 && fPmin[i] >= fPmax[i]) { //init
457  if (!fPval[i]) {
458  fParMin[i]->SetNumber(-10);
459  fParMax[i]->SetNumber(10);
460  } else {
461  fParMin[i]->SetNumber(-10*TMath::Abs(fPval[i]));
462  fParMax[i]->SetNumber(10*TMath::Abs(fPval[i]));
463  }
464  }
465  fParSld[i]->SetRange(fParMin[i]->GetNumber(), fParMax[i]->GetNumber());
466  fParSld[i]->SetPosition(fParMin[i]->GetNumber(), fParMax[i]->GetNumber());
468  }
469  }
470  }
471  if (fUpdate->GetState() == kButtonDown)
472  DrawFunction();
473  else if ((fApply->GetState() == kButtonDisabled) && fHasChanges)
475 }
476 
477 ////////////////////////////////////////////////////////////////////////////////
478 /// Slot related to parameter step setting.
479 
481 {
482 }
483 
484 ////////////////////////////////////////////////////////////////////////////////
485 /// Slot related to the Fix check button.
486 
488 {
490 
491  TGButton *bt = (TGButton *) gTQSender;
492  Int_t id = bt->WidgetId();
493  fHasChanges = kTRUE;
494 
495  for (Int_t i = 0; i < fNP; i++ ) {
496  if (id == kFIX*fNP+i) {
497  if (on) {
498  // no bound available
499  fParBnd[i]->Disconnect("Toggled(Bool_t)");
501  fParBnd[i]->SetToolTipText(Form("DISABLED - %s is fixed", fFunc->GetParName(i)));
502  if (fParVal[i]->GetNumber() != 0) {
503  fParMin[i]->SetNumber(fParVal[i]->GetNumber());
505  fParMax[i]->SetNumber(fParVal[i]->GetNumber());
507  } else {
508  fParMin[i]->SetNumber(1.);
510  fParMax[i]->SetNumber(1.);
512  }
513  fParVal[i]->SetState(kFALSE);
514  fParStp[i]->SetState(kFALSE);
515  fParSld[i]->Disconnect("PointerPositionChanged()");
516  fParSld[i]->Disconnect("PositionChanged()");
517  fParSld[i]->UnmapWindow();
518  fFunc->FixParameter(i, fParVal[i]->GetNumber());
519  } else if (!fParMin[i]->IsEnabled()) {
520  if (fPmin[i] != fPmax[i]) {
521  if (fPmin[i])
522  fParMin[i]->SetNumber(fPmin[i]);
523  else if (fPerr[i])
524  fParMin[i]->SetNumber(fPval[i]-3*fPerr[i]);
525  else if (fPval[i])
526  fParMin[i]->SetNumber(fPval[i]-0.1*fPval[i]);
527  else
528  fParMin[i]->SetNumber(1.0);
529  if (fPmax[i])
530  fParMax[i]->SetNumber(fPmax[i]);
531  else if (fPerr[i])
532  fParMax[i]->SetNumber(fPval[i]+3*fPerr[i]);
533  else if (fPval[i])
534  fParMax[i]->SetNumber(fPval[i]+0.1*fPval[i]);
535  else
536  fParMax[i]->SetNumber(1.0);
537  } else if (fPval[i]) {
538  fParMin[i]->SetNumber(fPval[i]-0.1*fPval[i]);
539  fParMax[i]->SetNumber(fPval[i]+0.1*fPval[i]);
540  } else {
541  fParMin[i]->SetNumber(1.0);
542  fParMax[i]->SetNumber(1.0);
543  }
544  if (fParMax[i]->GetNumber() < fParMin[i]->GetNumber()){
545  Double_t temp;
546  temp = fParMax[i]->GetNumber();
547  fParMax[i]->SetNumber(fParMin[i]->GetNumber());
548  fParMin[i]->SetNumber(temp);
549  }
550  fParBnd[i]->SetEnabled(kTRUE);
551  fParBnd[i]->Connect("Toggled(Bool_t)", "TFitParametersDialog",
552  this, "DoParBound(Bool_t)");
554  fParMax[i]->SetEnabled(kTRUE);
555  fParMin[i]->SetEnabled(kTRUE);
556  fParSld[i]->MapWindow();
557  fParVal[i]->SetState(kTRUE);
558  fParStp[i]->SetState(kTRUE);
559  fParSld[i]->SetRange(fParMin[i]->GetNumber(), fParMax[i]->GetNumber());
560  fParSld[i]->SetPosition(fParMin[i]->GetNumber(), fParMax[i]->GetNumber());
562  fParSld[i]->Connect("PointerPositionChanged()", "TFitParametersDialog",
563  this, "DoSlider()");
564  fParSld[i]->Connect("PositionChanged()", "TFitParametersDialog",
565  this, "DoSlider()");
566  fFunc->SetParLimits(i, fParMin[i]->GetNumber(), fParMax[i]->GetNumber());
567  }
568  }
569  }
570  if (fUpdate->GetState() == kButtonDown)
571  DrawFunction();
572  else if ((fApply->GetState() == kButtonDisabled) && fHasChanges)
574 }
575 
576 ////////////////////////////////////////////////////////////////////////////////
577 /// Set the parameter values inside the function
578 
580 {
582  for (Int_t i = 0; i < fNP; i++ ) {
583  // first make sure the current value is up to date
585  if (fParFix[i]->GetState() == kButtonDown) {
586  fFunc->SetParameter(i, fParVal[i]->GetNumber());
587  fFunc->FixParameter(i, fParVal[i]->GetNumber());
589  } else {
590  if (fParBnd[i]->GetState() == kButtonDown) {
591  fFunc->SetParameter(i, fParVal[i]->GetNumber());
592  fFunc->SetParLimits(i, fParMin[i]->GetNumber(), fParMax[i]->GetNumber());
594  } else {
596  }
597  }
598  }
599 }
600 
601 ////////////////////////////////////////////////////////////////////////////////
602 /// Slot related to the OK button.
603 
605 {
606  if (fHasChanges)
607  DrawFunction();
608 
609  SetParameters();
610 
611  // we want here to confirm the parameters settings so
612  // it is like having changed them
613  *fRetCode = kFPDChange;
614 
615 
616  CloseWindow();
617 }
618 
619 ////////////////////////////////////////////////////////////////////////////////
620 /// Slot related to the Preview button.
621 
623 {
624  DrawFunction();
626  if (fReset->GetState() == kButtonDisabled)
628 }
629 
630 ////////////////////////////////////////////////////////////////////////////////
631 /// Slot related to the Reset button.
632 
634 {
635  fHasChanges = kTRUE;
636  Int_t k = fNP;
637  for (Int_t i = 0; i < fNP; i++) {
638  if (fParVal[i]->GetNumber() == fPval[i])
639  k--;
640  else
641  break;
642  }
643 
644  if (!k) {
645  if (fReset->GetState() == kButtonUp)
648  return;
649  }
650  for (Int_t i = 0; i < fNP; i++) {
651  fFunc->SetParameter(i, fPval[i]);
652  fFunc->SetParLimits(i, fPmin[i], fPmax[i]);
653  fFunc->SetParError(i, fPerr[i]);
654 
655  if (fPmin[i])
656  fParMin[i]->SetNumber(fPmin[i]);
657  else if (fPerr[i])
658  fParMin[i]->SetNumber(fPval[i]-3*fPerr[i]);
659  else if (fPval[i])
660  fParMin[i]->SetNumber(-3*TMath::Abs(fPval[i]));
661  else
662  fParMin[i]->SetNumber(1.0);
663 
664  if (fPmax[i])
665  fParMax[i]->SetNumber(fPmax[i]);
666  else if (fPerr[i])
667  fParMax[i]->SetNumber(fPval[i]+3*fPerr[i]);
668  else if (fPval[i])
669  fParMax[i]->SetNumber(3*TMath::Abs(fPval[i]));
670  else
671  fParMax[i]->SetNumber(1.0);
672  if (fParMax[i]->GetNumber() < fParMin[i]->GetNumber()){
673  Double_t temp;
674  temp = fParMax[i]->GetNumber();
675  fParMax[i]->SetNumber(fParMin[i]->GetNumber());
676  fParMin[i]->SetNumber(temp);
677  }
678  if (fParMin[i]->GetNumber() == fParMax[i]->GetNumber()) {
679  fParVal[i]->SetState(kFALSE);
682  fParStp[i]->SetState(kFALSE);
683  fParSld[i]->Disconnect("PointerPositionChanged()");
684  fParSld[i]->Disconnect("PositionChanged()");
685  fParSld[i]->UnmapWindow();
686  fParBnd[i]->Disconnect("Toggled(Bool_t)");
688  fFunc->FixParameter(i, fParVal[i]->GetNumber());
690  } else {
692  if (!fParMax[i]->IsEnabled()) {
693  fParMax[i]->SetEnabled(kTRUE);
694  fParMin[i]->SetEnabled(kTRUE);
695  fParVal[i]->SetState(kTRUE);
696  fParStp[i]->SetState(kTRUE);
697  fParSld[i]->SetRange(fParMin[i]->GetNumber(), fParMax[i]->GetNumber());
698  fParSld[i]->SetPosition(fParMin[i]->GetNumber(), fParMax[i]->GetNumber());
700  fParSld[i]->MapWindow();
701  fParSld[i]->Connect("PointerPositionChanged()", "TFitParametersDialog",
702  this, "DoSlider()");
703  fParSld[i]->Connect("PositionChanged()", "TFitParametersDialog",
704  this, "DoSlider()");
705  fParBnd[i]->SetEnabled(kTRUE);
706  fParBnd[i]->Connect("Toggled(Bool_t)", "TFitParametersDialog",
707  this, "DoParBound(Bool_t)");
708  }
709  }
710  fParVal[i]->SetNumber(fPval[i]);
711 
712  fParSld[i]->SetRange(fParMin[i]->GetNumber(), fParMax[i]->GetNumber());
713  fParSld[i]->SetPosition(fParMin[i]->GetNumber(), fParMax[i]->GetNumber());
715  }
716 
717  if (fUpdate->GetState() == kButtonDown)
718  DrawFunction();
719  else if ((fApply->GetState() == kButtonDisabled) && fHasChanges)
724 }
725 
726 ////////////////////////////////////////////////////////////////////////////////
727 /// Slot related to the parameters' value settings.
728 
730 {
732  Int_t id = sl->WidgetId();
733 
734  fHasChanges = kTRUE;
735  for (Int_t i = 0; i < fNP; i++ ) {
736  if (id == kSLD*fNP+i) {
737  fFunc->SetParameter(i,fParSld[i]->GetPointerPosition());
738  fFunc->SetParLimits(i,fParSld[i]->GetMinPosition(),
739  fParSld[i]->GetMaxPosition());
740  fParMin[i]->SetNumber(fParSld[i]->GetMinPosition());
741  fParMax[i]->SetNumber(fParSld[i]->GetMaxPosition());
742  fParVal[i]->SetNumber(fParSld[i]->GetPointerPosition());
743  }
744  }
745  if (fUpdate->GetState() == kButtonDown)
746  DrawFunction();
747  else if ((fApply->GetState() == kButtonDisabled) && fHasChanges)
749  if (fReset->GetState() == kButtonDisabled)
751 }
752 
753 ////////////////////////////////////////////////////////////////////////////////
754 /// Slot related to the parameter value settings.
755 
757 {
759  Int_t id = ne->WidgetId();
760 
761  for (Int_t i = 0; i < fNP; i++ ) {
762  if (id == kVAL*fNP+i) {
763  if (fParVal[i]->GetNumber() < fParMin[i]->GetNumber()) {
764  Double_t extraIncrement = (fParMax[i]->GetNumber() - fParMin[i]->GetNumber()) / 4;
765  fParMin[i]->SetNumber(fParVal[i]->GetNumber() - extraIncrement );
767  fParSld[i]->SetRange(fParMin[i]->GetNumber(),
768  fParMax[i]->GetNumber());
769  fParSld[i]->SetPosition(fParMin[i]->GetNumber(),
770  fParMax[i]->GetNumber());
771  }
772  if (fParVal[i]->GetNumber() > fParMax[i]->GetNumber()) {
773  Double_t extraIncrement = (fParMax[i]->GetNumber() - fParMin[i]->GetNumber()) / 4;
774  fParMax[i]->SetNumber(fParVal[i]->GetNumber() + extraIncrement );
776  fParSld[i]->SetRange(fParMin[i]->GetNumber(),
777  fParMax[i]->GetNumber());
778  fParSld[i]->SetPosition(fParMin[i]->GetNumber(),
779  fParMax[i]->GetNumber());
780  }
781  fParSld[i]->SetPointerPosition(fParVal[i]->GetNumber());
783  fFunc->SetParameter(i,fParSld[i]->GetPointerPosition());
784  if (fParBnd[i]->GetState() == kButtonDown)
786  fParSld[i]->GetMaxPosition());
787  else
789  }
790  }
791  fHasChanges = kTRUE;
792  if (fUpdate->GetState() == kButtonDown)
793  DrawFunction();
794  else if ((fApply->GetState() == kButtonDisabled) && fHasChanges)
796  if (fReset->GetState() == kButtonDisabled)
798 }
799 
800 ////////////////////////////////////////////////////////////////////////////////
801 /// Slot related to the minumum parameter limit settings.
802 
804 {
806  Int_t id = ne->WidgetId();
807 
808  for (Int_t i = 0; i < fNP; i++ ) {
809  if (id == kMIN*fNP+i) {
810  if ((fParMin[i]->GetNumber() >= fParMax[i]->GetNumber()) &&
811  (fParBnd[i]->GetState() == kButtonDown)) {
812  Int_t ret;
813  const char *txt;
814  txt = "'Min' cannot be bigger then 'Max' if this parameter is bounded.";
816  "Parameter Limits", txt, kMBIconExclamation, kMBOk, &ret);
817  fParMin[i]->SetNumber(fParVal[i]->GetNumber()-fParStp[i]->GetNumber());
818  return;
819  }
820  if (fParBnd[i]->GetState() == kButtonDown) {
821  Double_t val = (fParMax[i]->GetNumber()+fParMin[i]->GetNumber())/2.;
822  fParVal[i]->SetNumber(val);
823  fParVal[i]->SetLimitValues(fParMin[i]->GetNumber(),
824  fParMax[i]->GetNumber());
825  }
826  fParSld[i]->SetRange(fParMin[i]->GetNumber(),
827  fParMax[i]->GetNumber());
828  fParSld[i]->SetPosition(fParMin[i]->GetNumber(),
829  fParMax[i]->GetNumber());
830  fParSld[i]->SetPointerPosition(fParVal[i]->GetNumber());
832  }
833  }
834  fHasChanges = kTRUE;
835  if (fUpdate->GetState() == kButtonDown)
836  DrawFunction();
837  else if ((fApply->GetState() == kButtonDisabled) && fHasChanges)
839  if (fReset->GetState() == kButtonDisabled)
841 }
842 
843 ////////////////////////////////////////////////////////////////////////////////
844 /// Slot related to the maximum parameter limit settings.
845 
847 {
849  Int_t id = ne->WidgetId();
850 
851  for (Int_t i = 0; i < fNP; i++ ) {
852  if (id == kMAX*fNP+i) {
853  if ((fParMin[i]->GetNumber() >= fParMax[i]->GetNumber()) &&
854  (fParBnd[i]->GetState() == kButtonDown)) {
855  Int_t ret;
856  const char *txt;
857  txt = "'Min' cannot be bigger then 'Max' if this parameter is bounded.";
859  "Parameter Limits", txt, kMBIconExclamation, kMBOk, &ret);
860  fParMax[i]->SetNumber(fParVal[i]->GetNumber()+fParStp[i]->GetNumber());
861  return;
862  }
863  if (fParBnd[i]->GetState() == kButtonDown) {
864  Double_t val = (fParMax[i]->GetNumber()+(fParMin[i]->GetNumber()))/2.;
865  fParVal[i]->SetNumber(val);
866  fParVal[i]->SetLimitValues(fParMin[i]->GetNumber(),
867  fParMax[i]->GetNumber());
868  }
869  fParSld[i]->SetRange(fParMin[i]->GetNumber(),
870  fParMax[i]->GetNumber());
871  fParSld[i]->SetPosition(fParMin[i]->GetNumber(),
872  fParMax[i]->GetNumber());
873  fParSld[i]->SetPointerPosition(fParVal[i]->GetNumber());
875  }
876  }
877  fHasChanges = kTRUE;
878  if (fUpdate->GetState() == kButtonDown)
879  DrawFunction();
880  else if ((fApply->GetState() == kButtonDisabled) && fHasChanges)
882  if (fReset->GetState() == kButtonDisabled)
884 }
885 
886 ////////////////////////////////////////////////////////////////////////////////
887 /// Redraw function graphics.
888 
890 {
891  if ( !fFpad ) return;
892  TVirtualPad *save = 0;
893  save = gPad;
894  gPad = fFpad;
895  gPad->cd();
896 
897  Style_t st = fFunc->GetLineStyle();
898  fFunc->SetLineStyle(2);
899 
900  TString opt = fFunc->GetDrawOption();
901  opt.ToUpper();
902  if (!opt.Contains("SAME"))
903  opt += "SAME";
904  //fFunc->SetRange(fRXmin, fRXmax);
905  fFunc->Draw(opt);
906  gPad->Modified();
907  gPad->Update();
909 
910  fFunc->SetLineStyle(st);
911  if (save) gPad = save;
913 }
914 
915 ////////////////////////////////////////////////////////////////////////////////
916 /// Handle the button dependent states in this dialog.
917 
919 {
920  if (update && fHasChanges)
921  DrawFunction();
922  else if ((fApply->GetState() == kButtonDisabled) && fHasChanges) {
924  }
925 }
926 
927 ////////////////////////////////////////////////////////////////////////////////
928 /// Disconnect signals from slot methods.
929 
931 {
932  for (Int_t i = 0; i < fNP; i++ ) {
933  fParFix[i]->Disconnect("Toggled(Bool_t)");
934  fParBnd[i]->Disconnect("Toggled(Bool_t)");
935  fParVal[i]->Disconnect("ValueSet(Long_t)");
936  fParMin[i]->Disconnect("ReturnPressed()");
937  fParMax[i]->Disconnect("ReturnPressed()");
938  fParSld[i]->Disconnect("PointerPositionChanged()");
939  fParSld[i]->Disconnect("PositionChanged()");
940  fParStp[i]->Disconnect("ValueSet(Long_t)");
941  fParVal[i]->Disconnect("TabPressed(Long_t)");
942  fParVal[i]->Disconnect("ShiftTabPressed(Long_t)");
943  fParMin[i]->Disconnect("TabPressed(Long_t)");
944  fParMin[i]->Disconnect("ShiftTabPressed(Long_t)");
945  fParMax[i]->Disconnect("TabPressed(Long_t)");
946  fParMax[i]->Disconnect("ShiftTabPressed(Long_t)");
947  fParStp[i]->Disconnect("TabPressed(Long_t)");
948  fParStp[i]->Disconnect("ShiftTabPressed(Long_t)");
949  }
950  fUpdate->Disconnect("Toggled(Bool_t)");
951  fReset->Disconnect("Clicked()");
952  fApply->Disconnect("Clicked()");
953  fOK->Disconnect("Clicked()");
954  fCancel->Disconnect("Clicked()");
955 }
956 
957 ////////////////////////////////////////////////////////////////////////////////
958 /// Handle Shift+Tab key event (set focus to the previous number entry field)
959 
961 {
962  TGNumberEntryField *next, *sender = (TGNumberEntryField *)gTQSender;
963  next = (TGNumberEntryField *)fTextEntries.Before((TObject *)sender);
964  if (next == 0)
966  if (next) {
967  next->SetFocus();
968  next->Home();
969  }
970 }
971 
972 ////////////////////////////////////////////////////////////////////////////////
973 /// Handle Tab key event (set focus to the next number entry field)
974 
976 {
977  TGNumberEntryField *next, *sender = (TGNumberEntryField *)gTQSender;
978  next = (TGNumberEntryField *)fTextEntries.After((TObject *)sender);
979  if (next == 0)
981  if (next) {
982  next->SetFocus();
983  next->Home();
984  }
985 }
986 
987 
988 
TGCompositeFrame::GetDefaultSize
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
Definition: TGFrame.h:353
TGButton::SetToolTipText
virtual void SetToolTipText(const char *text, Long_t delayms=400)
Set tool tip text associated with this button.
Definition: TGButton.cxx:398
kSLD
@ kSLD
Definition: TFitParametersDialog.cxx:42
TGTransientFrame
Definition: TGFrame.h:553
TGButton::SetEnabled
virtual void SetEnabled(Bool_t e=kTRUE)
Set enabled or disabled state of button.
Definition: TGButton.cxx:412
TFitParametersDialog::fFunc
TF1 * fFunc
Definition: TFitParametersDialog.h:51
TFitParametersDialog::fPmin
Double_t * fPmin
Definition: TFitParametersDialog.h:59
TQObject::Disconnect
Bool_t Disconnect(const char *signal=0, void *receiver=0, const char *slot=0)
Disconnects signal of this object from slot of receiver.
Definition: TQObject.cxx:1022
TGWindow
Definition: TGWindow.h:31
TGCheckButton::SetState
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set check button state.
Definition: TGButton.cxx:1203
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
TFitParametersDialog::DoReset
virtual void DoReset()
Slot related to the Reset button.
Definition: TFitParametersDialog.cxx:633
TGTextEntry::SetText
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.
Definition: TGTextEntry.cxx:623
TFitParametersDialog::~TFitParametersDialog
virtual ~TFitParametersDialog()
Destructor.
Definition: TFitParametersDialog.cxx:355
kFixedWidth
@ kFixedWidth
Definition: GuiTypes.h:387
Style_t
short Style_t
Definition: RtypesCore.h:80
TFitParametersDialog::fPmax
Double_t * fPmax
Definition: TFitParametersDialog.h:60
TGNumberFormat::kNELLimitMinMax
@ kNELLimitMinMax
Definition: TGNumberEntry.h:59
TFitParametersDialog::fRetCode
Int_t * fRetCode
Definition: TFitParametersDialog.h:55
TFitParametersDialog.h
TFitParametersDialog::fFpad
TVirtualPad * fFpad
Definition: TFitParametersDialog.h:52
TFitParametersDialog::fContVal
TGCompositeFrame * fContVal
Definition: TFitParametersDialog.h:65
TFitParametersDialog::DoParMaxLimit
virtual void DoParMaxLimit()
Slot related to the maximum parameter limit settings.
Definition: TFitParametersDialog.cxx:846
TGDoubleSlider::SetRange
virtual void SetRange(Float_t min, Float_t max)
Definition: TGDoubleSlider.h:116
TFitParametersDialog::fRangexmax
Double_t fRangexmax
Definition: TFitParametersDialog.h:58
TFitParametersDialog::DoSlider
virtual void DoSlider()
Slot related to the parameters' value settings.
Definition: TFitParametersDialog.cxx:729
TFitParametersDialog::fOK
TGTextButton * fOK
Definition: TFitParametersDialog.h:85
TFitParametersDialog::fParVal
TGNumberEntry ** fParVal
Definition: TFitParametersDialog.h:76
kMIN
@ kMIN
Definition: TFitParametersDialog.cxx:40
TGCompositeFrame::TGCompositeFrame
TGCompositeFrame(const TGCompositeFrame &)
TFitParametersDialog::DoOK
virtual void DoOK()
Slot related to the OK button.
Definition: TFitParametersDialog.cxx:604
kButtonDown
@ kButtonDown
Definition: TGButton.h:54
kLHintsTop
@ kLHintsTop
Definition: TGLayout.h:34
TGLayout.h
TFitParametersDialog::fContErr
TGCompositeFrame * fContErr
Definition: TFitParametersDialog.h:72
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
Form
char * Form(const char *fmt,...)
TNamed::GetTitle
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:48
kMBCancel
@ kMBCancel
Definition: TGMsgBox.h:48
kVerticalFrame
@ kVerticalFrame
Definition: GuiTypes.h:381
TGMsgBox
Definition: TGMsgBox.h:63
TF1::GetNpar
virtual Int_t GetNpar() const
Definition: TF1.h:480
TGNumberFormat::kNEAAnyNumber
@ kNEAAnyNumber
Definition: TGNumberEntry.h:50
kLHintsLeft
@ kLHintsLeft
Definition: TGLayout.h:31
TGLabel
Definition: TGLabel.h:32
TGCompositeFrame::Cleanup
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
Definition: TGFrame.cxx:952
kButtonUp
@ kButtonUp
Definition: TGButton.h:53
TGTextButton
Definition: TGButton.h:142
TFitParametersDialog::fParMin
TGNumberEntryField ** fParMin
Definition: TFitParametersDialog.h:77
gTQSender
R__EXTERN void * gTQSender
Definition: TQObject.h:44
TFitParametersDialog::fParSld
TGTripleHSlider ** fParSld
Definition: TFitParametersDialog.h:80
TFitParametersDialog::DoParStep
virtual void DoParStep()
Slot related to parameter step setting.
Definition: TFitParametersDialog.cxx:480
TGTransientFrame::kBottomLeft
@ kBottomLeft
Definition: TGFrame.h:567
TGNumberFormat::kNESReal
@ kNESReal
Definition: TGNumberEntry.h:39
TString::Contains
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:624
kMBYes
@ kMBYes
Definition: TGMsgBox.h:42
TFitParametersDialog::fParErr
TGNumberEntryField ** fParErr
Definition: TFitParametersDialog.h:81
TGTripleSlider.h
TList::Last
virtual TObject * Last() const
Return the last object in the list. Returns 0 when list is empty.
Definition: TList.cxx:692
TGMainFrame::SetWindowName
void SetWindowName(const char *name=0)
Set window name. This is typically done via the window manager.
Definition: TGFrame.cxx:1749
TGFrame::GetDefaultFrameBackground
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition: TGFrame.cxx:668
kFPDNoChange
@ kFPDNoChange
Definition: TFitParametersDialog.h:34
TMath::Abs
Short_t Abs(Short_t d)
Definition: TMathBase.h:120
TGNumberEntryField::SetNumber
virtual void SetNumber(Double_t val)
Set the numeric value (floating point representation).
Definition: TGNumberEntry.cxx:1119
TGNumberEntry::GetNumberEntry
TGNumberEntryField * GetNumberEntry() const
Definition: TGNumberEntry.h:268
TFitParametersDialog::fPerr
Double_t * fPerr
Definition: TFitParametersDialog.h:62
TString
Basic string class.
Definition: TString.h:136
kMBNo
@ kMBNo
Definition: TGMsgBox.h:43
TFitParametersDialog::DoCancel
virtual void DoCancel()
Slot related to the Cancel button.
Definition: TFitParametersDialog.cxx:405
v
@ v
Definition: rootcling_impl.cxx:3635
TFitParametersDialog::DoApply
virtual void DoApply()
Slot related to the Preview button.
Definition: TFitParametersDialog.cxx:622
kFIX
@ kFIX
Definition: TFitParametersDialog.cxx:37
TFitParametersDialog::DoParFix
virtual void DoParFix(Bool_t on)
Slot related to the Fix check button.
Definition: TFitParametersDialog.cxx:487
TGFrame::MapWindow
virtual void MapWindow()
map window
Definition: TGFrame.h:229
bool
TF1::GetParLimits
virtual void GetParLimits(Int_t ipar, Double_t &parmin, Double_t &parmax) const
Return limits for parameter ipar.
Definition: TF1.cxx:1941
TGTextBuffer
Definition: TGTextBuffer.h:30
kAPPLY
@ kAPPLY
Definition: TFitParametersDialog.cxx:47
TFitParametersDialog::fContFix
TGCompositeFrame * fContFix
Definition: TFitParametersDialog.h:66
TF1::GetRange
virtual void GetRange(Double_t *xmin, Double_t *xmax) const
Return range of a generic N-D function.
Definition: TF1.cxx:2280
TFitParametersDialog::fContStp
TGCompositeFrame * fContStp
Definition: TFitParametersDialog.h:71
TFitParametersDialog::fCancel
TGTextButton * fCancel
Definition: TFitParametersDialog.h:86
TF1::SetParameter
virtual void SetParameter(Int_t param, Double_t value)
Definition: TF1.h:633
kFPDBounded
@ kFPDBounded
Definition: TFitParametersDialog.h:27
TString::ToUpper
void ToUpper()
Change string to upper case.
Definition: TString.cxx:1138
TGNumberEntry::SetLimitValues
void SetLimitValues(Double_t min=0, Double_t max=1)
Definition: TGNumberEntry.h:259
gClient
#define gClient
Definition: TGClient.h:166
TList::First
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
Definition: TList.cxx:658
TGCheckButton
Definition: TGButton.h:264
update
static void update(gsl_integration_workspace *workspace, double a1, double b1, double area1, double error1, double a2, double b2, double area2, double error2)
Definition: RooAdaptiveGaussKronrodIntegrator1D.cxx:652
TFitParametersDialog::HandleButtons
virtual void HandleButtons(Bool_t update)
Handle the button dependent states in this dialog.
Definition: TFitParametersDialog.cxx:918
TFitParametersDialog::fTextEntries
TList fTextEntries
Definition: TFitParametersDialog.h:87
TFitParametersDialog::HandleShiftTab
virtual void HandleShiftTab()
Handle Shift+Tab key event (set focus to the previous number entry field)
Definition: TFitParametersDialog.cxx:960
TList::After
virtual TObject * After(const TObject *obj) const
Returns the object after object obj.
Definition: TList.cxx:329
kNAME
@ kNAME
Definition: TFitParametersDialog.cxx:36
TF1::SetParError
virtual void SetParError(Int_t ipar, Double_t error)
Set error for parameter number ipar.
Definition: TF1.cxx:3490
TFitParametersDialog::fPstp
Double_t * fPstp
Definition: TFitParametersDialog.h:63
TGFrame::DeleteWindow
virtual void DeleteWindow()
Delete window.
Definition: TGFrame.cxx:261
TFitParametersDialog::fApply
TGTextButton * fApply
Definition: TFitParametersDialog.h:83
TMath::Log10
Double_t Log10(Double_t x)
Definition: TMath.h:764
TGNumberEntry::SetNumber
virtual void SetNumber(Double_t val)
Definition: TGNumberEntry.h:186
kLHintsCenterY
@ kLHintsCenterY
Definition: TGLayout.h:35
TGWidget::WidgetId
Int_t WidgetId() const
Definition: TGWidget.h:80
TGCompositeFrame::MapSubwindows
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
Definition: TGFrame.cxx:1149
TObject::GetDrawOption
virtual Option_t * GetDrawOption() const
Get option used by the graphics system to draw this object.
Definition: TObject.cxx:343
TList::Before
virtual TObject * Before(const TObject *obj) const
Returns the object before object obj.
Definition: TList.cxx:370
TFitParametersDialog::DrawFunction
virtual void DrawFunction()
Redraw function graphics.
Definition: TFitParametersDialog.cxx:889
TGFrame::Resize
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:590
TMath::Floor
Double_t Floor(Double_t x)
Definition: TMath.h:703
TGTextEntry
Definition: TGTextEntry.h:39
kMBIconExclamation
@ kMBIconExclamation
Definition: TGMsgBox.h:35
TFitParametersDialog::fParMax
TGNumberEntryField ** fParMax
Definition: TFitParametersDialog.h:78
TFitParametersDialog::fNP
Int_t fNP
Definition: TFitParametersDialog.h:56
TAttLine::GetLineStyle
virtual Style_t GetLineStyle() const
Return the line style.
Definition: TAttLine.h:34
TGTextEntry::SetFocus
virtual void SetFocus()
Set focus to this text entry.
Definition: TGTextEntry.cxx:1677
kFPDChange
@ kFPDChange
Definition: TFitParametersDialog.h:35
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
TF1::GetParName
virtual const char * GetParName(Int_t ipar) const
Definition: TF1.h:528
TGNumberEntry::SetFormat
virtual void SetFormat(EStyle style, EAttribute attr=TGNumberFormat::kNEAAnyNumber)
Definition: TGNumberEntry.h:225
TFitParametersDialog::DoParMinLimit
virtual void DoParMinLimit()
Slot related to the minumum parameter limit settings.
Definition: TFitParametersDialog.cxx:803
TGNumberEntryField::GetNumber
virtual Double_t GetNumber() const
Get the numeric value (floating point representation).
Definition: TGNumberEntry.cxx:1249
TFitParametersDialog::CloseWindow
virtual void CloseWindow()
Close parameters' dialog.
Definition: TFitParametersDialog.cxx:380
main
int main(int argc, char **argv)
Definition: histspeedtest.cxx:751
kLHintsRight
@ kLHintsRight
Definition: TGLayout.h:33
TMath::Power
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Definition: TMath.h:735
kVAL
@ kVAL
Definition: TFitParametersDialog.cxx:39
TGLayoutHints
Definition: TGLayout.h:57
TGTripleHSlider
Definition: TGTripleSlider.h:101
kRESET
@ kRESET
Definition: TFitParametersDialog.cxx:46
TVirtualPad.h
TFitParametersDialog::fHasChanges
Bool_t fHasChanges
Definition: TFitParametersDialog.h:53
TGNumberEntryField
Definition: TGNumberEntry.h:74
EParametersDialogWid
EParametersDialogWid
Definition: TFitParametersDialog.cxx:35
kMAX
@ kMAX
Definition: TFitParametersDialog.cxx:41
TFitParametersDialog::fContNam
TGCompositeFrame * fContNam
Definition: TFitParametersDialog.h:64
TF1::SetRange
virtual void SetRange(Double_t xmin, Double_t xmax)
Initialize the upper and lower bounds to draw the function.
Definition: TF1.cxx:3536
kBND
@ kBND
Definition: TFitParametersDialog.cxx:38
kMBOk
@ kMBOk
Definition: TGMsgBox.h:44
TGButton::SetState
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set button state.
Definition: TGButton.cxx:188
TFitParametersDialog::fUpdate
TGCheckButton * fUpdate
Definition: TFitParametersDialog.h:82
kHorizontalFrame
@ kHorizontalFrame
Definition: GuiTypes.h:382
kERR
@ kERR
Definition: TFitParametersDialog.cxx:44
kCANCEL
@ kCANCEL
Definition: TFitParametersDialog.cxx:49
TGLabel.h
TGTripleHSlider::SetConstrained
virtual void SetConstrained(Bool_t on=kTRUE)
Set pointer position constrained in the slider range.
Definition: TGTripleSlider.cxx:535
TGNumberEntry::SetLimits
virtual void SetLimits(ELimit limits=TGNumberFormat::kNELNoLimits, Double_t min=0, Double_t max=1)
Definition: TGNumberEntry.h:228
TFitParametersDialog::TFitParametersDialog
TFitParametersDialog(const TGWindow *p, const TGWindow *main, TF1 *func, TVirtualPad *pad, Int_t *ret_code=0)
Definition: TFitParametersDialog.cxx:56
f1
TF1 * f1
Definition: legend1.C:11
TGClient::NeedRedraw
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition: TGClient.cxx:373
Double_t
double Double_t
Definition: RtypesCore.h:59
TF1::GetParError
virtual Double_t GetParError(Int_t ipar) const
Return value of parameter number ipar.
Definition: TF1.cxx:1931
TFitParametersDialog::fContMin
TGCompositeFrame * fContMin
Definition: TFitParametersDialog.h:69
TQObject::Connect
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:864
TVirtualPad
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition: TVirtualPad.h:51
TGTextEntry::Home
void Home(Bool_t mark=kFALSE)
Moves the text cursor to the left end of the line.
Definition: TGTextEntry.cxx:995
TGFrame::UnmapWindow
virtual void UnmapWindow()
unmap window
Definition: TGFrame.h:231
TGTextEntry::SetEnabled
void SetEnabled(Bool_t flag=kTRUE)
Definition: TGTextEntry.h:164
TF1.h
TGMsgBox.h
TGObject::fClient
TGClient * fClient
Definition: TGObject.h:37
TGWindow::GetMainFrame
virtual const TGWindow * GetMainFrame() const
Returns top level main frame.
Definition: TGWindow.cxx:133
TGTransientFrame::CenterOnParent
virtual void CenterOnParent(Bool_t croot=kTRUE, EPlacement pos=kCenter)
Position transient frame centered relative to the parent frame.
Definition: TGFrame.cxx:1916
TFitParametersDialog::fContMax
TGCompositeFrame * fContMax
Definition: TFitParametersDialog.h:70
TF1::Draw
virtual void Draw(Option_t *option="")
Draw this function with its current attributes.
Definition: TF1.cxx:1338
TFitParametersDialog::DoParBound
virtual void DoParBound(Bool_t on)
Slot related to the Bound check button.
Definition: TFitParametersDialog.cxx:419
TGCompositeFrame::GetState
Int_t GetState(TGFrame *f) const
Get state of sub frame.
Definition: TGFrame.cxx:1203
TList::Add
virtual void Add(TObject *obj)
Definition: TList.h:87
TGButton::GetState
virtual EButtonState GetState() const
Definition: TGButton.h:112
TFitParametersDialog::fContSld
TGCompositeFrame * fContSld
Definition: TFitParametersDialog.h:68
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
TGTextEntry.h
TGButton.h
TFitParametersDialog::fReset
TGTextButton * fReset
Definition: TFitParametersDialog.h:84
TList::Clear
virtual void Clear(Option_t *option="")
Remove all objects from the list.
Definition: TList.cxx:401
kDeepCleanup
@ kDeepCleanup
Definition: TGFrame.h:51
TGNumberFormat::kNELNoLimits
@ kNELNoLimits
Definition: TGNumberEntry.h:56
kUPDATE
@ kUPDATE
Definition: TFitParametersDialog.cxx:45
gPad
#define gPad
Definition: TVirtualPad.h:287
kSTP
@ kSTP
Definition: TFitParametersDialog.cxx:43
TFitParametersDialog::fParBnd
TGCheckButton ** fParBnd
Definition: TFitParametersDialog.h:74
TFitParametersDialog::fPval
Double_t * fPval
Definition: TFitParametersDialog.h:61
kOK
@ kOK
Definition: TFitParametersDialog.cxx:48
TGDoubleSlider::GetMinPosition
virtual Float_t GetMinPosition() const
Definition: TGDoubleSlider.h:127
TGNumberEntry.h
kLHintsExpandX
@ kLHintsExpandX
Definition: TGLayout.h:37
TFitParametersDialog::DisconnectSlots
void DisconnectSlots()
Disconnect signals from slot methods.
Definition: TFitParametersDialog.cxx:930
TGCompositeFrame::SetCleanup
virtual void SetCleanup(Int_t mode=kLocalCleanup)
Turn on automatic cleanup of child frames in dtor.
Definition: TGFrame.cxx:1057
TF1::SetParLimits
virtual void SetParLimits(Int_t ipar, Double_t parmin, Double_t parmax)
Set limits for parameter ipar.
Definition: TF1.cxx:3515
TGNumberEntry
Definition: TGNumberEntry.h:157
TGNumberEntryField::ReturnPressed
virtual void ReturnPressed()
Return was pressed.
Definition: TGNumberEntry.cxx:1724
TGTripleHSlider::SetPointerPosition
virtual void SetPointerPosition(Float_t pos)
Set pointer position in scaled (real) value.
Definition: TGTripleSlider.cxx:609
kDoubleScaleBoth
@ kDoubleScaleBoth
Definition: TGDoubleSlider.h:68
TGButton
Definition: TGButton.h:68
TF1
1-Dim function class
Definition: TF1.h:213
TFitParametersDialog::DoParValue
virtual void DoParValue()
Slot related to the parameter value settings.
Definition: TFitParametersDialog.cxx:756
TFitParametersDialog
Definition: TFitParametersDialog.h:48
TGCompositeFrame
Definition: TGFrame.h:324
TF1::GetParameter
virtual Double_t GetParameter(Int_t ipar) const
Definition: TF1.h:511
TAttLine::SetLineStyle
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
Definition: TAttLine.h:42
TGClient::GetRoot
const TGWindow * GetRoot() const
Returns current root (i.e.
Definition: TGClient.cxx:225
TFitParametersDialog::HandleTab
virtual void HandleTab()
Handle Tab key event (set focus to the next number entry field)
Definition: TFitParametersDialog.cxx:975
TGNumberEntry::SetState
virtual void SetState(Bool_t enable=kTRUE)
Set the active state.
Definition: TGNumberEntry.cxx:2028
TGCompositeFrame::AddFrame
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1102
TFitParametersDialog::fParFix
TGCheckButton ** fParFix
Definition: TFitParametersDialog.h:75
TMath::E
constexpr Double_t E()
Base of natural log:
Definition: TMath.h:96
TF1::FixParameter
virtual void FixParameter(Int_t ipar, Double_t value)
Fix the value of a parameter The specified value will be used in a fit operation.
Definition: TF1.cxx:1563
TFitParametersDialog::fParNam
TGTextEntry ** fParNam
Definition: TFitParametersDialog.h:73
TFitParametersDialog::fRangexmin
Double_t fRangexmin
Definition: TFitParametersDialog.h:57
kButtonDisabled
@ kButtonDisabled
Definition: TGButton.h:56
TMath.h
TGDoubleSlider::SetPosition
virtual void SetPosition(Float_t min, Float_t max)
Definition: TGDoubleSlider.h:121
TFitParametersDialog::SetParameters
void SetParameters()
Set the parameter values inside the function.
Definition: TFitParametersDialog.cxx:579
TFitParametersDialog::fContBnd
TGCompositeFrame * fContBnd
Definition: TFitParametersDialog.h:67
int
TGDoubleSlider::GetMaxPosition
virtual Float_t GetMaxPosition() const
Definition: TGDoubleSlider.h:131
TFitParametersDialog::fParStp
TGNumberEntry ** fParStp
Definition: TFitParametersDialog.h:79
TF1::ReleaseParameter
virtual void ReleaseParameter(Int_t ipar)
Release parameter number ipar If used in a fit, the parameter can vary freely.
Definition: TF1.cxx:3141