66 fImmediateDraw (
kTRUE),
74 fFunc->GetRange(fRangexmin, fRangexmax);
75 fNP = fFunc->GetNpar();
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);
121 fContNam->AddFrame(
new TGLabel(fContNam,
"Name"),
123 for (
Int_t i = 0; i < fNP; i++ ) {
125 fParNam[i]->SetText(
Form(
"%s", fFunc->GetParName(i)));
126 fParNam[i]->SetEnabled(kFALSE);
127 fContNam->AddFrame(fParNam[i],
134 fContFix->AddFrame(
new TGLabel(fContFix,
"Fix"),
136 for (
Int_t i = 0; i < fNP; i++ ) {
138 fParFix[i]->SetToolTipText(
Form(
"Set %s to fixed", fFunc->GetParName(i)));
141 if ((fPmin[i] == fPmax[i]) && (fPmin[i] || fPmax[i]))
145 fParFix[i]->Connect(
"Toggled(Bool_t)",
"TFitParametersDialog",
this,
"DoParFix(Bool_t)");
151 fContBnd->AddFrame(
new TGLabel(fContBnd,
"Bound"),
153 for (
Int_t i = 0; i < fNP; i++ ) {
155 fParBnd[i]->SetToolTipText(
Form(
"Set bound to %s", fFunc->GetParName(i)));
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]) )
168 fContVal->AddFrame(
new TGLabel(fContVal,
"Value"),
170 for (
Int_t i = 0; i < 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());
188 fContMin->AddFrame(
new TGLabel(fContMin,
"Min"),
190 for (
Int_t i = 0; i < fNP; i++ ) {
195 fFunc->GetParName(i)));
197 fParMin[i]->SetNumber(fPmin[i]);
198 fParMin[i]->Connect(
"ReturnPressed()",
"TFitParametersDialog",
this,
200 fParMin[i]->Connect(
"TabPressed()",
"TFitParametersDialog",
this,
"HandleTab()");
201 fParMin[i]->Connect(
"ShiftTabPressed()",
"TFitParametersDialog",
this,
"HandleShiftTab()");
202 fTextEntries.Add(fParMin[i]);
208 fContSld->AddFrame(
new TGLabel(fContSld,
"Set Range"),
210 for (
Int_t i = 0; i < fNP; i++ ) {
213 kFALSE, kFALSE, kFALSE, kFALSE);
215 fParSld[i]->SetConstrained(kTRUE);
221 fContMax->AddFrame(
new TGLabel(fContMax,
"Max"),
223 for (
Int_t i = 0; i < fNP; i++ ) {
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()");
234 fTextEntries.Add(fParMax[i]);
240 fContStp->AddFrame(
new TGLabel(fContStp,
"Step"),
242 for (
Int_t i = 0; i < 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());
260 fContErr->AddFrame(
new TGLabel(fContErr,
"Errors"),
262 for (
Int_t i = 0; i < fNP; i++ ) {
267 fFunc->GetParName(i)));
269 fParErr[i]->SetEnabled(kFALSE);
271 fParErr[i]->SetNumber(fPerr[i]);
281 fUpdate->SetToolTipText(
"Immediate function redrawing");
284 fUpdate->Connect(
"Toggled(Bool_t)",
"TFitParametersDialog",
this,
"HandleButtons(Bool_t)");
291 fReset->SetToolTipText(
"Reset the parameter settings");
293 fReset->Connect(
"Clicked()",
"TFitParametersDialog",
this,
"DoReset()");
298 fApply->Connect(
"Clicked()",
"TFitParametersDialog",
this,
"DoApply()");
299 fApply->SetToolTipText(
"Apply parameter settings and redraw the function");
303 fOK->SetToolTipText(
"Apply parameter settings, redraw function and close this dialog");
304 fOK->Connect(
"Clicked()",
"TFitParametersDialog",
this,
"DoOK()");
308 fCancel->SetToolTipText(
"Close this dialog with no parameter changes");
309 fCancel->Connect(
"Clicked()",
"TFitParametersDialog",
this,
"DoCancel()");
313 Resize(GetDefaultSize());
316 SetWindowName(
Form(
"Set Parameters of %s", fFunc->GetTitle()));
318 for (
Int_t i = 0; i < fNP; i++ ) {
320 fParVal[i]->SetState(kFALSE);
321 fParMin[i]->SetEnabled(kFALSE);
322 fParMax[i]->SetEnabled(kFALSE);
323 fParSld[i]->UnmapWindow();
325 if (fPmin[i]*fPmax[i] == 0 && fPmin[i] >= fPmax[i]) {
328 Double_t roundVal = int(fPval[i]/ u) * u;
330 fParMin[i]->SetNumber( roundVal - 100* fPstp[i]);
331 fParMax[i]->SetNumber( roundVal + 100* fPstp[i]);
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",
345 fParSld[i]->Connect(
"PositionChanged()",
"TFitParametersDialog",
386 txt =
"Do you want to apply last parameters' setting?";
394 else if (ret ==
kMBNo)
427 if (
id ==
kBND*fNP+i) {
432 txt =
"'Min' value cannot be bigger or equal to 'Max' - set the limits first!";
497 if (
id ==
kFIX*fNP+i) {
503 if (
fParVal[i]->GetNumber() != 0) {
520 }
else if (!
fParMin[i]->IsEnabled()) {
538 }
else if (
fPval[i]) {
553 this,
"DoParBound(Bool_t)");
563 fParSld[i]->
Connect(
"PointerPositionChanged()",
"TFitParametersDialog",
693 if (!
fParMax[i]->IsEnabled()) {
702 fParSld[i]->
Connect(
"PointerPositionChanged()",
"TFitParametersDialog",
708 this,
"DoParBound(Bool_t)");
737 if (
id ==
kSLD*fNP+i) {
763 if (
id ==
kVAL*fNP+i) {
810 if (
id ==
kMIN*fNP+i) {
815 txt =
"'Min' cannot be bigger then 'Max' if this parameter is bounded.";
853 if (
id ==
kMAX*fNP+i) {
858 txt =
"'Min' cannot be bigger then 'Max' if this parameter is bounded.";
892 if ( !
fFpad )
return;
912 if (save)
gPad = save;
virtual void DoParFix(Bool_t on)
Slot related to the Fix check button.
virtual void DoParMaxLimit()
Slot related to the maximum parameter limit settings.
virtual void HandleTab()
Handle Tab key event (set focus to the next number entry field)
Int_t GetState(TGFrame *f) const
Get state of sub frame.
Double_t Floor(Double_t x)
virtual void ReleaseParameter(Int_t ipar)
Release parameter number ipar If used in a fit, the parameter can vary freely.
virtual void ReturnPressed()
Return was pressed.
R__EXTERN void * gTQSender
const TGWindow * GetRoot() const
Returns current root (i.e.
virtual void DoApply()
Slot related to the Preview button.
virtual TObject * Last() const
Return the last object in the list. Returns 0 when list is empty.
virtual void SetRange(Double_t xmin, Double_t xmax)
Initialize the upper and lower bounds to draw the function.
virtual void SetNumber(Double_t val)
void ToUpper()
Change string to upper case.
virtual void DoCancel()
Slot related to the Cancel button.
virtual void Draw(Option_t *option="")
Draw this function with its current attributes.
virtual void SetState(Bool_t enable=kTRUE)
Set the active state.
virtual void SetLimits(ELimit limits=TGNumberFormat::kNELNoLimits, Double_t min=0, Double_t max=1)
virtual void SetRange(Float_t min, Float_t max)
TGTripleHSlider ** fParSld
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
virtual Style_t GetLineStyle() const
Return the line style.
TGNumberEntryField ** fParErr
virtual void SetPointerPosition(Float_t pos)
Set pointer position in scaled (real) value.
virtual void DoParMinLimit()
Slot related to the minumum parameter limit settings.
Double_t Log10(Double_t x)
virtual void SetFocus()
Set focus to this text entry.
virtual void CloseWindow()
Close parameters' dialog.
virtual Double_t GetNumber() const
Get the numeric value (floating point representation).
virtual const TGWindow * GetMainFrame() const
Returns top level main frame.
TVirtualPad is an abstract base class for the Pad and Canvas classes.
virtual Option_t * GetDrawOption() const
Get option used by the graphics system to draw this object.
virtual const char * GetParName(Int_t ipar) const
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...
virtual void SetParLimits(Int_t ipar, Double_t parmin, Double_t parmax)
Set limits for parameter ipar.
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
void SetLimitValues(Double_t min=0, Double_t max=1)
virtual void HandleButtons(Bool_t update)
Handle the button dependent states in this dialog.
virtual void DoParBound(Bool_t on)
Slot related to the Bound check button.
virtual void SetParError(Int_t ipar, Double_t error)
Set error for parameter number ipar.
virtual TObject * Before(const TObject *obj) const
Returns the object before object obj.
TGNumberEntryField ** fParMax
static void update(gsl_integration_workspace *workspace, double a1, double b1, double area1, double error1, double a2, double b2, double area2, double error2)
virtual void DrawFunction()
Redraw function graphics.
virtual void DoOK()
Slot related to the OK button.
char * Form(const char *fmt,...)
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. ...
virtual TObject * After(const TObject *obj) const
Returns the object after object obj.
virtual void HandleShiftTab()
Handle Shift+Tab key event (set focus to the previous number entry field)
virtual void DoReset()
Slot related to the Reset button.
TGNumberEntryField ** fParMin
virtual void DoParStep()
Slot related to parameter step setting.
virtual void DoParValue()
Slot related to the parameter value settings.
void SetEnabled(Bool_t flag=kTRUE)
double func(double *x, double *p)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Bool_t Disconnect(const char *signal=0, void *receiver=0, const char *slot=0)
Disconnects signal of this object from slot of receiver.
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
virtual void Clear(Option_t *option="")
Remove all objects from the list.
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
Mother of all ROOT objects.
virtual void UnmapWindow()
virtual void GetParLimits(Int_t ipar, Double_t &parmin, Double_t &parmax) const
Return limits for parameter ipar.
virtual void SetNumber(Double_t val)
Set the numeric value (floating point representation).
virtual void DoSlider()
Slot related to the parameters' value settings.
TGNumberEntryField * GetNumberEntry() const
double f2(const double *x)
virtual Double_t GetParameter(Int_t ipar) const
void SetParameters()
Set the parameter values inside the function.
void DisconnectSlots()
Disconnect signals from slot methods.
virtual void SetPosition(Float_t min, Float_t max)
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
virtual void SetParameter(Int_t param, Double_t value)
void Home(Bool_t mark=kFALSE)
Moves the text cursor to the left end of the line.
virtual ~TFitParametersDialog()
Destructor.
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
virtual void DeleteWindow()
Delete window.
int main(int argc, char **argv)