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