GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
QFitParCfgWidget.cpp
Go to the documentation of this file.
1// $Id$
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
21QFitParCfgWidget::QFitParCfgWidget(QWidget *parent, const char *name)
22 : QFitWidget(parent, name)
23{
24 setupUi(this);
25 QObject::connect(ParNameEdit, &QGo4LineEdit::textChanged, this, &QFitParCfgWidget::ParNameEdit_textChanged);
26 QObject::connect(ParFixedChk, &QCheckBox::toggled, this, &QFitParCfgWidget::ParFixedChk_toggled);
27 QObject::connect(RangeMinEdit, &QGo4LineEdit::textChanged, this, &QFitParCfgWidget::RangeMinEdit_textChanged);
28 QObject::connect(RangeMaxEdit, &QGo4LineEdit::textChanged, this, &QFitParCfgWidget::RangeMaxEdit_textChanged);
29 QObject::connect(EpsilonEdit, &QGo4LineEdit::textChanged, this, &QFitParCfgWidget::EpsilonEdit_textChanged);
30}
31
32
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().isEmpty() && RangeMaxEdit->text().isEmpty()) {
60 GetPar()->SetRangeUse(kFALSE);
61 return;
62 }
63 bool okmin = false, okmax = false;
64
65 double min = RangeMinEdit->text().toDouble(&okmin);
66 double max = RangeMaxEdit->text().toDouble(&okmax);
67
68 if (RangeMinEdit->text().isEmpty()) {
69 min = max;
70 okmin = okmax;
71 }
72 if (RangeMaxEdit->text().isEmpty()) {
73 max = min;
74 okmax = okmin;
75 }
76
77 if (okmin && okmax)
78 GetPar()->SetRange(min,max);
79}
80
81
83{
84 if(!fbFillWidget && GetPar() && (name.length() > 0)) {
85 TGo4FitParsList* pars = dynamic_cast<TGo4FitParsList*> (GetItem()->Parent()->Object());
86 if (!pars) return;
87 if (pars->FindPar(name.toLatin1().constData())) return;
88 GetPar()->SetName(name.toLatin1().constData());
89 GetItem()->setText(0,name.toLatin1().constData());
90 }
91}
92
93
95{
96 if(!fbFillWidget && GetPar())
97 GetPar()->SetFixed(chk);
98}
99
101{
102 if(!fbFillWidget && GetPar())
104}
105
107{
108 if(!fbFillWidget && GetPar())
110}
111
113{
114 if (!fbFillWidget && GetPar()) {
115 if (value.isEmpty()) {
116 GetPar()->SetEpsilonUse(kFALSE);
117 } else {
118 bool res = false;
119 double zn = value.toDouble(&res);
120 if (res)
121 GetPar()->SetEpsilon(zn);
122 }
123 }
124}
QFitItem * Parent() const
Definition QFitItem.h:35
TObject * Object() const
Definition QFitItem.h:27
virtual TGo4FitParameter * GetPar()
virtual void RangeMaxEdit_textChanged(const QString &)
QFitParCfgWidget(QWidget *parent=nullptr, const char *name=nullptr)
virtual void EpsilonEdit_textChanged(const QString &)
virtual void RangeMinEdit_textChanged(const QString &)
virtual void ParFixedChk_toggled(bool)
void FillSpecificData() override
virtual void AnalyzeRangeValues()
virtual void ParNameEdit_textChanged(const QString &)
virtual TObject * GetObject()
bool fbFillWidget
Definition QFitWidget.h:63
virtual QFitItem * GetItem()
QFitWidget(QWidget *parent=nullptr, const char *name=nullptr, Qt::WindowFlags fl=Qt::Widget)
Model and data objects parameter.
void SetEpsilon(Double_t iEpsilon)
Return epsilon value of parameter.
void SetRangeUse(Bool_t use)
Change status, is range was specified or not.
void SetRange(Double_t iRangeMin, Double_t iRangeMax)
Set range minimum and maximum values.
void SetEpsilonUse(Bool_t use)
Set status, if epsilon value was specified or not.
void SetFixed(Bool_t iFixed)
Set status of parameter fixed or not.
List of TGo4FitParameter objects.
TGo4FitParameter * FindPar(const char *ParName)
Find parameter object with given name.