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