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