GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
QFitRangeCutWidget.cpp
Go to the documentation of this file.
1 // $Id: QFitRangeCutWidget.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 "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 }
25 
27  return dynamic_cast<TGo4FitComponent*> (GetItem()->Parent()->Object());
28 }
29 
31  return GetItem()->Tag();
32 }
33 
35  return dynamic_cast<TCutG*> (GetObject());
36 }
37 
40  TGo4FitComponent* comp = GetComp();
41  TCutG* cut = GetCut();
42  if (comp && cut) {
43  ExcludeCutChk->setChecked(comp->IsRangeCutExcluding(GetCutIndex()));
44  NumPointsSpin->setValue(cut->GetN());
46  }
47 }
48 
50  TCutG* cut = GetCut();
51  if (cut==0) return;
52 
53  XYTable->setRowCount(cut->GetN());
54 
55  for (int n=0;n<cut->GetN();n++) {
56  Double_t x,y;
57  cut->GetPoint(n, x,y);
58  XYTable->setItem(n, 0, new QTableWidgetItem(QString::number(x)));
59  XYTable->setItem(n, 1, new QTableWidgetItem(QString::number(y)));
60  XYTable->setVerticalHeaderItem(n, new QTableWidgetItem(QString::number(n)));
61  }
62 }
63 
64 
66 {
67  if(!fbFillWidget && (GetCut()!=0)) {
68  TCutG* cut = GetCut();
69  int old = cut->GetN();
70  Double_t x=0., y=0.;
71  if (old>1) cut->GetPoint(old-2, x, y);
72  cut->Set(npoint);
73  for(int n= (old-1>=0 ? old-1 : 0); n<npoint-1; n++)
74  cut->SetPoint(n, x, y+(n-old+2)*10);
75 
76  cut->GetPoint(0, x, y);
77  cut->SetPoint(npoint-1, x, y);
78 
79  fbFillWidget = true;
81  fbFillWidget = false;
82  }
83 }
84 
85 
87 {
88  if(!fbFillWidget && (GetComp()!=0))
90 }
91 
92 
94 {
95  if(!fbFillWidget && (GetCut()!=0)) {
96  TCutG* cut = GetCut();
97  bool ok;
98  double zn = XYTable->item(nrow, ncol)->text().toDouble(&ok);
99  if(ok) {
100  if (ncol==0) cut->GetX()[nrow] = zn;
101  else cut->GetY()[nrow] = zn;
102  if ((nrow==0) || (nrow==cut->GetN()-1)) {
103  int nrow1 = (nrow==0) ? cut->GetN()-1 : 0;
104  fbFillWidget = true;
105  XYTable->setItem(nrow1, ncol, new QTableWidgetItem(XYTable->item(nrow, ncol)->text()));
106  if (ncol==0) cut->GetX()[nrow1] = zn;
107  else cut->GetY()[nrow1] = zn;
108  fbFillWidget = false;
109  }
110  }
111  }
112 }
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:64
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:53
Bool_t IsRangeCutExcluding(Int_t n)
virtual QFitItem * GetItem()
Definition: QFitWidget.cpp:48
virtual void FillSpecificData()
int Tag() const
Definition: QFitItem.h:33
virtual void FillSpecificData()