GSI Object Oriented Online Offline (Go4)  GO4-6.1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
QFitParCfgWidget.cpp
Go to the documentation of this file.
1 // $Id: QFitParCfgWidget.cpp 3114 2021-03-30 06:39:32Z linev $
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 #include "QFitParCfgWidget.h"
15 
16 #include "QFitItem.h"
17 #include "TGo4FitParsList.h"
18 #include "TGo4FitParameter.h"
19 
20 
21 QFitParCfgWidget::QFitParCfgWidget(QWidget *parent, const char* name)
22  : QFitWidget(parent, name)
23 {
24  setupUi(this);
25  QObject::connect(ParNameEdit, SIGNAL(textChanged(QString)), this, SLOT(ParNameEdit_textChanged(QString)));
26  QObject::connect(ParFixedChk, SIGNAL(toggled(bool)), this, SLOT(ParFixedChk_toggled(bool)));
27  QObject::connect(RangeMinEdit, SIGNAL(textChanged(QString)), this, SLOT(RangeMinEdit_textChanged(QString)));
28  QObject::connect(RangeMaxEdit, SIGNAL(textChanged(QString)), this, SLOT(RangeMaxEdit_textChanged(QString)));
29  QObject::connect(EpsilonEdit, SIGNAL(textChanged(QString)), this, SLOT(EpsilonEdit_textChanged(QString)));
30 }
31 
32 
34 {
35  return dynamic_cast<TGo4FitParameter*> (GetObject());
36 }
37 
39 {
40  if (GetPar()) {
41  ParNameEdit->setText(GetPar()->GetName());
42  ParFixedChk->setChecked(GetPar()->GetFixed());
43  Double_t min,max;
44  if (GetPar()->GetRange(min,max)) {
45  RangeMinEdit->setText(QString::number(min));
46  RangeMaxEdit->setText(QString::number(max));
47  } else {
48  RangeMinEdit->setText("");
49  RangeMaxEdit->setText("");
50  }
51  Double_t eps;
52  if (GetPar()->GetEpsilon(eps)) EpsilonEdit->setText(QString::number(eps));
53  else EpsilonEdit->setText("");
54  }
55 }
56 
58 {
59  if ((RangeMinEdit->text().length()==0) && (RangeMaxEdit->text().length()==0))
60  { GetPar()->SetRangeUse(kFALSE); return; }
61  double min,max;
62  bool okmin = false, okmax = false;
63 
64  min = RangeMinEdit->text().toDouble(&okmin);
65  max = RangeMaxEdit->text().toDouble(&okmax);
66 
67  if (RangeMinEdit->text().length()==0) { min = max; okmin = okmax; }
68  if (RangeMaxEdit->text().length()==0) { max = min; okmax = okmin; }
69 
70  if (okmin && okmax)
71  GetPar()->SetRange(min,max);
72 }
73 
74 
75 void QFitParCfgWidget::ParNameEdit_textChanged( const QString & name)
76 {
77  if(!fbFillWidget && GetPar() && (name.length()>0)) {
78  TGo4FitParsList* pars = dynamic_cast<TGo4FitParsList*> (GetItem()->Parent()->Object());
79  if (pars==0) return;
80  if (pars->FindPar(name.toLatin1().constData())) return;
81  GetPar()->SetName(name.toLatin1().constData());
82  GetItem()->setText(0,name.toLatin1().constData());
83  }
84 }
85 
86 
88 {
89  if(!fbFillWidget && GetPar())
90  GetPar()->SetFixed(chk);
91 }
92 
93 
95 {
96  if(!fbFillWidget && GetPar())
98 }
99 
100 
102 {
103  if(!fbFillWidget && GetPar())
105 }
106 
107 void QFitParCfgWidget::EpsilonEdit_textChanged( const QString & value)
108 {
109  if(!fbFillWidget && GetPar()) {
110  if (value.length()==0) {
111  GetPar()->SetEpsilonUse(kFALSE);
112  } else {
113  bool res = false;
114  double zn = value.toDouble(&res);
115  if(res) GetPar()->SetEpsilon(zn);
116  }
117  }
118 }
void SetRangeUse(Bool_t use)
virtual void FillSpecificData()
void SetEpsilonUse(Bool_t use)
TObject * Object() const
Definition: QFitItem.h:27
virtual void RangeMaxEdit_textChanged(const QString &)
virtual TGo4FitParameter * GetPar()
virtual void ParFixedChk_toggled(bool)
bool fbFillWidget
Definition: QFitWidget.h:63
QFitItem * Parent() const
Definition: QFitItem.h:35
TGo4FitParameter * FindPar(const char *ParName)
virtual void AnalyzeRangeValues()
QFitParCfgWidget(QWidget *parent=0, const char *name=0)
virtual TObject * GetObject()
Definition: QFitWidget.cpp:51
virtual QFitItem * GetItem()
Definition: QFitWidget.cpp:46
void SetEpsilon(Double_t iEpsilon)
virtual void RangeMinEdit_textChanged(const QString &)
virtual void EpsilonEdit_textChanged(const QString &)
void SetFixed(Bool_t iFixed)
virtual void ParNameEdit_textChanged(const QString &)
void SetRange(Double_t iRangeMin, Double_t iRangeMax)