00001 // $Id: QFitDataWidget.cpp 1135 2014-01-22 15:40:12Z linev $ 00002 //----------------------------------------------------------------------- 00003 // The GSI Online Offline Object Oriented (Go4) Project 00004 // Experiment Data Processing at EE department, GSI 00005 //----------------------------------------------------------------------- 00006 // Copyright (C) 2000- GSI Helmholtzzentrum für Schwerionenforschung GmbH 00007 // Planckstr. 1, 64291 Darmstadt, Germany 00008 // Contact: http://go4.gsi.de 00009 //----------------------------------------------------------------------- 00010 // This software can be used under the license agreements as stated 00011 // in Go4License.txt file which is part of the distribution. 00012 //----------------------------------------------------------------------- 00013 00014 #include "QFitDataWidget.h" 00015 #include "QFitItem.h" 00016 #include "TGo4FitData.h" 00017 #include "TGo4FitModel.h" 00018 #include "TGo4Fitter.h" 00019 #include "TGo4FitGuiTypes.h" 00020 00021 00022 QFitDataWidget::QFitDataWidget(QWidget *parent, const char* name) 00023 : QFitNamedWidget(parent, name) 00024 { 00025 setupUi(this); 00026 } 00027 00028 TGo4FitData* QFitDataWidget::GetData() { 00029 return dynamic_cast<TGo4FitData*> (GetObject()); 00030 } 00031 00032 void QFitDataWidget::FillSpecificData() { 00033 QFitNamedWidget::FillSpecificData(); 00034 00035 if(GetData()) { 00036 if(GetData()->GetDataType()==TGo4FitData::dtHistogram) DataInfoLbl->setText("Data type: histogramic"); 00037 else DataInfoLbl->setText("Data type: set of points"); 00038 DataInfoLbl->adjustSize(); 00039 00040 AmplChk->setChecked(GetData()->GetAmplPar()!=0); 00041 AmplChk->setEnabled(GetData()->CanAmplTouch()); 00042 00043 NumCalibrSpin->setValue(GetData()->GetNumberOfTransSlots()); 00044 UseBinsChk->setChecked(GetData()->GetUseBinScale()); 00045 SigmaCmb->setCurrentIndex(GetData()->GetSigmaSource()); 00046 SigmaEdt->setEnabled(GetData()->GetSigmaSource()==2); 00047 SigmaEdt->setText(QString::number(GetData()->GetSigmaValue())); 00048 BinsLimitEdt->setText(QString::number(GetData()->GetExcludeLessThen())); 00049 UseBuffersChk->setChecked(GetData()->GetUseBuffers()); 00050 00051 QString info("Models:"); 00052 00053 TGo4Fitter* fitter = dynamic_cast<TGo4Fitter*> (GetItem()->Parent()->Object()); 00054 if (fitter) 00055 for(Int_t nmodel=0;nmodel<fitter->GetNumModel();nmodel++) { 00056 TGo4FitModel* model = fitter->GetModel(nmodel); 00057 if (model->IsAssignTo(GetData()->GetName())) { 00058 info+=" "; info+=model->GetName(); 00059 } 00060 } 00061 ModelsLbl->setText(info); 00062 ModelsLbl->adjustSize(); 00063 } 00064 } 00065 00066 void QFitDataWidget::NumCalibrSpin_valueChanged( int num) 00067 { 00068 if(!fbFillWidget && GetData()) 00069 if (GetData()->SetNumberOfTransSlots(num)) { 00070 if (GetFitter()) 00071 GetFitter()->SetUpdateSlotList(); 00072 UpdateWidgetItem(true); 00073 UpdateItemsOfType(FitGui::ot_allslots, true); 00074 } 00075 } 00076 00077 void QFitDataWidget::UseBinsChk_toggled( bool zn) 00078 { 00079 if(!fbFillWidget && GetData()) 00080 GetData()->SetUseBinScale(zn); 00081 } 00082 00083 void QFitDataWidget::SigmaCmb_activated( int zn) 00084 { 00085 if(!fbFillWidget && GetData()) { 00086 GetData()->SetSigmaSource(zn, -1.); 00087 SigmaEdt->setEnabled(zn==2); 00088 } 00089 } 00090 00091 00092 void QFitDataWidget::SigmaEdt_textChanged( const QString & value) 00093 { 00094 if(!fbFillWidget && GetData()) { 00095 bool ok = true; 00096 double zn = value.toDouble(&ok); 00097 if(ok) GetData()->SetSigmaValue(zn); 00098 } 00099 } 00100 00101 void QFitDataWidget::BinsLimitEdt_textChanged( const QString & value) 00102 { 00103 if(!fbFillWidget && GetData()) { 00104 bool ok = true; 00105 double zn = value.toDouble(&ok); 00106 if(ok) GetData()->SetExcludeLessThen(zn); 00107 } 00108 } 00109 00110 void QFitDataWidget::AmplChk_toggled( bool chk) 00111 { 00112 if(!fbFillWidget && GetData() && GetData()->CanAmplTouch()) { 00113 bool res = false; 00114 if (chk) res = GetData()->MakeAmpl(); 00115 else res = GetData()->RemoveAmpl(); 00116 if (res) UpdateItemsOfType(FitGui::ot_parslist, false); 00117 } 00118 } 00119 00120 00121 void QFitDataWidget::UseBuffersChk_toggled(bool zn) 00122 { 00123 if(!fbFillWidget && GetData()) 00124 GetData()->SetUseBuffers(zn); 00125 }