GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
QFitParCfgWidget.cpp
Go to the documentation of this file.
1 // $Id: QFitParCfgWidget.cpp 1134 2014-01-22 14:53:40Z 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 für 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 }
26 
27 
29 {
30  return dynamic_cast<TGo4FitParameter*> (GetObject());
31 }
32 
34 {
35  if (GetPar()) {
36  ParNameEdit->setText(GetPar()->GetName());
37  ParFixedChk->setChecked(GetPar()->GetFixed());
38  Double_t min,max;
39  if (GetPar()->GetRange(min,max)) {
40  RangeMinEdit->setText(QString::number(min));
41  RangeMaxEdit->setText(QString::number(max));
42  } else {
43  RangeMinEdit->setText("");
44  RangeMaxEdit->setText("");
45  }
46  Double_t eps;
47  if (GetPar()->GetEpsilon(eps)) EpsilonEdit->setText(QString::number(eps));
48  else EpsilonEdit->setText("");
49  }
50 }
51 
53 {
54  if ((RangeMinEdit->text().length()==0) && (RangeMaxEdit->text().length()==0))
55  { GetPar()->SetRangeUse(kFALSE); return; }
56  double min,max;
57  bool okmin = false, okmax = false;
58 
59  min = RangeMinEdit->text().toDouble(&okmin);
60  max = RangeMaxEdit->text().toDouble(&okmax);
61 
62  if (RangeMinEdit->text().length()==0) { min = max; okmin = okmax; }
63  if (RangeMaxEdit->text().length()==0) { max = min; okmax = okmin; }
64 
65  if (okmin && okmax)
66  GetPar()->SetRange(min,max);
67 }
68 
69 
70 void QFitParCfgWidget::ParNameEdit_textChanged( const QString & name)
71 {
72  if(!fbFillWidget && GetPar() && (name.length()>0)) {
73  TGo4FitParsList* pars = dynamic_cast<TGo4FitParsList*> (GetItem()->Parent()->Object());
74  if (pars==0) return;
75  if (pars->FindPar(name.toLatin1().constData())) return;
76  GetPar()->SetName(name.toLatin1().constData());
77  GetItem()->setText(0,name.toLatin1().constData());
78  }
79 }
80 
81 
83 {
84  if(!fbFillWidget && GetPar())
85  GetPar()->SetFixed(chk);
86 }
87 
88 
90 {
91  if(!fbFillWidget && GetPar())
93 }
94 
95 
97 {
98  if(!fbFillWidget && GetPar())
100 }
101 
102 void QFitParCfgWidget::EpsilonEdit_textChanged( const QString & value)
103 {
104  if(!fbFillWidget && GetPar())
105  if (value.length()==0) GetPar()->SetEpsilonUse(kFALSE); else {
106  bool res = false;
107  double zn = value.toDouble(&res);
108  if(res) GetPar()->SetEpsilon(zn);
109  }
110 }
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:64
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:53
virtual QFitItem * GetItem()
Definition: QFitWidget.cpp:48
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)