GSI Object Oriented Online Offline (Go4)  GO4-6.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
QFitRangeCutWidget.cpp
Go to the documentation of this file.
1 // $Id: QFitRangeCutWidget.cpp 3116 2021-03-30 06:51:49Z 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 "QFitRangeCutWidget.h"
15 
16 #include "QFitItem.h"
17 #include "TGo4FitComponent.h"
18 #include "TCutG.h"
19 
20 QFitRangeCutWidget::QFitRangeCutWidget(QWidget *parent, const char* name)
21  : QFitNamedWidget(parent, name)
22 {
23  setupUi(this);
24  QObject::connect(NumPointsSpin, SIGNAL(valueChanged(int)), this, SLOT(NumPointsSpin_valueChanged(int)));
25  QObject::connect(ExcludeCutChk, SIGNAL(toggled(bool)), this, SLOT(ExcludeCutChk_toggled(bool)));
26  QObject::connect(XYTable, SIGNAL(cellChanged(int,int)), this, SLOT(XYTable_valueChanged(int,int)));
27 
28 }
29 
31 {
32  return dynamic_cast<TGo4FitComponent*> (GetItem()->Parent()->Object());
33 }
34 
36 {
37  return GetItem()->Tag();
38 }
39 
41 {
42  return dynamic_cast<TCutG*> (GetObject());
43 }
44 
46 {
48  TGo4FitComponent* comp = GetComp();
49  TCutG* cut = GetCut();
50  if (comp && cut) {
51  ExcludeCutChk->setChecked(comp->IsRangeCutExcluding(GetCutIndex()));
52  NumPointsSpin->setValue(cut->GetN());
54  }
55 }
56 
58 {
59  TCutG* cut = GetCut();
60  if (cut==0) return;
61 
62  XYTable->setRowCount(cut->GetN());
63 
64  for (int n=0;n<cut->GetN();n++) {
65  Double_t x,y;
66  cut->GetPoint(n, x,y);
67  XYTable->setItem(n, 0, new QTableWidgetItem(QString::number(x)));
68  XYTable->setItem(n, 1, new QTableWidgetItem(QString::number(y)));
69  XYTable->setVerticalHeaderItem(n, new QTableWidgetItem(QString::number(n)));
70  }
71 }
72 
73 
75 {
76  if(!fbFillWidget && (GetCut()!=0)) {
77  TCutG* cut = GetCut();
78  int old = cut->GetN();
79  Double_t x=0., y=0.;
80  if (old>1) cut->GetPoint(old-2, x, y);
81  cut->Set(npoint);
82  for(int n= (old-1>=0 ? old-1 : 0); n<npoint-1; n++)
83  cut->SetPoint(n, x, y+(n-old+2)*10);
84 
85  cut->GetPoint(0, x, y);
86  cut->SetPoint(npoint-1, x, y);
87 
88  fbFillWidget = true;
90  fbFillWidget = false;
91  }
92 }
93 
94 
96 {
97  if(!fbFillWidget && (GetComp()!=0))
99 }
100 
101 
103 {
104  if(!fbFillWidget && (GetCut()!=0)) {
105  TCutG* cut = GetCut();
106  bool ok;
107  double zn = XYTable->item(nrow, ncol)->text().toDouble(&ok);
108  if(ok) {
109  if (ncol==0) cut->GetX()[nrow] = zn;
110  else cut->GetY()[nrow] = zn;
111  if ((nrow==0) || (nrow==cut->GetN()-1)) {
112  int nrow1 = (nrow==0) ? cut->GetN()-1 : 0;
113  fbFillWidget = true;
114  XYTable->setItem(nrow1, ncol, new QTableWidgetItem(XYTable->item(nrow, ncol)->text()));
115  if (ncol==0) cut->GetX()[nrow1] = zn;
116  else cut->GetY()[nrow1] = zn;
117  fbFillWidget = false;
118  }
119  }
120  }
121 }
virtual TGo4FitComponent * GetComp()
virtual void FillXYPointsTable()
TObject * Object() const
Definition: QFitItem.h:27
virtual void NumPointsSpin_valueChanged(int)
void SetRangeCutExcluding(Int_t n, Bool_t exclude=kTRUE)
virtual TCutG * GetCut()
bool fbFillWidget
Definition: QFitWidget.h:63
virtual void XYTable_valueChanged(int, int)
QFitRangeCutWidget(QWidget *parent=0, const char *name=0)
QFitItem * Parent() const
Definition: QFitItem.h:35
virtual void ExcludeCutChk_toggled(bool)
virtual TObject * GetObject()
Definition: QFitWidget.cpp:51
Bool_t IsRangeCutExcluding(Int_t n)
virtual QFitItem * GetItem()
Definition: QFitWidget.cpp:46
virtual void FillSpecificData()
int Tag() const
Definition: QFitItem.h:33
virtual void FillSpecificData()