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