]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/Alieve/TPCSectorVizEditor.cxx
Merge from EVE-dev to HEAD.
[u/mrichter/AliRoot.git] / EVE / Alieve / TPCSectorVizEditor.cxx
1 // $Header$
2
3 #include "TPCSectorVizEditor.h"
4 #include <Alieve/TPCSectorViz.h>
5
6 #include <Reve/RGValuators.h>
7
8 #include <TVirtualPad.h>
9 #include <TColor.h>
10
11 #include <TGLabel.h>
12 #include <TGButton.h>
13 #include <TGNumberEntry.h>
14 #include <TGColorSelect.h>
15 #include <TGSlider.h>
16 #include <TGDoubleSlider.h>
17
18 using namespace Reve;
19 using namespace Alieve;
20
21 //______________________________________________________________________
22 // TPCSectorVizEditor
23 //
24
25 ClassImp(TPCSectorVizEditor)
26
27 TPCSectorVizEditor::TPCSectorVizEditor(const TGWindow *p,
28                                        Int_t width, Int_t height,
29                                        UInt_t options, Pixel_t back) :
30   TGedFrame(p, width, height, options | kVerticalFrame, back),
31   fM(0),
32   fSectorID  (0), fTrans   (0),
33   fRnrInn    (0), fRnrOut1 (0), fRnrOut2(0),
34   fThreshold (0), fMaxVal  (0),
35   fTime      (0)
36 {
37   MakeTitle("TPCSectorViz");
38   fPriority = 40;
39
40   Int_t labelW = 60;
41
42   fSectorID = new RGValuator(this, "SectorID", 110, 0);
43   fSectorID->SetLabelWidth(labelW);
44   fSectorID->SetShowSlider(kFALSE);
45   fSectorID->SetNELength(4);
46   fSectorID->Build();
47   fSectorID->SetLimits(0, 35);
48   fSectorID->SetToolTip("0-17 +z plate; 18-35 -z plate");
49   fSectorID->Connect("ValueSet(Double_t)",
50                      "Alieve::TPCSectorVizEditor", this, "DoSectorID()");
51   // Reuse sectorID for transformation button
52   fTrans = new TGCheckButton(fSectorID, "Trans");
53   fTrans->SetToolTipText("Translate to true position");
54   fSectorID->AddFrame(fTrans, new TGLayoutHints(kLHintsLeft, 12, 0, 1, 0));
55   fTrans->Connect("Toggled(Bool_t)","Alieve::TPCSectorVizEditor", this, "DoTrans()");
56   AddFrame(fSectorID, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
57
58   {
59     TGHorizontalFrame* f = new TGHorizontalFrame(this);
60
61     fRnrInn = new TGCheckButton(f, "Inner");
62     f->AddFrame(fRnrInn, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
63     fRnrInn->Connect("Toggled(Bool_t)","Alieve::TPCSectorVizEditor", this, "DoRnrInn()");
64
65     fRnrOut1 = new TGCheckButton(f, "Outer 1");
66     f->AddFrame(fRnrOut1, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
67     fRnrOut1->Connect("Toggled(Bool_t)","Alieve::TPCSectorVizEditor", this, "DoRnrOut1()");
68
69     fRnrOut2 = new TGCheckButton(f, "Outer 2");
70     f->AddFrame(fRnrOut2, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
71     fRnrOut2->Connect("Toggled(Bool_t)","Alieve::TPCSectorVizEditor", this, "DoRnrOut2()");
72
73     AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
74   }
75
76   fThreshold = new RGValuator(this, "Threshold", 200, 0);
77   fThreshold->SetNELength(4);
78   fThreshold->SetLabelWidth(labelW);
79   fThreshold->Build();
80   fThreshold->GetSlider()->SetWidth(120);
81   fThreshold->SetLimits(0,250);
82   fThreshold->Connect("ValueSet(Double_t)",
83                       "Alieve::TPCSectorVizEditor", this, "DoThreshold()");
84   AddFrame(fThreshold, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
85
86   fMaxVal = new RGValuator(this,"MaxVal", 200, 0);
87   fMaxVal->SetNELength(4);
88   fMaxVal->SetLabelWidth(labelW);
89   fMaxVal->Build();
90   fMaxVal->GetSlider()->SetWidth(120);
91   fMaxVal->SetLimits(0, 500);
92   fMaxVal->Connect("ValueSet(Double_t)",
93                    "Alieve::TPCSectorVizEditor", this, "DoMaxVal()");
94   AddFrame(fMaxVal, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
95
96   fTime = new RGDoubleValuator(this,"Time", 200, 0);
97   fTime->SetNELength(4);
98   fTime->SetLabelWidth(labelW);
99   fTime->Build();
100   fTime->GetSlider()->SetWidth(224);
101   fTime->SetLimits(0, 1023, TGNumberFormat::kNESInteger);
102   fTime->Connect("ValueSet()",
103                  "Alieve::TPCSectorVizEditor", this, "DoTime()");
104   AddFrame(fTime, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
105 }
106
107 TPCSectorVizEditor::~TPCSectorVizEditor()
108 {}
109
110 /**************************************************************************/
111
112 void TPCSectorVizEditor::SetModel(TObject* obj)
113 {
114   fM = dynamic_cast<TPCSectorViz*>(obj);
115
116   fSectorID->SetValue(fM->fSectorID);
117   fTrans->SetState(fM->fTrans  ? kButtonDown : kButtonUp);
118
119   fRnrInn ->SetState(fM->fRnrInn  ? kButtonDown : kButtonUp);
120   fRnrOut1->SetState(fM->fRnrOut1 ? kButtonDown : kButtonUp);
121   fRnrOut2->SetState(fM->fRnrOut2 ? kButtonDown : kButtonUp);
122
123   fThreshold->SetValue(fM->fThreshold);
124   fMaxVal->SetValue(fM->fMaxVal);
125
126   fTime->SetValues(fM->fMinTime, fM->fMaxTime);
127 }
128
129 /**************************************************************************/
130
131 void TPCSectorVizEditor::DoSectorID()
132 {
133   fM->SetSectorID((Int_t) fSectorID->GetValue());
134   Update();
135 }
136
137 void TPCSectorVizEditor::DoTrans()
138 {
139   fM->SetTrans(fTrans->IsOn());
140   Update();
141 }
142
143 /**************************************************************************/
144
145 void TPCSectorVizEditor::DoRnrInn()
146 {
147   fM->SetRnrInn(fRnrInn->IsOn());
148   Update();
149 }
150
151 void TPCSectorVizEditor::DoRnrOut1()
152 {
153   fM->SetRnrOut1(fRnrOut1->IsOn());
154   Update();
155 }
156
157 void TPCSectorVizEditor::DoRnrOut2()
158 {
159   fM->SetRnrOut2(fRnrOut2->IsOn());
160   Update();
161 }
162
163 /**************************************************************************/
164
165 void TPCSectorVizEditor::DoThreshold()
166 {
167   fM->SetThreshold((Short_t) fThreshold->GetValue());
168   fThreshold->SetValue(fM->fThreshold);
169   Update();
170 }
171
172 void TPCSectorVizEditor::DoMaxVal()
173 {
174   fM->SetMaxVal((Int_t) fMaxVal->GetValue());
175   fMaxVal->SetValue(fM->fMaxVal);
176   Update();
177 }
178
179 /**************************************************************************/
180
181 void TPCSectorVizEditor::DoTime()
182
183   fM->SetMinTime((Int_t) fTime->GetMin());
184   fM->SetMaxTime((Int_t) fTime->GetMax());
185   Update();
186 }