GSI Object Oriented Online Offline (Go4)  GO4-6.1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4OptStatsSettings.cpp
Go to the documentation of this file.
1 // $Id: TGo4OptStatsSettings.cpp 3127 2021-03-30 09:23:27Z 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 "TGo4OptStatsSettings.h"
15 
16 #include "TStyle.h"
17 #include "TMath.h"
18 
19 #include "TGo4QSettings.h"
20 
22  QDialog( parent )
23 {
24  //setObjectName(name);
25  setupUi(this);
26 
27  QObject::connect(buttonOk, SIGNAL(clicked()), this, SLOT(setFlags()));
28 
29  bool showstat = go4sett->getStatBoxVisible();
30  DrawStatboxButton->setChecked(showstat);
31  OptStatGroupBox->setEnabled(showstat);
32 
33  fStatW = go4sett->getOptStatW()*0.01;
34  fStatH = go4sett->getOptStatH()*0.01;
35 
36  if (fStatW<0.005) fStatW = gStyle->GetStatW();
37  if (fStatH<0.005) fStatH = gStyle->GetStatH();
38 
39  StatWidthBox->setValue(fStatW);
40  StatHeightBox->setValue(fStatH);
41 
42  int optstats = go4sett->getOptStat();
43  //std::cout <<"Found options stat: "<<optstats << std::endl;
44  bool k= (optstats/100000000)%10 ;
45  bool s=(optstats/10000000)%10;
46  bool i=(optstats/1000000)%10;
47  bool o=(optstats/100000)%10;
48  bool u=(optstats/10000)%10;
49  bool r=(optstats/1000)%10;
50  bool m=(optstats/100)%10;
51  bool e=(optstats/10)%10;
52  bool n=(optstats/1)%10;
53 
54  DrawNameButton->setChecked(n);
55  DrawEntriesButton->setChecked(e);
56  DrawIntegralButton->setChecked(i);
57  DrawRMSButton->setChecked(r);
58  DrawMeanButton->setChecked(m);
59  DrawCurtosisButton->setChecked(k);
60  DrawUnderflowButton->setChecked(u);
61  DrawOverflowButton->setChecked(o);
62  DrawSkewnessButton->setChecked(s);
63 
64  DrawErrorsButton->setChecked(go4sett->getStatBoxErrors());
65 }
66 
67 
69 {
70  bool drawbox=DrawStatboxButton->isChecked();
71  bool drawerrors=DrawErrorsButton->isChecked();
72  int leader=1000000000; // leading value to correctly decode "name only" option
73  bool k=DrawCurtosisButton->isChecked();
74  int kurt=100000000* (int) k;
75  if(drawerrors) kurt*=2;
76  bool s=DrawSkewnessButton->isChecked();
77  int skew=10000000* (int) s;
78  if(drawerrors) skew*=2;
79  bool i=DrawIntegralButton->isChecked();
80  int integ=1000000* (int) i;
81  bool o=DrawOverflowButton->isChecked();
82  int over=100000* (int) o;
83  bool u=DrawUnderflowButton->isChecked();
84  int under=10000* (int) u;
85  bool r=DrawRMSButton->isChecked();
86  int rms=1000* (int) r;
87  if(drawerrors) rms*=2;
88  bool m=DrawMeanButton->isChecked();
89  int mean=100* (int) m;
90  if(drawerrors) mean*=2;
91  bool e=DrawEntriesButton->isChecked();
92  int ent=10* (int) e;
93  bool n=DrawNameButton->isChecked();
94  int nm= (int) n;
95  int optstats=leader+kurt+skew+integ+over+under+rms+mean+ent+nm;
96  //std::cout <<"Set options stat to "<<optstats << std::endl;
97  go4sett->setStatBoxVisible(drawbox);
98  go4sett->setStatBoxErrors(drawerrors);
99  go4sett->setOptStat(optstats);
100 
101  if (TMath::Abs(fStatW-StatWidthBox->value())>0.005)
102  go4sett->setOptStatW((int)(StatWidthBox->value()*100));
103 
104  if (TMath::Abs(fStatH-StatHeightBox->value())>0.005)
105  go4sett->setOptStatH((int)(StatHeightBox->value()*100));
106 }
TGo4OptStatsSettings(QWidget *parent=0)
void setStatBoxErrors(bool on=true)
bool getStatBoxVisible()
void setOptStat(int value)
TGo4QSettings * go4sett
bool getStatBoxErrors()
void setOptStatW(int value)
void setOptStatH(int value)
void setStatBoxVisible(bool on=true)