65 fFunc->GetRange(fRangexmin, fRangexmax);
66 fNP = fFunc->GetNpar();
73 for (
Int_t i = 0; i < fNP; i++) {
74 fFunc->GetParLimits(i, fPmin[i], fPmax[i]);
75 fPval[i] = fFunc->GetParameter(i);
76 fPerr[i] = fFunc->GetParError(i);
97 fContNam->AddFrame(
new TGLabel(fContNam,
"Name"),
99 for (
Int_t i = 0; i < fNP; i++ ) {
101 fParNam[i]->SetText(
Form(
"%s", fFunc->GetParName(i)));
102 fParNam[i]->SetEnabled(
kFALSE);
103 fContNam->AddFrame(fParNam[i],
110 fContFix->AddFrame(
new TGLabel(fContFix,
"Fix"),
112 for (
Int_t i = 0; i < fNP; i++ ) {
114 fParFix[i]->SetToolTipText(
Form(
"Set %s to fixed", fFunc->GetParName(i)));
117 if ((fPmin[i] == fPmax[i]) && (fPmin[i] || fPmax[i]))
121 fParFix[i]->Connect(
"Toggled(Bool_t)",
"TFunctionParametersDialog",
this,
"DoFix(Bool_t)");
127 fContVal->AddFrame(
new TGLabel(fContVal,
"Value"),
129 for (
Int_t i = 0; i < fNP; i++ ) {
132 fParVal[i]->SetNumber(fPval[i]);
135 (fParVal[i]->GetNumberEntry())->SetToolTipText(
Form(
"%s", fFunc->GetParName(i)));
136 (fParVal[i]->GetNumberEntry())->Connect(
"ReturnPressed()",
"TFunctionParametersDialog",
137 this,
"DoParValue()");
138 fParVal[i]->Connect(
"ValueSet(Long_t)",
"TFunctionParametersDialog",
this,
"DoParValue()");
144 fContMin->AddFrame(
new TGLabel(fContMin,
"Min"),
146 for (
Int_t i = 0; i < fNP; i++ ) {
151 fFunc->GetParName(i)));
154 fParMin[i]->SetNumber(fPmin[i]);
156 fParMin[i]->SetNumber(fPval[i]-3*fPerr[i]);
158 fParMin[i]->SetNumber(fPval[i]-0.1*fPval[i]);
160 fParMin[i]->SetNumber(1.0);
161 fParMin[i]->Connect(
"ReturnPressed()",
"TFunctionParametersDialog",
this,
"DoParMinLimit()");
167 fContSld->AddFrame(
new TGLabel(fContSld,
"Set Range"),
169 for (
Int_t i = 0; i < fNP; i++ ) {
174 fParSld[i]->SetConstrained(
kTRUE);
180 fContMax->AddFrame(
new TGLabel(fContMax,
"Max"),
182 for (
Int_t i = 0; i < fNP; i++ ) {
187 fFunc->GetParName(i)));
190 fParMax[i]->SetNumber(fPmax[i]);
192 fParMax[i]->SetNumber(fPval[i]+3*fPerr[i]);
194 fParMax[i]->SetNumber(fPval[i]+0.1*fPval[i]);
196 fParMax[i]->SetNumber(1.0);
197 if (fParMax[i]->GetNumber() < fParMin[i]->GetNumber()){
199 temp = fParMax[i]->GetNumber();
200 fParMax[i]->SetNumber(fParMin[i]->GetNumber());
201 fParMin[i]->SetNumber(temp);
203 fParMax[i]->Connect(
"ReturnPressed()",
"TFunctionParametersDialog",
this,
"DoParMaxLimit()");
209 fUpdate->SetToolTipText(
"Immediate function redrawing");
211 fUpdate->Connect(
"Toggled(Bool_t)",
"TFunctionParametersDialog",
this,
"HandleButtons(Bool_t)");
218 fReset->SetToolTipText(
"Reset the parameter settings");
220 fReset->Connect(
"Clicked()",
"TFunctionParametersDialog",
this,
"DoReset()");
225 fApply->Connect(
"Clicked()",
"TFunctionParametersDialog",
this,
"DoApply()");
226 fApply->SetToolTipText(
"Apply parameter settings and redraw the function");
230 fOK->SetToolTipText(
"Apply parameter settings, redraw function and close this dialog");
231 fOK->Connect(
"Clicked()",
"TFunctionParametersDialog",
this,
"DoOK()");
235 fCancel->SetToolTipText(
"Close this dialog with no parameter changes");
236 fCancel->Connect(
"Clicked()",
"TFunctionParametersDialog",
this,
"DoCancel()");
239 Resize(GetDefaultSize());
241 SetWindowName(
Form(
"Set Parameters of %s", fFunc->GetTitle()));
244 for (
Int_t i = 0; i < fNP; i++ ) {
246 fParVal[i]->SetState(
kFALSE);
247 fParMin[i]->SetEnabled(
kFALSE);
248 fParMax[i]->SetEnabled(
kFALSE);
249 fParSld[i]->UnmapWindow();
251 fParSld[i]->SetRange(fParMin[i]->GetNumber(), fParMax[i]->GetNumber());
252 fParSld[i]->SetPosition(fParMin[i]->GetNumber(), fParMax[i]->GetNumber());
253 fParSld[i]->SetPointerPosition(fPval[i]);
254 fParSld[i]->Connect(
"PointerPositionChanged()",
"TFunctionParametersDialog",
256 fParSld[i]->Connect(
"PositionChanged()",
"TFunctionParametersDialog",
298 txt =
"Do you want to apply last parameters' setting?";
305 }
else if (ret ==
kMBNo) {
332 if (
id ==
kFIX*fNP+i) {
334 if (
fParVal[i]->GetNumber() != 0) {
350 }
else if (!
fParMin[i]->IsEnabled()) {
368 }
else if (
fPval[i]) {
388 fParSld[i]->
Connect(
"PointerPositionChanged()",
"TFunctionParametersDialog",
390 fParSld[i]->
Connect(
"PositionChanged()",
"TFunctionParametersDialog",
483 if (!
fParMax[i]->IsEnabled()) {
491 fParSld[i]->
Connect(
"PointerPositionChanged()",
"TFunctionParametersDialog",
493 fParSld[i]->
Connect(
"PositionChanged()",
"TFunctionParametersDialog",
522 if (
id ==
kSLD*fNP+i) {
548 if (
id ==
kVAL*fNP+i) {
590 if (
id ==
kMIN*fNP+i) {
594 txt =
"The lower parameter bound cannot be bigger then the upper one.";
626 if (
id ==
kMAX*fNP+i) {
630 txt =
"The lower parameter bound cannot be bigger then the upper one.";
virtual ~TFunctionParametersDialog()
Destructor.
ClassImp(TSeqCollection) Int_t TSeqCollection TIter next(this)
Return index of object in collection.
R__EXTERN void * gTQSender
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 DoOK()
Slot related to the OK button.
virtual TList * GetList() const
static void SingleShot(Int_t milliSec, const char *receiver_class, void *receiver, const char *method)
This static function calls a slot after a given time interval.
ClassImp(TFunctionParametersDialog) TFunctionParametersDialog
Create the parameters' dialog of currently selected function 'func'.
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 SetRange(Float_t min, Float_t max)
virtual void DoParMaxLimit()
Slot related to the maximum parameter limit settings.
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 RedrawFunction()
Redraw function graphics.
TGNumberEntryField ** fParMin
TVirtualPad is an abstract base class for the Pad and Canvas classes.
TGTripleHSlider ** fParSld
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 DoApply()
Slot related to the Preview button.
virtual void SetParLimits(Int_t ipar, Double_t parmin, Double_t parmax)
Set limits for parameter ipar.
virtual void DoParValue()
Slot related to the parameter value settings.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
virtual void SetParError(Int_t ipar, Double_t error)
Set error for parameter number ipar.
static void update(gsl_integration_workspace *workspace, double a1, double b1, double area1, double error1, double a2, double b2, double area2, double error2)
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 DoCancel()
Slot related to the Cancel button.
virtual const TGWindow * GetMainFrame() const
Returns top level main frame.
virtual void Modified(Bool_t flag=1)=0
int main(int argc, char *argv[])
void SetEnabled(Bool_t flag=kTRUE)
TGNumberEntryField ** fParMax
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 UnmapWindow()
virtual void SetNumber(Double_t val)
Set the numeric value (floating point representation).
virtual void DoParMinLimit()
Slot related to the minumum parameter limit settings.
virtual void DoReset()
Slot related to the Reset button.
double f2(const double *x)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
virtual void CloseWindow()
Close parameters' dialog.
virtual void SetPosition(Float_t min, Float_t max)
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
virtual void HandleButtons(Bool_t update)
Handle the button dependent states in this dialog.
virtual void SetParameter(Int_t param, Double_t value)
virtual void DoSlider()
Slot related to the parameters' value settings.
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
virtual void DeleteWindow()
Delete window.
virtual void DoFix(Bool_t on)
Slot related to the Fix check button.