67 fImmediateDraw (
kTRUE),
75 fFunc->GetRange(fRangexmin, fRangexmax);
76 fNP = fFunc->GetNpar();
83 for (
Int_t i = 0; i < fNP; i++) {
84 fFunc->GetParLimits(i, fPmin[i], fPmax[i]);
85 fPval[i] = fFunc->GetParameter(i);
86 fPerr[i] = fFunc->GetParError(i);
117 fContNam->AddFrame(
new TGLabel(fContNam,
"Name"),
119 for (
Int_t i = 0; i < fNP; i++ ) {
121 fParNam[i]->SetText(
Form(
"%s", fFunc->GetParName(i)));
122 fParNam[i]->SetEnabled(kFALSE);
123 fContNam->AddFrame(fParNam[i],
130 fContFix->AddFrame(
new TGLabel(fContFix,
"Fix"),
132 for (
Int_t i = 0; i < fNP; i++ ) {
134 fParFix[i]->SetToolTipText(
Form(
"Set %s to fixed", fFunc->GetParName(i)));
137 if ((fPmin[i] == fPmax[i]) && (fPmin[i] || fPmax[i]))
141 fParFix[i]->Connect(
"Toggled(Bool_t)",
"TFitParametersDialog",
this,
"DoParFix(Bool_t)");
147 fContBnd->AddFrame(
new TGLabel(fContBnd,
"Bound"),
149 for (
Int_t i = 0; i < fNP; i++ ) {
151 fParBnd[i]->SetToolTipText(
Form(
"Set bound to %s", fFunc->GetParName(i)));
154 fParBnd[i]->Connect(
"Toggled(Bool_t)",
"TFitParametersDialog",
this,
"DoParBound(Bool_t)");
155 if ( ((fPmin[i] != fPmax[i]) && (fPmin[i] || fPmax[i])) || (fParMin[i] < fParMax[i]) )
164 fContVal->AddFrame(
new TGLabel(fContVal,
"Value"),
166 for (
Int_t i = 0; i < fNP; i++ ) {
169 fParVal[i]->SetNumber(fPval[i]);
172 (fParVal[i]->GetNumberEntry())->SetToolTipText(
Form(
"%s", fFunc->GetParName(i)));
173 (fParVal[i]->GetNumberEntry())->Connect(
"ReturnPressed()",
"TFitParametersDialog",
174 this,
"DoParValue()");
175 fParVal[i]->Connect(
"ValueSet(Long_t)",
"TFitParametersDialog",
this,
"DoParValue()");
176 (fParVal[i]->GetNumberEntry())->Connect(
"TabPressed()",
"TFitParametersDialog",
this,
"HandleTab()");
177 (fParVal[i]->GetNumberEntry())->Connect(
"ShiftTabPressed()",
"TFitParametersDialog",
this,
"HandleShiftTab()");
178 fTextEntries.Add(fParVal[i]->GetNumberEntry());
184 fContMin->AddFrame(
new TGLabel(fContMin,
"Min"),
186 for (
Int_t i = 0; i < fNP; i++ ) {
191 fFunc->GetParName(i)));
193 fParMin[i]->SetNumber(fPmin[i]);
194 fParMin[i]->Connect(
"ReturnPressed()",
"TFitParametersDialog",
this,
196 fParMin[i]->Connect(
"TabPressed()",
"TFitParametersDialog",
this,
"HandleTab()");
197 fParMin[i]->Connect(
"ShiftTabPressed()",
"TFitParametersDialog",
this,
"HandleShiftTab()");
198 fTextEntries.Add(fParMin[i]);
204 fContSld->AddFrame(
new TGLabel(fContSld,
"Set Range"),
206 for (
Int_t i = 0; i < fNP; i++ ) {
209 kFALSE, kFALSE, kFALSE, kFALSE);
211 fParSld[i]->SetConstrained(kTRUE);
217 fContMax->AddFrame(
new TGLabel(fContMax,
"Max"),
219 for (
Int_t i = 0; i < fNP; i++ ) {
224 fFunc->GetParName(i)));
226 fParMax[i]->SetNumber(fPmax[i]);
227 fParMax[i]->Connect(
"ReturnPressed()",
"TFitParametersDialog",
this,
"DoParMaxLimit()");
228 fParMax[i]->Connect(
"TabPressed()",
"TFitParametersDialog",
this,
"HandleTab()");
229 fParMax[i]->Connect(
"ShiftTabPressed()",
"TFitParametersDialog",
this,
"HandleShiftTab()");
230 fTextEntries.Add(fParMax[i]);
236 fContStp->AddFrame(
new TGLabel(fContStp,
"Step"),
238 for (
Int_t i = 0; i < fNP; i++ ) {
241 fParStp[i]->SetNumber(fPstp[i]);
244 (fParStp[i]->GetNumberEntry())->SetToolTipText(
Form(
"%s", fFunc->GetParName(i)));
245 (fParStp[i]->GetNumberEntry())->Connect(
"ReturnPressed()",
"TFitParametersDialog",
246 this,
"DoParStep()");
247 fParStp[i]->Connect(
"ValueSet(Long_t)",
"TFitParametersDialog",
this,
"DoParStep()");
248 (fParStp[i]->GetNumberEntry())->Connect(
"TabPressed()",
"TFitParametersDialog",
this,
"HandleTab()");
249 (fParStp[i]->GetNumberEntry())->Connect(
"ShiftTabPressed()",
"TFitParametersDialog",
this,
"HandleShiftTab()");
250 fTextEntries.Add(fParStp[i]->GetNumberEntry());
256 fContErr->AddFrame(
new TGLabel(fContErr,
"Errors"),
258 for (
Int_t i = 0; i < fNP; i++ ) {
263 fFunc->GetParName(i)));
265 fParErr[i]->SetEnabled(kFALSE);
267 fParErr[i]->SetNumber(fPerr[i]);
277 fUpdate->SetToolTipText(
"Immediate function redrawing");
280 fUpdate->Connect(
"Toggled(Bool_t)",
"TFitParametersDialog",
this,
"HandleButtons(Bool_t)");
287 fReset->SetToolTipText(
"Reset the parameter settings");
289 fReset->Connect(
"Clicked()",
"TFitParametersDialog",
this,
"DoReset()");
294 fApply->Connect(
"Clicked()",
"TFitParametersDialog",
this,
"DoApply()");
295 fApply->SetToolTipText(
"Apply parameter settings and redraw the function");
299 fOK->SetToolTipText(
"Apply parameter settings, redraw function and close this dialog");
300 fOK->Connect(
"Clicked()",
"TFitParametersDialog",
this,
"DoOK()");
304 fCancel->SetToolTipText(
"Close this dialog with no parameter changes");
305 fCancel->Connect(
"Clicked()",
"TFitParametersDialog",
this,
"DoCancel()");
309 Resize(GetDefaultSize());
312 SetWindowName(
Form(
"Set Parameters of %s", fFunc->GetTitle()));
314 for (
Int_t i = 0; i < fNP; i++ ) {
316 fParVal[i]->SetState(kFALSE);
317 fParMin[i]->SetEnabled(kFALSE);
318 fParMax[i]->SetEnabled(kFALSE);
319 fParSld[i]->UnmapWindow();
321 if (fPmin[i]*fPmax[i] == 0 && fPmin[i] >= fPmax[i]) {
323 fParMin[i]->SetNumber(-10);
324 fParMax[i]->SetNumber(10);
326 fParMin[i]->SetNumber(-3*
TMath::Abs(fPval[i]));
327 fParMax[i]->SetNumber(3*
TMath::Abs(fPval[i]));
330 fParSld[i]->SetRange(fParMin[i]->GetNumber(), fParMax[i]->GetNumber());
331 fParSld[i]->SetPosition(fParMin[i]->GetNumber(), fParMax[i]->GetNumber());
332 fParSld[i]->SetPointerPosition(fParVal[i]->GetNumber());
333 fParSld[i]->Connect(
"PointerPositionChanged()",
"TFitParametersDialog",
335 fParSld[i]->Connect(
"PositionChanged()",
"TFitParametersDialog",
376 txt =
"Do you want to apply last parameters' setting?";
382 else if (ret ==
kMBNo)
415 if (
id ==
kBND*fNP+i) {
420 txt =
"'Min' value cannot be bigger or equal to 'Max' - set the limits first!";
486 if (
id ==
kFIX*fNP+i) {
492 if (
fParVal[i]->GetNumber() != 0) {
509 }
else if (!
fParMin[i]->IsEnabled()) {
527 }
else if (
fPval[i]) {
542 this,
"DoParBound(Bool_t)");
552 fParSld[i]->
Connect(
"PointerPositionChanged()",
"TFitParametersDialog",
677 if (!
fParMax[i]->IsEnabled()) {
686 fParSld[i]->
Connect(
"PointerPositionChanged()",
"TFitParametersDialog",
692 this,
"DoParBound()");
721 if (
id ==
kSLD*fNP+i) {
747 if (
id ==
kVAL*fNP+i) {
794 if (
id ==
kMIN*fNP+i) {
799 txt =
"'Min' cannot be bigger then 'Max' if this parameter is bounded.";
837 if (
id ==
kMAX*fNP+i) {
842 txt =
"'Min' cannot be bigger then 'Max' if this parameter is bounded.";
876 if ( !
fFpad )
return;
896 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.
int main(int argc, char *argv[])
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)
static Vc_ALWAYS_INLINE int_v max(const int_v &x, const int_v &y)
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.
double f2(const double *x)
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.