65 fImmediateDraw (
kTRUE),
73 fFunc->GetRange(fRangexmin, fRangexmax);
74 fNP = fFunc->GetNpar();
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);
115 fContNam->AddFrame(
new TGLabel(fContNam,
"Name"),
117 for (
Int_t i = 0; i < fNP; i++ ) {
119 fParNam[i]->SetText(
Form(
"%s", fFunc->GetParName(i)));
120 fParNam[i]->SetEnabled(kFALSE);
121 fContNam->AddFrame(fParNam[i],
128 fContFix->AddFrame(
new TGLabel(fContFix,
"Fix"),
130 for (
Int_t i = 0; i < fNP; i++ ) {
132 fParFix[i]->SetToolTipText(
Form(
"Set %s to fixed", fFunc->GetParName(i)));
135 if ((fPmin[i] == fPmax[i]) && (fPmin[i] || fPmax[i]))
139 fParFix[i]->Connect(
"Toggled(Bool_t)",
"TFitParametersDialog",
this,
"DoParFix(Bool_t)");
145 fContBnd->AddFrame(
new TGLabel(fContBnd,
"Bound"),
147 for (
Int_t i = 0; i < fNP; i++ ) {
149 fParBnd[i]->SetToolTipText(
Form(
"Set bound to %s", fFunc->GetParName(i)));
152 fParBnd[i]->Connect(
"Toggled(Bool_t)",
"TFitParametersDialog",
this,
"DoParBound(Bool_t)");
153 if ( ((fPmin[i] != fPmax[i]) && (fPmin[i] || fPmax[i])) || (fParMin[i] < fParMax[i]) )
162 fContVal->AddFrame(
new TGLabel(fContVal,
"Value"),
164 for (
Int_t i = 0; i < fNP; i++ ) {
167 fParVal[i]->SetNumber(fPval[i]);
170 (fParVal[i]->GetNumberEntry())->SetToolTipText(
Form(
"%s", fFunc->GetParName(i)));
171 (fParVal[i]->GetNumberEntry())->Connect(
"ReturnPressed()",
"TFitParametersDialog",
172 this,
"DoParValue()");
173 fParVal[i]->Connect(
"ValueSet(Long_t)",
"TFitParametersDialog",
this,
"DoParValue()");
174 (fParVal[i]->GetNumberEntry())->Connect(
"TabPressed()",
"TFitParametersDialog",
this,
"HandleTab()");
175 (fParVal[i]->GetNumberEntry())->Connect(
"ShiftTabPressed()",
"TFitParametersDialog",
this,
"HandleShiftTab()");
176 fTextEntries.Add(fParVal[i]->GetNumberEntry());
182 fContMin->AddFrame(
new TGLabel(fContMin,
"Min"),
184 for (
Int_t i = 0; i < fNP; i++ ) {
189 fFunc->GetParName(i)));
191 fParMin[i]->SetNumber(fPmin[i]);
192 fParMin[i]->Connect(
"ReturnPressed()",
"TFitParametersDialog",
this,
194 fParMin[i]->Connect(
"TabPressed()",
"TFitParametersDialog",
this,
"HandleTab()");
195 fParMin[i]->Connect(
"ShiftTabPressed()",
"TFitParametersDialog",
this,
"HandleShiftTab()");
196 fTextEntries.Add(fParMin[i]);
202 fContSld->AddFrame(
new TGLabel(fContSld,
"Set Range"),
204 for (
Int_t i = 0; i < fNP; i++ ) {
207 kFALSE, kFALSE, kFALSE, kFALSE);
209 fParSld[i]->SetConstrained(kTRUE);
215 fContMax->AddFrame(
new TGLabel(fContMax,
"Max"),
217 for (
Int_t i = 0; i < fNP; i++ ) {
222 fFunc->GetParName(i)));
224 fParMax[i]->SetNumber(fPmax[i]);
225 fParMax[i]->Connect(
"ReturnPressed()",
"TFitParametersDialog",
this,
"DoParMaxLimit()");
226 fParMax[i]->Connect(
"TabPressed()",
"TFitParametersDialog",
this,
"HandleTab()");
227 fParMax[i]->Connect(
"ShiftTabPressed()",
"TFitParametersDialog",
this,
"HandleShiftTab()");
228 fTextEntries.Add(fParMax[i]);
234 fContStp->AddFrame(
new TGLabel(fContStp,
"Step"),
236 for (
Int_t i = 0; i < fNP; i++ ) {
239 fParStp[i]->SetNumber(fPstp[i]);
242 (fParStp[i]->GetNumberEntry())->SetToolTipText(
Form(
"%s", fFunc->GetParName(i)));
243 (fParStp[i]->GetNumberEntry())->Connect(
"ReturnPressed()",
"TFitParametersDialog",
244 this,
"DoParStep()");
245 fParStp[i]->Connect(
"ValueSet(Long_t)",
"TFitParametersDialog",
this,
"DoParStep()");
246 (fParStp[i]->GetNumberEntry())->Connect(
"TabPressed()",
"TFitParametersDialog",
this,
"HandleTab()");
247 (fParStp[i]->GetNumberEntry())->Connect(
"ShiftTabPressed()",
"TFitParametersDialog",
this,
"HandleShiftTab()");
248 fTextEntries.Add(fParStp[i]->GetNumberEntry());
254 fContErr->AddFrame(
new TGLabel(fContErr,
"Errors"),
256 for (
Int_t i = 0; i < fNP; i++ ) {
261 fFunc->GetParName(i)));
263 fParErr[i]->SetEnabled(kFALSE);
265 fParErr[i]->SetNumber(fPerr[i]);
275 fUpdate->SetToolTipText(
"Immediate function redrawing");
278 fUpdate->Connect(
"Toggled(Bool_t)",
"TFitParametersDialog",
this,
"HandleButtons(Bool_t)");
285 fReset->SetToolTipText(
"Reset the parameter settings");
287 fReset->Connect(
"Clicked()",
"TFitParametersDialog",
this,
"DoReset()");
292 fApply->Connect(
"Clicked()",
"TFitParametersDialog",
this,
"DoApply()");
293 fApply->SetToolTipText(
"Apply parameter settings and redraw the function");
297 fOK->SetToolTipText(
"Apply parameter settings, redraw function and close this dialog");
298 fOK->Connect(
"Clicked()",
"TFitParametersDialog",
this,
"DoOK()");
302 fCancel->SetToolTipText(
"Close this dialog with no parameter changes");
303 fCancel->Connect(
"Clicked()",
"TFitParametersDialog",
this,
"DoCancel()");
307 Resize(GetDefaultSize());
310 SetWindowName(
Form(
"Set Parameters of %s", fFunc->GetTitle()));
312 for (
Int_t i = 0; i < fNP; i++ ) {
314 fParVal[i]->SetState(kFALSE);
315 fParMin[i]->SetEnabled(kFALSE);
316 fParMax[i]->SetEnabled(kFALSE);
317 fParSld[i]->UnmapWindow();
319 if (fPmin[i]*fPmax[i] == 0 && fPmin[i] >= fPmax[i]) {
321 fParMin[i]->SetNumber(-10);
322 fParMax[i]->SetNumber(10);
324 fParMin[i]->SetNumber(-3*
TMath::Abs(fPval[i]));
325 fParMax[i]->SetNumber(3*
TMath::Abs(fPval[i]));
328 fParSld[i]->SetRange(fParMin[i]->GetNumber(), fParMax[i]->GetNumber());
329 fParSld[i]->SetPosition(fParMin[i]->GetNumber(), fParMax[i]->GetNumber());
330 fParSld[i]->SetPointerPosition(fParVal[i]->GetNumber());
331 fParSld[i]->Connect(
"PointerPositionChanged()",
"TFitParametersDialog",
333 fParSld[i]->Connect(
"PositionChanged()",
"TFitParametersDialog",
374 txt =
"Do you want to apply last parameters' setting?";
380 else if (ret ==
kMBNo)
413 if (
id ==
kBND*fNP+i) {
418 txt =
"'Min' value cannot be bigger or equal to 'Max' - set the limits first!";
484 if (
id ==
kFIX*fNP+i) {
490 if (
fParVal[i]->GetNumber() != 0) {
507 }
else if (!
fParMin[i]->IsEnabled()) {
525 }
else if (
fPval[i]) {
540 this,
"DoParBound(Bool_t)");
550 fParSld[i]->
Connect(
"PointerPositionChanged()",
"TFitParametersDialog",
675 if (!
fParMax[i]->IsEnabled()) {
684 fParSld[i]->
Connect(
"PointerPositionChanged()",
"TFitParametersDialog",
690 this,
"DoParBound()");
719 if (
id ==
kSLD*fNP+i) {
745 if (
id ==
kVAL*fNP+i) {
792 if (
id ==
kMIN*fNP+i) {
797 txt =
"'Min' cannot be bigger then 'Max' if this parameter is bounded.";
835 if (
id ==
kMAX*fNP+i) {
840 txt =
"'Min' cannot be bigger then 'Max' if this parameter is bounded.";
874 if ( !
fFpad )
return;
894 if (save)
gPad = save;
virtual void DoParFix(Bool_t on)
Slot related to the Fix check button.
virtual Style_t GetLineStyle() const
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)
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.
ClassImp(TSeqCollection) Int_t TSeqCollection TIter next(this)
Return index of object in collection.
R__EXTERN void * gTQSender
virtual const char * GetParName(Int_t ipar) const
virtual void DoApply()
Slot related to the Preview button.
const TGWindow * GetRoot() const
Returns current root (i.e.
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
TGNumberEntryField * GetNumberEntry() const
TGNumberEntryField ** fParErr
virtual TObject * After(const TObject *obj) const
Returns the object after object obj.
virtual Option_t * GetDrawOption() const
Get option used by the graphics system to draw this object.
virtual void SetPointerPosition(Float_t pos)
Set pointer position in scaled (real) value.
virtual void DoParMinLimit()
Slot related to the minumum parameter limit settings.
virtual void SetFocus()
Set focus to this text entry.
virtual void CloseWindow()
Close parameters' dialog.
TVirtualPad is an abstract base class for the Pad and Canvas classes.
ClassImp(TFitParametersDialog) TFitParametersDialog
virtual void GetParLimits(Int_t ipar, Double_t &parmin, Double_t &parmax) const
Return limits for parameter ipar.
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 * Before(const TObject *obj) const
Returns the object before object obj.
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.
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 Double_t GetNumber() const
Get the numeric value (floating point representation).
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.
virtual const TGWindow * GetMainFrame() const
Returns top level main frame.
TGNumberEntryField ** fParMin
virtual TObject * Last() const
Return the last object in the list. Returns 0 when list is empty.
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 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)
virtual Double_t GetParameter(Int_t ipar) const
Mother of all ROOT objects.
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
virtual void UnmapWindow()
virtual void SetNumber(Double_t val)
Set the numeric value (floating point representation).
virtual void DoSlider()
Slot related to the parameters' value settings.
void SetParameters()
Set the parameter values inside the function.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
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_t GetState(TGFrame *f) const
Get state of sub frame.